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
bbe893b0e45f644e0eb0e155b9cb75335fd65d7d
2,224
js
JavaScript
client/src/scenes/Tops/components/Album/index.js
telegrambotdev/your_spotify
0c33bf642547a6a8dd3029615c5d5f23e749b936
[ "MIT" ]
582
2020-03-16T13:02:05.000Z
2022-03-31T14:40:18.000Z
client/src/scenes/Tops/components/Album/index.js
telegrambotdev/your_spotify
0c33bf642547a6a8dd3029615c5d5f23e749b936
[ "MIT" ]
103
2020-03-17T01:12:43.000Z
2022-03-30T07:26:23.000Z
client/src/scenes/Tops/components/Album/index.js
telegrambotdev/your_spotify
0c33bf642547a6a8dd3029615c5d5f23e749b936
[ "MIT" ]
33
2020-03-23T16:43:57.000Z
2022-03-29T20:46:45.000Z
import { Paper, useMediaQuery } from '@material-ui/core'; import React from 'react'; import cl from 'classnames'; import s from '../index.module.css'; import { lessThanMobile } from '../../../../services/theme'; import SimpleArtistLine from '../../../../components/SimpleArtistLine'; import { msToHoursAndMinutesString } from '../../../../services/operations'; function Album({ className, header, ...props }) { let { infos } = props; const { rank } = props; let img; if (header) { img = null; infos = { artist: { name: 'Artist name' }, album: { name: 'Album name', release_date: 'Release date' }, duration_ms: 'Duration', count: 'Count', }; } else { img = infos.album.images[0].url; } const mobile = useMediaQuery(lessThanMobile); return ( <Paper className={cl(s.root, className)}> {img ? <img className={s.cover} alt="cover" src={img} /> : <div className={s.cover} />} <span className={s.rank}> # {rank} </span> <span className={cl(s.normal, s.grow)}> {infos.album.name} {mobile && ( <div className={s.littleArtist}> {!header ? <SimpleArtistLine artist={infos.artist} /> : infos.artist.name} </div> )} </span> {!mobile && ( <span className={cl(s.normal, s.grow)}> {!header ? <SimpleArtistLine artist={infos.artist} /> : infos.artist.name} </span> )} {!mobile && ( <span className={s.normal}> {infos.album.release_date.split('-')[0]} </span> )} {!mobile && ( <span className={s.small}> {header ? infos.duration_ms : msToHoursAndMinutesString(infos.duration_ms)} &nbsp; <span className={s.percent}> ( {!header && Math.floor((infos.duration_ms / infos.total_duration_ms) * 100)} %) </span> </span> )} <span className={s.small}> {infos.count} &nbsp; <span className={s.percent}> ( {!header && Math.floor((infos.count / infos.total_count) * 100)} %) </span> </span> </Paper> ); } export default Album;
28.883117
93
0.53732
bbf6843370dd7a445ea821dc8b2a8cf0388cc705
7,544
js
JavaScript
client/src/services/EventService.js
ccrowley96/digital-twins-explorer
d9d8bd43f974f355697289210c890724ed0a6d98
[ "MIT" ]
107
2020-07-09T15:00:13.000Z
2022-03-31T17:14:51.000Z
client/src/services/EventService.js
ccrowley96/digital-twins-explorer
d9d8bd43f974f355697289210c890724ed0a6d98
[ "MIT" ]
151
2020-07-27T21:15:23.000Z
2022-02-28T03:34:41.000Z
client/src/services/EventService.js
ccrowley96/digital-twins-explorer
d9d8bd43f974f355697289210c890724ed0a6d98
[ "MIT" ]
89
2020-07-13T14:46:33.000Z
2022-03-31T18:24:40.000Z
// Copyright (c) Microsoft Corporation. // Licensed under the MIT license. import PubSub from "pubsub-js"; const buildCallback = c => (e, val) => c(val); class EventService { publishQuery(query) { this._emit("query", query); } subscribeQuery(callback) { this._on("query", callback); } publishOverlayQueryResults(overlayResults) { this._emit("overlay", overlayResults); } subscribeOverlayQueryResults(callback) { this._on("overlay", callback); } publishLog(data, type) { this._emit("log", { data, type }); } subscribeLog(callback) { this._on("log", callback); } publishConfigure(evt) { this._emit("configure", evt); } subscribeConfigure(callback) { this._on("configure", callback); } unsubscribeConfigure(callback) { this._off("configure", callback); } publishPreferences(evt) { this._emit("preferences", evt); } subscribePreferences(callback) { this._on("preferences", callback); } unsubscribePreferences(callback) { this._off("preferences", callback); } publishClearTwinsData() { this._emit("cleartwins"); } subscribeClearTwinsData(callback) { this._on("cleartwins", callback); } publishClearModelsData() { this._emit("clearmodels"); } subscribeClearModelsData(callback) { this._on("clearmodels", callback); } publishError(error) { this._emit("error", error); } subscribeError(callback) { this._on("error", callback); } unsubscribeError(callback) { this._off("error", callback); } publishSelection(selection) { this._emit("selection", selection); } subscribeSelection(callback) { this._on("selection", callback); } publishGraphTwins(selection) { this._emit("graphtwins", selection); } subscribeGraphTwins(callback) { this._on("graphtwins", callback); } publishGraphRelationships(selection) { this._emit("graphrels", selection); } subscribeGraphRelationships(callback) { this._on("graphrels", callback); } publishFocusTwin(twin) { this._emit("focustwin", twin); } subscribeFocusTwin(callback) { this._on("focustwin", callback); } publishBlurTwin(twin) { this._emit("blurtwin", twin); } subscribeBlurTwin(callback) { this._on("blurtwin", callback); } publishFocusModel(model) { this._emit("focusmodel", model); } subscribeFocusModel(callback) { this._on("focusmodel", buildCallback(callback)); } publishBlurModel(model) { this._emit("blurmodel", model); } subscribeBlurModel(callback) { this._on("blurmodel", callback); } publishSelectTwins(twins) { this._emit("clicktwins", twins); } subscribeSelectTwins(callback) { this._on("clicktwins", callback); } publishClickRelationship(rel) { this._emit("clickrel", rel); } subscribeClickRelationship(callback) { this._on("clickrel", callback); } publishRelationshipContextMenu(rel) { this._emit("relcontextmenu", rel); } subscribeRelationshipContextMenu(callback) { this._on("relcontextmenu", callback); } publishTwinContextMenu(rel) { this._emit("twincontextmenu", rel); } subscribeTwinContextMenu(callback) { this._on("twincontextmenu", callback); } publishClearGraphSelection() { this._emit("cleargraphselection"); } subscribeClearGraphSelection(callback) { this._on("cleargraphselection", callback); } publishCreateTwin(evt) { this._emit("createtwin", evt); } subscribeCreateTwin(callback) { this._on("createtwin", callback); } publishDeleteTwin(id) { this._emit("delete", id); } subscribeDeleteTwin(callback) { this._on("delete", callback); } publishAddRelationship(evt) { this._emit("addrelationship", evt); } subscribeAddRelationship(callback) { this._on("addrelationship", callback); } publishDeleteRelationship(evt) { this._emit("deleterelationship", evt); } subscribeDeleteRelationship(callback) { this._on("deleterelationship", callback); } publishCreateModel(models) { this._emit("createmodel", models); } subscribeCreateModel(callback) { this._on("createmodel", callback); } publishSelectedTwins(twins) { this._emit("selectedtwins", twins); } subscribeSelectedTwins(callback) { this._on("selectedtwins", callback); } publishDeleteModel(evt) { this._emit("deletemodel", evt); } subscribeDeleteModel(callback) { this._on("deletemodel", callback); } publishSelectModel(item) { this._emit("selectmodel", item); } subscribeSelectModel(callback) { this._on("selectmodel", callback); } publishModelSelectionUpdatedInGraph(modelId) { this._emit("modelselectionupdatedingraph", modelId); } subscribeModelSelectionUpdatedInGraph(callback) { this._on("modelselectionupdatedingraph", callback); } publishCloseComponent(component) { this._emit("closecomponent", component); } subscribeCloseComponent(callback) { this._on("closecomponent", callback); } publishFocusConsole(component) { this._emit("focusconsole", component); } subscribeFocusConsole(callback) { this._on("focusconsole", buildCallback(callback)); } publishOpenOptionalComponent(component) { this._emit("opencomponent", component); } subscribeOpenOptionalComponent(callback) { this._on("opencomponent", callback); } publishComponentClosed(component) { this._emit("componentclosed", component); } subscribeComponentClosed(callback) { this._on("componentclosed", callback); } publishImport(evt) { this._emit("import", evt); } subscribeImport(callback) { this._on("import", callback); } publishExport(evt) { this._emit("export", evt); } subscribeExport(callback) { this._on("export", callback); } publishLoading(isLoading) { this._emit("loading", isLoading); } subscribeLoading(callback) { this._on("loading", callback); } publishModelIconUpdate(modelId) { this._emit("modeliconupdate", modelId); } subscribeModelIconUpdate(callback) { this._on("modeliconupdate", callback); } publishModelsUpdate(modelId) { this._emit("modelsupdate", modelId); } subscribeModelsUpdate(callback) { this._on("modelsupdate", callback); } publishEnvironmentChange() { this._emit("environmentChanged"); } subscribeEnvironmentChange(callback) { this._on("environmentChanged", callback); } unsubscribeEnvironmentChange(callback) { this._off("environmentChanged", callback); } publishFocusRelationshipsToggle(e) { this._emit("focusrelationshiptoggle", e); } subscribeFocusRelationshipsToggle(callback) { this._on("focusrelationshiptoggle", buildCallback(callback)); } publishFocusModelViewer() { this._emit("focusmodelviewer"); } subscribeFocusModelViewer(callback) { this._on("focusmodelviewer", buildCallback(callback)); } publishFocusTwinViewer() { this._emit("focustwinviewer"); } subscribeFocusTwinViewer(callback) { this._on("focustwinviewer", buildCallback(callback)); } _emit = (name, payload) => this._action({ type: "publish", name, payload }); _off = (name, payload) => this._action({ type: "unsubscribe", name, payload }); _on = (name, payload) => this._action({ type: "subscribe", name, payload: buildCallback(payload) }); _action({ type, name, payload }) { PubSub[type](name, payload); } } export const eventService = new EventService();
20.225201
102
0.681734
bbe93238e7ae14125e42282d72276247dbdb6ac6
4,344
js
JavaScript
src/numbro.js
jinhuiWong/numbro
6ae190f87b15f4842c0e93a471b9d8292b79f782
[ "MIT-0", "MIT" ]
null
null
null
src/numbro.js
jinhuiWong/numbro
6ae190f87b15f4842c0e93a471b9d8292b79f782
[ "MIT-0", "MIT" ]
null
null
null
src/numbro.js
jinhuiWong/numbro
6ae190f87b15f4842c0e93a471b9d8292b79f782
[ "MIT-0", "MIT" ]
null
null
null
/*! * Copyright (c) 2017 Benjamin Van Ryseghem<benjamin@vanryseghem.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ const VERSION = "2.3.1"; const BigNumber = require("bignumber.js"); const globalState = require("./globalState"); const validator = require("./validating"); const loader = require("./loading")(numbro); const unformatter = require("./unformatting"); let formatter = require("./formatting")(numbro); let manipulate = require("./manipulating")(numbro); const parsing = require("./parsing"); class Numbro { constructor(number) { this._value = number; } clone() { return numbro(this._value); } format(format = {}) { return formatter.format(this, format); } formatCurrency(format) { if (typeof format === "string") { format = parsing.parseFormat(format); } format = formatter.formatOrDefault(format, globalState.currentCurrencyDefaultFormat()); format.output = "currency"; return formatter.format(this, format); } formatTime(format = {}) { format.output = "time"; return formatter.format(this, format); } binaryByteUnits() { return formatter.getBinaryByteUnit(this);} decimalByteUnits() { return formatter.getDecimalByteUnit(this);} byteUnits() { return formatter.getByteUnit(this);} difference(other) { return manipulate.difference(this, other); } add(other) { return manipulate.add(this, other); } subtract(other) { return manipulate.subtract(this, other); } multiply(other) { return manipulate.multiply(this, other); } divide(other) { return manipulate.divide(this, other); } set(input, isNormalize) { return manipulate.set(this, normalizeInput(input, isNormalize)); } value() { return this._value; } valueOf() { return this._value; } } /** * Make its best to convert input into a number. * * @param {numbro|string|number} input - Input to convert * @param {boolean} isNormalize - isNormalize * @return {number} */ function normalizeInput(input, isNormalize = true) { let result = input; if (numbro.isNumbro(input)) { result = input._value; } else if (typeof input === "string" && isNormalize) { result = numbro.unformat(input); } else if (input instanceof BigNumber) { result = input.toString(); } else if (isNaN(input)) { result = NaN; } return result; } function numbro(input, isNormalize) { return new Numbro(normalizeInput(input, isNormalize)); } numbro.version = VERSION; numbro.isNumbro = function(object) { return object instanceof Numbro; }; // // `numbro` static methods // numbro.language = globalState.currentLanguage; numbro.registerLanguage = globalState.registerLanguage; numbro.setLanguage = globalState.setLanguage; numbro.languages = globalState.languages; numbro.languageData = globalState.languageData; numbro.zeroFormat = globalState.setZeroFormat; numbro.defaultFormat = globalState.currentDefaults; numbro.setDefaults = globalState.setDefaults; numbro.defaultCurrencyFormat = globalState.currentCurrencyDefaultFormat; numbro.validate = validator.validate; numbro.loadLanguagesInNode = loader.loadLanguagesInNode; numbro.unformat = unformatter.unformat; numbro.BigNumber = manipulate.BigNumber; module.exports = numbro;
33.160305
96
0.714549
01111f421fd0e4cf2026855f8f6748d2229d9a6d
4,899
js
JavaScript
src/components/modeDerniersArticles.js
floflooow/blog-paupau
4062c58d9906799abeb3eaa8a5b3882e69e1b071
[ "RSA-MD" ]
null
null
null
src/components/modeDerniersArticles.js
floflooow/blog-paupau
4062c58d9906799abeb3eaa8a5b3882e69e1b071
[ "RSA-MD" ]
24
2021-04-25T17:38:17.000Z
2021-09-04T17:40:55.000Z
src/components/modeDerniersArticles.js
floflooow/blog-paupau
4062c58d9906799abeb3eaa8a5b3882e69e1b071
[ "RSA-MD" ]
null
null
null
import * as React from "react" import { useStaticQuery, graphql, Link } from "gatsby" import { GatsbyImage, StaticImage } from "gatsby-plugin-image" import { useWindowSize } from "./useWindowSize/useWindowSize" const ModeDerniersArticles = () => { const [width] = useWindowSize() const data = useStaticQuery(graphql` query modeDerniersArticles { allWpPost( limit: 3 sort: { fields: date, order: DESC } filter: { categories: { nodes: { elemMatch: { slug: { eq: "mode" } } } } } ) { nodes { categories { nodes { name } } commentCount date(formatString: "DD MMMM YYYY", locale: "fr-FR") title featuredImage { node { localFile { childImageSharp { gatsbyImageData( jpgOptions: { quality: 100 } layout: FULL_WIDTH ) } } altText } } uri } } } `) let articleList = data.allWpPost.nodes return ( <div className="flex flex-col bg-beige sm:pt-16 sm:pb-12 sm:px-20 sm:-mx-9"> <div className="relative flex sm:pt-16 sm:pb-12 sm:px-20 sm:-mx-9 p-3 flex-col sm:flex-row sm:flex-no-wrap justify-between items-center bg-beige"> <div className="transform -rotate-90 absolute -left-20 top-28 sm:block hidden"> <h3 className="text-4xl font-sans-serif font-thin text-center text-rouille m-0"> Articles de mode </h3> </div> <h3 className="text-4xl mt-3 font-sans-serif font-thin text-center text-rouille m-0 block sm:hidden"> Articles de mode </h3> <div className="flex flex-row flex-wrap sm:flex-no-wrap w-full"> {articleList.map((article, key) => ( <Link className="imageContainer relative sm:w-30/100 w-11/12 mx-auto mt-6 sm:mt-0 flex flex-col" key={key} to={`/mode${article.uri}`} > <div className="h-full"> <GatsbyImage className="imageWithoutFullHeight h-80/100" alt={article.featuredImage.node.altText} image={ article.featuredImage.node.localFile.childImageSharp .gatsbyImageData } ></GatsbyImage> <p className="text-black font-light font-sans-serif sm:text-xl text-2xl mx-0 sm:mb-0 mb-2 sm:mt-3 mt-4"> {article.title} </p> <div className="flex flex-row flex-no-wrap justify-start items-center w-auto"> <p className="text-black opacity-50 font-normal font-sans-serif sm:text-xxs text-base ml-0 mb-0 mt-0 mr-2"> {article.date} </p> <div className="flex flex-row flex-no-wrap items-center"> {width <= 640 ? ( <StaticImage src="../images/comments-black.svg" width={24} height={24} className="mr-1 opacity-50" quality={100} formats={["AUTO", "WEBP", "AVIF"]} alt="Nombre de commentaires" /> ) : ( <StaticImage src="../images/comments-black.svg" width={16} height={16} className="mr-1 opacity-50" quality={100} formats={["AUTO", "WEBP", "AVIF"]} alt="Nombre de commentaires" /> )} <p className="text-black opacity-50 font-normal font-sans-serif text-xxs m-0"> {article.commentCount ? article.commentCount : 0} </p> </div> </div> <p className="absolute top-0 shadow-sm right-0 px-3 bg-white text-black font-sans-serif uppercase text-xxs"> {article.categories.nodes[0].name} </p> </div> </Link> ))} </div> <div className="transform rotate-90 absolute -right-20 bottom-28 sm:block hidden"> <h3 className="text-4xl font-sans-serif font-thin text-center text-rouille m-0"> Articles de mode </h3> </div> </div> <Link className="flex sm:mt-3 mt-0 mb-9 mx-auto text-sm text-rouille font-thin font-serif hoverBorder" to="/mode" > Voir tout </Link> </div> ) } export default ModeDerniersArticles
37.684615
152
0.480302
bbeac4d58b3674ecccea2e32fe95709aee22d883
32,712
js
JavaScript
addons/ewei_shopv2/static/js/app/biz/order/create.js
owenzhang24/rrmall
1556bf32165a30376a6d10fe8f1e8160c2c95b4e
[ "AFL-3.0" ]
null
null
null
addons/ewei_shopv2/static/js/app/biz/order/create.js
owenzhang24/rrmall
1556bf32165a30376a6d10fe8f1e8160c2c95b4e
[ "AFL-3.0" ]
null
null
null
addons/ewei_shopv2/static/js/app/biz/order/create.js
owenzhang24/rrmall
1556bf32165a30376a6d10fe8f1e8160c2c95b4e
[ "AFL-3.0" ]
1
2019-12-13T18:10:26.000Z
2019-12-13T18:10:26.000Z
define(["core","tpl","biz/plugin/diyform","biz/order/invoice"],function(f,e,c,t){var _={params:{orderid:0,goods:[],coupon_goods:[],merchs:[],iscarry:0,isverify:0,isvirtual:0,isonlyverifygoods:0,dispatch_price:0,deductenough_enough:0,merch_deductenough_enough:0,deductenough_money:0,merch_deductenough_money:0,addressid:0,contype:0,couponid:0,card_id:0,card_price:0,wxid:0,wxcardid:0,wxcode:"",isnodispatch:0,nodispatch:"",packageid:0,card_packageid:0,new_area:"",address_street:"",discountprice:0,isdiscountprice:0,lotterydiscountprice:0,gift_price:0,giftid:0,show_card:!1,city_express_state:!1},invoice_info:{},init:function(e,t){t&&t.title&&(_.invoice_info=t),_.params=$.extend(_.params,e||{}),_.params.couponid=0,$("#coupondiv").find(".fui-cell-label").html("优惠券"),$("#coupondiv").find(".fui-cell-info").html("");var i=f.getNumber($(".discountprice").val()),r=f.getNumber($(".isdiscountprice").val());0<i&&$(".discount").show(),0<r&&$(".isdiscount").show(),_.params.city_express_state?($(".fui-cell-group.city_express.external").show(),$("#showdispatchprice div:first-child").text("同城运费")):($(".fui-cell-group.city_express.external").hide(),$("#showdispatchprice div:first-child").text("运费"));var a=!1;if(void 0!==window.selectedAddressData)a=window.selectedAddressData;else if(void 0!==window.editAddressData)(a=window.editAddressData).address=a.areas.replace(/ /gi,"")+" "+a.address;else{var d=_.getCookie("id"),c=_.getCookie("mobile"),o=decodeURIComponent(_.getCookie("realname")),s=decodeURIComponent(_.getCookie("addressd"));0<d&&(a={id:d,mobile:c,address:s,realname:o})}a&&(_.params.addressid=a.id,$("#addressInfo .has-address").show(),$("#addressInfo .no-address").hide(),$("#addressInfo .icon-dingwei").show(),$("#addressInfo .realname").html(a.realname),$("#addressInfo .mobile").html(a.mobile),$("#addressInfo .address").html(a.address),$("#addressInfo a").attr("href",f.getUrl("member/address/selector")),$("#addressInfo a").click(function(){window.orderSelectedAddressID=a.id}));var n=!(document.cookie="id=0");if(void 0!==window.selectedStoreData){n=window.selectedStoreData,_.params.storeid=n.id;var u="#carrierInfo";1==_.params.isforceverifystore&&1==_.params.isverify&&(u="#forceStoreInfo"),$(u+" .storename").html(n.storename),$(u+" .realname").html(n.realname),$(u+"_mobile").html(n.mobile),$(u+" .address").html(n.address),$(u).find(".no-address").css("display","none"),$(u).find(".has-address").css("display","block"),$(u).find(".fui-list-media").css("display","block"),$(u).find(".text").css("display","block"),$(u).find(".title").css("display","block"),$(u).find(".subtitle").css("display","block")}FoxUI.tab({container:$("#carrierTab"),handlers:{tab1:function(){$(".exchange-withoutpostage").hide(),$(".exchange-withpostage").show(),_.params.iscarry=0,$("#addressInfo").show(),$("#carrierInfo").hide(),$("#memberInfo").hide(),$("#showdispatchprice").show(),_.caculate()},tab2:function(){_.params.iscarry=1,$(".exchange-withpostage").hide(),$(".exchange-withoutpostage").show(),$("#addressInfo").hide(),$("#carrierInfo").show(),$("#memberInfo").show(),$("#showdispatchprice").hide(),_.caculate()}}});var m=$(".fui-number");if(0<m.length){var l=m.data("maxbuy")||0,p=m.data("goodsid"),h=m.data("minbuy")||0,g=m.data("unit")||"件";m.numbers({max:l,min:h,minToast:"{min}"+g+"起售",maxToast:"最多购买{max}"+g,callback:function(e){$.each(_.params.goods,function(){if(this.goodsid==p)return this.total=e,!1}),$.each(_.params.coupon_goods,function(){if(this.goodsid==p)return this.total=e,!1}),_.params.contype=0,_.params.couponid=0,_.params.wxid=0,_.params.wxcardid="",_.params.wxcode="",_.params.couponmerchid=0,$("#coupondiv").find(".fui-cell-label").html("优惠券"),$("#coupondiv").find(".fui-cell-info").html(""),$("#goodscount").html(e);var t=f.getNumber(m.closest(".goods-item").find(".marketprice").html())*e;$(".goodsprice").html(f.number_format(t,2)),_.caculate()}})}$("#deductcredit").click(function(){_.calcCouponPrice(),_.calcCardPrice()}),$("#deductcredit2").click(function(){_.calcCouponPrice(),_.calcCardPrice()}),_.bindCoupon(),_.bindCard(),$(document).click(function(){$("input,select,textarea").each(function(){$(this).attr("data-value",$(this).val())}),$(":checkbox,:radio").each(function(){$(this).attr("data-checked",$(this).prop("checked"))})}),$("input,select,textarea").each(function(){var e=$(this).attr("data-value")||"";""!=e&&$(this).val(e)}),$(":checkbox,:radio").each(function(){var e="true"===$(this).attr("data-checked");$(this).prop("checked",e)}),$(".buybtn").click(function(){_.submit(this,e.token)}),_.caculate(),$(".fui-cell-giftclick").click(function(){_.giftPicker=new FoxUIModal({content:$("#gift-picker-modal").html(),extraClass:"picker-modal",maskClick:function(){_.giftPicker.close()}}),_.giftPicker.container.find(".btn-danger").click(function(){_.giftPicker.close()}),_.giftPicker.show();var e=$("#giftid").val();$(".gift-item").each(function(){$(this).val()==e&&$(this).prop("checked","true")}),$(".gift-item").on("click",function(){$.ajax({url:f.getUrl("goods/detail/querygift",{id:$(this).val()}),cache:!0,success:function(e){0<(e=window.JSON.parse(e)).status&&($("#giftid").val(e.result.id),$("#gifttitle").text(e.result.title))}})})}),$(".show-allshop-btn").click(function(){$(this).closest(".store-container").addClass("open")}),_.initaddress(),$(".card-list-modal").click(function(){$(".card-list-modal").removeClass("in"),$(".card-list-group").removeClass("in")})},getCookie:function(e){for(var t=e+"=",i=document.cookie.split(";"),r=0;r<i.length;r++){for(var a=i[r];" "==a.charAt(0);)a=a.substring(1);if(-1!=a.indexOf(t))return a.substring(t.length,a.length)}return""},giftPicker:function(){_.giftPicker=new FoxUIModal({content:$("#option-picker-modal").html(),extraClass:"picker-modal",maskClick:function(){_.packagePicker.close()}})},bindCard:function(){$("#selectCard").unbind("click").click(function(){$("#cardloading").show(),$("#showdispatchprice div:first-child").text("同城运费"),f.json("membercard/query",{money:0,type:0,goods:_.params.goods,discountprice:_.params.discountprice,isdiscountprice:_.params.isdiscountprice},function(t){$("#cardloading").hide(),0<t.result.cards.length||0<t.result.wxcards.length?($("#selectCard").show().find(".badge").html(t.result.cards.length).show(),$("#selectCard").find(".text-danger").hide(),require(["../addons/ewei_shopv2/plugin/membercard/static/js/picker.js"],function(e){e.show({card_id:_.params.card_id,cards:t.result.cards,onCancel:function(){_.params.card_id=0,$("#selectCard").find(".fui-cell-label").html("不使用会员卡"),$("#selectCard").find(".fui-cell-info").html(""),_.calcCardPrice()},onCaculate:function(){_.params.card_id=0,_.caculate()},onSelected:function(e){_.params.card_id=e.card_id,_.params.card_price=e.card_price,$("#selectCard").find(".fui-cell-label").html("已选择"),$("#selectCard").find(".fui-cell-info").html(e.card_name),$("#selectCard").data(e),_.calcCardPrice()}})})):(FoxUI.toast.show("未找到会员卡!"),_.hideCard())},!1,!0)})},hideCard:function(){$("#selectCard").hide(),$("#selectCard").find(".badge").html("0").hide(),$("#selectCard").find(".text").show()},hideCoupon:function(){$("#coupondiv").hide(),$("#coupondiv").find(".badge").html("0").hide(),$("#coupondiv").find(".text").show()},caculate:function(){var e=f.getNumber($(".goodsprice").html())-f.getNumber($(".taskdiscountprice").val())-f.getNumber($(".lotterydiscountprice").val())-f.getNumber($(".discountprice").val())-f.getNumber($(".isdiscountprice").val())-f.getNumber($("#taskcut").val());0<$(".shownum").length&&(e=f.getNumber($(".marketprice").html())*parseInt($(".shownum").val())),0==_.params.fromcart&&1==_.params.goods.length&&(_.params.goods[0].total=parseInt($(".shownum").val())),void 0!==window.selectedAddressData&&(_.params.addressid=window.selectedAddressData.id),f.json("order/create/caculate",{totalprice:e,addressid:_.params.addressid,dispatchid:_.params.dispatchid,dflag:_.params.iscarry,goods:_.params.goods,packageid:_.params.card_packageid,liveid:_.params.liveid,card_id:_.params.card_id,giftid:_.params.giftid,goods_dispatch:_.params.goods_dispatch},function(e){if(1==e.status){var t=parseInt($(".shownum").val()),i=_.params.goods[0].goodsid+"_"+t+"_isgift";if(0==_.params.fromcart&&1==e.result.isgift&&0==_.params.giftid&&1!=_.getCookie(i)){_.params.goods[0].goodsid,_.params.goods[0].optionid,_.params.giftid,_.params.liveid;document.cookie=i+"=1"}else document.cookie=i+"=-1";_.params.iscarry?$(".dispatchprice").html("0.00"):$(".dispatchprice").html(f.number_format(e.result.price,2)),e.result.taskdiscountprice&&$("#taskdiscountprice").val(f.number_format(e.result.taskdiscountprice,2)),e.result.lotterydiscountprice&&$("#lotterydiscountprice").val(f.number_format(e.result.lotterydiscountprice,2)),e.result.discountprice&&$("#discountprice").val(f.number_format(e.result.discountprice,2)),e.result.buyagain&&($("#buyagain").val(f.number_format(e.result.buyagain,2)),$("#showbuyagainprice").html(f.number_format(e.result.buyagain,2)).parents(".fui-cell").show()),e.result.isdiscountprice&&$("#isdiscountprice").val(f.number_format(e.result.isdiscountprice,2)),e.result.deductcredit&&($("#deductcredit_money").html(f.number_format(e.result.deductmoney,2)),$("#deductcredit_info").html(e.result.deductcredit),$("#deductcredit").data("credit",e.result.deductcredit),$("#deductcredit").data("money",f.number_format(e.result.deductmoney,2))),e.result.deductcredit2&&($("#deductcredit2_money").html(e.result.deductcredit2),$("#deductcredit2").data("credit2",e.result.deductcredit2)),0<e.result.include_dispath?$("#include_dispath").show():$("#include_dispath").hide(),0<e.result.seckillprice?($("#seckillprice").show(),$("#seckillprice_money").html(f.number_format(e.result.seckillprice,2))):($("#seckillprice").hide(),$("#seckillprice_money").html(0)),0<e.result.couponcount?($("#coupondiv").show().find(".badge").html(e.result.couponcount).show(),$("#coupondiv").find(".text").hide()):(_.params.couponid=0,$("#coupondiv").hide().find(".badge").html(0).hide()),0<e.result.merch_deductenough_money?($("#merch_deductenough").show(),$("#merch_deductenough_money").html(f.number_format(e.result.merch_deductenough_money,2)),$("#merch_deductenough_enough").html(f.number_format(e.result.merch_deductenough_enough,2))):($("#merch_deductenough").hide(),$("#merch_deductenough_money").html("0.00"),$("#merch_deductenough_enough").html("0.00")),0<e.result.deductenough_money?($("#deductenough").show(),$("#deductenough_money").html(f.number_format(e.result.deductenough_money,2)),$("#deductenough_enoughdeduct").html(f.number_format(e.result.deductenough_money,2)),$("#deductenough_enough").html(f.number_format(e.result.deductenough_enough,2))):($("#deductenough").hide(),$("#deductenough_money").html("0.00"),$("#deductenough_enoughdeduct").html("0.00"),$("#deductenough_enough").html("0.00")),e.result.merchs&&(_.params.merchs=e.result.merchs),1==e.result.isnodispatch?(_.isnodispatch=1,_.nodispatch=e.result.nodispatch,FoxUI.toast.show(_.nodispatch)):(_.isnodispatch=0,_.nodispatch=""),_.params.city_express_state=e.result.city_express_state,_.params.city_express_state?($(".fui-cell-group.city_express.external").show(),$("#showdispatchprice div:first-child").text("同城运费")):($(".fui-cell-group.city_express.external").hide(),$("#showdispatchprice div:first-child").text("运费")),0<_.params.liveid&&0==_.params.card_id&&($(".goodsprice").html(f.number_format(e.result.realprice-e.result.price,2)),$(".marketprice").html(f.number_format(e.result.realprice-e.result.price,2))),_.calcCouponPrice(),_.calcCardPrice()}},!0,!0)},totalPrice:function(e){var t=f.getNumber($(".goodsprice").html());0<_.params.packageid||0<_.params.card_packageid?(t=f.getNumber($(".bigprice-packageprice").html()),$("#showpackageprice").show()):$("#showpackageprice").hide();var i=t-f.getNumber($(".showtaskdiscountprice").html())-f.getNumber($(".showlotterydiscountprice").html())-f.getNumber($(".showdiscountprice").html())-f.getNumber($(".showisdiscountprice").html())-e-f.getNumber($("#buyagain").val()),r=f.getNumber($("#taskcut").val()),a=f.getNumber($(".dispatchprice").html()),d=(f.getNumber($("#deductenough_enough").html()),f.getNumber($("#merch_deductenough_enough").html()),f.getNumber($("#merch_deductenough_money").html())),c=f.getNumber($("#deductenough_money").html());d=0;0<$("#merch_deductenough_money").length&&""!=$("#merch_deductenough_money").html()&&(d=f.getNumber($("#merch_deductenough_money").html()));c=0;0<$("#deductenough_money").length&&""!=$("#deductenough_money").html()&&(c=f.getNumber($("#deductenough_money").html()));0<_.params.card_packageid&&0==_.params.card_id&&(i-=f.getNumber($(".packageprice").html())),i=i-d-c+a-r;var o=0;if(0<$("#deductcredit").length){var s=f.getNumber($("#deductcredit").data("credit"));if($("#deductcredit").prop("checked")){if(o=f.getNumber($("#deductcredit").data("money")),0<$("#deductcredit2").length){var n=f.getNumber($("#deductcredit2").data("credit2"));if(0<=i-o)n<(s=i-o)&&(s=n),$("#deductcredit2_money").html(f.number_format(s,2))}}else if(0<$("#deductcredit2").length){s=f.getNumber($("#deductcredit2").data("credit2"));$("#deductcredit2_money").html(f.number_format(s,2))}}var u=0;0<$("#deductcredit2").length&&$("#deductcredit2").prop("checked")&&(u=f.getNumber($("#deductcredit2_money").html()));var m=0;if(0<$("#seckillprice_money").length&&""!=$("#seckillprice_money").html()&&(m=f.getNumber($("#seckillprice_money").html())),(i=i-o-u-m)<=0&&(i=0),0<_.params.gift_price&&t>parseInt(_.params.gift_price)?($(".giftdiv").show(),$("#giftid").val(_.params.giftid)):($(".giftdiv").hide(),$("#giftid").val(0)),$(".totalprice").html(f.number_format(i)),(0<_.params.packageid||0<_.params.card_packageid)&&$(".total-packageid").html(f.number_format(i)),0<$("#deductcredit2").length)n=f.getNumber($("#deductcredit2").data("credit2")),f.getNumber($("#coupondeduct_money").html());if(0<$("#deductcredit").length)n=f.getNumber($("#deductcredit").data("credit")),f.getNumber($("#coupondeduct_money").html());return _.bindCoupon(),_.bindCard(),i},calcCouponPrice:function(){var e=f.getNumber($(".goodsprice").html()),r=0,t=f.getNumber($(".taskdiscountprice").val()),i=f.getNumber($("#taskcut").val()),a=f.getNumber($(".lotterydiscountprice").val()),d=f.getNumber($(".discountprice").val()),c=f.getNumber($(".isdiscountprice").val()),o=f.getNumber($("#carddeduct_money").html());if(0==_.params.couponid&&0==_.params.wxid)return $("#coupondeduct_div").hide(),$("#coupondeduct_text").html(""),$("#coupondeduct_money").html("0"),0<t?($(".showtaskdiscountprice").html($(".taskdiscountprice").val()),$(".istaskdiscount").show()):$(".istaskdiscount").hide(),0<i?($(".showtaskcut").html($("#taskcut").val()),$(".taskcut").show()):$(".istaskdiscount").hide(),0<a?($(".showlotterydiscountprice").html($(".lotterydiscountprice").val()),$(".islotterydiscount").show()):$(".islotterydiscount").hide(),0<d?($(".showdiscountprice").html($(".discountprice").val()),$(".discount").show()):$(".discount").hide(),0<c?($(".showisdiscountprice").html($(".isdiscountprice").val()),$(".isdiscount").show()):$(".isdiscount").hide(),0<o?$("#carddeduct_div").show():$("#carddeduct_div").hide(),0<o?_.totalPrice(o):_.totalPrice(0);f.json("order/create/getcouponprice",{goods:_.params.coupon_goods,goodsprice:e,real_price:_.realPrice(),couponid:_.params.couponid,contype:_.params.contype,wxid:_.params.wxid,wxcardid:_.params.wxcardid,wxcode:_.params.wxcode,discountprice:d,isdiscountprice:c},function(e){if(1==e.status){$("#coupondeduct_text").html(e.result.coupondeduct_text),r=e.result.deductprice;var t=e.result.discountprice,i=e.result.isdiscountprice;0<t?($(".showdiscountprice").html(t),$(".discount").show()):($(".showdiscountprice").html(0),$(".discount").hide()),0<i?($(".showisdiscountprice").html(i),$(".isdiscount").show()):($(".showisdiscountprice").html(0),$(".isdiscount").hide()),0<r?($("#coupondeduct_div").show(),$("#coupondeduct_money").html(f.number_format(r,2))):($("#coupondeduct_div").hide(),$("#coupondeduct_text").html(""),$("#coupondeduct_money").html("0"))}else 0<d?($(".showdiscountprice").html($(".discountprice").val()),$(".discount").show()):$(".discount").hide(),0<c?($(".showisdiscountprice").html($(".isdiscountprice").val()),$(".isdiscount").show()):$(".isdiscount").hide(),r=0;return 0<o?_.totalPrice(o+r):_.totalPrice(r)},!0,!0)},calcCardPrice:function(){if(_.params.show_card){var e=f.getNumber($(".goodsprice").html());0<_.params.packageid&&(e=f.getNumber($(".bigprice-packageprice").html())),$("#carddeduct_div").hide(),$("#carddeduct_text").html(""),$("#carddeduct_money").html("0");var d=0,c=(f.getNumber($(".taskdiscountprice").val()),f.getNumber($("#taskcut").val()),f.getNumber($(".lotterydiscountprice").val()),f.getNumber($(".discountprice").val())),o=f.getNumber($(".isdiscountprice").val()),s=f.getNumber($("#coupondeduct_money").html()),n=(f.getNumber($("#deductenough_enough").html()),f.getNumber($("#merch_deductenough_enough").html())),u="";if(0==_.params.card_id)return 0<_.params.card_packageid?$("#showpackageprice").show():$("#showpackageprice").hide(),$("#taskcut").val(_.params.taskcut),$(".showtaskcut").html(_.params.taskcut),0<_.params.taskcut&&(_.params.discountprice=0,_.params.isdiscountprice=0,_.params.deductenough_enough=0,_.params.merch_deductenough_enough=0,$("#deductenough_enough").html("0.00"),$("#merch_deductenough_enough").html("0.00"),$("#deductenough_money").html("0.00"),$("#merch_deductenough_money").html("0.00"),$("#deductenough").hide(),$("#merch_deductenough").hide()),0<_.params.lotterydiscountprice&&(_.params.discountprice=0,_.params.isdiscountprice=0),0<_.params.card_packageid&&(_.params.discountprice=0,_.params.isdiscountprice=0,$("#showdiscountprice").html("0"),$("#discountprice").attr("value","0"),$(".discount").hide(),$("#showisdiscountprice").html("0"),$("#isdiscountprice").attr("value","0"),$(".isdiscount").hide(),$("#deductenough").hide(),$("#deductenough_money").html("0.00"),$("#deductenough_enoughdeduct").html("0.00"),$("#deductenough_enough").html("0.00"),$("#merch_deductenough").hide(),$("#merch_deductenough_money").html("0.00"),$("#merch_deductenough_enough").html("0.00")),0<_.params.liveid&&(_.params.discountprice=0,_.params.isdiscountprice=0),0<_.params.lotterydiscountprice&&$("#lotterydiscountprice").val(_.params.lotterydiscountprice),0<_.params.lotterydiscountprice&&$(".showlotterydiscountprice").html(_.params.lotterydiscountprice),f.getNumber($(".dispatchprice").html())<=0&&(_.params.iscarry?$(".dispatchprice").html("0.00"):$(".dispatchprice").html(f.number_format(_.params.dispatch_price,2))),0<_.params.discountprice&&($("#discountprice").attr("value",_.params.discountprice),$(".showdiscountprice").html(_.params.discountprice)),0<_.params.isdiscountprice&&($("#isdiscountprice").attr("value",_.params.isdiscountprice),$(".showisdiscountprice").html(_.params.isdiscountprice)),0<c||0<_.params.discountprice?$(".discount").show():$(".discount").hide(),0<o||0<_.params.isdiscountprice?$(".isdiscount").show():$(".isdiscount").hide(),_.params.city_express_state?($(".fui-cell-group.city_express.external").show(),$("#showdispatchprice div:first-child").text("同城运费")):($(".fui-cell-group.city_express.external").hide(),$("#showdispatchprice div:first-child").text("运费")),s?_.totalPrice(s):_.totalPrice(0);f.json("order/create/getcardprice",{goods:_.params.goods,goodsprice:e,card_id:_.params.card_id,liveid:_.params.liveid,card_price:_.params.card_price,deductenough_enough:_.params.deductenough_enough,merch_deductenough_enough:_.params.merch_deductenough_enough,dispatch_price:_.params.dispatch_price,lotterydiscountprice:_.params.lotterydiscountprice,taskcut:_.params.taskcut,discountprice:_.params.discountprice,isdiscountprice:_.params.isdiscountprice,goods_dispatch:_.params.goods_dispatch},function(e){if(1==e.status){$("#discountprice").attr("value",e.result.discountprice),$("#isdiscountprice").attr("value",e.result.isdiscountprice);var t=e.result.discountprice,i=e.result.isdiscountprice;0<t?($(".showdiscountprice").html(t),$(".discount").show()):($(".showdiscountprice").html(0),$(".discount").hide()),0<i?($(".showisdiscountprice").html(i),$(".isdiscount").show()):($(".showisdiscountprice").html(0),$(".isdiscount").hide()),$("#carddeduct_text").html(e.result.carddeduct_text),d=e.result.carddeductprice,u=e.result.cardname,$("#selectCard").find(".fui-cell-label").html("已选择"),$("#selectCard").find(".fui-cell-info").html(u),$(".islotterydiscount").hide();var r=e.result.dispatch_price;1==_.params.iscarry&&0<r&&(r=0),$(".dispatchprice").html(f.number_format(r,2)),0<d&&($("#carddeduct_div").show(),$("#carddeduct_money").html(f.number_format(d,2))),$("#taskcut").val(f.number_format(e.result.taskcut,2)),$(".showtaskcut").html(f.number_format(e.result.taskcut,2)),0<e.result.taskcut?$(".taskcut").show():$(".taskcut").hide(),$("#lotterydiscountprice").val(f.number_format(e.result.lotterydiscountprice,2)),$(".showlotterydiscountprice").html(f.number_format(e.result.lotterydiscountprice,2)),e.result.deductcredit&&($("#deductcredit_money").html(f.number_format(e.result.deductmoney,2)),$("#deductcredit_info").html(e.result.deductcredit),$("#deductcredit").data("credit",e.result.deductcredit),$("#deductcredit").data("money",f.number_format(e.result.deductmoney,2))),e.result.deductcredit2&&($("#deductcredit2_money").html(e.result.deductcredit2),$("#deductcredit2").data("credit2",e.result.deductcredit2)),0==e.result.dispatch_price&&1==e.result.shipping?$("#showdispatchprice div:first-child").html("运费(<span style='color: red'>会员卡包邮</span>)"):_.params.city_express_state?($(".fui-cell-group.city_express.external").show(),$("#showdispatchprice div:first-child").text("同城运费")):($(".fui-cell-group.city_express.external").hide(),$("#showdispatchprice div:first-child").text("运费"));var a=f.getNumber($(".packageprice").html());0<_.params.card_packageid&&0<a||a<=0?$("#showpackageprice").hide():$("#showpackageprice").show(),0<e.result.deductenough_money?($("#deductenough").show(),$("#deductenough_money").html(f.number_format(e.result.deductenough_money,2)),$("#deductenough_enoughdeduct").html(f.number_format(e.result.deductenough_money,2)),$("#deductenough_enough").html(f.number_format(e.result.deductenough_enough,2))):($("#deductenough").hide(),$("#deductenough_money").html("0.00"),$("#deductenough_enoughdeduct").html("0.00"),$("#deductenough_enough").html("0.00")),e.result.totalprice<n&&($("#merch_deductenough").hide(),$("#merch_deductenough_money").html("0.00"),$("#merch_deductenough_enough").html("0.00")),0<_.params.liveid&&($(".goodsprice").html(f.number_format(e.result.goodsprice,2)),$(".marketprice").html(f.number_format(e.result.goodsprice,2)))}else 0<c?($(".showdiscountprice").html($(".discountprice").val()),$(".discount").show()):$(".discount").hide(),0<o?($(".showisdiscountprice").html($(".isdiscountprice").val()),$(".isdiscount").show()):$(".isdiscount").hide(),d=0;return 0<_.params.couponid&&_.calcCouponPrice(),0<s?_.totalPrice(d+s):_.totalPrice(d)},!0,!0)}},submit:function(e,t){var i=$(e),r=parseInt($("#giftid").val());if(_.params.mustbind,!i.attr("stop")){if(_.params.iscarry||_.params.isverify||_.params.isvirtual||_.params.isonlyverifygoods){if($(":input[name=carrier_realname]").isEmpty()&&0==$(":input[name=carrier_realname]").attr("data-set"))return void FoxUI.toast.show("请填写联系人");if($(":input[name=carrier_mobile]").isEmpty()&&0==$(":input[name=carrier_mobile]").attr("data-set"))return void FoxUI.toast.show("请填写联系电话");if(!$(":input[name=carrier_mobile]").isMobile()&&0==$(":input[name=carrier_mobile]").attr("data-set"))return void FoxUI.toast.show("联系电话需请填写11位手机号")}if(_.params.isonlyverifygoods){if(1==_.params.isforceverifystore&&0==_.params.storeid)return void FoxUI.toast.show("请选择核销门店")}else if(_.params.iscarry||_.params.isverify||_.params.isvirtual){if(_.params.iscarry&&0==_.params.storeid)return void FoxUI.toast.show("请选择自提点");if(1==_.params.isforceverifystore&&0==_.params.storeid)return void FoxUI.toast.show("请选择核销门店")}else{if(0==_.params.addressid)return void FoxUI.toast.show("请选择收货地址");if(1==_.isnodispatch)return void FoxUI.toast.show(_.nodispatch)}var a="";if(_.params.has_fields)if(!(a=c.getData(".diyform-container")))return;0==_.params.fromcart&&1==_.params.goods.length&&(_.params.goods[0].total=parseInt($(".shownum").val())),i.attr("stop",1);var d={orderid:_.params.orderid,id:_.params.id,goods:_.params.goods,card_id:_.params.card_id,giftid:r,gdid:_.params.gdid,liveid:_.params.liveid,diydata:a,dispatchtype:_.params.iscarry?1:0,fromcart:_.params.fromcart,carrierid:_.params.iscarry?_.params.storeid:0,addressid:_.params.iscarry?0:_.params.addressid,carriers:_.params.iscarry||_.params.isvirtual||_.params.isverify?{carrier_realname:$(":input[name=carrier_realname]").val(),carrier_mobile:$(":input[name=carrier_mobile]").val(),realname:$("#carrierInfo .realname").html(),mobile:$("#carrierInfo_mobile").html(),storename:$("#carrierInfo .storename").html(),address:$("#carrierInfo .address").html()}:"",remark:$("#remark").val(),officcode:$("#officcode").val(),deduct:0<$("#deductcredit").length&&$("#deductcredit").prop("checked")?1:0,deduct2:0<$("#deductcredit2").length&&$("#deductcredit2").prop("checked")?1:0,contype:_.params.contype,couponid:_.params.couponid,wxid:_.params.wxid,wxcardid:_.params.wxcardid,wxcode:_.params.wxcode,invoicename:$("#invoicename").val(),submit:!0,real_price:_.realPrice(),token:t,packageid:_.params.card_packageid,fromquick:_.params.fromquick,goods_dispatch:_.params.goods_dispatch};_.params.isverify&&_.params.isforceverifystore&&(d.carrierid=_.params.storeid),FoxUI.loader.show("mini"),f.json("order/create/submit",d,function(e){if(i.removeAttr("stop",1),0==e.status)return FoxUI.loader.hide(),void FoxUI.toast.show(e.result.message);if(-1==e.status)return FoxUI.loader.hide(),void FoxUI.alert(e.result.message);if(3==e.status)return FoxUI.loader.hide(),_.endtime=e.result.endtime||0,_.imgcode=e.result.imgcode||0,void require(["biz/member/account"],function(e){e.initQuick({action:"bind",backurl:btoa(location.href),endtime:_.endtime,imgcode:_.imgcode,success:function(){var e=_.params;e.refresh=!0,_.open(e)}})});var t=f.getUrl("order/pay",{id:e.result.orderid});f.options&&f.options.siteUrl&&(t=f.options.siteUrl+"app"+t.substr(1)),location.href=t},!1,!0)}},initaddress:function(e){var t=["foxui.picker"];_.params.new_area&&(t=["foxui.picker","foxui.citydatanew"]),require(t,function(){if($("#areas").cityPicker({title:"请选择所在城市",new_area:_.params.new_area,address_street:_.params.address_street,onClose:function(e){var t=$("#areas").attr("data-value"),i=t.split(" ");if(_.params.new_area&&$("#areas").attr("data-datavalue",t),_.params.new_area&&_.params.address_street){var r=i[1],a=i[2];r+="",a+="";var d=_.loadStreetData(r,a),c=$('<input type="text" id="street" name="street" data-value="" value="" placeholder="所在街道" class="fui-input" readonly=""/>'),o=$("#street").closest(".fui-cell-info");$("#street").remove(),o.append(c),c.cityPicker({title:"请选择所在街道",street:1,data:d,onClose:function(e){var t=$("#street").attr("data-value");$("#street").attr("data-datavalue",t)}})}}}),_.params.new_area&&_.params.address_street){var e=$("#areas").attr("data-value");if(e){var t=e.split(" "),i=t[1],r=t[2],a=_.loadStreetData(i,r);$("#street").cityPicker({title:"请选择所在街道",street:1,data:a})}}}),$(document).on("click","#btn-submit",function(){if(!$(this).attr("submit"))if($("#realname").isEmpty())FoxUI.toast.show("请填写收件人");else{var e=/(境外地区)+/.test($("#areas").val()),t=/(台湾)+/.test($("#areas").val()),i=/(澳门)+/.test($("#areas").val()),r=/(香港)+/.test($("#areas").val());if(e||t||i||r){if($("#mobile").isEmpty())return void FoxUI.toast.show("请填写手机号码")}else if(!$("#mobile").isMobile())return void FoxUI.toast.show("请填写正确手机号码");$("#areas").isEmpty()?FoxUI.toast.show("请填写所在地区"):$("#address").isEmpty()?FoxUI.toast.show("请填写详细地址"):($("#btn-submit").html("正在处理...").attr("submit",1),window.editAddressData={realname:$("#realname").val(),mobile:$("#mobile").val(),address:$("#address").val(),areas:$("#areas").val(),street:$("#street").val(),streetdatavalue:$("#street").attr("data-datavalue"),datavalue:$("#areas").attr("data-datavalue"),isdefault:$("#isdefault").is(":checked")?1:0},f.json("member/address/submit",{id:$("#addressid").val(),addressdata:window.editAddressData},function(e){$("#btn-submit").html("保存地址").removeAttr("submit"),window.editAddressData.id=e.result.addressid,1==e.status?(FoxUI.toast.show("保存成功!"),$("#addaddress").css("display","none"),location.reload()):FoxUI.toast.show(e.result.message)},!0,!0))}})},loadStreetData:function(e,t){var i="../addons/ewei_shopv2/static/js/dist/area/list/"+e.substring(0,2)+"/"+e+".xml",r=_.loadXmlFile(i).childNodes[0].getElementsByTagName("county"),a=[];if(0<r.length)for(var d=0;d<r.length;d++){var c=r[d];if(c.getAttribute("code")==t)for(var o=c.getElementsByTagName("street"),s=0;s<o.length;s++){var n=o[s];a.push({text:n.getAttribute("name"),value:n.getAttribute("code"),children:[]})}}return a},bindCoupon:function(){$("#coupondiv").unbind("click").click(function(){$("#coupondiv").attr("is_open")||($("#coupondiv").attr("is_open",!0),$("#couponloading").show(),f.json("sale/coupon/util/query",{money:0,type:0,merchs:_.params.merchs,goods:_.params.goods},function(t){$("#couponloading").hide(),0<t.result.coupons.length||0<t.result.wxcards.length?($("#coupondiv").show().find(".badge").html(t.result.coupons.length+t.result.wxcards.length).show(),$("#coupondiv").find(".text").hide(),require(["biz/sale/coupon/picker"],function(e){e.show({couponid:_.params.couponid,coupons:t.result.coupons,wxcards:t.result.wxcards,onClose:function(){$("#coupondiv").removeAttr("is_open")},onCancel:function(){_.params.contype=0,_.params.couponid=0,_.params.wxid=0,_.params.wxcardid="",_.params.wxcode="",_.params.couponmerchid=0,$("#coupondiv").find(".fui-cell-label").html("优惠券"),$("#coupondiv").find(".fui-cell-info").html(""),_.calcCouponPrice()},onSelected:function(e){_.params.contype=e.contype,1==_.params.contype?(_.params.couponid=0,_.params.wxid=e.wxid,_.params.wxcardid=e.wxcardid,_.params.wxcode=e.wxcode,_.params.couponmerchid=e.merchid,$("#coupondiv").find(".fui-cell-label").html("已选择"),$("#coupondiv").find(".fui-cell-info").html(e.couponname),$("#coupondiv").data(e)):2==_.params.contype?(_.params.couponid=e.couponid,_.params.wxid=0,_.params.wxcardid="",_.params.wxcode="",_.params.couponmerchid=e.merchid,$("#coupondiv").find(".fui-cell-label").html("已选择"),$("#coupondiv").find(".fui-cell-info").html(e.couponname),$("#coupondiv").data(e)):(_.params.contype=0,_.params.couponid=0,_.params.wxid=0,_.params.wxcardid="",_.params.wxcode="",_.params.couponmerchid=0,$("#coupondiv").find(".fui-cell-label").html("优惠券"),$("#coupondiv").find(".fui-cell-info").html("")),_.calcCouponPrice()}})})):(FoxUI.toast.show("未找到优惠券!"),_.hideCoupon())},!1,!0))})},hideCoupon:function(){$("#coupondiv").hide(),$("#coupondiv").find(".badge").html("0").hide(),$("#coupondiv").find(".text").show(),$("#coupondiv").removeAttr("is_open")},loadXmlFile:function(e){var t=null;if(window.ActiveXObject)(t=new ActiveXObject("Microsoft.XMLDOM")).async=!1,t.load(e)||t.loadXML(e);else if(document.implementation&&document.implementation.createDocument){var i=new window.XMLHttpRequest;i.open("GET",e,!1),i.send(null),t=i.responseXML}else t=null;return t}};return $(document).on("click","#invoicename",function(){var e=$(this).data("type");t.open(_.invoice_info,function(e){_.invoice_info=e;var t="["+(1==_.invoice_info.entity?"纸质":"电子")+"] ";t+=_.invoice_info.title,t+=" ("+(1==_.invoice_info.company?"单位":"个人")+(_.invoice_info.number?": "+_.invoice_info.number:"")+")",$("#invoicename").val(t)},e)}),_.realPrice=function(){var e=f.getNumber($(".goodsprice").html())-f.getNumber($(".showtaskdiscountprice").html())-f.getNumber($(".showlotterydiscountprice").html())-f.getNumber($(".showdiscountprice").html())-f.getNumber($(".showisdiscountprice").html())-f.getNumber($("#buyagain").val()),t=f.getNumber($("#taskcut").val()),i=(f.getNumber($("#deductenough_enough").html()),f.getNumber($("#merch_deductenough_enough").html()),f.getNumber($("#merch_deductenough_money").html())),r=f.getNumber($("#deductenough_money").html());i=0;0<$("#merch_deductenough_money").length&&""!=$("#merch_deductenough_money").html()&&(i=f.getNumber($("#merch_deductenough_money").html()));r=0;0<$("#deductenough_money").length&&""!=$("#deductenough_money").html()&&(r=f.getNumber($("#deductenough_money").html()));0<_.params.card_packageid&&0==_.params.card_id&&(e-=f.getNumber($(".packageprice").html()));_.params.show_card&&(e-=f.getNumber($("#carddeduct_money").html())),e=e-i-r-t;var a=0;return 0<$("#seckillprice_money").length&&""!=$("#seckillprice_money").html()&&(a=f.getNumber($("#seckillprice_money").html())),(e-=a)<=0&&(e=0),e},_});
32,712
32,712
0.707691
bbea8eb6b4ed223c188a71758f7276cde32f1143
3,216
js
JavaScript
packages/oae-util/lib/init.js
chauhan-rakesh/Hilary
3ef169da8d103381ae7c98bb742450ed83404a6a
[ "ECL-2.0" ]
1
2020-04-23T08:35:24.000Z
2020-04-23T08:35:24.000Z
packages/oae-util/lib/init.js
chauhan-rakesh/Hilary
3ef169da8d103381ae7c98bb742450ed83404a6a
[ "ECL-2.0" ]
null
null
null
packages/oae-util/lib/init.js
chauhan-rakesh/Hilary
3ef169da8d103381ae7c98bb742450ed83404a6a
[ "ECL-2.0" ]
null
null
null
/*! * Copyright 2014 Apereo Foundation (AF) Licensed under the * Educational Community 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://opensource.org/licenses/ECL-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing * permissions and limitations under the License. */ import { logger } from 'oae-logger'; import * as Cassandra from './cassandra'; import * as Cleaner from './cleaner'; import * as Locking from './locking'; import * as MQ from './mq'; import * as Pubsub from './pubsub'; import * as Redis from './redis'; import * as Signature from './signature'; import * as TaskQueue from './taskqueue'; import * as Tempfile from './tempfile'; const log = logger('oae-cassandra'); export const init = function(config, callback) { // Create Cassandra database. // TODO: Move Cassandra into its own oae-cassandra module with a high priority. All of the init(..) stuff then goes in its init.js bootCassandra(config, () => { bootRedis(config, () => { bootPubSub(config, () => { bootRabbitMQ(config, () => { return callback(); }); }); }); }); }; const bootCassandra = (config, callback) => { const retryCallback = function(err) { const timeout = 5; if (err) { log().error('Error connecting to cassandra, retrying in ' + timeout + 's...'); return setTimeout(Cassandra.init, timeout * 1000, config.cassandra, retryCallback); } return callback(); }; Cassandra.init(config.cassandra, retryCallback); }; const bootRedis = (config, callback) => { // Allows for simple redis client creations // TODO: Move this into its own oae-redis module with a high priority. All of the init(..) stuff then goes in its init.js Redis.init(config.redis, err => { if (err) { return callback(err); } // Initialize the Redis based locking Locking.init(); return callback(); }); }; const bootPubSub = (config, callback) => { // Setup the Pubsub communication // This requires that the redis utility has already been loaded. // TODO: Move this into its own oae-pubsub module with a high priority. All of the init(..) stuff then goes in its init.js Pubsub.init(config.redis, err => { if (err) { return callback(err); } // Setup the key signing utility Signature.init(config.signing); // Setup the temporary file generator Tempfile.init(config.files.tmpDir); // Clean up temp files that might be accidentally left in the temp directory if (config.files.cleaner.enabled) { Cleaner.start(config.files.tmpDir, config.files.cleaner.interval); } return callback(); }); }; const bootRabbitMQ = (config, callback) => { // Initialize the RabbitMQ listener MQ.init(config.mq, err => { if (err) { return callback(err); } // Initialize the task queue TaskQueue.init(callback); }); };
29.777778
132
0.665112
bbf420bb7347bb2ebd8e339a258549bbc42d0c77
3,915
js
JavaScript
js/barrage/index.js
huangxiaoxin-hxx/javascript_fullstack
10ab414899788ec9607fa31bb3736b88745268c7
[ "CECILL-B" ]
null
null
null
js/barrage/index.js
huangxiaoxin-hxx/javascript_fullstack
10ab414899788ec9607fa31bb3736b88745268c7
[ "CECILL-B" ]
3
2021-05-10T17:48:51.000Z
2022-02-26T19:38:28.000Z
js/barrage/index.js
huangxiaoxin-hxx/javascript_fullstack
10ab414899788ec9607fa31bb3736b88745268c7
[ "CECILL-B" ]
null
null
null
let data = [ { value: '周杰伦的听妈妈的话好好听!', time: 5, color: 'red', speed: 1, fontSize: 22 }, { value: 'bilibili 干杯', time: 10, color: 'red', speed: 1, fontSize: 18 }, { value: 'wdnmd', time: 11, color: 'red', speed: 1, fontSize: 18 }, { value: '邓志坚你可真是个脑残', time: 20, color: 'green', speed: 1, fontSize: 40 }, { value: '弹幕怎么变颜色啊', time: 16 } ] // 获取所有需要的 dom 结构 let canvas = document.getElementById('canvas') let video = document.getElementById('video') let $txt = document.getElementById('text') let $btn = document.getElementById('btn') let $color = document.getElementById('color') let $range = document.getElementById('range') class CanvasBarrage { constructor(canvas, video, opts = {}) { // 如果canvas 和 video 都没传的话 if (!canvas || !video) { return } //增加两个属性,挂载到this上 this.video = video this.canvas = canvas this.canvas.width = video.width this.canvas.height = video.height //获取画布 this.ctx = canvas.getContext('2d') //设置默认参数,如果没有传参就使用默认参数 let defOpts = { color: '#e91e63', speed: 1.5, opacity: 0.5, fontSize: 20, data: [] } // 合并对象全部挂载到this实例上 Object.assign(this, defOpts, opts) // 添加一个,判断当前视频播放状态,默认true是暂停 this.isPaused = true // 获取所有的弹幕消息 this.barrages = this.data.map(item => new Barrage(item, this)) // 渲染弹幕 this.render() } render() { //先清除原有的画布 this.clear() //渲染弹幕 this.randerBarrage() //如果没有暂停的话,就继续渲染 if (this.isPaused == false) { requestAnimationFrame(this.render.bind(this)) } } clear() { this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height) } randerBarrage() { // 根据视频播放的时间和弹幕展示的时间做比较,来判断是否展示弹幕 let time = this.video.currentTime this.barrages.forEach(barrage => { // 只有在视频的播放时间大于等于弹幕展示的时间才做处理 if (!barrage.flag && time >= barrage.time) { //判断当前弹幕是否初始化 if (!barrage.isInit) { barrage.init() barrage.isInit = true } // 弹幕从右往左渲染,所以x坐标减去当前弹幕的速度speed barrage.x -= barrage.speed barrage.render() //如果当前弹幕的x坐标比自身宽度还小,就表示渲染结束 if (barrage.x < -barrage.width) { barrage.flag = true } } }) } add(obj) { this.barrages.push(new Barrage(obj, this)) } } // 创建Barrage类,用来实例化每一条弹幕 class Barrage { constructor(obj, ctx) { this.value = obj.value this.time = obj.time this.obj = obj this.context = ctx } // 初始化 init() { //如果数据里面没有涉及到以下值,就取默认值 this.color = this.obj.color || this.context.color this.speed = this.obj.speed || this.context.speed this.opacity = this.obj.opacity || this.context.opacity this.fontSize = this.obj.fontSize || this.context.fontSize let p = document.createElement('p') p.style.fontSize = this.fontSize + 'px' p.innerHTML = this.value document.body.appendChild(p) this.width = p.clientWidth document.body.removeChild(p) //设置弹幕出现的位置 this.x = this.context.canvas.width this.y = this.context.canvas.height * Math.random() if (this.y < this.fontSize) { this.y = this.fontSize } else if (this.y > this.context.canvas.height - this.fontSize) { this.y = this.context.canvas.height - this.fontSize } } //渲染每一条弹幕 render() { //设置画布/字体 this.context.ctx.font = `${this.fontSize}px Arial` //设置画布颜色 this.context.ctx.fillStyle = this.color // 绘制文字 this.context.ctx.fillText(this.value, this.x, this.y) } } let canvasBarrage = new CanvasBarrage(canvas, video, { data }) video.addEventListener('play', () => { canvasBarrage.isPaused = false canvasBarrage.render() //触发弹幕 }) //发送弹幕的方法 function send(){ let value = $txt.value let time = video.currentTime let color = $color.value let fontSize = $range.value let obj = {value, time, color, fontSize} canvasBarrage.add(obj) } $btn.addEventListener('click', send)
25.588235
76
0.62401
bbf4947fd346a5fe4990be02aba54e2bb08ffa0d
2,526
js
JavaScript
src/render/scripts/script.js
cattermo/fyrton
431f63714f134884bbb1248a0f82559e5307dbcf
[ "CC-BY-3.0", "CC0-1.0", "MIT" ]
null
null
null
src/render/scripts/script.js
cattermo/fyrton
431f63714f134884bbb1248a0f82559e5307dbcf
[ "CC-BY-3.0", "CC0-1.0", "MIT" ]
1
2022-02-10T11:46:16.000Z
2022-02-10T11:46:16.000Z
src/render/scripts/script.js
cattermo/fyrton
431f63714f134884bbb1248a0f82559e5307dbcf
[ "CC-BY-3.0", "CC0-1.0", "MIT" ]
null
null
null
/*** uglify: true ***/ 'use strict'; (function () { //classlist if (typeof window.Element === "undefined" || "classList" in document.documentElement) return; var prototype = Array.prototype, push = prototype.push, splice = prototype.splice, join = prototype.join; function DOMTokenList(el) { this.el = el; // The className needs to be trimmed and split on whitespace // to retrieve a list of classes. var classes = el.className.replace(/^\s+|\s+$/g,'').split(/\s+/); for (var i = 0; i < classes.length; i++) { push.call(this, classes[i]); } }; DOMTokenList.prototype = { add: function(token) { if(this.contains(token)) return; push.call(this, token); this.el.className = this.toString(); }, contains: function(token) { return this.el.className.indexOf(token) != -1; }, item: function(index) { return this[index] || null; }, remove: function(token) { if (!this.contains(token)) return; for (var i = 0; i < this.length; i++) { if (this[i] == token) break; } splice.call(this, i, 1); this.el.className = this.toString(); }, toString: function() { return join.call(this, ' '); }, toggle: function(token) { if (!this.contains(token)) { this.add(token); } else { this.remove(token); } return this.contains(token); } }; window.DOMTokenList = DOMTokenList; function defineElementGetter (obj, prop, getter) { if (Object.defineProperty) { Object.defineProperty(obj, prop,{ get : getter }); } else { obj.__defineGetter__(prop, getter); } } defineElementGetter(Element.prototype, 'classList', function () { return new DOMTokenList(this); }); })(); (function(){ var initGallery = function(){ var EXPANDED_CLASS = 'ban_is-expanded'; var galleryItems = document.querySelectorAll('.ban_js-gallery-item'); var clickListener = function() { if (this.classList.contains(EXPANDED_CLASS)) { this.classList.remove(EXPANDED_CLASS); } else { this.classList.add(EXPANDED_CLASS); } }; Array.prototype.forEach.call(galleryItems, function(item) { item.addEventListener('click', clickListener); }) }; initGallery(); })();
25.77551
97
0.553048
bbe7e95533da8a1df383a5e8f726eea2de463f32
175
js
JavaScript
data/js/70/b3/d5/b2/c0/00.36.js
p-g-krish/deepmac-tracker
44d625a6b1ec30bf52f8d12a44b0afc594eb5f94
[ "CC-BY-4.0", "MIT" ]
null
null
null
data/js/70/b3/d5/b2/c0/00.36.js
p-g-krish/deepmac-tracker
44d625a6b1ec30bf52f8d12a44b0afc594eb5f94
[ "CC-BY-4.0", "MIT" ]
null
null
null
data/js/70/b3/d5/b2/c0/00.36.js
p-g-krish/deepmac-tracker
44d625a6b1ec30bf52f8d12a44b0afc594eb5f94
[ "CC-BY-4.0", "MIT" ]
null
null
null
deepmacDetailCallback("70b3d5b2c000/36",[{"d":"2020-10-28","t":"add","s":"ieee-oui36.csv","a":"Via di Valle Caia, km 4.700 Pomezia Roma IT 00040","c":"IT","o":"Elman srl"}]);
87.5
174
0.64
01165cd9cfbd5f9096bc8fa38641eb000a376aa8
2,005
js
JavaScript
Libraries/Components/SegmentedControlIOS/__tests__/SegmentedContolIOS-test.js
alleniver/react-native
e22b760e594db97c22b34084a1770ac3a40c0ccf
[ "CC-BY-4.0", "MIT" ]
217
2019-03-25T17:44:40.000Z
2020-10-21T22:43:22.000Z
Libraries/Components/SegmentedControlIOS/__tests__/SegmentedContolIOS-test.js
alleniver/react-native
e22b760e594db97c22b34084a1770ac3a40c0ccf
[ "CC-BY-4.0", "MIT" ]
227
2019-05-07T23:55:52.000Z
2020-05-05T05:04:42.000Z
Libraries/Components/SegmentedControlIOS/__tests__/SegmentedContolIOS-test.js
alleniver/react-native
e22b760e594db97c22b34084a1770ac3a40c0ccf
[ "CC-BY-4.0", "MIT" ]
32
2019-05-13T20:03:01.000Z
2020-04-28T02:31:25.000Z
/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @format * @emails oncall+react_native */ 'use strict'; const React = require('react'); const ReactTestRenderer = require('react-test-renderer'); const SegmentedControlIOS = require('../SegmentedControlIOS.ios'); describe('SegmentedControlIOS', () => { it('renders the segmented control', () => { const component = ReactTestRenderer.create(<SegmentedControlIOS />); expect(component).not.toBeNull(); }); it('renders the segmented control with enabled default value', () => { const component = ReactTestRenderer.create(<SegmentedControlIOS />); expect(component.toTree().rendered.props.enabled).toBe(true); expect(component).toMatchSnapshot(); }); it('renders the segmented control with enabled', () => { const component = ReactTestRenderer.create( <SegmentedControlIOS enabled={true} />, ); expect(component.toTree().rendered.props.enabled).toBe(true); expect(component).toMatchSnapshot(); }); it('renders the segmented control with enabled set to false', () => { const component = ReactTestRenderer.create( <SegmentedControlIOS enabled={false} />, ); expect(component.toTree().rendered.props.enabled).toBe(false); expect(component).toMatchSnapshot(); }); it('renders the segmented control with values default value', () => { const component = ReactTestRenderer.create(<SegmentedControlIOS />); expect(component.toTree().rendered.props.values).toEqual([]); expect(component).toMatchSnapshot(); }); it('renders the segmented control with values', () => { const values = ['One', 'Two']; const component = ReactTestRenderer.create( <SegmentedControlIOS values={values} />, ); expect(component.toTree().rendered.props.values).toBe(values); expect(component).toMatchSnapshot(); }); });
35.803571
72
0.691771
01132c2e338f89324a3bebfe2572a439732d768e
691
js
JavaScript
lib/intents/intent.movie.js
manmorjim/core
2a41f2c254f5e13c1a37bdcc6eaaa7f75004e7ca
[ "Unlicense" ]
245
2016-05-30T14:13:49.000Z
2021-09-05T16:59:24.000Z
lib/intents/intent.movie.js
manmorjim/core
2a41f2c254f5e13c1a37bdcc6eaaa7f75004e7ca
[ "Unlicense" ]
6
2016-06-29T08:27:35.000Z
2017-11-10T19:41:17.000Z
lib/intents/intent.movie.js
manmorjim/core
2a41f2c254f5e13c1a37bdcc6eaaa7f75004e7ca
[ "Unlicense" ]
31
2016-06-28T18:48:00.000Z
2022-02-01T01:57:47.000Z
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _helpers = require('../helpers'); // -- Internal var TERMS = ['film', 'movie', 'show', 'actor', 'director', 'camera', 'editor', 'cinema', 'tv', 'producer']; exports.default = function (state, actions) { var tokens = (0, _helpers.intersect)(TERMS, state.tokens); var classifiers = (0, _helpers.intersect)(TERMS, state.classifier); if (state.debug) { console.log('IntentMovie'.bold.green, 'tokens: ' + tokens.toString().green + ', classifiers: ' + classifiers.toString().green); } return tokens || classifiers ? (0, _helpers.factoryActions)(state, actions) : (0, _helpers.resolve)(state); };
34.55
131
0.665702
bbf20ddbdca154a42ed3e657f2cd4d9a9a788e34
980
js
JavaScript
src/types/TxStatus.js
Manta-Network/manta-front-end
fa1e8a5789c753f04e3cdc2bed553c21edc96746
[ "Unlicense" ]
10
2021-02-09T16:11:50.000Z
2022-03-21T12:43:31.000Z
src/types/TxStatus.js
Manta-Network/manta-front-end
fa1e8a5789c753f04e3cdc2bed553c21edc96746
[ "Unlicense" ]
46
2021-03-08T21:52:15.000Z
2022-03-01T06:27:42.000Z
src/types/TxStatus.js
Manta-Network/manta-front-end
fa1e8a5789c753f04e3cdc2bed553c21edc96746
[ "Unlicense" ]
5
2021-05-14T20:08:29.000Z
2022-03-14T01:56:29.000Z
const FINALIZED = 'finalized'; const FAILED = 'failed'; const PROCESSING = 'processing'; export default class TxStatus { constructor (status, block = null, message = null) { this.status = status; this.block = block; this.message = message; this.batchNum = null; this.totalBatches = null; } static processing (message) { return new TxStatus(PROCESSING, null, message); } static finalized (block) { return new TxStatus(FINALIZED, block, null); } static failed (block, message) { return new TxStatus(FAILED, block, message); } isProcessing () { return this.status === PROCESSING; } isFinalized () { return this.status === FINALIZED; } isFailed () { return this.status === FAILED; } toString () { let message = this.status; if (this.block) { message += `;\n block hash: ${this.block}`; } if (this.message) { message += `;\n ${this.message}`; } return message; } }
20
54
0.613265
bbfb824152a429d356ae7fd00bf6c6bbfeb33801
7,681
js
JavaScript
tests/edgehostnname_manager_test.js
joshjohnson/cli-property-manager
bee248f36fb9093da514faccaf40b6a413e8c8f3
[ "Apache-2.0" ]
null
null
null
tests/edgehostnname_manager_test.js
joshjohnson/cli-property-manager
bee248f36fb9093da514faccaf40b6a413e8c8f3
[ "Apache-2.0" ]
null
null
null
tests/edgehostnname_manager_test.js
joshjohnson/cli-property-manager
bee248f36fb9093da514faccaf40b6a413e8c8f3
[ "Apache-2.0" ]
null
null
null
// Copyright 2018. Akamai Technologies, Inc // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. const td = require('testdouble'); const path = require('path'); const chai = require('chai'); const assert = chai.assert; const logger = require("../src/logging") .createLogger("devops-prov.environment_tests"); const {throwsAsync, equalIgnoreWhiteSpaces} = require("./testutils"); const VerifyUtils = require('./verify-utils'); const RoUtils = require('./ro-utils'); const createOverlayUtils = require('./overlay-utils'); const Project = require('../src/project'); const Environment = require('../src/environment'); const EdgeHostnameManager = require('../src/edgehostname_manager').EdgeHostnameManager; const Template = require('../src/template'); const EL = require('../src/el'); const errors = require('../src/errors'); const helpers = require('../src/helpers'); describe('Environment static function tests', function () { it('_extractPropertyId should be able to extract the propertyId ', function () { let pcData = { "propertyLink": "/papi/v0/properties/prp_410651?groupId=grp_61726&contractId=ctr_1-1TJZH5" }; assert.equal(Environment._extractPropertyId(pcData), 410651); pcData.propertyLink = "/papi/v0/properties/410651?groupId=grp_61726&contractId=ctr_1-1TJZH5"; assert.equal(Environment._extractPropertyId(pcData), 410651); }); it('_extractEdgeHostnameId should be able to extract the edgehostnameId ', function () { let pcData = { edgeHostnameLink: '/papi/v0/edgehostnames/2683119?contractId=1-1TJZH5&groupId=61726' }; assert.equal(EdgeHostnameManager._extractEdgeHostnameId(pcData), 2683119); pcData.edgeHostnameLink = '/papi/v0/edgehostnames/ehn_2683119?contractId=1-1TJZH5&groupId=61726'; assert.equal(EdgeHostnameManager._extractEdgeHostnameId(pcData), 2683119); }); it('_extractActivationId testing extraction of activation ID', function () { let activationData = { "activationLink" : "/papi/v0/properties/414298/activations/4998030" }; assert.equal(Environment._extractActivationId(activationData), 4998030); activationData.edgeHostnameLink = "/papi/v0/properties/prp_414298/activations/atv_4998030"; assert.equal(Environment._extractActivationId(activationData), 4998030); }); it('_extractVersionId testing extraction of version id', function () { let versionData = { "versionLink": "/papi/v0/properties/429569/versions/2" }; assert.equal(Environment._extractVersionId(versionData), 2); versionData.versionLink = "/papi/v0/properties/prp_429569/versions/2"; assert.equal(Environment._extractVersionId(versionData), 2); }); }); describe('Edgehostname Manager Unit Tests', function () { let papi; let project; let env; let ehm; before(function () { let getProjectInfo = td.function(); project = td.object(['storeEnvironmentInfo', 'loadEnvironmentInfo', 'loadEnvironmentHostnames', 'getProjectInfo', 'getName']); td.when(getProjectInfo()).thenReturn({}); // This is spoofed because getProjectInfo is used in the constructor of the environment project.getProjectInfo = getProjectInfo; papi = td.object(['createProperty', 'latestPropertyVersion']); env = new Environment('qa', { project: project, getPAPI: function() { return papi; }, getTemplate: function(pmData, rules) { return new Template(pmData, rules) } }); ehm = new EdgeHostnameManager(env); }); it('check clean hostname', function () { let hostnames =[ { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : "ehn_3248236", "cnameFrom" : "testing-snippets-pull.com", "cnameTo" : "testing-snippets-pull.com.edgesuite.net" }, { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : "ehn_3216762", "cnameFrom" : "testing-snippets.com", "cnameTo" : "testing-snippets.edgesuite.net" } ]; let hostnamesClean = [ { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : 3248236, "cnameFrom" : "testing-snippets-pull.com", "cnameTo" : "testing-snippets-pull.com.edgesuite.net" }, { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : 3216762, "cnameFrom" : "testing-snippets.com", "cnameTo" : "testing-snippets.edgesuite.net" } ]; ehm.cleanHostnameIds(hostnames); assert.deepEqual(hostnames,hostnamesClean); }); it('check clean hostname no id', function () { let hostnames =[ { "cnameType" : "EDGE_HOSTNAME", "cnameFrom" : "testing-snippets-pull.com", "cnameTo" : "testing-snippets-pull.com.edgesuite.net" }, { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : "ehn_3216762", "cnameFrom" : "testing-snippets.com", "cnameTo" : "testing-snippets.edgesuite.net" } ]; let hostnamesClean = [ { "cnameType" : "EDGE_HOSTNAME", "cnameFrom" : "testing-snippets-pull.com", "cnameTo" : "testing-snippets-pull.com.edgesuite.net" }, { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : 3216762, "cnameFrom" : "testing-snippets.com", "cnameTo" : "testing-snippets.edgesuite.net" } ]; ehm.cleanHostnameIds(hostnames); assert.deepEqual(hostnames,hostnamesClean); }); it('check clean hostname NOT an array', function () { let hostnames = undefined; assert.throws(() => { ehm.cleanHostnameIds(hostnames); }, "Hostnames is not an array"); hostnames = {}; assert.throws(() => { ehm.cleanHostnameIds(hostnames); }, "Hostnames is not an array"); }); it('check clean hostname no prefix', function () { let hostnames =[ { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : 3248236, "cnameFrom" : "testing-snippets-pull.com", "cnameTo" : "testing-snippets-pull.com.edgesuite.net" }, { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : "3216762", "cnameFrom" : "testing-snippets.com", "cnameTo" : "testing-snippets.edgesuite.net" } ]; let hostnamesClean = [ { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : 3248236, "cnameFrom" : "testing-snippets-pull.com", "cnameTo" : "testing-snippets-pull.com.edgesuite.net" }, { "cnameType" : "EDGE_HOSTNAME", "edgeHostnameId" : 3216762, "cnameFrom" : "testing-snippets.com", "cnameTo" : "testing-snippets.edgesuite.net" } ]; ehm.cleanHostnameIds(hostnames); assert.deepEqual(hostnames,hostnamesClean); }); });
37.10628
137
0.616977
bbfcb2ddee51ecf5606c9a8284b4486fd87e752f
7,276
js
JavaScript
tests/functional/aws-node-sdk/test/legacy/authV4QueryTests.js
3846masa-tmp/S3
3f9c2a5d2dfee2f88273d11648adfde01bff8af4
[ "Apache-2.0" ]
null
null
null
tests/functional/aws-node-sdk/test/legacy/authV4QueryTests.js
3846masa-tmp/S3
3f9c2a5d2dfee2f88273d11648adfde01bff8af4
[ "Apache-2.0" ]
null
null
null
tests/functional/aws-node-sdk/test/legacy/authV4QueryTests.js
3846masa-tmp/S3
3f9c2a5d2dfee2f88273d11648adfde01bff8af4
[ "Apache-2.0" ]
null
null
null
import assert from 'assert'; import process from 'process'; import cp from 'child_process'; import { parseString } from 'xml2js'; import { S3 } from 'aws-sdk'; import getConfig from '../support/config'; import provideRawOutput from '../../lib/utility/provideRawOutput'; const random = Math.round(Math.random() * 100).toString(); const bucket = `mybucket-${random}`; function diff(putFile, receivedFile, done) { process.stdout.write(`diff ${putFile} ${receivedFile}\n`); cp.spawn('diff', [putFile, receivedFile]).on('exit', code => { assert.strictEqual(code, 0); done(); }); } function deleteFile(file, callback) { process.stdout.write(`rm ${file}\n`); cp.spawn('rm', [file]).on('exit', () => { callback(); }); } describe('aws-node-sdk v4auth query tests', function testSuite() { this.timeout(60000); let s3; // setup test before(() => { const config = getConfig('default', { signatureVersion: 'v4' }); s3 = new S3(config); }); // emptyListing test it('should do an empty bucket listing', done => { const url = s3.getSignedUrl('listBuckets'); provideRawOutput(['-verbose', url], httpCode => { assert.strictEqual(httpCode, '200 OK'); done(); }); }); // createBucket test it('should create a bucket', done => { const params = { Bucket: bucket }; const url = s3.getSignedUrl('createBucket', params); provideRawOutput(['-verbose', '-X', 'PUT', url], httpCode => { assert.strictEqual(httpCode, '200 OK'); done(); }); }); // fullListing test it('should do a bucket listing with result', done => { const url = s3.getSignedUrl('listBuckets'); provideRawOutput(['-verbose', url], (httpCode, rawOutput) => { assert.strictEqual(httpCode, '200 OK'); parseString(rawOutput.stdout, (err, xml) => { if (err) { assert.ifError(err); } const bucketNames = xml.ListAllMyBucketsResult .Buckets[0].Bucket.map(item => item.Name[0]); const whereIsMyBucket = bucketNames.indexOf(bucket); assert(whereIsMyBucket > -1); done(); }); }); }); // putObject test it('should put an object', done => { const params = { Bucket: bucket, Key: 'key' }; const url = s3.getSignedUrl('putObject', params); provideRawOutput(['-verbose', '-X', 'PUT', url, '--upload-file', 'uploadFile'], httpCode => { assert.strictEqual(httpCode, '200 OK'); done(); }); }); it('should put an object with an acl setting and a storage class setting', done => { // This will test that upper case query parameters and lowercase // query parameters (i.e., 'x-amz-acl') are being sorted properly. // This will also test that query params that contain "x-amz-" // are being added to the canonical headers list in our string // to sign. const params = { Bucket: bucket, Key: 'key', ACL: 'public-read', StorageClass: 'STANDARD', ContentType: 'text/plain' }; const url = s3.getSignedUrl('putObject', params); provideRawOutput(['-verbose', '-X', 'PUT', url, '--upload-file', 'uploadFile'], httpCode => { assert.strictEqual(httpCode, '200 OK'); done(); }); }); it('should put an object with native characters', done => { const Key = 'key-pâtisserie-中文-español-English-हिन्दी-العربية-' + 'português-বাংলা-русский-日本語-ਪੰਜਾਬੀ-한국어-தமிழ்'; const params = { Bucket: bucket, Key }; const url = s3.getSignedUrl('putObject', params); provideRawOutput(['-verbose', '-X', 'PUT', url, '--upload-file', 'uploadFile'], httpCode => { assert.strictEqual(httpCode, '200 OK'); done(); }); }); // listObjects test it('should list objects in bucket', done => { const params = { Bucket: bucket }; const url = s3.getSignedUrl('listObjects', params); provideRawOutput(['-verbose', url], (httpCode, rawOutput) => { assert.strictEqual(httpCode, '200 OK'); parseString(rawOutput.stdout, (err, result) => { if (err) { assert.ifError(err); } assert.strictEqual(result.ListBucketResult .Contents[0].Key[0], 'key'); done(); }); }); }); // getObject test it('should get an object', done => { const params = { Bucket: bucket, Key: 'key' }; const url = s3.getSignedUrl('getObject', params); provideRawOutput(['-verbose', '-o', 'download', url], httpCode => { assert.strictEqual(httpCode, '200 OK'); done(); }); }); it('downloaded file should equal file that was put', done => { diff('uploadFile', 'download', () => { deleteFile('download', done); }); }); // deleteObject test it('should delete an object', done => { const params = { Bucket: bucket, Key: 'key' }; const url = s3.getSignedUrl('deleteObject', params); provideRawOutput(['-verbose', '-X', 'DELETE', url], httpCode => { assert.strictEqual(httpCode, '204 NO CONTENT'); done(); }); }); it('should return a 204 on delete of an already deleted object', done => { const params = { Bucket: bucket, Key: 'key' }; const url = s3.getSignedUrl('deleteObject', params); provideRawOutput(['-verbose', '-X', 'DELETE', url], httpCode => { assert.strictEqual(httpCode, '204 NO CONTENT'); done(); }); }); it('should return 204 on delete of non-existing object', done => { const params = { Bucket: bucket, Key: 'randomObject' }; const url = s3.getSignedUrl('deleteObject', params); provideRawOutput(['-verbose', '-X', 'DELETE', url], httpCode => { assert.strictEqual(httpCode, '204 NO CONTENT'); done(); }); }); it('should delete an object with native characters', done => { const Key = 'key-pâtisserie-中文-español-English-हिन्दी-العربية-' + 'português-বাংলা-русский-日本語-ਪੰਜਾਬੀ-한국어-தமிழ்'; const params = { Bucket: bucket, Key }; const url = s3.getSignedUrl('deleteObject', params); provideRawOutput(['-verbose', '-X', 'DELETE', url], httpCode => { assert.strictEqual(httpCode, '204 NO CONTENT'); done(); }); }); // deleteBucket test it('should delete a bucket', done => { const params = { Bucket: bucket }; const url = s3.getSignedUrl('deleteBucket', params); provideRawOutput(['-verbose', '-X', 'DELETE', url], httpCode => { assert.strictEqual(httpCode, '204 NO CONTENT'); done(); }); }); });
35.842365
78
0.53381
010c06471c6120204132fa2a1b586a87edb9c5de
1,089
js
JavaScript
JS/zx-course-web/src/api/MainService.js
sven820/WebTest
86f953a1efbe12272ef6c67f3cf97c2cbd7671c2
[ "Apache-2.0" ]
null
null
null
JS/zx-course-web/src/api/MainService.js
sven820/WebTest
86f953a1efbe12272ef6c67f3cf97c2cbd7671c2
[ "Apache-2.0" ]
22
2020-07-18T17:33:46.000Z
2022-02-26T19:48:17.000Z
JS/zx-course-web/src/api/MainService.js
sven820/WebTest
86f953a1efbe12272ef6c67f3cf97c2cbd7671c2
[ "Apache-2.0" ]
null
null
null
import axios from './http' // import store from '../vuex/store' export default { /** * 获取首页参数,banner等 */ getCourseHomeData () { return axios.get('/online/getCourseHomeData', { }).then((response) => { return response.data; }) }, /** * 根据年级获取首页分类 */ getCourseCategory (gradeCode) { return axios.get('/online/getCourseCategory', { params: { gradeCode: gradeCode } }).then((response) => { return response.data; }) }, /** * 获取推荐课程 * @param {String} gradeCode 年级 * @param {String} subjectCode 学科 * @param {Number} categoryId 课程分类ID * @param {Number} pageIndex 分页参数 * @param {Number} pageSize 分页参数 */ getCourseRecommentData (gradeCode, subjectCode, categoryId, pageIndex, pageSize) { return axios.get('/online/getCourseRecommentData', { params: { gradeCode: gradeCode, subjectCode: subjectCode, categoryId: categoryId, pageIndex: pageIndex, pageSize: pageSize } }).then((response) => { return response.data; }) } }
21.352941
84
0.594123
0100fefe52f3082566348e851e7cd9e5b0eb3002
54,568
js
JavaScript
Specs/Core/JulianDateSpec.js
GCRC/cesium
7612d4aae3e35acaae273db0069e8fb33dedf986
[ "Apache-2.0" ]
1
2015-04-09T09:55:17.000Z
2015-04-09T09:55:17.000Z
Specs/Core/JulianDateSpec.js
kod3r/cesium
d702d40a50d689f518fdd5f68788979473e4636a
[ "Apache-2.0" ]
null
null
null
Specs/Core/JulianDateSpec.js
kod3r/cesium
d702d40a50d689f518fdd5f68788979473e4636a
[ "Apache-2.0" ]
null
null
null
/*global defineSuite*/ defineSuite(['Core/JulianDate', 'Core/TimeStandard', 'Core/TimeConstants', 'Core/Math'], function(JulianDate, TimeStandard, TimeConstants, CesiumMath) { "use strict"; /*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/ // All exact Julian Dates found using NASA's Time Conversion Tool: http://ssd.jpl.nasa.gov/tc.cgi it('Construct a default date', function() { // Default constructing a date uses 'now'. Unfortunately, // there's no way to know exactly what that time will be, so we // give ourselves a 5 second epsilon as a hack to avoid possible // race conditions. In reality, it might be better to just omit // a check in this test, since if this breaks, tons of other stuff // will as well. var defaultDate = new JulianDate(); var dateNow = JulianDate.fromDate(new Date()); expect(defaultDate.equalsEpsilon(dateNow, 5)).toEqual(true); }); it('Construct a date from basic TAI components', function() { var dayNumber = 12; var seconds = 12.5; var timeStandard = TimeStandard.TAI; var julianDate = new JulianDate(dayNumber, seconds, timeStandard); expect(julianDate.getJulianDayNumber()).toEqual(dayNumber); expect(julianDate.getSecondsOfDay()).toEqual(seconds); }); it('clone works without result parameter', function() { var julianDate = new JulianDate(); var returnedResult = julianDate.clone(); expect(returnedResult).toEqual(julianDate); expect(returnedResult).toNotBe(julianDate); }); it('clone works with result parameter', function() { var julianDate = new JulianDate(1, 2); var result = new JulianDate(); var returnedResult = julianDate.clone(result); expect(returnedResult).toBe(result); expect(returnedResult).toNotBe(julianDate); expect(returnedResult).toEqual(julianDate); }); it('Construct a date from UTC components just before a leap second', function() { var expected = new JulianDate(2443874, 43216, TimeStandard.TAI); var julianDate = new JulianDate(2443874, 43199.0, TimeStandard.UTC); expect(julianDate.getJulianDayNumber()).toEqual(expected.getJulianDayNumber()); expect(julianDate.getSecondsOfDay()).toEqual(expected.getSecondsOfDay()); }); it('Construct a date from UTC components equivalent to a LeapSecond table entry', function() { var expected = new JulianDate(2443874, 43218, TimeStandard.TAI); var julianDate = new JulianDate(2443874, 43200.0, TimeStandard.UTC); expect(julianDate.getJulianDayNumber()).toEqual(expected.getJulianDayNumber()); expect(julianDate.getSecondsOfDay()).toEqual(expected.getSecondsOfDay()); }); it('Construct a date from UTC components just after a leap second', function() { var expected = new JulianDate(2443874, 43219, TimeStandard.TAI); var julianDate = new JulianDate(2443874, 43201.0, TimeStandard.UTC); expect(julianDate.getJulianDayNumber()).toEqual(expected.getJulianDayNumber()); expect(julianDate.getSecondsOfDay()).toEqual(expected.getSecondsOfDay()); }); it('Construct a date from basic components with more seconds than a day', function() { var dayNumber = 12; var seconds = 86401; var timeStandard = TimeStandard.TAI; var julianDate = new JulianDate(dayNumber, seconds, timeStandard); expect(julianDate.getJulianDayNumber()).toEqual(13); expect(julianDate.getSecondsOfDay()).toEqual(1); }); it('Construct a date from basic components with negative seconds in a day', function() { var dayNumber = 12; var seconds = -1; var timeStandard = TimeStandard.TAI; var julianDate = new JulianDate(dayNumber, seconds, timeStandard); expect(julianDate.getJulianDayNumber()).toEqual(11); expect(julianDate.getSecondsOfDay()).toEqual(86399); }); it('Construct a date from basic components with partial day and seconds in a day', function() { var dayNumber = 12.5; var seconds = -1; var timeStandard = TimeStandard.TAI; var julianDate = new JulianDate(dayNumber, seconds, timeStandard); expect(julianDate.getJulianDayNumber()).toEqual(12); expect(julianDate.getSecondsOfDay()).toEqual(43199); }); it('Construct a date with default time standard', function() { var dayNumber = 12; var seconds = 12.5; var julianDateDefault = new JulianDate(dayNumber, seconds); var julianDateUtc = new JulianDate(dayNumber, seconds, TimeStandard.UTC); expect(julianDateDefault).toEqual(julianDateUtc); }); it('Fail to construct a date with invalid time standard', function() { var dayNumber = 12; var seconds = 12.5; var timeStandard = 'invalid'; expect(function() { return new JulianDate(dayNumber, seconds, timeStandard); }).toThrow(); }); it('Fail to construct a date with a null time standard', function() { var dayNumber = 12; var seconds = 12.5; var timeStandard = null; expect(function() { return new JulianDate(dayNumber, seconds, timeStandard); }).toThrow(); }); it('Fail to construct a date with an undefined secondsOfDay', function() { var dayNumber = 12; var timeStandard = TimeStandard.UTC; expect(function() { return new JulianDate(dayNumber, undefined, timeStandard); }).toThrow(); }); it('Fail to construct a date with null secondsOfDay', function() { var dayNumber = 12; var seconds = null; var timeStandard = TimeStandard.UTC; expect(function() { return new JulianDate(dayNumber, seconds, timeStandard); }).toThrow(); }); it('Fail to construct a date with non-numerical secondsOfDay', function() { var dayNumber = 12; var seconds = 'not a number'; var timeStandard = TimeStandard.UTC; expect(function() { return new JulianDate(dayNumber, seconds, timeStandard); }).toThrow(); }); it('Fail to construct a date with undefined day number', function() { var seconds = 12.5; var timeStandard = TimeStandard.UTC; expect(function() { return new JulianDate(undefined, seconds, timeStandard); }).toThrow(); }); it('Fail to construct a date with null day number', function() { var dayNumber = null; var seconds = 12.5; var timeStandard = TimeStandard.UTC; expect(function() { return new JulianDate(dayNumber, seconds, timeStandard); }).toThrow(); }); it('Fail to construct a date with non-numerical day number', function() { var dayNumber = 'not a number'; var seconds = 12.5; var timeStandard = TimeStandard.UTC; expect(function() { return new JulianDate(dayNumber, seconds, timeStandard); }).toThrow(); }); it('Construct a date from a JavaScript Date (1)', function() { var date = new Date('January 1, 1991 06:00:00 UTC'); var julianDate = JulianDate.fromDate(date, TimeStandard.TAI); expect(julianDate.getTotalDays()).toEqualEpsilon(2448257.75, CesiumMath.EPSILON5); }); it('Construct a date from a JavaScript Date (2)', function() { var date = new Date('July 4, 2011 12:00:00 UTC'); var julianDate = JulianDate.fromDate(date, TimeStandard.TAI); expect(julianDate.getTotalDays()).toEqualEpsilon(2455747.0, CesiumMath.EPSILON5); }); it('Construct a date from a JavaScript Date (3)', function() { var date = new Date('December 31, 2021 18:00:00 UTC'); var julianDate = JulianDate.fromDate(date, TimeStandard.TAI); expect(julianDate.getTotalDays()).toEqualEpsilon(2459580.25, CesiumMath.EPSILON5); }); it('Construct a date from a JavaScript Date (4)', function() { var jsDate = new Date('September 1, 2011 12:00:00 UTC'); var julianDate = JulianDate.fromDate(jsDate, TimeStandard.TAI); expect(julianDate.getTotalDays()).toEqualEpsilon(2455806.0, CesiumMath.EPSILON5); }); it('Construct a date from a JavaScript Date in different TimeStandard', function() { var taiDate = new Date('September 1, 2012 12:00:35'); var taiJulianDate = JulianDate.fromDate(taiDate, TimeStandard.TAI); var utcDate = new Date('September 1, 2012 12:00:00'); var utcJulianDate = JulianDate.fromDate(utcDate, TimeStandard.UTC); expect(taiJulianDate.equalsEpsilon(utcJulianDate, CesiumMath.EPSILON20)).toEqual(true); }); it('Fail to construct from an undefined JavaScript Date', function() { expect(function() { return JulianDate.fromDate(undefined); }).toThrow(); }); it('Fail to construct from an invalid JavaScript Date', function() { expect(function() { return JulianDate.fromDate(new Date(Date.parse('garbage'))); }).toThrow(); }); it('Fail to construct from a JavaScript Date with invalid time standard', function() { expect(function() { return JulianDate.fromDate(new Date(), 'invalid'); }).toThrow(); }); it('Construct a date from total days (1)', function() { var julianDate = JulianDate.fromTotalDays(2448257.75, TimeStandard.UTC); var expected = JulianDate.fromDate(new Date('January 1, 1991 06:00:00 UTC')); expect(julianDate).toEqual(expected); }); it('Construct a date from total days (2)', function() { var julianDate = JulianDate.fromTotalDays(2455747.0, TimeStandard.UTC); var expected = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); expect(julianDate).toEqual(expected); }); it('Construct a date from total days (3)', function() { var julianDate = JulianDate.fromTotalDays(2459580.25, TimeStandard.UTC); var expected = JulianDate.fromDate(new Date('December 31, 2021 18:00:00 UTC')); expect(julianDate).toEqual(expected); }); it('Construct a date from total days with different time standards', function() { var julianDate = JulianDate.fromTotalDays(2455806, TimeStandard.TAI); var expected = JulianDate.fromDate(new Date('September 1, 2011 12:00:00 UTC'), TimeStandard.TAI); expect(julianDate).toEqual(expected); }); it('Fail to construct from non-numeric total days', function() { expect(function() { return JulianDate.fromTotalDays('not a number', TimeStandard.UTC); }).toThrow(); }); it('Fail to construct from null total days', function() { expect(function() { return JulianDate.fromTotalDays(null, TimeStandard.UTC); }).toThrow(); }); it('Fail to construct from undefined total days', function() { expect(function() { return JulianDate.fromTotalDays(undefined, TimeStandard.UTC); }).toThrow(); }); it('Fail to construct from total days with null time standard', function() { expect(function() { return JulianDate.fromTotalDays(1234, null); }).toThrow(); }); it('Fail to construct from total days with invalid time standard', function() { expect(function() { return JulianDate.fromTotalDays(1234, 'invalid'); }).toThrow(); }); it('Construct from ISO8601 local calendar date, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(2009, 7, 1)); var computedDate = JulianDate.fromIso8601('20090801'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 local calendar date, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(2009, 7, 1)); var computedDate = JulianDate.fromIso8601('2009-08-01'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 local calendar date on Feb 29th, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(2000, 1, 29)); var computedDate = JulianDate.fromIso8601('20000229'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 local calendar date on Feb 29th, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(2000, 1, 29)); var computedDate = JulianDate.fromIso8601('2000-02-29'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local ordinal date, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(1985, 3, 12)); var computedDate = JulianDate.fromIso8601('1985102'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local ordinal date, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(1985, 3, 12)); var computedDate = JulianDate.fromIso8601('1985-102'); expect(computedDate).toEqual(expectedDate); }); it('Construct an ISO8601 ordinal date on a leap year', function() { var expectedDate = JulianDate.fromDate(new Date(2000, 11, 31)); var computedDate = JulianDate.fromIso8601('2000-366'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local week date, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(1985, 3, 12)); var computedDate = JulianDate.fromIso8601('1985W155'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local week date, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(2008, 8, 27)); var computedDate = JulianDate.fromIso8601('2008-W39-6'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar week date, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(1985, 3, 7)); var computedDate = JulianDate.fromIso8601('1985W15'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar week date, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(2008, 8, 21)); var computedDate = JulianDate.fromIso8601('2008-W39'); expect(computedDate).toEqual(expectedDate); }); //Note, there is no 'extended format' for calendar month because eliminating the //would confuse is with old YYMMDD dates it('Construct from an ISO8601 local calendar month, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(1985, 3, 1)); var computedDate = JulianDate.fromIso8601('1985-04'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 25))); var computedDate = JulianDate.fromIso8601('20090801T123025Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 25))); var computedDate = JulianDate.fromIso8601('2009-08-01T12:30:25Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional seconds, basic format', function() { //Date is only accurate to milliseconds, while JulianDate, much more so. The below date gets //rounded to 513, so we need to construct a JulianDate directly. //var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 25, 5125423))); var expectedDate = new JulianDate(2455045, 1825.5125423, TimeStandard.UTC); var computedDate = JulianDate.fromIso8601('20090801T123025.5125423Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional seconds, extended format', function() { //Date is only accurate to milliseconds, while JulianDate, much more so. The below date gets //rounded to 513, so we need to construct a JulianDate directly. var expectedDate = new JulianDate(2455045, 1825.5125423, TimeStandard.UTC); var computedDate = JulianDate.fromIso8601('2009-08-01T12:30:25.5125423Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional seconds, basic format, "," instead of "."', function() { //Date is only accurate to milliseconds, while JulianDate, much more so. The below date gets //rounded to 513, so we need to construct a JulianDate directly. //var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 25, 5125423))); var expectedDate = new JulianDate(2455045, 1825.5125423, TimeStandard.UTC); var computedDate = JulianDate.fromIso8601('20090801T123025,5125423Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional seconds, extended format, "," instead of "."', function() { //Date is only accurate to milliseconds, while JulianDate, much more so. The below date gets //rounded to 513, so we need to construct a JulianDate directly. var expectedDate = new JulianDate(2455045, 1825.5125423, TimeStandard.UTC); var computedDate = JulianDate.fromIso8601('2009-08-01T12:30:25,5125423Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time no seconds, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); var computedDate = JulianDate.fromIso8601('20090801T1230Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time no seconds, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); var computedDate = JulianDate.fromIso8601('2009-08-01T12:30Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional minutes, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 30))); var computedDate = JulianDate.fromIso8601('20090801T1230.5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional minutes, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 30))); var computedDate = JulianDate.fromIso8601('2009-08-01T12:30.5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional minutes, basic format, "," instead of "."', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 30))); var computedDate = JulianDate.fromIso8601('20090801T1230,5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional minutes, extended format, "," instead of "."', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 30))); var computedDate = JulianDate.fromIso8601('2009-08-01T12:30,5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time no minutes/seconds, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 0, 0))); var computedDate = JulianDate.fromIso8601('20090801T12Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time no minutes/seconds, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 0, 0))); var computedDate = JulianDate.fromIso8601('2009-08-01T12Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional hours, basic format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); var computedDate = JulianDate.fromIso8601('20090801T12.5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional hours, extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); var computedDate = JulianDate.fromIso8601('2009-08-01T12.5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional hours, basic format, "," instead of "."', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); var computedDate = JulianDate.fromIso8601('20090801T12,5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from ISO8601 UTC calendar date and time fractional hours, extended format, "," instead of "."', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 1, 12, 30, 0))); var computedDate = JulianDate.fromIso8601('2009-08-01T12,5Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 UTC calendar date and time on a leap second', function() { var computedDate = JulianDate.fromIso8601('2008-12-31T23:59:60Z'); var expectedDate = new JulianDate(2454832, 43233, TimeStandard.TAI); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 UTC calendar date and time within a leap second', function() { var computedDate = JulianDate.fromIso8601('2008-12-31T23:59:60.123456789Z'); var expectedDate = new JulianDate(2454832, 43233.123456789, TimeStandard.TAI); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date and time on a leap second 1 hour behind UTC', function() { var computedDate = JulianDate.fromIso8601('2008-12-31T22:59:60-01'); var expectedDate = new JulianDate(2454832, 43233, TimeStandard.TAI); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date and time on a leap second 1 hour ahead of UTC', function() { var computedDate = JulianDate.fromIso8601('2009-01-01T00:59:60+01'); var expectedDate = new JulianDate(2454832, 43233, TimeStandard.TAI); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 calendar date and time using 24:00:00 midnight notation', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 7, 2, 0, 0, 0))); var computedDate = JulianDate.fromIso8601('2009-08-01T24:00:00Z'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with UTC offset that crosses into previous month', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(1985, 2, 31, 23, 59, 0))); var computedDate = JulianDate.fromIso8601('1985-04-01T00:59:00+01'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with UTC offset that crosses into next month', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(1985, 3, 1, 0, 59, 0))); var computedDate = JulianDate.fromIso8601('1985-03-31T23:59:00-01'); expect(computedDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with UTC offset that crosses into next year', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2008, 11, 31, 23, 0, 0))); var julianDate = JulianDate.fromIso8601('2009-01-01T01:00:00+02'); expect(julianDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with UTC offset that crosses into previous year', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2009, 0, 1, 1, 0, 0))); var julianDate = JulianDate.fromIso8601('2008-12-31T23:00:00-02'); expect(julianDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with UTC offset', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2008, 10, 10, 12, 0, 0))); var julianDate = JulianDate.fromIso8601('2008-11-10T14:00:00+02'); expect(julianDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with UTC offset in extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2008, 10, 10, 11, 30, 0))); var julianDate = JulianDate.fromIso8601('2008-11-10T14:00:00+02:30'); expect(julianDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with zero UTC offset in extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2008, 10, 10, 14, 0, 0))); var julianDate = JulianDate.fromIso8601('2008-11-10T14:00:00+00:00'); expect(julianDate).toEqual(expectedDate); }); it('Construct from an ISO8601 local calendar date with zero UTC offset in extended format', function() { var expectedDate = JulianDate.fromDate(new Date(Date.UTC(2008, 10, 10, 14, 0, 0))); var julianDate = JulianDate.fromIso8601('2008-11-10T14:00:00+00'); expect(julianDate).toEqual(expectedDate); }); it('Fails to construct an ISO8601 ordinal date with day less than 1', function() { expect(function() { return JulianDate.fromIso8601('2009-000'); }).toThrow(); }); it('Fails to construct an ISO8601 ordinal date with day more than 365 on non-leap year', function() { expect(function() { return JulianDate.fromIso8601('2001-366'); }).toThrow(); }); it('Fails to construct ISO8601 UTC calendar date of invalid YYMMDD format', function() { expect(function() { return JulianDate.fromIso8601('200905'); }).toThrow(); }); it('Fails to construct a complete ISO8601 date missing T delimeter', function() { expect(function() { return JulianDate.fromIso8601('2009-08-0112:30.5Z'); }).toThrow(); }); it('Fails to construct a complete ISO8601 date with delimeter other than T', function() { expect(function() { return JulianDate.fromIso8601('2009-08-01Q12:30.5Z'); }).toThrow(); }); it('Fails to construct an ISO8601 date from undefined', function() { expect(function() { return JulianDate.fromIso8601(undefined); }).toThrow(); }); it('Fails to construct an ISO8601 date from null', function() { expect(function() { return JulianDate.fromIso8601(null); }).toThrow(); }); it('Fails to construct an ISO8601 from complete garbage', function() { expect(function() { return JulianDate.fromIso8601('this is not a date'); }).toThrow(); }); it('Fails to construct an ISO8601 date from a valid ISO8601 interval', function() { expect(function() { return JulianDate.fromIso8601('2007-03-01T13:00:00Z/2008-05-11T15:30:00Z'); }).toThrow(); }); it('Fails to construct from an ISO8601 with too many year digits', function() { expect(function() { return JulianDate.fromIso8601('20091-05-19'); }).toThrow(); }); it('Fails to construct from an ISO8601 with too many month digits', function() { expect(function() { return JulianDate.fromIso8601('2009-100-19'); }).toThrow(); }); it('Fails to construct from an ISO8601 with more than 12 months', function() { expect(function() { return JulianDate.fromIso8601('2009-13-19'); }).toThrow(); }); it('Fails to construct from an ISO8601 with less than 1 months', function() { expect(function() { return JulianDate.fromIso8601('2009-00-19'); }).toThrow(); }); it('Fails to construct an ISO8601 January date with more than 31 days', function() { expect(function() { return JulianDate.fromIso8601('2009-01-32'); }).toThrow(); }); it('Fails to construct an ISO8601 Febuary date with more than 28 days', function() { expect(function() { return JulianDate.fromIso8601('2009-02-29'); }).toThrow(); }); it('Fails to construct an ISO8601 Febuary leap year date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-02-30'); }).toThrow(); }); it('Fails to construct an ISO8601 March date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-03-32'); }).toThrow(); }); it('Fails to construct an ISO8601 April date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-04-31'); }).toThrow(); }); it('Fails to construct an ISO8601 May date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-05-32'); }).toThrow(); }); it('Fails to construct an ISO8601 June date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-06-31'); }).toThrow(); }); it('Fails to construct an ISO8601 July date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-07-32'); }).toThrow(); }); it('Fails to construct an ISO8601 August date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-08-32'); }).toThrow(); }); it('Fails to construct an ISO8601 September date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-09-31'); }).toThrow(); }); it('Fails to construct an ISO8601 October date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-10-32'); }).toThrow(); }); it('Fails to construct an ISO8601 November date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-11-31'); }).toThrow(); }); it('Fails to construct an ISO8601 December date with more than 29 days', function() { expect(function() { return JulianDate.fromIso8601('2000-12-32'); }).toThrow(); }); it('Fails to construct an ISO8601 date with more than 24 hours (extra seconds)', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T24:00:01'); }).toThrow(); }); it('Fails to construct an ISO8601 date with more than 24 hours (extra minutes)', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T24:01:00'); }).toThrow(); }); it('Fails to construct an ISO8601 date with more than 59 minutes', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T12:60'); }).toThrow(); }); it('Fails to construct an ISO8601 date with more than 60 seconds', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T12:59:61'); }).toThrow(); }); it('Fails to construct from an ISO8601 with less than 1 day', function() { expect(function() { return JulianDate.fromIso8601('2009-01-00'); }).toThrow(); }); it('Fails to construct from an ISO8601 with too many dashes', function() { expect(function() { return JulianDate.fromIso8601('2009--01-01'); }).toThrow(); }); it('Fails to construct from an ISO8601 with garbage offset', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T12:59:23ZZ+-050708::1234'); }).toThrow(); }); it('Fails to construct an ISO8601 date with more than one decimal place', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T12:59:22..2'); }).toThrow(); }); it('Fails to construct an ISO8601 calendar date mixing basic and extended format', function() { expect(function() { return JulianDate.fromIso8601('200108-01'); }).toThrow(); }); it('Fails to construct an ISO8601 calendar date mixing basic and extended format', function() { expect(function() { return JulianDate.fromIso8601('2001-0801'); }).toThrow(); }); it('Fails to construct an ISO8601 calendar week mixing basic and extended format', function() { expect(function() { return JulianDate.fromIso8601('2008-W396'); }).toThrow(); }); it('Fails to construct an ISO8601 calendar week mixing basic and extended format', function() { expect(function() { return JulianDate.fromIso8601('2008W39-6'); }).toThrow(); }); it('Fails to construct an ISO8601 date with trailing -', function() { expect(function() { return JulianDate.fromIso8601('2001-'); }).toThrow(); }); it('Fails to construct an ISO8601 time mixing basic and extended format', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T22:0100'); }).toThrow(); }); it('Fails to construct an ISO8601 time mixing basic and extended format', function() { expect(function() { return JulianDate.fromIso8601('2000-12-15T2201:00'); }).toThrow(); }); it('getJulianTimeFraction works', function() { var seconds = 12345.678; var fraction = seconds / 86400.0; var julianDate = new JulianDate(0, seconds, TimeStandard.TAI); expect(julianDate.getJulianTimeFraction()).toEqualEpsilon(fraction, CesiumMath.EPSILON20); }); it('toDate works when constructed from total days', function() { var julianDate = JulianDate.fromTotalDays(2455770.9986087964, TimeStandard.UTC); var javascriptDate = julianDate.toDate(); expect(javascriptDate.getUTCFullYear()).toEqual(2011); expect(javascriptDate.getUTCMonth()).toEqual(6); expect(javascriptDate.getUTCDate()).toEqual(28); expect(javascriptDate.getUTCHours()).toEqual(11); expect(javascriptDate.getUTCMinutes()).toEqual(57); expect(javascriptDate.getUTCSeconds()).toEqual(59); expect(javascriptDate.getUTCMilliseconds()).toEqualEpsilon(800, 10); }); it('toDate works when using TAI', function() { var julianDateTai = JulianDate.fromTotalDays(2455927.157772, TimeStandard.UTC); var javascriptDate = julianDateTai.toDate(); expect(javascriptDate.getUTCFullYear()).toEqual(2011); expect(javascriptDate.getUTCMonth()).toEqual(11); expect(javascriptDate.getUTCDate()).toEqual(31); expect(javascriptDate.getUTCHours()).toEqual(15); expect(javascriptDate.getUTCMinutes()).toEqual(47); expect(javascriptDate.getUTCSeconds()).toEqual(11); expect(javascriptDate.getUTCMilliseconds()).toEqualEpsilon(500, 10); }); it('toDate works a second before a leap second', function() { var expectedDate = new Date('6/30/1997 11:59:59 PM UTC'); var date = new JulianDate(2450630, 43229.0, TimeStandard.TAI).toDate(); expect(date).toEqual(expectedDate); }); it('toDate works on a leap second', function() { var expectedDate = new Date('6/30/1997 11:59:59 PM UTC'); var date = new JulianDate(2450630, 43230.0, TimeStandard.TAI).toDate(); expect(date).toEqual(expectedDate); }); it('toDate works a second after a leap second', function() { var expectedDate = new Date('7/1/1997 12:00:00 AM UTC'); var date = new JulianDate(2450630, 43231.0, TimeStandard.TAI).toDate(); expect(date).toEqual(expectedDate); }); it('toDate works on date before any leap seconds', function() { var expectedDate = new Date('09/10/1968 12:00:00 AM UTC'); var date = new JulianDate(2440109, 43210.0, TimeStandard.TAI).toDate(); expect(date).toEqual(expectedDate); }); it('toDate works on date later than all leap seconds', function() { var expectedDate = new Date('11/17/2039 12:00:00 AM UTC'); var date = new JulianDate(2466109, 43235.0, TimeStandard.TAI).toDate(); expect(date).toEqual(expectedDate); }); it('toIso8601 works a second before a leap second', function() { var expectedDate = '1997-06-30T23:59:59Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 works on a leap second', function() { var expectedDate = '1997-06-30T23:59:60Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 works a second after a leap second', function() { var expectedDate = '1997-07-01T00:00:00Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 works on date before any leap seconds', function() { var expectedDate = '1968-09-10T00:00:00Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 works on date later than all leap seconds', function() { var expectedDate = '2031-11-17T00:00:00Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 works without precision', function() { var expectedDate = '0950-01-02T03:04:05.5Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 pads zeros for year less than four digits or time components less than two digits', function() { var expectedDate = '0950-01-02T03:04:05.005Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(3); expect(date).toEqual(expectedDate); }); it('toIso8601 does not show milliseconds if they are 0', function() { var expectedDate = '0950-01-02T03:04:05Z'; var date = JulianDate.fromIso8601(expectedDate).toIso8601(); expect(date).toEqual(expectedDate); }); it('toIso8601 works with specified precision', function() { var isoDate = '0950-01-02T03:04:05.012345Z'; var date; date = JulianDate.fromIso8601(isoDate).toIso8601(0); expect(date).toEqual('0950-01-02T03:04:05Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(1); expect(date).toEqual('0950-01-02T03:04:05.0Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(2); expect(date).toEqual('0950-01-02T03:04:05.01Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(3); expect(date).toEqual('0950-01-02T03:04:05.012Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(4); expect(date).toEqual('0950-01-02T03:04:05.0123Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(5); expect(date).toEqual('0950-01-02T03:04:05.01234Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(6); expect(date).toEqual('0950-01-02T03:04:05.012345Z'); date = JulianDate.fromIso8601(isoDate).toIso8601(7); expect(date).toEqual('0950-01-02T03:04:05.0123450Z'); }); it('getSecondsDifference works in UTC', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = JulianDate.fromDate(new Date('July 5, 2011 12:01:00 UTC')); expect(start.getSecondsDifference(end)).toEqualEpsilon(TimeConstants.SECONDS_PER_DAY + TimeConstants.SECONDS_PER_MINUTE, CesiumMath.EPSILON5); }); it('getSecondsDifference works in TAI', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = JulianDate.fromDate(new Date('July 5, 2011 12:01:00 UTC')); expect(start.getSecondsDifference(end)).toEqualEpsilon(TimeConstants.SECONDS_PER_DAY + TimeConstants.SECONDS_PER_MINUTE, CesiumMath.EPSILON5); }); it('getSecondsDifference works with mixed time standards', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = JulianDate.fromDate(new Date('July 5, 2011 12:01:00 UTC')); expect(start.getSecondsDifference(end)).toEqualEpsilon(TimeConstants.SECONDS_PER_DAY + TimeConstants.SECONDS_PER_MINUTE, CesiumMath.EPSILON5); }); it('getMinutesDifference works in UTC', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = JulianDate.fromDate(new Date('July 5, 2011 12:01:00 UTC')); expect(start.getMinutesDifference(end)).toEqualEpsilon(TimeConstants.MINUTES_PER_DAY + 1.0, CesiumMath.EPSILON5); }); it('getMinutesDifference works in TAI', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = JulianDate.fromDate(new Date('July 5, 2011 12:01:00 UTC')); expect(start.getMinutesDifference(end)).toEqualEpsilon(TimeConstants.MINUTES_PER_DAY + 1.0, CesiumMath.EPSILON5); }); it('getMinutesDifference works with mixed time standards', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = JulianDate.fromDate(new Date('July 5, 2011 12:01:00 UTC')); expect(start.getMinutesDifference(end)).toEqualEpsilon(TimeConstants.MINUTES_PER_DAY + 1.0, CesiumMath.EPSILON5); }); it('getDaysDifference works', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00')); var end = JulianDate.fromDate(new Date('July 5, 2011 14:24:00')); var difference = start.getDaysDifference(end); expect(difference).toEqual(1.1); }); it('getDaysDifference works with negative result', function() { var end = JulianDate.fromDate(new Date('July 4, 2011 12:00:00')); var start = JulianDate.fromDate(new Date('July 5, 2011 14:24:00')); var difference = start.getDaysDifference(end); expect(difference).toEqual(-1.1); }); it('addSeconds works with whole seconds', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:30 UTC')); var end = start.addSeconds(95); expect(end.toDate().getUTCSeconds()).toEqualEpsilon(5, CesiumMath.EPSILON5); expect(end.toDate().getUTCMinutes()).toEqualEpsilon(2, CesiumMath.EPSILON5); }); it('addSeconds works with fractions (1)', function() { var start = new JulianDate(2454832, 0, TimeStandard.TAI); var end = start.addSeconds(1.5); expect(start.getSecondsDifference(end)).toEqual(1.5); }); it('addSeconds works with fractions (2)', function() { var start = JulianDate.fromDate(new Date('August 11 2011 6:00:00 UTC')); var end = start.addSeconds(0.5); expect(start.getSecondsDifference(end)).toEqual(0.5); }); it('addSeconds works with fractions (3)', function() { var start = JulianDate.fromDate(new Date('August 11 2011 11:59:59 UTC')); var end = start.addSeconds(1.25); expect(start.getSecondsDifference(end)).toEqual(1.25); }); it('addSeconds works with negative numbers', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:01:30 UTC')); var end = start.addSeconds(-60.0); expect(start.getSecondsDifference(end)).toEqual(-60.0); }); it('addSeconds works with more seconds than in a day', function() { var seconds = TimeConstants.SECONDS_PER_DAY * 7 + 15; var start = new JulianDate(2448444, 0, TimeStandard.UTC); var end = start.addSeconds(seconds); expect(start.getSecondsDifference(end)).toEqual(seconds); }); it('addSeconds works with negative seconds more than in a day', function() { var seconds = -TimeConstants.SECONDS_PER_DAY * 7 - 15; var start = new JulianDate(2448444, 0, TimeStandard.UTC); var end = start.addSeconds(seconds); expect(start.getSecondsDifference(end)).toEqual(seconds); }); it('addSeconds fails with non-numeric input', function() { expect(function() { return new JulianDate().addSeconds('banana'); }).toThrow(); }); it('addSeconds fails with null input', function() { expect(function() { return new JulianDate().addSeconds(null); }).toThrow(); }); it('addSeconds fails with undefined input', function() { expect(function() { return new JulianDate().addSeconds(undefined); }).toThrow(); }); it('addMinutes works', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = start.addMinutes(65); expect(end.toDate().getUTCMinutes()).toEqualEpsilon(5, CesiumMath.EPSILON5); expect(end.toDate().getUTCHours()).toEqualEpsilon(13, CesiumMath.EPSILON5); }); it('addMinutes works with negative numbers', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = start.addMinutes(-35); expect(end.toDate().getUTCMinutes()).toEqualEpsilon(25, CesiumMath.EPSILON5); expect(end.toDate().getUTCHours()).toEqualEpsilon(11, CesiumMath.EPSILON5); }); it('addMinutes fails with non-numeric input', function() { expect(function() { return new JulianDate().addMinutes('banana'); }).toThrow(); }); it('addMinutes fails with null input', function() { expect(function() { return new JulianDate().addMinutes(null); }).toThrow(); }); it('addMinutes fails with undefined input', function() { expect(function() { return new JulianDate().addMinutes(undefined); }).toThrow(); }); it('addHours works', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = start.addHours(6); expect(end.toDate().getUTCHours()).toEqualEpsilon(18, CesiumMath.EPSILON5); }); it('addHours works with negative numbers', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = start.addHours(-6); expect(end.toDate().getUTCHours()).toEqualEpsilon(6, CesiumMath.EPSILON5); }); it('addHours fails with non-numeric input', function() { expect(function() { return new JulianDate().addHours('banana'); }).toThrow(); }); it('addHours fails with null input', function() { expect(function() { return new JulianDate().addHours(null); }).toThrow(); }); it('addHours fails with undefined input', function() { expect(function() { return new JulianDate().addHours(undefined); }).toThrow(); }); it('addDays works', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = start.addDays(32); expect(end.toDate().getUTCDate()).toEqualEpsilon(5, CesiumMath.EPSILON5); expect(end.toDate().getUTCMonth()).toEqualEpsilon(7, CesiumMath.EPSILON5); }); it('addDays works with negative numbers', function() { var start = JulianDate.fromDate(new Date('July 4, 2011 12:00:00 UTC')); var end = start.addDays(-4); expect(end.toDate().getUTCDate()).toEqualEpsilon(30, CesiumMath.EPSILON5); expect(end.toDate().getUTCMonth()).toEqualEpsilon(5, CesiumMath.EPSILON5); }); it('addDays fails with non-numeric input', function() { expect(function() { return new JulianDate().addDays('banana'); }).toThrow(); }); it('addDays fails with null input', function() { expect(function() { return new JulianDate().addDays(null); }).toThrow(); }); it('addDays fails with undefined input', function() { expect(function() { return new JulianDate().addDays(undefined); }).toThrow(); }); it('lessThan works', function() { var start = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); var end = JulianDate.fromDate(new Date('July 6, 2011 12:01:00')); expect(start.lessThan(end)).toEqual(true); }); it('lessThan works with equal values', function() { var start = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); var end = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); expect(start.lessThan(end)).toEqual(false); expect(start.lessThan(end.addSeconds(1))).toEqual(true); }); it('lessThan works with different time standards', function() { var start = JulianDate.fromDate(new Date('July 6, 1991 12:00:00'), TimeStandard.UTC); var end = JulianDate.fromDate(new Date('July 6, 2011 12:00:00'), TimeStandard.TAI); expect(start.lessThan(end)).toEqual(true); }); it('lessThanOrEquals works', function() { var start = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); var end = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); expect(start.lessThanOrEquals(end)).toEqual(true); expect(start.addSeconds(1).lessThanOrEquals(end)).toEqual(false); expect(start.addSeconds(-1).lessThanOrEquals(end)).toEqual(true); }); it('greaterThan works', function() { var start = JulianDate.fromDate(new Date('July 6, 2011 12:01:00')); var end = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); expect(start.greaterThan(end)).toEqual(true); }); it('greaterThan works with equal values', function() { var start = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); var end = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); expect(start.greaterThan(end)).toEqual(false); expect(start.greaterThan(end.addSeconds(-1))).toEqual(true); }); it('greaterThan works with different time standards', function() { var start = JulianDate.fromDate(new Date('July 6, 2011 12:01:00'), TimeStandard.TAI); var end = JulianDate.fromDate(new Date('July 6, 1991 12:00:00'), TimeStandard.UTC); expect(start.greaterThan(end)).toEqual(true); }); it('greaterThanOrEquals works', function() { var start = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); var end = JulianDate.fromDate(new Date('July 6, 1991 12:00:00')); expect(start.greaterThanOrEquals(end)).toEqual(true); expect(start.addSeconds(-1).greaterThanOrEquals(end)).toEqual(false); expect(start.addSeconds(1).greaterThanOrEquals(end)).toEqual(true); }); it('can be equal to within an epsilon of another JulianDate', function() { var original = JulianDate.fromDate(new Date('September 7, 2011 12:55:00 UTC')); var clone = JulianDate.fromDate(new Date('September 7, 2011 12:55:00 UTC')); clone = clone.addSeconds(1); expect(original.equalsEpsilon(clone, 2)).toEqual(true); }); it('getTotalDays works', function() { var totalDays = 2455784.7500058; var original = JulianDate.fromTotalDays(totalDays, TimeStandard.TAI); expect(totalDays).toEqual(original.getTotalDays()); }); it('equalsEpsilon works', function() { var date = new JulianDate(); var datePlusOne = date.addSeconds(0.01); expect(date.equalsEpsilon(datePlusOne, CesiumMath.EPSILON1)).toEqual(true); }); it('getTaiMinusUtc works before all leap seconds', function() { var date = new Date('July 11, 1970 12:00:00 UTC'); var jd = JulianDate.fromDate(date, TimeStandard.TAI); var difference = jd.getTaiMinusUtc(); expect(difference).toEqual(10); }); it('getTaiMinusUtc works a second before a leap second', function() { var date = new JulianDate(2456109, 43233.0, TimeStandard.TAI); expect(date.getTaiMinusUtc()).toEqual(34); }); it('getTaiMinusUtc works on a leap second', function() { var date = new JulianDate(2456109, 43234.0, TimeStandard.TAI); expect(date.getTaiMinusUtc()).toEqual(34); }); it('getTaiMinusUtc works a second after a leap second', function() { var date = new JulianDate(2456109, 43235.0, TimeStandard.TAI); expect(date.getTaiMinusUtc()).toEqual(35); }); it('getTaiMinusUtc works after all leap seconds', function() { var date = new JulianDate(2556109, 43235.0, TimeStandard.TAI); expect(date.getTaiMinusUtc()).toEqual(35); }); it('can compare instances with compareTo', function() { var date = new JulianDate(0, 0.0, TimeStandard.TAI); var date2 = new JulianDate(1, 0.0, TimeStandard.TAI); expect(date.compareTo(date2)).toBeLessThan(0); expect(date2.compareTo(date)).toBeGreaterThan(0); }); });
43.900241
150
0.645928
01044f3e792039a5c1d36811db6698d33bc5d0d9
354
js
JavaScript
js/test/queue/queue.test.js
ZhuoYaZhao/data-structure
41aa7c5ea4540d71ee82d9fcfeff2efd5e1a3914
[ "Apache-2.0" ]
2
2019-04-28T01:14:17.000Z
2019-05-28T00:51:11.000Z
js/test/queue/queue.test.js
ZhuoYaZhao/data-structure
41aa7c5ea4540d71ee82d9fcfeff2efd5e1a3914
[ "Apache-2.0" ]
null
null
null
js/test/queue/queue.test.js
ZhuoYaZhao/data-structure
41aa7c5ea4540d71ee82d9fcfeff2efd5e1a3914
[ "Apache-2.0" ]
2
2019-03-14T13:16:28.000Z
2019-03-14T14:14:15.000Z
import MyCircularQueue from '../../code/queue/queue' test('MyCircularQueue', () => { let queue = new MyCircularQueue(4) queue.enQueue(2) queue.enQueue(3) queue.enQueue(4) expect(queue.isFull()).toBe(false) expect(queue.deQueue()).toBe(2) expect(queue.isEmpty()).toBe(false) expect(queue.Rear()).toBe(4) expect(queue.Front()).toBe(3) })
27.230769
52
0.680791
011018f6231a16edb6aa4260d6ab6ef7b1585aec
1,947
js
JavaScript
src/components/search/src/components/SearchResults.js
openlattice/lattice-ui-kit
596be943ecf666666fe4affa543fa32091c0bbda
[ "Apache-2.0" ]
9
2018-12-26T10:42:45.000Z
2021-01-28T22:34:14.000Z
src/components/search/src/components/SearchResults.js
openlattice/lattice-ui-kit
596be943ecf666666fe4affa543fa32091c0bbda
[ "Apache-2.0" ]
1,594
2018-05-11T06:51:08.000Z
2022-03-25T23:34:10.000Z
src/components/search/src/components/SearchResults.js
openlattice/lattice-ui-kit
596be943ecf666666fe4affa543fa32091c0bbda
[ "Apache-2.0" ]
2
2018-09-12T18:02:12.000Z
2018-10-11T22:00:50.000Z
// @flow import { Component } from 'react'; import type { ComponentType, Node } from 'react'; import { faSearchMinus } from '@fortawesome/pro-regular-svg-icons'; import { List, Map } from 'immutable'; import IconSplash from './IconSplash'; import Result from './Result'; import type { ResultProps } from './Result'; import Spinner from '../../../../spinner'; import { CardStack } from '../../../../layout'; type Props = { className ? :string; hasSearched ? :boolean; isLoading ? :boolean; noResults ? :ComponentType<any>; onResultClick ? :(result :Map) => void; resultComponent ? :ComponentType<ResultProps>; resultLabels ? :Map; results :List<Map>; }; class SearchResults extends Component<Props> { static defaultProps = { className: undefined, hasSearched: false, isLoading: false, noResults: () => (<IconSplash icon={faSearchMinus} caption="No results" />), onResultClick: undefined, resultComponent: Result, resultLabels: undefined, } renderResults = () :Node => { const { hasSearched, isLoading, noResults: NoResults, onResultClick, resultComponent: ResultComponent, resultLabels, results, } = this.props; if (isLoading) return <Spinner size="2x" />; if (List.isList(results) && results.count() && ResultComponent) { return results.map((result :Map, index :number) => ( <ResultComponent key={index.toString()} onClick={onResultClick} result={result} index={index} resultLabels={resultLabels} /> )); } if (hasSearched && NoResults) { return <NoResults />; } return null; } render() { const { className } = this.props; return ( <CardStack className={className}> { this.renderResults() } </CardStack> ); } } export default SearchResults; export type { Props as SearchResultsProps };
23.743902
80
0.620442
01075a9692b0f18db531363e8a4cf95172d888a6
4,280
js
JavaScript
app/routes/admin/messages.js
ayushmansxn01/open-event-frontend
4b516f43b854e231b6be07b8edcb008641b24793
[ "Apache-2.0" ]
1
2021-08-18T05:43:28.000Z
2021-08-18T05:43:28.000Z
app/routes/admin/messages.js
ayushmansxn01/open-event-frontend
4b516f43b854e231b6be07b8edcb008641b24793
[ "Apache-2.0" ]
null
null
null
app/routes/admin/messages.js
ayushmansxn01/open-event-frontend
4b516f43b854e231b6be07b8edcb008641b24793
[ "Apache-2.0" ]
2
2021-06-16T04:01:38.000Z
2021-08-11T16:57:05.000Z
import Ember from 'ember'; const { Route } = Ember; export default Route.extend({ titleToken() { return this.l10n.t('Messages'); }, model() { return [{ recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title1', emailMessage : { subject : 'Email subject1', message : 'Hi, the schedule for session1 has been changed' }, notificationMessage: { subject : 'Notification subject1', message : 'Hi, the schedule for session1 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }, { recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title2', emailMessage : { subject : 'Email subject2', message : 'Hi, the schedule for session2 has been changed' }, notificationMessage: { subject : 'Notification subject2', message : 'Hi, the schedule for session2 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }, { recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title3', emailMessage : { subject : 'Email subject3', message : 'Hi, the schedule for session3 has been changed' }, notificationMessage: { subject : 'Notification subject3', message : 'Hi, the schedule for session3 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }, { recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title3', emailMessage : { subject : 'Email subject3', message : 'Hi, the schedule for session3 has been changed' }, notificationMessage: { subject : 'Notification subject3', message : 'Hi, the schedule for session3 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }, { recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title3', emailMessage : { subject : 'Email subject3', message : 'Hi, the schedule for session3 has been changed' }, notificationMessage: { subject : 'Notification subject3', message : 'Hi, the schedule for session3 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }, { recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title1', emailMessage : { subject : 'Email subject4', message : 'Hi, the schedule for session4 has been changed' }, notificationMessage: { subject : 'Notification subject4', message : 'Hi, the schedule for session4 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }, { recipient: [ { name: 'Organizer' }, { name: 'Speaker' } ], trigger : 'Title5', emailMessage : { subject : 'Email subject5', message : 'Hi, the schedule for session5 has been changed' }, notificationMessage: { subject : 'Notification subject5', message : 'Hi, the schedule for session5 has been changed' }, option: { mail : true, notification : false, userControl : true }, sentAt: new Date() }]; } });
22.887701
66
0.470561
01121052db1648419e0ce5d2cbdf5b3d616a5b80
4,041
js
JavaScript
src/indexer/index.js
bdcorps/airswap.js
1d8391d50c46d3d2e981c8da58315e72a7c8b2d3
[ "Apache-2.0" ]
24
2019-06-01T06:50:47.000Z
2021-11-08T23:49:55.000Z
src/indexer/index.js
panda6853/BSwap.js
e5fe4c5a01f743dd8a995812fd112625b668ae5f
[ "Apache-2.0" ]
42
2019-06-12T17:10:26.000Z
2020-10-07T16:20:57.000Z
src/indexer/index.js
panda6853/BSwap.js
e5fe4c5a01f743dd8a995812fd112625b668ae5f
[ "Apache-2.0" ]
20
2019-05-16T05:40:51.000Z
2021-12-06T22:36:40.000Z
const _ = require('lodash') const { trackIndexSetLocator, trackIndexUnsetLocator } = require('../index/eventListeners') const { trackIndexerCreateIndex } = require('./eventListeners') const { parseLocatorAndLocatorType, getUniqueLocatorsFromBlockEvents, mapOnChainIntentToOffChain } = require('./utils') const { INDEXER_CONTRACT_DEPLOY_BLOCK } = require('../constants') class Indexer { constructor({ onIndexAdded, onLocatorAdded, onLocatorUnset } = {}) { this.indexEvents = [] this.indexes = [] this.locatorEvents = [] this.locators = [] this.unsetLocatorEvents = [] this.unsetLocators = [] this.onIndexAdded = onIndexAdded || _.identity this.onLocatorAdded = onLocatorAdded || _.identity this.onLocatorUnset = onLocatorUnset || _.identity const initialIndexLoad = new Promise(resolve => trackIndexerCreateIndex({ callback: async events => { this.indexEvents = [...this.indexEvents, ...events] this.addIndexesFromEvents(events) }, onFetchedHistoricalEvents: events => resolve(events), fromBlock: INDEXER_CONTRACT_DEPLOY_BLOCK, }), ) const initialLocatorLoad = new Promise(resolve => trackIndexSetLocator({ callback: async events => { this.locatorEvents = [...this.locatorEvents, ...events] this.addLocatorFromEvents(events) }, fromBlock: INDEXER_CONTRACT_DEPLOY_BLOCK, onFetchedHistoricalEvents: events => resolve(events), }), ) const initialUnsetLocatorLoad = new Promise(resolve => trackIndexUnsetLocator({ callback: async events => { this.unsetLocatorEvents = [...this.unsetLocatorEvents, ...events] this.addUnsetLocatorFromEvents(events) }, fromBlock: INDEXER_CONTRACT_DEPLOY_BLOCK, onFetchedHistoricalEvents: events => resolve(events), }), ) this.ready = Promise.all([initialIndexLoad, initialLocatorLoad, initialUnsetLocatorLoad]) } async addIndexesFromEvents(events) { const indexes = events.map(({ values }) => values) indexes.forEach(index => { this.onIndexAdded(index) }) this.indexes = [...this.indexes, ...indexes] } async addLocatorFromEvents(events) { const locators = events.map(({ values, address, blockNumber, logIndex }) => { const indexAddress = address.toLowerCase() return { ...values, indexAddress, blockNumber, logIndex, } }) locators.forEach(locator => { this.onLocatorAdded(locator) }) this.locators = [...this.locators, ...locators] } async addUnsetLocatorFromEvents(events) { const unsetLocators = events.map(({ values, address, blockNumber, logIndex }) => { const indexAddress = address.toLowerCase() return { ...values, indexAddress, blockNumber, logIndex, } }) unsetLocators.forEach(locator => { this.onLocatorUnset(locator) }) this.unsetLocators = [...this.unsetLocators, ...unsetLocators] } getIntents() { const locators = getUniqueLocatorsFromBlockEvents(this.locatorEvents, this.unsetLocatorEvents) return locators .map(locator => { const { signerToken, senderToken, protocol } = this.indexes.find(({ indexAddress }) => indexAddress === locator.indexAddress) || {} parseLocatorAndLocatorType(locator.locator, locator.identifier) return { signerToken, senderToken, protocol, identifier: locator.identifier, ...parseLocatorAndLocatorType(locator.locator, locator.identifier, protocol), swapVersion: 2, } }) .filter( ({ identifier, locator, locatorType, senderToken, signerToken }) => identifier && locator && locatorType && senderToken && signerToken, ) } getLegacyFormattedIntents() { return this.getIntents().map(intent => mapOnChainIntentToOffChain(intent)) } } module.exports = Indexer
33.396694
119
0.649097
01135a3393414019045dcea4cfbb7ca0f2647141
627
js
JavaScript
src/includes/fontawesome-pro-5.0.4/advanced-options/use-with-node-js/fontawesome-pro-light/faCalendarPlus.js
iamacup/alumnibase-data
8603dedda5a91cc02d0c7a861c20fe6516385e47
[ "Apache-2.0" ]
25
2018-06-27T07:40:00.000Z
2021-12-27T13:37:02.000Z
src/includes/fontawesome-pro-5.0.4/advanced-options/use-with-node-js/fontawesome-pro-light/faCalendarPlus.js
iamacup/alumnibase-data
8603dedda5a91cc02d0c7a861c20fe6516385e47
[ "Apache-2.0" ]
36
2018-06-07T09:21:40.000Z
2021-05-08T19:13:21.000Z
webroot/fontawesome/advanced-options/use-with-node-js/fontawesome-pro-light/faCalendarPlus.js
sdevore/cakephp-scid-plugin
75b393903f49972455ee01adacedd32be62c9923
[ "MIT" ]
13
2018-06-18T10:13:39.000Z
2019-05-22T16:01:07.000Z
module.exports = { prefix: 'fal', iconName: 'calendar-plus', icon: [448, 512, [], "f271", "M320 332v8c0 6.6-5.4 12-12 12h-68v68c0 6.6-5.4 12-12 12h-8c-6.6 0-12-5.4-12-12v-68h-68c-6.6 0-12-5.4-12-12v-8c0-6.6 5.4-12 12-12h68v-68c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v68h68c6.6 0 12 5.4 12 12zm128-220v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h48V12c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v52h192V12c0-6.6 5.4-12 12-12h8c6.6 0 12 5.4 12 12v52h48c26.5 0 48 21.5 48 48zm-416 0v48h384v-48c0-8.8-7.2-16-16-16H48c-8.8 0-16 7.2-16 16zm384 352V192H32v272c0 8.8 7.2 16 16 16h352c8.8 0 16-7.2 16-16z"] };
627
627
0.6874
010c84cb64c15b6c46a326f7347326c4ba75bd89
4,712
js
JavaScript
src/components/Dialog/AddExistingForm.js
DalerAsrorov/componofy
4216a102ce84de9b4c137372f850056dde78d626
[ "Apache-2.0" ]
20
2018-01-01T19:38:41.000Z
2022-03-24T20:37:40.000Z
src/components/Dialog/AddExistingForm.js
DalerAsrorov/componofy
4216a102ce84de9b4c137372f850056dde78d626
[ "Apache-2.0" ]
22
2017-12-30T21:43:54.000Z
2022-03-08T22:43:16.000Z
src/components/Dialog/AddExistingForm.js
DalerAsrorov/componofy
4216a102ce84de9b4c137372f850056dde78d626
[ "Apache-2.0" ]
2
2018-08-08T14:17:52.000Z
2018-08-30T03:50:31.000Z
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { Waypoint } from 'react-waypoint'; import { head } from 'ramda'; import { withStyles } from '@material-ui/core/styles'; import { Avatar, InputLabel, CircularProgress, FormControl, ListItemText, ListItemIcon, MenuItem, Select, Typography, } from '@material-ui/core'; import { LIGHT_CYAN_COLOR, PLAYLIST_OFFSET_LIMIT } from '../../utils/constants'; const styles = (theme) => ({ formControl: { width: '100%', }, loaderWrapper: { textAlign: 'center', width: '100%', }, playlistName: { width: '100%', paddingLeft: `${theme.spacing(1)}px`, }, progress: { margin: `0 ${theme.spacing(2)}px`, color: LIGHT_CYAN_COLOR, }, select: { display: 'flex', alignItems: 'center', padding: `${theme.spacing(1.5)}px`, }, wrapper: { width: '100%', }, }); class AddExistingForm extends PureComponent { static propTypes = { onSetAddExistingOpenStatus: PropTypes.func.isRequired, onFetchPlaylistSelection: PropTypes.func.isRequired, totalNumberOfPlaylists: PropTypes.number.isRequired, selectedPlaylist: PropTypes.string.isRequired, wasAddExistingOpen: PropTypes.bool.isRequired, wasDialogOpen: PropTypes.bool, onSetCurrentOffset: PropTypes.func.isRequired, isFetchingOptions: PropTypes.bool.isRequired, onSelectPlaylist: PropTypes.func.isRequired, playlistOptions: PropTypes.array.isRequired, currentOffset: PropTypes.number.isRequired, error: PropTypes.bool.isRequired, classes: PropTypes.object.isRequired, }; _handleSelectionFetch = () => { const { onSetCurrentOffset, onFetchPlaylistSelection, totalNumberOfPlaylists, currentOffset, } = this.props; if (currentOffset < totalNumberOfPlaylists) { onFetchPlaylistSelection(currentOffset, PLAYLIST_OFFSET_LIMIT); onSetCurrentOffset(currentOffset + PLAYLIST_OFFSET_LIMIT); } }; componentDidMount() { const { onFetchPlaylistSelection, onSetAddExistingOpenStatus, onSetCurrentOffset, wasAddExistingOpen, currentOffset, } = this.props; if (!wasAddExistingOpen) { onSetAddExistingOpenStatus(true); onFetchPlaylistSelection(currentOffset, PLAYLIST_OFFSET_LIMIT); onSetCurrentOffset(PLAYLIST_OFFSET_LIMIT); } } _handlePlaylistSelect = (event) => { const { onSelectPlaylist } = this.props; onSelectPlaylist(event.target.value); }; render() { const { selectedPlaylist: selectedPlaylistId, playlistOptions, isFetchingOptions, currentOffset, classes, error, } = this.props; let contentComponent = ( <div className={classes.loaderWrapper}> <CircularProgress className={classes.progress} thickness={7} /> <Typography variant="caption" color="textSecondary"> Loading your playlists... </Typography> </div> ); if (!isFetchingOptions || currentOffset >= PLAYLIST_OFFSET_LIMIT) { contentComponent = ( <FormControl className={classes.formControl} error={error}> <InputLabel htmlFor="playlist-choice">Choose Playlist</InputLabel> <Select value={selectedPlaylistId} onChange={this._handlePlaylistSelect} name="playlist" classes={{ select: classes.select, }} MenuProps={{ PaperProps: { style: { maxHeight: 420, }, }, }} > {playlistOptions.map(({ id, name, images = [] }) => ( <MenuItem key={id} value={id}> <ListItemIcon className={classes.icon}> <Avatar src={head(images).url} alt={`${name} cover image`} /> </ListItemIcon> <ListItemText primary={ <Typography variant="h5" color="textSecondary" component="p" className={classes.playlistName} > {name} </Typography> } /> </MenuItem> ))} <Waypoint onEnter={() => { this._handleSelectionFetch(); }} /> </Select> </FormControl> ); } return ( <main id="addExistingForm" className={classes.wrapper}> {contentComponent} </main> ); } } export default withStyles(styles)(AddExistingForm);
26.324022
80
0.587436
bbed93f427d99ee706e4ac5ac782d176fabab58c
506
js
JavaScript
src/common/langConfig.js
louie28lee/pd-openweb
b9e7692058305620750bde7f187e5d29efc992d5
[ "Apache-2.0" ]
1
2022-03-25T13:56:53.000Z
2022-03-25T13:56:53.000Z
src/common/langConfig.js
louie28lee/pd-openweb
b9e7692058305620750bde7f187e5d29efc992d5
[ "Apache-2.0" ]
null
null
null
src/common/langConfig.js
louie28lee/pd-openweb
b9e7692058305620750bde7f187e5d29efc992d5
[ "Apache-2.0" ]
null
null
null
const config = [ { key: 'zh-Hant', value: '繁體中文', languageTeam: 'Chinese Traditional', language: 'zh_TW', path: '/staticfiles/lang/zh-Hant/mdTranslation.js', }, { key: 'en', value: 'English', languageTeam: 'English', language: 'en_US', path: '/staticfiles/lang/en/mdTranslation.js', }, { key: 'ja', value: '日本語', languageTeam: 'Japanese', language: 'ja', path: '/staticfiles/lang/ja/mdTranslation.js', }, ]; module.exports = config;
19.461538
55
0.583004
01074c54f51f6d36023fc63ae87fc483ae7d9158
3,836
js
JavaScript
managed/ui/src/components/config/Security/ListKeyManagementConfigurations.js
skahler-yuga/yugabyte-db
3a69097e0230bc064c260dfddb0f8fddca2c60f1
[ "Apache-2.0", "CC0-1.0" ]
null
null
null
managed/ui/src/components/config/Security/ListKeyManagementConfigurations.js
skahler-yuga/yugabyte-db
3a69097e0230bc064c260dfddb0f8fddca2c60f1
[ "Apache-2.0", "CC0-1.0" ]
189
2021-02-19T01:23:31.000Z
2021-04-02T01:03:14.000Z
managed/ui/src/components/config/Security/ListKeyManagementConfigurations.js
skahler-yuga/yugabyte-db
3a69097e0230bc064c260dfddb0f8fddca2c60f1
[ "Apache-2.0", "CC0-1.0" ]
null
null
null
// Copyright (c) YugaByte, Inc. import React, { Component, Fragment } from 'react'; import { Button } from 'react-bootstrap'; import { FlexContainer, FlexShrink } from '../../common/flexbox/YBFlexBox'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; import { YBPanelItem } from '../../panels'; export class ListKeyManagementConfigurations extends Component { render() { const { configs, onCreate, onDelete } = this.props; const actionList = (item, row) => { const { configUUID, in_use } = row.metadata; return ( <Button title={'Delete provider'} bsClass="btn btn-default btn-config pull-right" disabled={in_use} onClick={() => onDelete(configUUID)} > Delete Configuration </Button> ); }; const showConfigProperties = (item, row) => { const displayed = []; const credentials = row.credentials; Object.keys(credentials).forEach((key) => { if (key !== 'provider') { displayed.push(`${key}: ${credentials[key]}`); } }); return ( <div> <a onClick={(e) => { e.target.classList.add('yb-hidden'); e.target.parentNode.lastChild.classList.remove('yb-hidden'); e.preventDefault(); }} href="/" > Show details </a> <span title={displayed.join(', ')} className="yb-hidden"> {displayed.join(', ')} </span> </div> ); }; return ( <div> <YBPanelItem header={ <Fragment> <h2 className="table-container-title pull-left">List Configurations</h2> <FlexContainer className="pull-right"> <FlexShrink> <Button bsClass="btn btn-orange btn-config" onClick={onCreate}> Create New Config </Button> </FlexShrink> </FlexContainer> </Fragment> } body={ <Fragment> <BootstrapTable data={configs.data} className="backup-list-table middle-aligned-table" > <TableHeaderColumn dataField="metadata" dataFormat={cell => cell.configUUID} isKey={true} hidden={true} /> <TableHeaderColumn dataField="metadata" dataFormat={(cell) => cell.name} dataSort columnClassName="no-border name-column" className="no-border" > Name </TableHeaderColumn> <TableHeaderColumn dataField="metadata" dataFormat={(cell) => cell.provider} dataSort columnClassName="no-border name-column" className="no-border" > Provider </TableHeaderColumn> <TableHeaderColumn dataField="base_url" dataFormat={showConfigProperties} columnClassName="no-border name-column" className="no-border" > Properties </TableHeaderColumn> <TableHeaderColumn dataField="configActions" dataFormat={actionList} columnClassName="no-border name-column no-side-padding" className="no-border" /> </BootstrapTable> </Fragment> } noBackground /> </div> ); } }
31.442623
86
0.476538
bbeb3dfb5765e84b9b14a5ce063ae03feea0ecc9
241
js
JavaScript
routes/account/code_after_fb_connent.js
saarsta/IDEMOS-SECUNDI
b84d4fa5fbcd749d07b6414e5295eaa4b2a83f9f
[ "BSD-3-Clause" ]
null
null
null
routes/account/code_after_fb_connent.js
saarsta/IDEMOS-SECUNDI
b84d4fa5fbcd749d07b6414e5295eaa4b2a83f9f
[ "BSD-3-Clause" ]
16
2015-07-04T13:39:03.000Z
2015-07-20T08:46:45.000Z
routes/account/code_after_fb_connent.js
saarsta/IDEMOS-SECUNDI
b84d4fa5fbcd749d07b6414e5295eaa4b2a83f9f
[ "BSD-3-Clause" ]
null
null
null
var common = require('./common'); module.exports = { get: function (req, res) { res.redirect(common.DEFAULT_LOGIN_REDIRECT); }, post: function (req, res) { res.redirect(common.DEFAULT_LOGIN_REDIRECT); } };
18.538462
52
0.614108
0112fb7f25ba8d0d3913652b692361e157dcbae0
8,753
js
JavaScript
import/dariusk_corpora.js
fdg19anon/bracery
0e7b9cdd04ecf83fa46d17e01f9bc02b25c1f1e6
[ "BSD-3-Clause" ]
null
null
null
import/dariusk_corpora.js
fdg19anon/bracery
0e7b9cdd04ecf83fa46d17e01f9bc02b25c1f1e6
[ "BSD-3-Clause" ]
null
null
null
import/dariusk_corpora.js
fdg19anon/bracery
0e7b9cdd04ecf83fa46d17e01f9bc02b25c1f1e6
[ "BSD-3-Clause" ]
null
null
null
var fs = require('fs') var rp = require('request-promise') var bb = require('bluebird') var _ = require('lodash') var baseUrl = 'https://raw.githubusercontent.com/ihh/corpora/pulls/data/' var targets = [ { name: 'common_animal', path: 'animals/common.json', key: 'animals' }, { name: 'common_flower', path: 'plants/flowers.json', key: 'flowers' }, { name: 'common_fruit', path: 'foods/fruits.json', key: 'fruits' }, { name: 'common_condiment', path: 'foods/condiments.json', key: 'condiments' }, { name: 'common_bread', path: 'foods/breads_and_pastries.json', key: 'breads' }, { name: 'common_pastry', path: 'foods/breads_and_pastries.json', key: 'pastries' }, { name: 'menu_item', path: 'foods/menuItems.json', key: 'menuItems' }, { name: 'human_mood', path: 'humans/moods.json', key: 'moods' }, { name: 'rich_person', path: 'humans/richpeople.json', key: 'richPeople', rhs: function (entry) { return [entry.name] } }, { name: 'lovecraftian_god', path: 'mythology/lovecraft.json', key: 'deities' }, { name: 'lovecraftian_creature', path: 'mythology/lovecraft.json', key: 'supernatural_creatures' }, { name: 'famous_duo', path: 'humans/famousDuos.json', key: 'famousDuos' }, { name: 'english_town', path: 'geography/english_towns_cities.json', key: 'towns' }, { name: 'english_city', path: 'geography/english_towns_cities.json', key: 'cities' }, { name: 'american_city', path: 'geography/us_cities.json', key: 'cities', rhs: function (entry) { return [entry.city] } }, { name: 'london_underground_station', path: 'geography/london_underground_stations.json', key: 'stations', rhs: function (entry) { return [entry.name] } }, { name: 'major_sea', path: 'geography/oceans.json', key: 'seas', rhs: function (entry) { return [entry.name] } }, { name: 'major_river', path: 'geography/rivers.json', key: 'rivers', rhs: function (entry) { return [entry.name] } }, { name: 'crayola_color', path: 'colors/crayola.json', key: 'colors', rhs: function (entry) { return [entry.color.toLowerCase()] } }, { name: 'disease_diagnosis', path: 'medicine/diagnoses.json', key: 'codes', rhs: function (entry) { return [entry.desc] } }, { name: 'hebrew_god', path: 'mythology/hebrew_god.json', key: 'names', rhs: function (entry) { return [entry.name] } }, { name: 'harry_potter_spell', path: 'words/spells.json', key: 'spells', rhs: function (entry) { return [entry.incantation] } }, ] // 12/15/2017 IH added code to autodetect key, so we can represent targets as a hash var symbolPath = { tolkien_character: 'humans/tolkienCharacterNames.json', famous_author: 'humans/authors.json', body_part: 'humans/bodyParts.json', british_actor: 'humans/britishActors.json', famous_celebrity: 'humans/celebrities.json', person_adjective: 'humans/descriptions.json', english_honorific: 'humans/englishHonorifics.json', english_first_name: 'humans/firstNames.json', english_last_name: 'humans/lastNames.json', spanish_first_name: 'humans/spanishFirstNames.json', spanish_last_name: 'humans/spanishLastNames.json', human_occupation: 'humans/occupations.json', name_prefix: 'humans/prefixes.json', name_suffix: 'humans/suffixes.json', famous_scientist: 'humans/scientists.json', cat_breed: 'animals/cats.json', rabbit_breed: 'animals/rabbits.json', dinosaur_species: 'animals/dinosaurs.json', dog_name: 'animals/dog_names.json', dog_breed: 'animals/dogs.json', donkey_breed: 'animals/donkeys.json', horse_breed: 'animals/horses.json', pony_breed: 'animals/ponies.json', music_genre: 'music/genres.json', musical_instrument: 'music/instruments.json', random_room: 'architecture/rooms.json', art_genre: 'art/isms.json', movie_genre: 'film-tv/netflix-categories.json', popular_movie: 'film-tv/popular-movies.json', car_manufacturer: 'corporations/cars.json', fortune500_company: 'corporations/fortune500.json', american_industry: 'corporations/industries.json', american_newspaper: 'corporations/newspapers.json', tv_show: 'film-tv/tv_shows.json', pizza_topping: 'foods/pizzaToppings.json', cocktail_name: 'foods/iba_cocktails.json', common_vegetable: 'foods/vegetables.json', wrestling_move: 'games/wrestling_moves.json', major_country: 'geography/countries.json', federal_agency: 'governments/us_federal_agencies.json', military_operation: 'governments/us_mil_operations.json', nsa_project: 'governments/nsa_projects.json', bodily_fluid: 'materials/abridged-body-fluids.json', building_material: 'materials/building-materials.json', decorative_stone: 'materials/decorative-stones.json', common_fabric: 'materials/fabrics.json', common_fiber: 'materials/fibers.json', gemstone: 'materials/gemstones.json', common_metal: 'materials/layperson-metals.json', packaging_material: 'materials/packaging.json', sculpture_material: 'materials/sculpture-materials.json', pharma_drug: 'medicine/drugs.json', hospital_name: 'medicine/hospitals.json', roman_god: 'mythology/roman_deities.json', greek_god: 'mythology/greek_gods.json', greek_monster: 'mythology/greek_monsters.json', greek_titan: 'mythology/greek_titans.json', mythic_monster: 'mythology/monsters.json', common_clothing: 'objects/clothing.json', common_object: 'objects/objects.json', home_appliance: 'technology/appliances.json', software_technology: 'technology/computer_sciences.json', firework: 'technology/fireworks.json', brand_of_gun: 'technology/guns_n_rifles.json', common_knot: 'technology/knots.json', new_technology: 'technology/new_technologies.json', programming_language: 'technology/programming_languages.json', social_networking_website: 'technology/social_networking_websites.json', video_hosting_website: 'technology/video_hosting_websites.json', common_adjective: 'words/adjs.json', common_adverb: 'words/adverbs.json', encouraging_word: 'words/encouraging_words.json', // common_expletive: 'words/expletives.json', common_interjection: 'words/interjections.json', common_noun: 'words/nouns.json', oprah_quote: 'words/oprah_quotes.json', personal_noun: 'words/personal_nouns.json', common_preposition: 'words/prepositions.json', drunken_state: 'words/states_of_drunkenness.json', // Commented out the emoji; Unicode makes Sails barf, apparently // emoji: 'words/emoji/emoji.json', // cute_kaomoji: 'words/emoji/cute_kaomoji.json', } var symbolFile = { disease: 'obo/diseases.json', infectious_disease: 'obo/infectious_diseases.json', cancer: 'obo/cancer.json', symptom: 'obo/symptoms.json', environmental_hazard: 'obo/environmental_hazards.json', anthropogenic_feature: 'obo/anthropogenic_features.json', geographic_feature: 'obo/geographic_features.json', cephalopod_part: 'obo/cephalopod_anatomy.json', ant_part: 'obo/ant_anatomy.json' } Object.keys(symbolPath).forEach (function (symbol) { targets.push ({ name: symbol, path: symbolPath[symbol] }) }) bb.Promise.map (targets, function (target) { return rp (baseUrl + target.path) .then (function (htmlString) { return processFile (target, htmlString) }).catch (function (err) { console.warn ('Error fetching ' + target.path) throw err }) }).then (function (results) { results = results.concat (Object.keys(symbolFile).map (function (symbol) { var filename = symbolFile[symbol] return processFile ({ name: symbol, path: filename, rhs: function (entry) { return _.isArray(entry) ? entry.slice(entry.length-1) : [entry] } }, fs.readFileSync(filename).toString()) })) console.log (JSON.stringify (results)) }) function processFile (target, text) { var json try { json = JSON.parse (text) } catch (e) { console.warn(text) throw e } var array if (target.key) array = json[target.key] else if (_.isArray(json)) array = json else { var keys = Object.keys(json) .filter (function (key) { return _.isArray (json[key]) }) if (keys.length === 1) array = json[keys[0]] } if (!array) throw new Error ('Error autodetecting key for ' + target.path) console.warn ('~' + target.name + ' <-- ' + target.path) var result = { name: target.name, summary: target.summary, rules: array.map (function (text) { return target.rhs ? target.rhs(text) : [text] }) } return result }
32.660448
91
0.685137
0101f47ee4c989dcb28e77c7c57536fd3edf20d1
544
js
JavaScript
cae-app/test/examples/example1.js
erdzan12/CAE-Frontend
d475ebb6cf841b2106e6c5d4639fa645636adb1a
[ "BSD-3-Clause" ]
4
2016-07-11T12:54:10.000Z
2021-09-14T12:00:27.000Z
cae-app/test/examples/example1.js
erdzan12/CAE-Frontend
d475ebb6cf841b2106e6c5d4639fa645636adb1a
[ "BSD-3-Clause" ]
22
2020-10-07T09:41:03.000Z
2021-08-15T13:58:00.000Z
cae-app/test/examples/example1.js
erdzan12/CAE-Frontend
d475ebb6cf841b2106e6c5d4639fa645636adb1a
[ "BSD-3-Clause" ]
7
2016-09-15T08:09:38.000Z
2021-09-23T07:08:13.000Z
/** * This example model is an empty model, containing no nodes and * no edges. */ export default { "nodes": {}, "wireframe": null, "edges": {}, "attributes": { "top": "0", "left": "0", "width": "0", "attributes": {}, "label": { "name": "Label", "id": "modelAttributes[label]", "value": { "name": "Label", "id": "modelAttributes[label]", "value": "NAME DOES NOT EXIST ANYMORE" } }, "type": "ModelAttributesNode", "height": "0", "zIndex": "0" } }
18.758621
64
0.487132
bb93dccab7b558377c166cf0352d1cc5e3157e72
3,645
js
JavaScript
layouts/layout-simple/script.js
Avid-Gaming-Esports/lol-pick-ban-ui
433de0b39b4ac63063854ad6befc21bbe21f2685
[ "MIT" ]
150
2020-01-31T19:14:12.000Z
2022-03-17T10:48:52.000Z
layouts/layout-simple/script.js
Avid-Gaming-Esports/lol-pick-ban-ui
433de0b39b4ac63063854ad6befc21bbe21f2685
[ "MIT" ]
96
2019-12-12T21:28:27.000Z
2022-03-28T18:04:31.000Z
layouts/layout-simple/script.js
Avid-Gaming-Esports/lol-pick-ban-ui
433de0b39b4ac63063854ad6befc21bbe21f2685
[ "MIT" ]
60
2020-02-07T17:12:14.000Z
2022-03-23T20:58:23.000Z
function convertTimer(timer) { if (timer.toString().length === 1) { return '0' + timer; } return timer; } PB.on('statusChange', newStatus => { }); PB.on('newState', newState => { console.log(newState); const state = newState.state; const config = state.config.frontend; let activeTeam = 'blue'; if (state.redTeam.isActive) { activeTeam = 'red'; } // Update timers if (activeTeam === 'blue') { document.getElementById('red_timer').innerText = ''; document.getElementById('blue_timer').innerText = ':' + convertTimer(state.timer); } else { document.getElementById('blue_timer').innerText = ''; document.getElementById('red_timer').innerText = ':' + convertTimer(state.timer); } // Update team names document.getElementById('blue_name').innerText = config.blueTeam.name; document.getElementById('red_name').innerText = config.redTeam.name; // Update score document.getElementById('score').innerText = config.blueTeam.score + ' - ' + config.redTeam.score; // Update phase document.getElementById('phase').innerText = state.state; // Update picks const updatePicks = team => { const teamData = team === 'blue' ? state.blueTeam : state.redTeam; console.log(teamData); teamData.picks.forEach((pick, index) => { const splash = document.getElementById(`picks_${team}_splash_${index}`); const text = document.getElementById(`picks_${team}_text_${index}`); if (pick.champion.id === 0) { // Not picked yet, hide splash.classList.add('hidden'); } else { // We have a pick to show splash.src = PB.toAbsoluteUrl(pick.champion.splashCenteredImg); splash.classList.remove('hidden'); } text.innerText = pick.displayName; }); teamData.bans.forEach((ban, index) => { const splash = document.getElementById(`bans_${team}_splash_${index}`); if (ban.champion.id === 0) { // Not banned yet, hide splash.classList.add('hidden'); } else { // We have a ban to show splash.src = PB.toAbsoluteUrl(ban.champion.splashCenteredImg); splash.classList.remove('hidden'); } console.log(splash, ban); }); }; updatePicks('blue'); updatePicks('red'); }); PB.on('heartbeat', newHb => { Window.CONFIG = newHb.config; }); PB.on('champSelectStarted', () => { }); PB.on('champSelectEnded', () => { }); PB.start(); function parseHTML(html) { const t = document.createElement('template'); t.innerHTML = html; return t.content.cloneNode(true); } // dynamically inject picks function inject(team) { const pickTemplate = ` <div class="pick"> <div class="splash"> <img src="" id="picks_${team}_splash_%id%" class="hidden"> </div> <div class="text" id="picks_${team}_text_%id%"></div> </div>`; const banTemplate = ` <div class="ban"> <div class="splash"> <img src="" id="bans_${team}_splash_%id%" class="hidden"> </div> </div>`; for (let i = 0; i < 5; i++) { const adaptedPickTemplate = pickTemplate.replace(/%id%/g, i); document.getElementById('picks_' + team).appendChild(parseHTML(adaptedPickTemplate)); const adaptedBanTemplate = banTemplate.replace(/%id%/g, i); document.getElementById('bans_' + team).appendChild(parseHTML(adaptedBanTemplate)); } } inject('blue'); inject('red');
29.395161
102
0.588752
bb94475c61c3a6da5ada67f1d5ee9471231ccd57
4,194
js
JavaScript
src/Modules/Account/Components/Settings/ApiKeyCredentials.js
joanjane/application-insights-client
f58bcbbdfe1eec5af95e7e89580bb34a6110297f
[ "MIT" ]
3
2018-04-30T15:26:49.000Z
2020-03-20T00:17:26.000Z
src/Modules/Account/Components/Settings/ApiKeyCredentials.js
joanjane/application-insights-client
f58bcbbdfe1eec5af95e7e89580bb34a6110297f
[ "MIT" ]
null
null
null
src/Modules/Account/Components/Settings/ApiKeyCredentials.js
joanjane/application-insights-client
f58bcbbdfe1eec5af95e7e89580bb34a6110297f
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { setApiKeyCredentialsAction, tryFindApiCredentialsAction } from 'Modules/Account/Actions/ApiKey'; const mapStateToProps = state => { return { availableApps: [...state.account.appVaults.apiKey.availableApps], credentials: { ...state.account.apiKey } }; }; const mapDispatchToProps = dispatch => { return { setApiKeyCredentials: (appId, apiKey) => dispatch(setApiKeyCredentialsAction(appId, apiKey)), tryFindCredentials: appName => dispatch(tryFindApiCredentialsAction(appName)), }; }; class ApiKeyCredentials extends Component { constructor(props) { super(props); this.state = { credentials: { ...props.credentials }, availableApps: props.availableApps, selectedStoredCredential: props.credentials.appId, editing: !props.credentials.appId }; } componentWillReceiveProps(nextProps) { if (!this.state.editing && this.accountChanged(nextProps.credentials, this.state.credentials)) { this.setState({ credentials: nextProps.credentials, selectedStoredCredential: nextProps.credentials.appId, }); } } handleChange = (event) => { let { credentials } = this.state; credentials = { ...credentials, [event.target.id]: event.target.value }; this.setState({ credentials: { ...this.state.credentials, ...credentials } }); } handleSubmit = (event) => { event.preventDefault(); this.props.setApiKeyCredentials( this.state.credentials.appId, this.state.credentials.apiKey, ); this.setState({ selectedStoredCredential: this.state.credentials.appId }); this.toggleEdit(); } checkStoredAppCredentials(appId) { this.setState({ editing: false }); this.props.tryFindCredentials(appId); this.setState({ selectedStoredCredential: appId }) } accountChanged(credentials1, credentials2) { return credentials1.appId !== credentials2.appId || credentials1.apiKey !== credentials2.apiKey; } validCredentials = () => { return this.state.credentials.appId && this.state.credentials.apiKey; } toggleEdit = (event) => { event && event.preventDefault(); this.setState({ editing: !this.state.editing }); } renderCredentialsForm() { return ( <form onSubmit={this.handleSubmit}> <div className="ail-account-section ail-account"> <label>Credentials</label> <input className="ail-input" value={this.state.credentials.appId} placeholder='App id' id="appId" disabled={!this.state.editing} onChange={(e) => this.handleChange(e)} /> <input className="ail-input" value={this.state.credentials.apiKey} id="apiKey" placeholder='API key' disabled={!this.state.editing} onChange={(e) => this.handleChange(e)} /> { this.state.editing ? <button className={`ail-btn ail-btn--success u-w100 u-mt-2 ${(!this.validCredentials() ? 'disabled' : '')}`}> Apply </button> : <button type="button" className={`ail-btn ail-btn--default u-w100 u-mt-2`} onClick={(e) => this.toggleEdit(e)}>Edit</button> } </div> </form> ); } renderAppsDropDown() { if (this.props.availableApps.length === 0) { return ''; } return ( <div className="ail-account-section"> <label>Switch apps</label> <select value={this.state.selectedStoredCredential} className="ail-input" onChange={(e) => this.checkStoredAppCredentials(e.target.value)}> <option>Saved apps</option> {this.props.availableApps.sort().map((app, i) => <option key={`${i}${app.appId}`} value={app.appId}>{app.appName}</option> )} </select> </div> ); } render() { return ( <div> {this.renderCredentialsForm()} {this.renderAppsDropDown()} </div> ); } } ApiKeyCredentials = connect(mapStateToProps, mapDispatchToProps)(ApiKeyCredentials); export default ApiKeyCredentials;
30.391304
123
0.626609
bb9508ee540dee15ae24f8bd5068b80c1f91f636
2,252
js
JavaScript
api/models/Equipment.js
firebull/DCMon2
fb4ced7d265dd6189ce136e6e04e1881e41fbbc5
[ "MIT" ]
null
null
null
api/models/Equipment.js
firebull/DCMon2
fb4ced7d265dd6189ce136e6e04e1881e41fbbc5
[ "MIT" ]
null
null
null
api/models/Equipment.js
firebull/DCMon2
fb4ced7d265dd6189ce136e6e04e1881e41fbbc5
[ "MIT" ]
null
null
null
/** * Equipment.js * * @description :: Equipment model schema * @docs :: http://sailsjs.org/#!documentation/models */ module.exports = { connection: 'dcmonMysqlServer', attributes: { id: { type: 'integer', primaryKey: true, autoIncrement: true, unique: true }, name: { type: 'string', required: true }, description: 'text', pos_in_rack: 'integer', type: { type: 'string', required: true, enum: ['server', 'store', 'lan'] }, vendor: { type: 'string', required: true, enum: HelperService.vendorsList() }, address: { type: 'string' }, address_v6: { type: 'ipv6' }, snmp_trap: 'string', login: 'string', password: 'string', monitoring_enable: { type: 'boolean', defaultsTo: true }, power_state: { type: 'string', enum: ['off', 'on'], defaultsTo: 'on' }, sensor_status: { type: 'string', enum: ['ok', 'warn', 'error', 'alert', 'crit', 'emerg'], defaultsTo: 'ok' }, event_status: { type: 'string', enum: ['ok', 'warn', 'error', 'alert', 'crit', 'emerg'], defaultsTo: 'ok' }, query_configuration: { type: 'boolean', defaultsTo: true }, sensors: { model: 'sensors' }, sensors_state: 'json', sensors_proto: 'string', events_proto: 'string', configuration_proto: 'string', rackmount: { model: 'rackmount', required: true, }, info: { collection: 'eqinfo', via: 'equipment' }, alerts: { collection: 'alert', via: 'equipments', dominant: false}, // Override toJSON instance method to remove password value toJSON: function() { var obj = this.toObject(); delete obj.password; return obj; } }, };
25.303371
72
0.439609
bb953b817d76c281226393b108435810dff9bf14
2,117
js
JavaScript
src/components/description.js
BillNas/landing-page
d1155488cc603713112eda2947f2b5f452b5c5fa
[ "MIT" ]
null
null
null
src/components/description.js
BillNas/landing-page
d1155488cc603713112eda2947f2b5f452b5c5fa
[ "MIT" ]
null
null
null
src/components/description.js
BillNas/landing-page
d1155488cc603713112eda2947f2b5f452b5c5fa
[ "MIT" ]
null
null
null
import React from "react" import { graphql, useStaticQuery } from "gatsby" const query = graphql` query HomePage { strapiHomePage { description description_image { publicURL } origin origin_image { publicURL } } } ` const Description = () => { const { strapiHomePage: { description, description_image: { publicURL: description_image }, origin, origin_image: { publicURL: origin_image }, }, } = useStaticQuery(query) return ( <section className="bg-white py-8"> <div className="container max-w-5xl mx-auto m-8"> <h2 className="w-full my-2 text-5xl font-bold leading-tight text-center text-gray-800"> WaffleHacks </h2> <div className="w-full mb-4"> <div className="h-1 mx-auto gradient w-64 opacity-25 my-0 py-0 rounded-t" /> </div> <div className="flex flex-wrap"> <div className="w-5/6 sm:w-1/2 p-6"> <h3 className="text-3xl text-gray-800 font-bold leading-none mb-3"> Our Origin </h3> <p className="text-gray-600 mb-8">{origin}</p> </div> <div className="w-full sm:w-1/2 p-6"> <img className="w-auto sm:h-80 mx-auto" src={origin_image} alt="placeholder" /> </div> </div> <div className="flex flex-wrap flex-col-reverse sm:flex-row"> <div className="w-full sm:w-1/2 p-6 mt-6"> <img className="w-auto sm:h-80 mx-auto" src={description_image} alt="placeholder" /> </div> <div className="w-full sm:w-1/2 p-6 mt-6"> <div className="align-middle"> <h3 className="text-3xl text-gray-800 font-bold leading-none mb-3"> What is WaffleHacks </h3> <p className="text-gray-600 mb-8">{description}</p> </div> </div> </div> </div> </section> ) } export default Description
27.141026
95
0.521493
bb958bbfc2758bd8dff3aa0ce6c8075d185cd208
277
js
JavaScript
src/parallelCoordinates/api/api-render.js
VizArtJS/vizart-path
88169c3a1fbf1475654b9724769be881b002e24b
[ "MIT" ]
4
2018-01-27T04:11:32.000Z
2019-11-03T01:29:02.000Z
src/parallelCoordinates/api/api-render.js
VizArtJS/vizart-path
88169c3a1fbf1475654b9724769be881b002e24b
[ "MIT" ]
2
2018-01-19T12:15:16.000Z
2018-12-09T16:06:04.000Z
src/parallelCoordinates/api/api-render.js
VizArtJS/vizart-path
88169c3a1fbf1475654b9724769be881b002e24b
[ "MIT" ]
2
2018-03-05T09:41:19.000Z
2018-03-07T09:20:22.000Z
import { apiRenderSVG } from 'vizart-core'; import { select } from 'd3-selection'; import draw from './draw'; const apiRender = state => ({ render(data) { apiRenderSVG(state).render(data); select('svg').remove(); draw(state); }, }); export default apiRender;
19.785714
43
0.646209
bb9620a980bcef2db4acd5519293a032f772981b
4,600
js
JavaScript
components/town-item/town-item.js
tgowon/green-up-app
4ee414ffac50f4e671fcf93ec015c5d6402eaf2b
[ "Apache-2.0" ]
18
2018-04-23T17:57:33.000Z
2022-03-11T22:57:39.000Z
components/town-item/town-item.js
tgowon/green-up-app
4ee414ffac50f4e671fcf93ec015c5d6402eaf2b
[ "Apache-2.0" ]
237
2018-04-17T12:44:37.000Z
2022-03-22T22:45:10.000Z
components/town-item/town-item.js
tgowon/green-up-app
4ee414ffac50f4e671fcf93ec015c5d6402eaf2b
[ "Apache-2.0" ]
10
2018-12-21T23:02:59.000Z
2022-03-22T22:49:02.000Z
// @flow import React from "react"; import { StyleSheet, Text, View } from "react-native"; import { defaultStyles } from "../../styles/default-styles"; const newLineRegex = /\r?\n|\r/g; const myStyles = { location: { padding: 5, width: "100%", borderStyle: "solid", borderColor: "#BBB", borderWidth: 1, marginLeft: 2, marginRight: 2 }, town: { marginBottom: 20, borderWidth: 1, borderColor: "#EEE", padding: 5 }, townName: { fontSize: 24, color: "#666", width: "100%", marginBottom: 10 } }; const combinedStyles = Object.assign({}, defaultStyles, myStyles); const styles = StyleSheet.create(combinedStyles); type PropsType = { item: Object }; export const TownItem = ({ item }: PropsType): React$Element<any> => ( <View key={ item.key } style={ styles.infoBlock }> <Text style={ styles.townName }>{ item.name }</Text> <Text style={ [styles.textDark, { fontSize: 16, marginBottom: 5 }] }> { `Road-side trash drops ${ item.roadsideDropOffAllowed ? "ARE" : "ARE NOT" } allowed` } </Text> { item.description ? ( <Text style={ [styles.textDark, { fontSize: 14, marginBottom: 5, marginTop: 5 }] }> { item.description } </Text> ) : null } <Text style={ [styles.textDark, { fontSize: 18, marginTop: 5 }] }> { "Supply Pickup Locations" } </Text> { ((item.pickupLocations || []).length === 0) ? ( <View style={ styles.location }> <Text style={ [styles.textDark, { marginBottom: 5, fontSize: 14 }] }> { "No trash bag pickup locations in this town" } </Text> </View> ) : item.pickupLocations.map((loc, i): React$Element<any> => ( <View key={ i } style={ styles.location }> { Boolean(loc.name) ? ( <Text style={ [styles.textDark, { marginBottom: 5, fontSize: 14 }] }> { loc.name.replace(newLineRegex, " ").replace(/\s\s/g, " ") } </Text>) : null } { Boolean(loc.address) ? ( <Text style={ [styles.textDark, { marginBottom: 5, fontSize: 14 }] }> { loc.address.replace(newLineRegex, " ").replace(/\s\s/g, " ") } </Text>) : null } { Boolean(loc.notes) ? ( <Text style={ [styles.textDark, { marginBottom: 0, fontSize: 14 }] }> { loc.notes.replace(newLineRegex, " ").replace(/\s\s/g, " ") } </Text>) : null } </View> )) } <Text style={ [styles.textDark, { fontSize: 18, marginTop: 10 }] }> { "Trash Drop-off Locations" } </Text> { ((item.dropOffLocations || []).length === 0) ? ( <View style={ styles.location }> <Text style={ [styles.textDark, { marginBottom: 5, fontSize: 14 }] }> { "No trash drop-off locations in this town" } </Text> </View> ) : item.dropOffLocations.map((loc, i): React$Element<any> => ( <View key={ i } style={ [styles.location, { borderStyle: "solid" }] }> { Boolean(loc.name) ? ( <Text style={ [styles.textDark, { marginBottom: 5, fontSize: 14 }] }> { loc.name.replace(newLineRegex, " ").replace(/\s\s/g, " ") } </Text>) : null } { Boolean(loc.address) ? ( <Text style={ [styles.textDark, { marginBottom: 5, fontSize: 14 }] }> { loc.address.replace(newLineRegex, " ").replace(/\s\s/g, " ") } </Text>) : null } { Boolean(loc.notes) ? ( <Text style={ [styles.textDark, { marginBottom: 0, fontSize: 14 }] }> { loc.notes.replace(newLineRegex, " ").replace(/\s\s/g, " ") } </Text>) : null } </View> )) } </View> );
46
103
0.430652
bb963e3902e69efeacc058c60a5bb8909279a98f
500
js
JavaScript
commands/say.js
FrostedWeFall/FrostBotV2
f6ccd31612aa9fecc9cf23b11111e0a60251d6c9
[ "MIT" ]
null
null
null
commands/say.js
FrostedWeFall/FrostBotV2
f6ccd31612aa9fecc9cf23b11111e0a60251d6c9
[ "MIT" ]
null
null
null
commands/say.js
FrostedWeFall/FrostBotV2
f6ccd31612aa9fecc9cf23b11111e0a60251d6c9
[ "MIT" ]
null
null
null
const Discord = require("discord.js"); module.exports.run = async (bot, message, args) => { if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("❌ Sorry but due to the substantial amount of abuse with this command it has been limited to players with the following permission: 'MANAGE_MESSAGES'"); const sayMessage = args.join(" "); message.delete().catch(O_o=>{}); message.channel.send(sayMessage); } module.exports.help = { name: "say" }
35.714286
237
0.694
bb966fdae7d4911fa8675f3ab5b3f5c27631da70
10,253
js
JavaScript
tests/Pivot.js
luizfernandorg/angular-winjs
98e060e9618a562e5aca77e344fe5c7fdc5a4601
[ "MIT" ]
171
2015-01-30T10:01:22.000Z
2021-06-03T07:21:08.000Z
tests/Pivot.js
luizfernandorg/angular-winjs
98e060e9618a562e5aca77e344fe5c7fdc5a4601
[ "MIT" ]
108
2015-02-23T20:22:04.000Z
2021-11-10T06:30:21.000Z
tests/Pivot.js
luizfernandorg/angular-winjs
98e060e9618a562e5aca77e344fe5c7fdc5a4601
[ "MIT" ]
72
2015-02-25T08:00:52.000Z
2021-06-03T07:21:17.000Z
// Copyright (c) Microsoft Corp. All Rights Reserved. Licensed under the MIT License. See License.txt in the project root for license information. describe("Pivot control directive tests", function () { var testTimeout = 5000, testDatasourceLength = 5; var scope, compile; beforeEach(angular.mock.module("winjs")); beforeEach(angular.mock.inject(function ($rootScope, $compile) { scope = $rootScope.$new(); compile = $compile; })); beforeEach(function () { WinJS.Utilities._fastAnimations = true; }); function initControl(markup) { var element = angular.element(markup)[0]; document.body.appendChild(element); var compiledControl = compile(element)(scope)[0]; scope.$digest(); return compiledControl; } it("should initialize a simple Pivot", function () { var compiledControl = initControl("<win-pivot></win-pivot>"); expect(compiledControl.winControl).toBeDefined(); expect(compiledControl.winControl instanceof WinJS.UI.Pivot); expect(compiledControl.className).toContain("win-pivot"); }); it("should use the locked attribute", function () { var compiledControl = initControl("<win-pivot locked='true'></win-pivot>"); expect(compiledControl.winControl.locked).toBeTruthy(); }); it("should use the title attribute", function () { var compiledControl = initControl("<win-pivot title=\"'PivotTitle'\"></win-pivot>"); expect(compiledControl.winControl.title).toEqual("PivotTitle"); }); it("should use inline pivot items", function () { var compiledControl = initControl("<win-pivot>" + "<win-pivot-item header=\"'Header1'\">Item1</win-pivot-item>" + "<win-pivot-item header=\"'Header2'\">Item2</win-pivot-item>" + "</win-pivot>"); // The Pivot doesn't have a loadingStateChanged event (or any similar loading complete events). // We'll use itemanimationend as a signal for loading complete. var gotItemAnimationEndEvent = false; compiledControl.addEventListener("itemanimationend", function () { gotItemAnimationEndEvent = true; }, false); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to load", testTimeout); runs(function () { var pivotHeaders = compiledControl.querySelectorAll(".win-pivot-header"); var pivotItemContent = compiledControl.querySelectorAll(".win-pivot-item-content"); expect(pivotHeaders.length).toEqual(2); expect(pivotItemContent.length).toEqual(2); expect(pivotHeaders[0].innerHTML).toEqual("Header1"); expect(pivotHeaders[1].innerHTML).toEqual("Header2"); expect(pivotItemContent[0].firstElementChild.innerHTML).toEqual("Item1"); expect(pivotItemContent[1].firstElementChild.innerHTML).toEqual("Item2"); }); }); it("should use the selectedIndex attribute", function () { scope.selectedIndex = 0; var compiledControl = initControl("<win-pivot selected-index='selectedIndex'>" + "<win-pivot-item header=\"'Header1'\">Item1</win-pivot-item>" + "<win-pivot-item header=\"'Header2'\">Item2</win-pivot-item>" + "</win-pivot>"), pivot = compiledControl.winControl; var gotItemAnimationEndEvent = false; compiledControl.addEventListener("itemanimationend", function () { gotItemAnimationEndEvent = true; }, false); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to load", testTimeout); runs(function () { gotItemAnimationEndEvent = false; expect(pivot.selectedIndex).toEqual(0); scope.selectedIndex = 1; scope.$digest(); }); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to change pages", testTimeout); runs(function () { expect(pivot.selectedIndex).toEqual(1); }); }); it("should use the selectedItem attribute", function () { scope.selectedItem = null; var compiledControl = initControl("<win-pivot selected-item='selectedItem'>" + "<win-pivot-item header=\"'Header1'\">Item1</win-pivot-item>" + "<win-pivot-item header=\"'Header2'\">Item2</win-pivot-item>" + "</win-pivot>"), pivot = compiledControl.winControl; var gotItemAnimationEndEvent = false; compiledControl.addEventListener("itemanimationend", function () { gotItemAnimationEndEvent = true; }, false); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to load", testTimeout); runs(function () { gotItemAnimationEndEvent = false; expect(pivot.selectedIndex).toEqual(0); scope.selectedItem = compiledControl.querySelectorAll(".win-pivot-item")[1].winControl; scope.$digest(); }); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to change pages", testTimeout); runs(function () { expect(pivot.selectedIndex).toEqual(1); }); }); it("should use the on-item-animation-end event handler", function () { var gotItemAnimationEndEvent = false; scope.itemAnimationEndHandler = function (e) { gotItemAnimationEndEvent = true; }; var compiledControl = initControl("<win-pivot on-item-animation-end='itemAnimationEndHandler($event)'>" + "<win-pivot-item>Item1</win-pivot-item>" + "</win-pivot>"); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to fire animation events", testTimeout); }); it("should use the custom header attributes", function () { scope.customLeftHeader = document.createElement("div"); scope.customRightHeader = document.createElement("div"); var control = initControl("<win-pivot custom-left-header='customLeftHeader' custom-right-header='customRightHeader'>" + "<win-pivot-item>Item1</win-pivot-item>" + "</win-pivot>").winControl; expect(control.customLeftHeader).toEqual(scope.customLeftHeader); expect(control.customRightHeader).toEqual(scope.customRightHeader); }); it("should use the custom header directives", function () { var control = initControl("<win-pivot>" + "<win-pivot-left-header>LeftHeader</win-pivot-left-header>" + "<win-pivot-item>Item1</win-pivot-item>" + "<win-pivot-right-header>RightHeader</win-pivot-right-header>" + "</win-pivot>").winControl; expect(control.customLeftHeader.firstElementChild.innerHTML).toEqual("LeftHeader"); expect(control.customRightHeader.firstElementChild.innerHTML).toEqual("RightHeader"); }); it("should render child WinJS controls that need to measure", function () { var listViewLoaded; scope.onListViewStateChanged = function (e) { if (e.currentTarget.winControl && e.currentTarget.winControl.loadingState === "complete") { listViewLoaded = true; } }; scope.childData = [1, 2, 3]; var compiledControl = initControl("<win-pivot>" + "<win-pivot-item><win-list-view item-data-source='childData' on-loading-state-changed='onListViewStateChanged($event)'></win-list-view></win-pivot-item>" + "</win-pivot>"); waitsFor(function () { return listViewLoaded; }, "the child ListView to load", testTimeout); runs(function () { expect(compiledControl.querySelectorAll(".win-item").length > 0); }); }); it("should let ng-repeat add new pivot items", function () { scope.items = [ { title: "Item0" }, { title: "Item1" } ]; var compiledControl = initControl("<win-pivot>" + "<win-pivot-item ng-repeat='item in items' header='item.title'></win-pivot-item>" + "</win-pivot>"); var gotItemAnimationEndEvent = false; compiledControl.addEventListener("itemanimationend", function () { gotItemAnimationEndEvent = true; }, false); waitsFor(function () { return gotItemAnimationEndEvent; }, "the Pivot to load", testTimeout); runs(function () { var pivotHeaders = compiledControl.querySelectorAll(".win-pivot-header"); expect(pivotHeaders.length).toEqual(2); expect(pivotHeaders[0].innerHTML).toEqual("Item0"); expect(pivotHeaders[1].innerHTML).toEqual("Item1"); scope.items.push({ title: "NewItem" }); scope.$digest(); pivotHeaders = compiledControl.querySelectorAll(".win-pivot-header"); expect(pivotHeaders.length).toEqual(3); expect(pivotHeaders[0].innerHTML).toEqual("Item0"); expect(pivotHeaders[1].innerHTML).toEqual("Item1"); expect(pivotHeaders[2].innerHTML).toEqual("NewItem"); }); }); afterEach(function () { var controls = document.querySelectorAll(".win-pivot"); for (var i = 0; i < controls.length; i++) { controls[i].parentNode.removeChild(controls[i]); } WinJS.Utilities._fastAnimations = false; }); });
43.816239
201
0.574954
bb96a21e3b995ae339254c0f300fcda7ba2a78af
259
js
JavaScript
tests/bacon.test.js
ibnusyawall/encryptlab
a88a352206c24ce3d9062164eac81c31bd69fc38
[ "MIT" ]
76
2020-10-24T04:09:51.000Z
2021-06-26T20:39:44.000Z
tests/bacon.test.js
ibnusyawall/encryptlab
a88a352206c24ce3d9062164eac81c31bd69fc38
[ "MIT" ]
14
2021-07-21T11:45:29.000Z
2021-11-20T00:39:55.000Z
tests/bacon.test.js
ibnusyawall/encryptlab
a88a352206c24ce3d9062164eac81c31bd69fc38
[ "MIT" ]
25
2020-10-25T01:05:02.000Z
2021-06-14T14:41:57.000Z
const { bacon } = require("../src"); let encoded = bacon.encode("encode"); let decoded = bacon.decode(encoded); test('is encode work?', () => { expect(encoded).toBeTruthy(); }); test('is decode work?', () => { expect(decoded).toBeTruthy(); });
19.923077
37
0.590734
bb96ce9eb399ea17370f7469334b120291367733
4,022
js
JavaScript
asearch.min.js
RestfulDesign/aSearch
30161c2fc0d041b1070fc45c86db62fa1159e8d1
[ "Apache-2.0" ]
null
null
null
asearch.min.js
RestfulDesign/aSearch
30161c2fc0d041b1070fc45c86db62fa1159e8d1
[ "Apache-2.0" ]
4
2015-05-21T13:30:50.000Z
2015-07-08T14:34:42.000Z
asearch.min.js
RestfulDesign/aSearch
30161c2fc0d041b1070fc45c86db62fa1159e8d1
[ "Apache-2.0" ]
null
null
null
!function(t){"use strict";function e(e,r){var a=e.cache[e.source],n={};if(a){for(var l in a)if(l===r)return void i(e,a[l],r)}else a=e.cache[e.source]={};e.query&&(n[e.search]=r,r=t.extend({},e.query,n)),t.ajax({url:e.source,data:r,method:e.method||"get",dataType:e.type||"json"}).done(function(t){t=e.normalize(t),a[r]=t,i(e,t,r)}).fail(function(t){e.target.trigger("error",t)})}function r(r,a){var n=e;a&&(a=t.trim(a.toLowerCase())),Array.isArray(r.source)&&(n=function(){i(r,r.source,a)}),r.timer&&(clearTimeout(r.timer),r.timer=null),r.timer=setTimeout(function(){n(r,a)},r.delay)}function i(e,r,a){function n(t){var r="";return Object.keys(t).forEach(function(i,a){r+="<"+e.li+">\n",r+="<"+e.lt+' title="'+i+'" data-row="'+a+'">\n',r+=o(t[i]),r+="</"+e.lt+">\n",r+="</"+e.li+">\n"}),r}function l(t,r){var i="",a=t.title||"&nbsp;",n=t.price&&parseFloat(t.price)||0,l=t.compare_price&&parseFloat(t.compare_price)||0,o=l>n;return i+="<"+e.li+' title="'+a+'" data-row="'+r+'">',t.url?i+='<a href="'+t.url+'">':i+="<div>",t.thumbnail&&(i+='<img src="'+t.thumbnail+'">'),i+="<h4>"+a+"</h4>",t.description&&(i+="<p>"+t.description+"</p>"),o&&l&&(i+="<i>"+l+"</i>"),n&&(i+='<b class="'+(o?"discount":"")+'">'+n+"</b>"),t.url?i+="</a>":i+="</div>",i+="</"+e.li+">\n"}function o(t){var r="";return"object"==typeof t?Array.isArray(t)?t.forEach(function(t){"string"==typeof t?(r+="<"+e.li+">",r+=t,r+="</"+e.li+">\n"):r+=l(t)}):Object.keys(t).forEach(function(e){r+=n(t[e])}):(r+="<"+e.li+">",r+=t,r+="</"+e.li+">\n"),r}var s=t(e.lt,e.elem),c="";if(a&&"function"==typeof e.filter)return i(e,e.filter(r,a));e.elem.data("results",r);for(var u=0,p=r.length;u<p;u++)"object"==typeof r[u]?c+=l(r[u],u):(0===u&&(c+="<"+e.li+">\n",c+="<"+e.lt+">\n"),c+=o(r[u]),u===p-1&&(c+="</"+e.lt+">\n",c+="</"+e.li+">\n"));return c||(e.notFound?(c+="<"+e.li+' title="'+e.notFound+'">',c+=e.notFound,c+="</"+e.li+">\n"):e.toggle(!1)),s.html(c),this}function a(e){function i(e){var r=a.elem.data("results"),i=t(e).attr("data-row"),n=t(e).attr("href");n||(n=t(e).find("a").first().attr("href")),a.target.trigger("selected",n,r[i])}e=e||{},(Array.isArray(e)||"string"==typeof e)&&(e={source:e});var a=t.extend({},n,e),o=[a.lt,a.li].join(" ");if(a.target=t(this),a.wrapper.indexOf("id=")<0){var s=a.wrapper.indexOf(">");if(s<0)throw new TypeError("wrapper");a.className=a.asClass+"-wrapper",a.id=a.asClass+l++,a.wrapper=a.wrapper.substr(0,s-1)+' id="'+a.id+'" class="'+a.className+'"'+a.wrapper.substr(s,a.wrapper.length)}t(this).wrap(a.wrapper),a.elem=t("#"+a.id),t("<"+a.lt+' class="'+a.asClass+'"></'+a.lt+">\n").appendTo(a.elem),a.listElem=t(a.lt,a.elem),a.toggle=function(t){a.visible=void 0===t?!a.visible:t,a.visible?(a.listElem.show(a.animate),a.target.trigger("show")):(a.listElem.hide(a.animate),a.target.trigger("hide"))},a.toggle(a.visible),a.chars||r(a,null);var c="",u=!1;return a.elem.on("touchstart",o,function(t){u=t.timeStamp}).on("touchend",o,function(t){var e;return e=t.timeStamp-u,t.preventDefault(),t.stopPropagation(),e<a.threshold&&i(this),!1}).on("click",o,function(t){t.preventDefault(),i(this)}).on("keyup","input",function(t){this.value!==c&&((c=this.value).length>=a.chars?(r(a,c),a.toggle(!0)):a.toggle(!1))}).on("click","input",function(t){this.value.length>=a.chars&&a.toggle()}).on("blur","input",function(t){setTimeout(function(){a.toggle(!1)},a.delay)}),this}var n={source:"/search.json",notFound:void 0,asClass:"asearch",visible:!1,wrapper:"<div/>",animate:300,search:"q",delay:200,threshold:250,chars:3,cache:{},lt:"ul",li:"li"};n.query={type:"product",fields:["title","url","thumbnail","price","compare_at_price"],limit:0},n.normalize=function(t){return t.results?t.results.map(function(t){return{url:t.url,title:t.title,thumbnail:t.thumbnail,description:t.meta_description,price:t.price,compare_price:t.compare_at_price}}):[]};var l=0;t.fn.aSearch=function(){var e=Array.prototype.slice.call(arguments);return t.data(this,"aSearch")?this:t(this).each(function(){a.apply(this,e),t.data(this,"aSearch")})}}(jQuery);
2,011
4,021
0.619592
bb974100752f49589e7941d58e0e8b3c0a146e36
370
js
JavaScript
App.js
thiagosouzasi/MyClimate
3a3f4064fda25d3600863c5a01e844ceef319b22
[ "MIT" ]
null
null
null
App.js
thiagosouzasi/MyClimate
3a3f4064fda25d3600863c5a01e844ceef319b22
[ "MIT" ]
null
null
null
App.js
thiagosouzasi/MyClimate
3a3f4064fda25d3600863c5a01e844ceef319b22
[ "MIT" ]
null
null
null
/** * Sample React Native App * https://github.com/facebook/react-native * * @format * @flow strict-local */ import React from 'react'; import Routes from './src/Routes'; import {NavigationContainer} from '@react-navigation/native'; export default function App(){ return ( <NavigationContainer> <Routes/> </NavigationContainer> ); };
13.703704
62
0.656757
bb974a44ad80c68c191154ee72a0d309cd9d34ca
20,203
js
JavaScript
dist/js/app.fe8a1931.js
TomvonH/gif-picker
d048951b71fab1f6f5d44af206652ce6e6293858
[ "MIT" ]
null
null
null
dist/js/app.fe8a1931.js
TomvonH/gif-picker
d048951b71fab1f6f5d44af206652ce6e6293858
[ "MIT" ]
4
2021-05-11T18:33:21.000Z
2022-02-27T07:11:24.000Z
dist/js/app.fe8a1931.js
TomvonH/gif-picker
d048951b71fab1f6f5d44af206652ce6e6293858
[ "MIT" ]
null
null
null
(function(e){function t(t){for(var i,s,o=t[0],c=t[1],u=t[2],f=0,m=[];f<o.length;f++)s=o[f],Object.prototype.hasOwnProperty.call(a,s)&&a[s]&&m.push(a[s][0]),a[s]=0;for(i in c)Object.prototype.hasOwnProperty.call(c,i)&&(e[i]=c[i]);l&&l(t);while(m.length)m.shift()();return r.push.apply(r,u||[]),n()}function n(){for(var e,t=0;t<r.length;t++){for(var n=r[t],i=!0,o=1;o<n.length;o++){var c=n[o];0!==a[c]&&(i=!1)}i&&(r.splice(t--,1),e=s(s.s=n[0]))}return e}var i={},a={app:0},r=[];function s(t){if(i[t])return i[t].exports;var n=i[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,s),n.l=!0,n.exports}s.m=e,s.c=i,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="/";var o=window["webpackJsonp"]=window["webpackJsonp"]||[],c=o.push.bind(o);o.push=t,o=o.slice();for(var u=0;u<o.length;u++)t(o[u]);var l=c;r.push([0,"chunk-vendors"]),n()})({0:function(e,t,n){e.exports=n("56d7")},"129a":function(e,t,n){},1348:function(e,t,n){},1593:function(e,t,n){},"1f7c":function(e,t,n){},"40e1":function(e,t,n){},"4bd8":function(e,t,n){"use strict";var i=n("40e1"),a=n.n(i);a.a},"565d":function(e,t,n){},"56d7":function(e,t,n){"use strict";n.r(t);n("e260"),n("e6cf"),n("cca6"),n("a79d");var i=n("2b0e"),a=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{attrs:{id:"app"}},[n("div",{staticClass:"nav",attrs:{id:"nav"}},[n("router-link",{attrs:{to:"/"}},[e._v("Home")]),n("router-link",{attrs:{to:"/favorites"}},[e._v("Favorites")])],1),n("router-view")],1)},r=[],s=(n("5c0b"),n("2877")),o={},c=Object(s["a"])(o,a,r,!1,null,null,null),u=c.exports,l=n("8c4f"),f=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("SearchBox",{attrs:{message:"What are you looking for?"}})},m=[],d=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("transition",{attrs:{name:"sliding"}},[e.allGifs.length<=0?n("div",{staticClass:"hero"},[n("img",{attrs:{src:e.src}})]):e._e()]),n("MainSearch",{attrs:{title:e.searchTitle,placeholder:e.placeholder},on:{getGifs:function(t){return e.getGifs(t)}}}),n("transition",{attrs:{name:"fade",mode:"out-in"}},[e.allGifs.length>0?n("div",{key:e.allGifs[0].id,staticClass:"container"},[n("GiphsList",{attrs:{gifs:e.allGifs}}),n("Pagination",{attrs:{showNumbers:!1,"current-page":e.currentPage,"page-count":e.pageCount},on:{nextPage:function(t){return e.pageChangeHandle("next")},previousPage:function(t){return e.pageChangeHandle("previous")}}})],1):e._e()])],1)},v=[],h=(n("96cf"),n("1da1")),p=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"img-container"},e._l(e.chunkedGifs,(function(t){return n("div",{key:t.id,staticClass:"column"},e._l(t,(function(t){return n("GiphItem",{key:t.id,attrs:{gif:t,isFavorite:t.isFavorite},on:{addToFavorites:function(n){return e.addToFavorites(t)},removeFromFavorites:function(n){return e.removeFromFavorites(t,t.id)}}})})),1)})),0)},g=[],b=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"img-item"},[n("img",{attrs:{src:e.setSrc}}),e.isFavorite?e._e():n("button",{on:{click:function(t){return t.preventDefault(),e.addToFavorites(t)}}},[n("heart-outline-icon")],1),e.isFavorite?n("button",{staticClass:"is-active",on:{click:function(t){return t.preventDefault(),e.removeFromFavorites(t)}}},[n("heart-icon")],1):e._e(),n("transition",{attrs:{name:"slide"}},[e.isFavorite?n("span",{staticClass:"img-state"},[e._v(e._s(e.saved))]):e._e()])],1)},_=[],C=n("3a9d"),y=n("4f97"),F={components:{HeartIcon:C["a"],HeartOutlineIcon:y["a"]},data:function(){return{saved:"Saved"}},computed:{setSrc:function(){return"https://media.giphy.com/media/".concat(this.gif.id,"/200w.gif")}},props:{gif:Object,isFavorite:Boolean},methods:{addToFavorites:function(){this.$emit("addToFavorites")},removeFromFavorites:function(){this.$emit("removeFromFavorites")}}},k=F,P=(n("8a41"),Object(s["a"])(k,b,_,!1,null,"2e432ec6",null)),x=P.exports,O=n("6118"),w=n.n(O),G={components:{GiphItem:x},props:{gifs:Array},computed:{chunkedGifs:function(){return w()(this.gifs,5)}},methods:{addToFavorites:function(e){this.$store.commit("addFavorite",e)},removeFromFavorites:function(e,t){this.$store.commit("removeFavorite",{favorite:e,id:t})}}},B=G,$=Object(s["a"])(B,p,g,!1,null,null,null),j=$.exports,T=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"pagination"},[n("BaseButton",{attrs:{disabled:e.isPreviousButtonDisabled},nativeOn:{click:function(t){return e.previousPage(t)}}},[e._v(e._s(e.previous))]),e.showNumbers?n("div",{staticClass:"pagination-number-container"},e._l(e.pageCount,(function(t,i){return n("BaseButton",{key:i,class:{"is-active":t===e.currentPage},nativeOn:{click:function(n){return e.onLoadPage(t)}}},[e._v(e._s(t))])})),1):e._e(),n("BaseButton",{attrs:{disabled:e.isNextButtonDisabled},nativeOn:{click:function(t){return e.nextPage(t)}}},[e._v(e._s(e.next))])],1)},M=[],S=(n("a9e3"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("button",{staticClass:"btn"},[e._t("default",[e._v("Button")])],2)}),E=[],I=(n("ac36"),{}),N=Object(s["a"])(I,S,E,!1,null,"02da32fa",null),H=N.exports,R={components:{BaseButton:H},data:function(){return{next:"Next",previous:"Previous"}},props:{showNumbers:{default:!0,type:Boolean},currentPage:{type:Number,required:!0},pageCount:{type:Number,required:!0}},computed:{isPreviousButtonDisabled:function(){return 1===this.currentPage},isNextButtonDisabled:function(){return this.currentPage===this.pageCount}},methods:{nextPage:function(){this.$emit("nextPage")},previousPage:function(){this.$emit("previousPage")},onLoadPage:function(e){console.log(e),this.$emit("loadPage",e)}}},D=R,L=(n("d0b0"),Object(s["a"])(D,T,M,!1,null,"6a1b726f",null)),A=L.exports,V=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"hero-bar",class:{"pb-lg":e.allGifs.length<=0,"hero-bar-scaled":e.allGifs.length>0}},[n("div",{staticClass:"hero-container",class:{scaler:e.allGifs.length>0}},[n("h2",{staticClass:"hero-title",class:{"hero-title-scaled":e.allGifs.length>0}},[e._v(e._s(e.title))]),n("div",{staticClass:"search-field",class:{"search-field-scaled":e.allGifs.length>0}},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.searchTerm,expression:"searchTerm"}],staticClass:"input",attrs:{type:"text",placeholder:e.placeholder,autofocus:""},domProps:{value:e.searchTerm},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.getGifs(t)},input:function(t){t.target.composing||(e.searchTerm=t.target.value)}}}),n("BaseButton",{staticClass:"btn-inverted",nativeOn:{click:function(t){return e.getGifs(t)}}},[e._v(e._s(e.search))]),n("h2",{staticClass:"search-field-inline"},[e._v("or")]),n("BaseButton",{staticClass:"btn-inverted",nativeOn:{click:function(t){return e.$router.push("favorites")}}},[e._v(e._s(e.checkFavorites))])],1)])])},W=[],q={components:{BaseButton:H},props:{title:String,placeholder:String},computed:{allGifs:function(){return this.$store.getters.allGifs}},data:function(){return{searchTerm:"",search:"Search",checkFavorites:"View your favorites"}},methods:{getGifs:function(){this.$emit("getGifs",this.searchTerm)}}},J=q,X=(n("804d"),Object(s["a"])(J,V,W,!1,null,"04e1b7e9",null)),Y=X.exports,Z={name:"SearchBox",components:{GiphsList:j,Pagination:A,MainSearch:Y},props:{message:String},computed:{allGifs:function(){return this.$store.getters.allGifs},allFavorites:function(){return this.$store.getters.allFavorites}},data:function(){return{pageCount:0,currentPage:1,src:"https://media.giphy.com/media/Xy6nEr568Vy9WAofEI/giphy.gif",searchTitle:"Find your favorite gifs",placeholder:"Just type anything you want!"}},mounted:function(){this.$store.dispatch("resetGifs")},methods:{getGifs:function(e){var t=this;return Object(h["a"])(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.searchTerm=e,t.currentPage=1,n.next=4,t.dispatchGifs({searchTerm:t.searchTerm,currentPage:t.currentPage});case 4:case"end":return n.stop()}}),n)})))()},dispatchGifs:function(e){var t=e.searchTerm,n=e.currentPage;this.gifs=this.$store.dispatch("fetchGifs",{searchTerm:t,currentPage:n})},pageChangeHandle:function(e){var t=this;return Object(h["a"])(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:n.t0=e,n.next="next"===n.t0?3:"previous"===n.t0?5:7;break;case 3:return t.currentPage+=1,n.abrupt("break",8);case 5:return t.currentPage-=1,n.abrupt("break",8);case 7:t.currentPage=e;case 8:return n.next=10,t.dispatchGifs({searchTerm:t.searchTerm,currentPage:t.currentPage});case 10:case"end":return n.stop()}}),n)})))()}}},K=Z,Q=(n("c28d"),Object(s["a"])(K,d,v,!1,null,"e15334ec",null)),U=Q.exports,z={name:"Home",components:{SearchBox:U}},ee=z,te=Object(s["a"])(ee,f,m,!1,null,null,null),ne=te.exports,ie=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("FavoritesList")],1)},ae=[],re=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"hero-bar"},[n("div",{staticClass:"hero-container"},[e.allFavorites.length>0?n("h2",{staticClass:"hero-title"},[e._v(e._s(e.title))]):e._e(),e.allFavorites.length<=0?n("h2",{staticClass:"hero-title"},[e._v(e._s(e.titleNoFavorites))]):e._e(),n("BaseButton",{staticClass:"btn-inverted",nativeOn:{click:function(t){return e.goToHome(t)}}},[e._v(e._s(e.addMoreFavorites))])],1)]),n("div",{staticClass:"container"},[e.allFavorites.length<=0?n("img",{staticStyle:{"padding-top":"40px"},attrs:{src:e.noResult}}):e._e(),n("transition-group",{staticClass:"favorite-container",attrs:{name:"fade",tag:"div"}},e._l(e.showNumberOfFavorites,(function(t){return n("FavoriteItem",{key:t.id,attrs:{gif:t,isFavorite:t.isFavorite,comments:t.comments},on:{removeFromFavorites:function(n){return e.removeFromFavorites(t,t.id)},openGifInModal:function(n){return e.openGifInModal(t)}}})})),1),e.allFavorites.length>0?n("Pagination",{attrs:{"current-page":e.currentPage,"page-count":e.pageCount},on:{nextPage:function(t){return e.pageChangeHandle("next")},previousPage:function(t){return e.pageChangeHandle("previous")},loadPage:e.pageChangeHandle}}):e._e()],1),n("Modal",{directives:[{name:"show",rawName:"v-show",value:e.isModalVisible,expression:"isModalVisible"}],on:{close:e.closeModal},scopedSlots:e._u([{key:"header",fn:function(){return[e._v(e._s(e.gif.title))]},proxy:!0},{key:"body",fn:function(){return[n("img",{attrs:{src:"https://media.giphy.com/media/"+e.gif.id+"/giphy.gif"}}),n("Comments",{attrs:{comments:e.gif.comments}})]},proxy:!0}])})],1)},se=[],oe=(n("fb6a"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"favorite-item"},[n("div",{staticClass:"grid-item"},[n("div",{staticClass:"column-one"},[n("img",{attrs:{src:e.setSrc}})]),n("div",{staticClass:"column-two"},[n("BaseButton",{staticClass:"btn-remove",nativeOn:{click:function(t){return e.removeFromFavorites(t)}}},[n("delete-icon")],1)],1),n("div",{staticClass:"column-three"},[n("BaseButton",{staticClass:"button-overlay",nativeOn:{click:function(t){return e.openGifInModal(t)}}},[e._v(e._s(e.gif.comments.length)+" "+e._s(e.setComment))])],1)])])}),ce=[],ue=n("0647"),le={components:{BaseButton:H,DeleteIcon:ue["a"]},props:{gif:Object,isFavorite:Boolean},computed:{setSrc:function(){return"https://media.giphy.com/media/".concat(this.gif.id,"/200.gif")},setComment:function(){return 1===this.gif.comments.length?"Comment":"Comments"}},methods:{removeFromFavorites:function(){this.$emit("removeFromFavorites")},openGifInModal:function(){this.$emit("openGifInModal")}}},fe=le,me=Object(s["a"])(fe,oe,ce,!1,null,null,null),de=me.exports,ve=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"comment-section"},[n("div",{staticClass:"input-container"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.message,expression:"message"}],ref:"input",staticClass:"input",attrs:{placeholder:"Write a comment",autofocus:""},domProps:{value:e.message},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.addComment(t)},input:function(t){t.target.composing||(e.message=t.target.value)}}}),n("BaseButton",{attrs:{disabled:e.message.length<=0},nativeOn:{click:function(t){return e.addComment(t)}}},[n("send-icon"),e._v(" "+e._s(e.post)+" ")],1)],1),n("div",{staticClass:"comment-list"},[n("transition-group",{attrs:{name:"slide-fade",tag:"div"}},e._l(e.comments,(function(t,i){return n("div",{key:t.id},[n("CommentItem",{attrs:{comment:t.message},on:{removeComment:function(t){return e.removeComment(i)}}})],1)})),0)],1)])},he=[],pe=(n("a434"),function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("div",{staticClass:"comment-item"},[n("span",{staticClass:"comment"},[e._v(e._s(e.comment))]),n("div",{staticStyle:{display:"flex"}},[n("span",{staticClass:"time"},[e._v(e._s(e.time))]),n("BaseButton",{staticClass:"btn-remove",nativeOn:{click:function(t){return e.removeComment(t)}}},[n("delete-icon")],1)],1)])])}),ge=[],be=(n("0d03"),{components:{DeleteIcon:ue["a"],BaseButton:H},props:{comment:String},computed:{time:function(){var e=new Date;return e.toLocaleDateString()+" "+e.toLocaleTimeString()}},methods:{removeComment:function(){this.$emit("removeComment")}}}),_e=be,Ce=(n("4bd8"),Object(s["a"])(_e,pe,ge,!1,null,"6080f962",null)),ye=Ce.exports,Fe=n("c2d8"),ke={components:{CommentItem:ye,SendIcon:Fe["a"],BaseButton:H},props:{comments:Array},data:function(){return{message:"",post:"Post comment"}},methods:{addComment:function(){this.message.length>0&&this.comments.push({id:Math.random(),message:this.message}),this.message="",this.$refs["input"].focus()},removeComment:function(e){this.comments.splice(e,1)}}},Pe=ke,xe=(n("eed7"),Object(s["a"])(Pe,ve,he,!1,null,"37deb6f2",null)),Oe=xe.exports,we=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"modal-backdrop"},[n("div",{staticClass:"modal"},[n("header",{staticClass:"modal-header"},[n("h3",[e._t("header")],2),n("button",{staticClass:"btn-close",attrs:{type:"button"},on:{click:e.close}},[e._v("X")])]),n("section",{staticClass:"modal-body"},[e._t("body")],2),n("footer",{staticClass:"modal-footer"},[n("BaseButton",{staticClass:"btn-link",attrs:{type:"button"},nativeOn:{click:function(t){return e.close(t)}}},[e._v("Close")])],1)])])},Ge=[],Be={name:"modal",components:{BaseButton:H},methods:{close:function(){this.$emit("close")}}},$e=Be,je=(n("f45a"),Object(s["a"])($e,we,Ge,!1,null,"4c70536a",null)),Te=je.exports,Me={components:{FavoriteItem:de,Modal:Te,Comments:Oe,BaseButton:H,Pagination:A},data:function(){return{noResult:"https://media.giphy.com/media/11R5KYi6ZdP8Z2/giphy.gif",isModalVisible:!1,gif:{},title:"Welcome to your Favorites! Is there anything else you want to add?",titleNoFavorites:"Looks like you don't have any favorites yet.",addMoreFavorites:"Add more favorites",currentPage:1,pageCount:0,nrOfItems:12}},mounted:function(){this.pageCount=Math.ceil(this.allFavorites.length/this.nrOfItems)},computed:{allFavorites:function(){return this.$store.getters.allFavorites},showNumberOfFavorites:function(){return this.allFavorites.slice((this.currentPage-1)*this.nrOfItems,this.currentPage*this.nrOfItems)}},methods:{removeFromFavorites:function(e,t){this.$store.commit("removeFavorite",{favorite:e,id:t}),this.pageCount=Math.ceil(this.allFavorites.length/this.nrOfItems),this.showNumberOfFavorites.length<=0&&(this.currentPage-=1)},openGifInModal:function(e){this.gif=e,this.showModal()},showModal:function(){this.isModalVisible=!0},closeModal:function(){this.isModalVisible=!1},goToHome:function(){Ve.push("/")},pageChangeHandle:function(e){switch(e){case"next":this.currentPage+=1;break;case"previous":this.currentPage-=1;break;default:this.currentPage=e}}}},Se=Me,Ee=(n("a720"),Object(s["a"])(Se,re,se,!1,null,"1aca11f6",null)),Ie=Ee.exports,Ne={name:"Favorites",components:{FavoritesList:Ie}},He=Ne,Re=Object(s["a"])(He,ie,ae,!1,null,null,null),De=Re.exports;i["a"].use(l["a"]);var Le=[{path:"/",name:"Home",component:ne,meta:{title:"Pick the Gifs you like"}},{path:"/favorites",name:"Favorites",component:De,meta:{title:"My Favorite Gifs"}}],Ae=new l["a"]({routes:Le});Ae.beforeEach((function(e,t,n){document.title=e.meta.title||"Your Website Title",n()}));var Ve=Ae,We=(n("4160"),n("c975"),n("d81d"),n("159b"),n("2f62")),qe=n("bfa9"),Je=n("bc3a"),Xe=n.n(Je),Ye=Xe.a.create({baseURL:"https://api.giphy.com/",headers:{"Content-Type":"application-json"}}),Ze=Ye,Ke="/v1/gifs/search",Qe="rWqXP4sGGTHujRmCN1osOoCEQEBOWibd",Ue=function(e,t,n){return Ze.get(Ke,{useCahe:!0,params:{api_key:Qe,q:e,limit:t,offset:n}})};i["a"].use(We["a"]);var ze=new qe["a"]({storage:window.localStorage,reducer:function(e){return{favorites:e.favorites}}}),et=new We["a"].Store({state:{favorites:[],allGifs:[]},getters:{allGifs:function(e){return e.allGifs},allFavorites:function(e){return e.favorites}},mutations:{addFavorite:function(e,t){t["comments"]=[],t["isFavorite"]=!0,e.favorites.push(t)},removeFavorite:function(e,t){var n=e.favorites.map((function(e){return e.id})).indexOf(t.id);t.favorite["isFavorite"]=!1,e.favorites.splice(n,1)},setGifs:function(e,t){t.forEach((function(t){t["comments"]=[],t["isFavorite"]=!1,e.favorites.forEach((function(e){t.id===e.id&&(t["isFavorite"]=!0)}))})),e.allGifs=t},resetGifs:function(e){e.allGifs=[]}},actions:{resetGifs:function(e){e.commit("resetGifs")},fetchGifs:function(){var e=Object(h["a"])(regeneratorRuntime.mark((function e(t,n){var i,a,r,s;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return i=25,a=(n.currentPage-1)*i,e.prev=2,e.next=5,Ue(n.searchTerm,i,a);case 5:r=e.sent,s=r.data.data,t.commit("setGifs",s),e.next=12;break;case 10:e.prev=10,e.t0=e["catch"](2);case 12:case"end":return e.stop()}}),e,null,[[2,10]])})));function t(t,n){return e.apply(this,arguments)}return t}()},modules:{},plugins:[ze.plugin]}),tt=n("9483");Object(tt["a"])("".concat("/","service-worker.js"),{ready:function(){console.log("App is being served from cache by a service worker.\nFor more details, visit https://goo.gl/AFskqB")},registered:function(){console.log("Service worker has been registered.")},cached:function(){console.log("Content has been cached for offline use.")},updatefound:function(){console.log("New content is downloading.")},updated:function(){console.log("New content is available; please refresh."),window.location.reload(!0)},offline:function(){console.log("No internet connection found. App is running in offline mode.")},error:function(e){console.error("Error during service worker registration:",e)}}),i["a"].config.productionTip=!1,new i["a"]({router:Ve,store:et,render:function(e){return e(u)}}).$mount("#app")},"5c0b":function(e,t,n){"use strict";var i=n("9c0c"),a=n.n(i);a.a},"804d":function(e,t,n){"use strict";var i=n("565d"),a=n.n(i);a.a},"8a41":function(e,t,n){"use strict";var i=n("1593"),a=n.n(i);a.a},"9c0c":function(e,t,n){},a720:function(e,t,n){"use strict";var i=n("1f7c"),a=n.n(i);a.a},ac36:function(e,t,n){"use strict";var i=n("129a"),a=n.n(i);a.a},adb5:function(e,t,n){},c28d:function(e,t,n){"use strict";var i=n("e99e"),a=n.n(i);a.a},cbb3:function(e,t,n){},d0b0:function(e,t,n){"use strict";var i=n("1348"),a=n.n(i);a.a},e99e:function(e,t,n){},eed7:function(e,t,n){"use strict";var i=n("cbb3"),a=n.n(i);a.a},f45a:function(e,t,n){"use strict";var i=n("adb5"),a=n.n(i);a.a}}); //# sourceMappingURL=app.fe8a1931.js.map
10,101.5
20,162
0.699995
bb98e41b96faea55d65d6da9a339ff7a8e23f9a7
691
js
JavaScript
compiled/config/secrets.js
AndrewGHC/image-share
86cce029fcb0fb327c9c558655d470aebcb6c46e
[ "MIT" ]
null
null
null
compiled/config/secrets.js
AndrewGHC/image-share
86cce029fcb0fb327c9c558655d470aebcb6c46e
[ "MIT" ]
null
null
null
compiled/config/secrets.js
AndrewGHC/image-share
86cce029fcb0fb327c9c558655d470aebcb6c46e
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); /** Important **/ /** You should not be committing this file to GitHub **/ /** Repeat: DO! NOT! COMMIT! THIS! FILE! TO! YOUR! REPO! **/ var sessionSecret = exports.sessionSecret = process.env.SESSION_SECRET || 'Your Session Secret goes here'; var google = exports.google = { clientID: process.env.GOOGLE_CLIENTID || '62351010161-eqcnoa340ki5ekb9gvids4ksgqt9hf48.apps.googleusercontent.com', clientSecret: process.env.GOOGLE_SECRET || '6cKCWD75gHgzCvM4VQyR5_TU', callbackURL: process.env.GOOGLE_CALLBACK || '/auth/google/callback' }; exports.default = { sessionSecret: sessionSecret, google: google };
36.368421
117
0.739508
bb9909496343787b4b8e396539bdf9f4d8a803ba
44,139
js
JavaScript
node_modules/@angular/core/esm5/src/render3/state.js
bmkarthik610/ambipalm
eeace84443869f3950c1cfa6700cfbc8f50a1f88
[ "OML", "RSA-MD" ]
null
null
null
node_modules/@angular/core/esm5/src/render3/state.js
bmkarthik610/ambipalm
eeace84443869f3950c1cfa6700cfbc8f50a1f88
[ "OML", "RSA-MD" ]
4
2021-05-11T19:50:39.000Z
2022-02-27T08:05:15.000Z
node_modules/@angular/core/esm5/src/render3/state.js
insureco/newsite
6d244eccfde31eaf7ebd528cce0d47650ba26f1a
[ "RSA-MD" ]
1
2020-03-27T03:57:52.000Z
2020-03-27T03:57:52.000Z
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ import { assertDefined } from '../util/assert'; import { assertLViewOrUndefined } from './assert'; import { CONTEXT, DECLARATION_VIEW, TVIEW } from './interfaces/view'; import { MATH_ML_NAMESPACE, SVG_NAMESPACE } from './namespaces'; export var instructionState = { lFrame: createLFrame(null), bindingsEnabled: true, checkNoChangesMode: false, }; export function getElementDepthCount() { return instructionState.lFrame.elementDepthCount; } export function increaseElementDepthCount() { instructionState.lFrame.elementDepthCount++; } export function decreaseElementDepthCount() { instructionState.lFrame.elementDepthCount--; } export function getBindingsEnabled() { return instructionState.bindingsEnabled; } /** * Enables directive matching on elements. * * * Example: * ``` * <my-comp my-directive> * Should match component / directive. * </my-comp> * <div ngNonBindable> * <!-- ɵɵdisableBindings() --> * <my-comp my-directive> * Should not match component / directive because we are in ngNonBindable. * </my-comp> * <!-- ɵɵenableBindings() --> * </div> * ``` * * @codeGenApi */ export function ɵɵenableBindings() { instructionState.bindingsEnabled = true; } /** * Disables directive matching on element. * * * Example: * ``` * <my-comp my-directive> * Should match component / directive. * </my-comp> * <div ngNonBindable> * <!-- ɵɵdisableBindings() --> * <my-comp my-directive> * Should not match component / directive because we are in ngNonBindable. * </my-comp> * <!-- ɵɵenableBindings() --> * </div> * ``` * * @codeGenApi */ export function ɵɵdisableBindings() { instructionState.bindingsEnabled = false; } /** * Return the current `LView`. */ export function getLView() { return instructionState.lFrame.lView; } /** * Return the current `TView`. */ export function getTView() { return instructionState.lFrame.tView; } /** * Restores `contextViewData` to the given OpaqueViewState instance. * * Used in conjunction with the getCurrentView() instruction to save a snapshot * of the current view and restore it when listeners are invoked. This allows * walking the declaration view tree in listeners to get vars from parent views. * * @param viewToRestore The OpaqueViewState instance to restore. * * @codeGenApi */ export function ɵɵrestoreView(viewToRestore) { instructionState.lFrame.contextLView = viewToRestore; } export function getPreviousOrParentTNode() { return instructionState.lFrame.previousOrParentTNode; } export function setPreviousOrParentTNode(tNode, _isParent) { instructionState.lFrame.previousOrParentTNode = tNode; instructionState.lFrame.isParent = _isParent; } export function getIsParent() { return instructionState.lFrame.isParent; } export function setIsNotParent() { instructionState.lFrame.isParent = false; } export function setIsParent() { instructionState.lFrame.isParent = true; } export function getContextLView() { return instructionState.lFrame.contextLView; } export function getCheckNoChangesMode() { // TODO(misko): remove this from the LView since it is ngDevMode=true mode only. return instructionState.checkNoChangesMode; } export function setCheckNoChangesMode(mode) { instructionState.checkNoChangesMode = mode; } // top level variables should not be exported for performance reasons (PERF_NOTES.md) export function getBindingRoot() { var lFrame = instructionState.lFrame; var index = lFrame.bindingRootIndex; if (index === -1) { index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex; } return index; } export function getBindingIndex() { return instructionState.lFrame.bindingIndex; } export function setBindingIndex(value) { return instructionState.lFrame.bindingIndex = value; } export function nextBindingIndex() { return instructionState.lFrame.bindingIndex++; } export function incrementBindingIndex(count) { var lFrame = instructionState.lFrame; var index = lFrame.bindingIndex; lFrame.bindingIndex = lFrame.bindingIndex + count; return index; } /** * Set a new binding root index so that host template functions can execute. * * Bindings inside the host template are 0 index. But because we don't know ahead of time * how many host bindings we have we can't pre-compute them. For this reason they are all * 0 index and we just shift the root so that they match next available location in the LView. * * @param bindingRootIndex Root index for `hostBindings` * @param currentDirectiveIndex `TData[currentDirectiveIndex]` will point to the current directive * whose `hostBindings` are being processed. */ export function setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) { var lFrame = instructionState.lFrame; lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex; lFrame.currentDirectiveIndex = currentDirectiveIndex; } /** * When host binding is executing this points to the directive index. * `TView.data[getCurrentDirectiveIndex()]` is `DirectiveDef` * `LView[getCurrentDirectiveIndex()]` is directive instance. */ export function getCurrentDirectiveIndex() { return instructionState.lFrame.currentDirectiveIndex; } export function getCurrentQueryIndex() { return instructionState.lFrame.currentQueryIndex; } export function setCurrentQueryIndex(value) { instructionState.lFrame.currentQueryIndex = value; } /** * This is a light weight version of the `enterView` which is needed by the DI system. * @param newView * @param tNode */ export function enterDI(newView, tNode) { ngDevMode && assertLViewOrUndefined(newView); var newLFrame = allocLFrame(); instructionState.lFrame = newLFrame; newLFrame.previousOrParentTNode = tNode; newLFrame.lView = newView; if (ngDevMode) { // resetting for safety in dev mode only. newLFrame.isParent = DEV_MODE_VALUE; newLFrame.selectedIndex = DEV_MODE_VALUE; newLFrame.contextLView = DEV_MODE_VALUE; newLFrame.elementDepthCount = DEV_MODE_VALUE; newLFrame.currentNamespace = DEV_MODE_VALUE; newLFrame.currentSanitizer = DEV_MODE_VALUE; newLFrame.bindingRootIndex = DEV_MODE_VALUE; newLFrame.currentQueryIndex = DEV_MODE_VALUE; } } var DEV_MODE_VALUE = 'Value indicating that DI is trying to read value which it should not need to know about.'; /** * This is a light weight version of the `leaveView` which is needed by the DI system. * * Because the implementation is same it is only an alias */ export var leaveDI = leaveView; /** * Swap the current lView with a new lView. * * For performance reasons we store the lView in the top level of the module. * This way we minimize the number of properties to read. Whenever a new view * is entered we have to store the lView for later, and when the view is * exited the state has to be restored * * @param newView New lView to become active * @param tNode Element to which the View is a child of * @returns the previously active lView; */ export function enterView(newView, tNode) { ngDevMode && assertLViewOrUndefined(newView); var newLFrame = allocLFrame(); var tView = newView[TVIEW]; instructionState.lFrame = newLFrame; newLFrame.previousOrParentTNode = tNode; newLFrame.isParent = true; newLFrame.lView = newView; newLFrame.tView = tView; newLFrame.selectedIndex = 0; newLFrame.contextLView = newView; newLFrame.elementDepthCount = 0; newLFrame.currentDirectiveIndex = -1; newLFrame.currentNamespace = null; newLFrame.currentSanitizer = null; newLFrame.bindingRootIndex = -1; newLFrame.bindingIndex = tView.bindingStartIndex; newLFrame.currentQueryIndex = 0; } /** * Allocates next free LFrame. This function tries to reuse the `LFrame`s to lower memory pressure. */ function allocLFrame() { var currentLFrame = instructionState.lFrame; var childLFrame = currentLFrame === null ? null : currentLFrame.child; var newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame; return newLFrame; } function createLFrame(parent) { var lFrame = { previousOrParentTNode: null, isParent: true, lView: null, tView: null, selectedIndex: 0, contextLView: null, elementDepthCount: 0, currentNamespace: null, currentSanitizer: null, currentDirectiveIndex: -1, bindingRootIndex: -1, bindingIndex: -1, currentQueryIndex: 0, parent: parent, child: null, }; parent !== null && (parent.child = lFrame); // link the new LFrame for reuse. return lFrame; } export function leaveView() { instructionState.lFrame = instructionState.lFrame.parent; } export function nextContextImpl(level) { var contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView); return contextLView[CONTEXT]; } function walkUpViews(nestingLevel, currentView) { while (nestingLevel > 0) { ngDevMode && assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.'); currentView = currentView[DECLARATION_VIEW]; nestingLevel--; } return currentView; } /** * Gets the currently selected element index. * * Used with {@link property} instruction (and more in the future) to identify the index in the * current `LView` to act on. */ export function getSelectedIndex() { return instructionState.lFrame.selectedIndex; } /** * Sets the most recent index passed to {@link select} * * Used with {@link property} instruction (and more in the future) to identify the index in the * current `LView` to act on. * * (Note that if an "exit function" was set earlier (via `setElementExitFn()`) then that will be * run if and when the provided `index` value is different from the current selected index value.) */ export function setSelectedIndex(index) { instructionState.lFrame.selectedIndex = index; } /** * Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state. * * @codeGenApi */ export function ɵɵnamespaceSVG() { instructionState.lFrame.currentNamespace = SVG_NAMESPACE; } /** * Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state. * * @codeGenApi */ export function ɵɵnamespaceMathML() { instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE; } /** * Sets the namespace used to create elements to `null`, which forces element creation to use * `createElement` rather than `createElementNS`. * * @codeGenApi */ export function ɵɵnamespaceHTML() { namespaceHTMLInternal(); } /** * Sets the namespace used to create elements to `null`, which forces element creation to use * `createElement` rather than `createElementNS`. */ export function namespaceHTMLInternal() { instructionState.lFrame.currentNamespace = null; } export function getNamespace() { return instructionState.lFrame.currentNamespace; } export function setCurrentStyleSanitizer(sanitizer) { instructionState.lFrame.currentSanitizer = sanitizer; } export function resetCurrentStyleSanitizer() { setCurrentStyleSanitizer(null); } export function getCurrentStyleSanitizer() { // TODO(misko): This should throw when there is no LView, but it turns out we can get here from // `NodeStyleDebug` hence we return `null`. This should be fixed var lFrame = instructionState.lFrame; return lFrame === null ? null : lFrame.currentSanitizer; } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NyYy9yZW5kZXIzL3N0YXRlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUdILE9BQU8sRUFBQyxhQUFhLEVBQUMsTUFBTSxnQkFBZ0IsQ0FBQztBQUM3QyxPQUFPLEVBQUMsc0JBQXNCLEVBQUMsTUFBTSxVQUFVLENBQUM7QUFFaEQsT0FBTyxFQUFDLE9BQU8sRUFBRSxnQkFBZ0IsRUFBMEIsS0FBSyxFQUFRLE1BQU0sbUJBQW1CLENBQUM7QUFDbEcsT0FBTyxFQUFDLGlCQUFpQixFQUFFLGFBQWEsR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dGlvbiBjcmVhdGVMRnJhbWUocGFyZW50OiBMRnJhbWUgfCBudWxsKTogTEZyYW1lIHtcbiAgY29uc3QgbEZyYW1lOiBMRnJhbWUgPSB7XG4gICAgcHJldmlvdXNPclBhcmVudFROb2RlOiBudWxsICEsICAvL1xuICAgIGlzUGFyZW50OiB0cnVlLCAgICAgICAgICAgICAgICAgLy9cbiAgICBsVmlldzogbnVsbCAhLCAgICAgICAgICAgICAgICAgIC8vXG4gICAgdFZpZXc6IG51bGwgISwgICAgICAgICAgICAgICAgICAvL1xuICAgIHNlbGVjdGVkSW5kZXg6IDAsICAgICAgICAgICAgICAgLy9cbiAgICBjb250ZXh0TFZpZXc6IG51bGwgISwgICAgICAgICAgIC8vXG4gICAgZWxlbWVudERlcHRoQ291bnQ6IDAsICAgICAgICAgICAvL1xuICAgIGN1cnJlbnROYW1lc3BhY2U6IG51bGwsICAgICAgICAgLy9cbiAgICBjdXJyZW50U2FuaXRpemVyOiBudWxsLCAgICAgICAgIC8vXG4gICAgY3VycmVudERpcmVjdGl2ZUluZGV4OiAtMSwgICAgICAvL1xuICAgIGJpbmRpbmdSb290SW5kZXg6IC0xLCAgICAgICAgICAgLy9cbiAgICBiaW5kaW5nSW5kZXg6IC0xLCAgICAgICAgICAgICAgIC8vXG4gICAgY3VycmVudFF1ZXJ5SW5kZXg6IDAsICAgICAgICAgICAvL1xuICAgIHBhcmVudDogcGFyZW50ICEsICAgICAgICAgICAgICAgLy9cbiAgICBjaGlsZDogbnVsbCwgICAgICAgICAgICAgICAgICAgIC8vXG4gIH07XG4gIHBhcmVudCAhPT0gbnVsbCAmJiAocGFyZW50LmNoaWxkID0gbEZyYW1lKTsgIC8vIGxpbmsgdGhlIG5ldyBMRnJhbWUgZm9yIHJldXNlLlxuICByZXR1cm4gbEZyYW1lO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gbGVhdmVWaWV3KCkge1xuICBpbnN0cnVjdGlvblN0YXRlLmxGcmFtZSA9IGluc3RydWN0aW9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3J0IGZ1bmN0aW9uIGdldE5hbWVzcGFjZSgpOiBzdHJpbmd8bnVsbCB7XG4gIHJldHVybiBpbnN0cnVjdGlvblN0YXRlLmxGcmFtZS5jdXJyZW50TmFtZXNwYWNlO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gc2V0Q3VycmVudFN0eWxlU2FuaXRpemVyKHNhbml0aXplcjogU3R5bGVTYW5pdGl6ZUZuIHwgbnVsbCkge1xuICBpbnN0cnVjdGlvblN0YXRlLmxGcmFtZS5jdXJyZW50U2FuaXRpemVyID0gc2FuaXRpemVyO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gcmVzZXRDdXJyZW50U3R5bGVTYW5pdGl6ZXIoKSB7XG4gIHNldEN1cnJlbnRTdHlsZVNhbml0aXplcihudWxsKTtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEN1cnJlbnRTdHlsZVNhbml0aXplcigpIHtcbiAgLy8gVE9ETyhtaXNrbyk6IFRoaXMgc2hvdWxkIHRocm93IHdoZW4gdGhlcmUgaXMgbm8gTFZpZXcsIGJ1dCBpdCB0dXJucyBvdXQgd2UgY2FuIGdldCBoZXJlIGZyb21cbiAgLy8gYE5vZGVTdHlsZURlYnVnYCBoZW5jZSB3ZSByZXR1cm4gYG51bGxgLiBUaGlzIHNob3VsZCBiZSBmaXhlZFxuICBjb25zdCBsRnJhbWUgPSBpbnN0cnVjdGlvblN0YXRlLmxGcmFtZTtcbiAgcmV0dXJuIGxGcmFtZSA9PT0gbnVsbCA/IG51bGwgOiBsRnJhbWUuY3VycmVudFNhbml0aXplcjtcbn1cbiJdfQ==
124.686441
32,250
0.925893
bb99dcc215bbcd1b3d0899b7d756037f03bfe370
442
js
JavaScript
script/util/inputUtil.js
edwardsCam/Matador
d09be6dad89812b608771ec33c58188b2ee23279
[ "MIT" ]
null
null
null
script/util/inputUtil.js
edwardsCam/Matador
d09be6dad89812b608771ec33c58188b2ee23279
[ "MIT" ]
null
null
null
script/util/inputUtil.js
edwardsCam/Matador
d09be6dad89812b608771ec33c58188b2ee23279
[ "MIT" ]
null
null
null
var IO = (function() { var mpos = defaultPos(), prev_mpos = defaultPos(); return { mouseMove: mouseMove, mousepos: mousepos }; function mouseMove(e) { prev_mpos = mpos; mpos = normalizeScreenPos(e.clientX, e.clientY); } function mousepos() { return mpos; } function defaultPos() { return { x: 0, y: 0 }; } })();
15.785714
56
0.479638
bb99f092e104d654a85679d1e36eac35ea7604c6
389
js
JavaScript
src/assets/css/animations.js
immunnak/munnak
ebedf1b63ccf11dfef3e98f4efadcfdcaae5be73
[ "MIT" ]
null
null
null
src/assets/css/animations.js
immunnak/munnak
ebedf1b63ccf11dfef3e98f4efadcfdcaae5be73
[ "MIT" ]
1
2021-05-12T00:30:35.000Z
2021-05-12T00:30:35.000Z
src/assets/css/animations.js
immunnak/munnak
ebedf1b63ccf11dfef3e98f4efadcfdcaae5be73
[ "MIT" ]
null
null
null
import { keyframes } from 'styled-components'; export const fadeInDown = keyframes` 0% { opacity: 0; transform: translate3d(0, -100%, 0) } to { opacity: 1; transform: translateZ(0) } `; export const Loading = keyframes` 0% { transform: rotate(0deg) } to { transform: rotate(360deg) } `;
18.52381
47
0.511568
bb9a124abb246ed4e7e49ce0dc179ae46cb98afc
572
js
JavaScript
workers/CurrencyWorkers/CurrencyPublisherWorker/helper/publishRtaesFromApi.js
somdeepjana/bank-microservice
b7bb9b0405c96db86c583d24a002f8d548956883
[ "MIT" ]
null
null
null
workers/CurrencyWorkers/CurrencyPublisherWorker/helper/publishRtaesFromApi.js
somdeepjana/bank-microservice
b7bb9b0405c96db86c583d24a002f8d548956883
[ "MIT" ]
null
null
null
workers/CurrencyWorkers/CurrencyPublisherWorker/helper/publishRtaesFromApi.js
somdeepjana/bank-microservice
b7bb9b0405c96db86c583d24a002f8d548956883
[ "MIT" ]
1
2022-03-09T03:14:50.000Z
2022-03-09T03:14:50.000Z
const ExchangeRateService = require("../services/ExchangeRateService"); module.exports = (rabbitMqChannel, rabbitMqExchange) => { ExchangeRateService() .then((rateResponseDto) => { const sendString = JSON.stringify(rateResponseDto); rabbitMqChannel.publish(rabbitMqExchange, "", Buffer.from(sendString)); console.log( " [x] Sent currency rates at %s", rateResponseDto.featch_date ); }) .catch((err) => { console.error(err); console.error("Faild to get the currency rates from remote server"); }); };
30.105263
77
0.655594
bb9a42fd61a39b8be10bdd55073f442c5613cd4e
1,772
js
JavaScript
src/lib/utils/helper.js
schmittmj99/WAFFL
5f4dff57cc8908478a4b4f395108640f1190f4b2
[ "MIT" ]
null
null
null
src/lib/utils/helper.js
schmittmj99/WAFFL
5f4dff57cc8908478a4b4f395108640f1190f4b2
[ "MIT" ]
1
2021-09-11T03:00:24.000Z
2021-09-11T03:00:24.000Z
src/lib/utils/helper.js
schmittmj99/WAFFL
5f4dff57cc8908478a4b4f395108640f1190f4b2
[ "MIT" ]
null
null
null
import {getLeagueData} from './helperFunctions/leagueData'; import {dues, leagueID, leagueName, dynasty, managers, homepageText, enableBlog} from './leagueInfo'; import {getLeagueTransactions} from './helperFunctions/leagueTransactions'; import {getNflState} from './helperFunctions/nflState'; import {getLeagueRosters} from './helperFunctions/leagueRosters'; import {getLeagueUsers} from './helperFunctions/leagueUsers'; import {getLeagueMatchups} from './helperFunctions/leagueMatchups' import {getNews, stringDate} from './helperFunctions/news'; import {loadPlayers} from './helperFunctions/players'; import { waitForAll } from './helperFunctions/multiPromise'; import { getUpcomingDraft, getPreviousDrafts } from './helperFunctions/leagueDrafts' import { getLeagueRecords } from './helperFunctions/leagueRecords' import { getAwards } from './helperFunctions/leagueAwards' import { cleanName, round, generateGraph, gotoManager } from './helperFunctions/universalFunctions'; import { predictScores } from './helperFunctions/predictOptimalScore'; import { getBrackets } from './helperFunctions/leagueBrackets'; import { getBlogPosts } from './helperFunctions/getBlogPosts'; import { getLeagueStandings } from './helperFunctions/leagueStandings'; export { enableBlog, homepageText, gotoManager, managers, getLeagueData, getLeagueTransactions, getNflState, getLeagueRosters, getLeagueUsers, getLeagueMatchups, getNews, loadPlayers, waitForAll, getUpcomingDraft, getPreviousDrafts, getLeagueRecords, cleanName, round, dues, leagueID, leagueName, dynasty, getAwards, stringDate, getBrackets, generateGraph, getBlogPosts, predictScores, getLeagueStandings, }
35.44
101
0.756772
bb9a6f99c9d6653a40ae6e2f342f47a403d49313
1,025
js
JavaScript
packages/expo-device/build/ExpoDevice.web.js
mk360/expo
54b06c9826ccd013bd28c345d787173c09ba26a2
[ "Apache-2.0", "MIT" ]
null
null
null
packages/expo-device/build/ExpoDevice.web.js
mk360/expo
54b06c9826ccd013bd28c345d787173c09ba26a2
[ "Apache-2.0", "MIT" ]
null
null
null
packages/expo-device/build/ExpoDevice.web.js
mk360/expo
54b06c9826ccd013bd28c345d787173c09ba26a2
[ "Apache-2.0", "MIT" ]
null
null
null
import UAParser from 'ua-parser-js'; const parser = new UAParser(window.navigator.userAgent); const result = parser.getResult(); export default { get isDevice() { return true; }, get modelName() { return result.device.model || null; }, get osName() { return result.os.name; }, get osVersion() { return result.os.version; }, get supportedCpuArchitectures() { return result.cpu.architecture ? [result.cpu.architecture] : null; }, get deviceName() { const { browser, engine, os: OS } = parser.getResult(); return browser.name || engine.name || OS.name || null; }, get deviceYearClass() { return null; }, get osBuildId() { return null; }, get osInternalBuildId() { return null; }, get totalMemory() { return null; }, get manufacturer() { return null; }, get brand() { return null; }, }; //# sourceMappingURL=ExpoDevice.web.js.map
23.837209
74
0.566829
bb9ba272b6ab97bb32e3ac13ec643d97b5fa59f8
19,063
js
JavaScript
static/js/chunk-831cb27e.103729d2.js
PANColin/admin-leju
93a030b28024af91a3ef89cacdd62c36b3085980
[ "MIT" ]
null
null
null
static/js/chunk-831cb27e.103729d2.js
PANColin/admin-leju
93a030b28024af91a3ef89cacdd62c36b3085980
[ "MIT" ]
null
null
null
static/js/chunk-831cb27e.103729d2.js
PANColin/admin-leju
93a030b28024af91a3ef89cacdd62c36b3085980
[ "MIT" ]
null
null
null
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-831cb27e"],{"1ce7":function(e,t,r){"use strict";r("ed6c")},"1f91":function(e,t,r){"use strict";var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{class:e.isFlex?"wrapper-upload":""},[r("el-upload",{ref:"uploadCoverImg",staticClass:"upload-demo",attrs:{"list-type":e.listType,headers:{token:e.token},"on-success":e.handleSuccess,"before-upload":e.beforeUpload,multiple:e.isMultiple,limit:e.limitNumber,"show-file-list":!1,action:e.uploadUrl,"on-change":e.changeUpload}},["text"==e.listType?r("el-button",{attrs:{size:"small",type:"primary"}},[e._v("点击上传")]):e._e(),"picture-card"==e.listType||"picture"==e.listType?r("el-button",{staticStyle:{border:"none"},attrs:{icon:"el-icon-plus",size:"small",plain:""}}):e._e(),r("div",{staticClass:"el-upload__tip",attrs:{slot:"tip"},slot:"tip"},[e._v(" 只能上传图片格式文件,且不超过1.5M "),e.isMultiple?r("span",[e._v("文件不能超过"+e._s(e.limitNumber)+"个")]):e._e()])],1),e.isShowImg&&!e.isMultiple?r("div",{staticClass:"icon-wrapper"},[e.imgSrcStr||e.imgSrc?r("img",{staticClass:"cover-img",attrs:{src:e.imgSrc||e.imgSrcStr,alt:""}}):e._e(),e.imgSrc?r("i",{staticClass:"el-icon-circle-close",attrs:{slot:"reference"},on:{click:e.removeCoverImg},slot:"reference"}):e._e()]):e._e(),e.isShowImg&&e.isMultiple?r("div",{staticClass:"icon-wrapper",class:e.isFlex?"wrapper-img":""},e._l(e.picList.length>0?e.picList:e.imgSrcList,(function(t,a){return r("div",{key:a,staticClass:"multImg"},[r("img",{staticClass:"cover-img",attrs:{src:t,alt:""}}),e.picList.length>0?r("i",{staticClass:"el-icon-circle-close",on:{click:function(t){return e.removeCoverImg(a)}}}):e._e()])})),0):e._e()],1)},s=[],n=(r("a9e3"),r("a434"),r("5f87")),i={name:"UploadImg",props:{isShowImg:{type:Boolean,default:!1},uploadUrl:{type:String,default:"/lejuAdmin/material/uploadFileOss"},listType:{type:String,default:"text"},isWho:{type:String,default:""},isFlex:{type:Boolean,default:!0},isMultiple:{type:Boolean,default:!1},limitNumber:{type:Number,default:5},imgSrcStr:{type:String,default:""},imgSrcList:{type:Array,default:function(){return[]}}},mounted:function(){},data:function(){return{picList:[],imgSrc:""}},computed:{token:function(){return Object(n["b"])()}},methods:{changeUpload:function(e,t){},handleSuccess:function(e,t,r){var a=e.success,s=e.data,n=e.message;if(a){var i=s.fileUrl;this.picList.push(i),this.$message.success("上传成功!");var o={url:i,isWho:this.isWho};this.$emit("reciveImgSrc",o),this.imgSrc=i,this.isMultiple&&this.$emit("reciveImgSrcList",this.picList)}else this.$message.error(n)},beforeUpload:function(e){var t=/image\/(jpeg|png|jpg)/g,r=t.test(e.type),a=e.size/1024/1024<1.5;return r||this.$message.error("只能上传图片格式"),a||this.$message.error("上传头像图片大小不能超过1.5MB!"),r&&a},removeCoverImg:function(e){var t=this;this.$confirm("此操作将永久删除该文件, 是否继续?","系统提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){t.$message({type:"success",message:"删除成功!"}),t.imgSrc="",t.isMultiple&&t.picList.splice(e,1)})).catch((function(){t.$message({type:"info",message:"已取消删除"})}))}}},o=i,l=(r("1ce7"),r("2877")),c=Object(l["a"])(o,a,s,!1,null,"18f632b0",null);t["a"]=c.exports},"2f08":function(e,t,r){"use strict";var a=function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},s=[function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"wrapper-copyright"},[r("div",{staticClass:"row1"},[r("span",[e._v("Element")]),r("a",{attrs:{href:"https://github.com/PanJiaChen/vue-element-admin",target:"blank"}},[r("img",{attrs:{src:"https://img0.baidu.com/it/u=2078769130,3528906519&fm=26&fmt=auto&gp=0.jpg",alt:""}})]),r("span",[e._v("Element-admin")])]),r("div",{staticClass:"row2"},[r("span",[e._v("Copyright© 2017-2020 不凡学院 豫ICP备 17015347号")])])])}],n={name:"Copyright"},i=n,o=(r("97db"),r("2877")),l=Object(o["a"])(i,a,s,!1,null,"5e5f4c36",null);t["a"]=l.exports},"3e6f":function(e,t,r){"use strict";r.r(t);var a=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",[r("detail",{key:e.key,ref:"editRoles",attrs:{logo:e.editRoles.logo,bigImg:e.editRoles.bigPic,editRoles:e.editRoles},on:{refrush:e.getBrandList}}),r("el-card",{staticStyle:{width:"95%",margin:"10px auto"},attrs:{shadow:"hover","body-style":{paddingTop:"20px",paddingBottom:"0"}}},[r("div",{staticStyle:{cursor:"pointer"},attrs:{slot:"header"},on:{click:function(t){e.isShow=!e.isShow}},slot:"header"},[r("span",[e._v("条件查询")])]),r("el-form",{directives:[{name:"show",rawName:"v-show",value:e.isShow,expression:"isShow"}],ref:"ruleForm",attrs:{model:e.searchForm,rules:e.rules,"label-width":"80px",inline:!1,size:"normal"}},[r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:6,offset:0}},[r("el-form-item",{attrs:{label:"昵称",prop:"nickName"}},[r("el-input",{attrs:{placeholder:"请输入昵称(支持模糊查询)"},model:{value:e.searchForm.nickName,callback:function(t){e.$set(e.searchForm,"nickName","string"===typeof t?t.trim():t)},expression:"searchForm.nickName"}})],1)],1),r("el-col",{attrs:{span:6,offset:0}},[r("el-form-item",{attrs:{label:"用户名",prop:"username"}},[r("el-input",{attrs:{placeholder:"请输入用户名(支持模糊查询)"},model:{value:e.searchForm.username,callback:function(t){e.$set(e.searchForm,"username","string"===typeof t?t.trim():t)},expression:"searchForm.username"}})],1)],1)],1),r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:6,offset:18}},[r("el-form-item",[r("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.onSearch("ruleForm")}}},[e._v("查询")]),r("el-button",{on:{click:function(t){return e.onCancle("ruleForm")}}},[e._v("取消")])],1)],1)],1)],1)],1),r("el-card",{staticStyle:{width:"95%",margin:"20px auto"}},[r("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:e.add}},[e._v("新增")]),r("el-table",{directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],staticStyle:{width:"100%"},attrs:{fit:"",border:"",data:e.list}},[r("el-table-column",{attrs:{align:"center",type:"index",label:"序号",width:"50",fixed:"left"}}),r("el-table-column",{attrs:{align:"center",prop:"username",label:"用户名",width:"160"}}),r("el-table-column",{attrs:{align:"center",prop:"nick_name",label:"昵称",width:"100"}}),r("el-table-column",{attrs:{align:"center",label:"头像",width:"110"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("img",{attrs:{src:t.row.salt,width:"100",height:"110"},on:{error:function(r){return e.handleError(t.row)}}})]}}])}),r("el-table-column",{attrs:{resizable:"",align:"center",prop:"roles",label:"角色",width:"160"}}),r("el-table-column",{attrs:{align:"center",prop:"modify_time",label:"修改日期",width:"180"}}),r("el-table-column",{attrs:{align:"center",prop:"create_time",label:"添加时间",width:"180"}}),r("el-table-column",{attrs:{label:"操作",align:"center",fixed:"right"},scopedSlots:e._u([{key:"default",fn:function(t){return[r("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(r){return e.edit(t.row)}}},[e._v("编辑")]),r("el-popconfirm",{attrs:{title:"亲,您确定要删除吗?"},on:{onConfirm:function(r){return e.del(t.row)}}},[r("el-button",{attrs:{slot:"reference",type:"danger",size:"mini"},slot:"reference"},[e._v("删除")])],1)]}}])})],1),r("el-pagination",{staticClass:"pagination",attrs:{background:"","current-page":e.pageInfo.start,"page-sizes":[5,10,15,20],"page-size":e.pageInfo.limit,layout:"total, sizes, prev, pager, next, jumper",total:e.total},on:{"size-change":e.SizeChange,"current-change":e.CurrentChange}})],1),r("copyright")],1)},s=[],n=r("1da1"),i=(r("159b"),r("96cf"),function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"dialog-detail"},[r("el-dialog",{attrs:{title:"编辑用户",visible:e.dialogVisible},on:{"update:visible":function(t){e.dialogVisible=t}}},[r("el-form",{ref:"adduserRoleForm",attrs:{model:e.adduserRoleForm,rules:e.rules}},[r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:24,offset:0}},[r("el-form-item",{attrs:{label:"用户名","label-width":e.formLabelWidth,prop:"username"}},[r("el-input",{attrs:{placeholder:"请输入用户名称",autocomplete:"off"},model:{value:e.adduserRoleForm.username,callback:function(t){e.$set(e.adduserRoleForm,"username",t)},expression:"adduserRoleForm.username"}})],1)],1)],1),r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:24,offset:0}},[r("el-form-item",{attrs:{label:"用户昵称","label-width":e.formLabelWidth,prop:"nickName"}},[r("el-input",{attrs:{placeholder:"请输入用户昵称",autocomplete:"off"},model:{value:e.adduserRoleForm.nickName,callback:function(t){e.$set(e.adduserRoleForm,"nickName",e._n(t))},expression:"adduserRoleForm.nickName"}})],1)],1)],1),r("el-row",{attrs:{gutter:20}},[r("el-col",{attrs:{span:24,offset:0}},[r("el-form-item",{attrs:{label:"密码","label-width":e.formLabelWidth,prop:"password "}},[r("el-input",{attrs:{placeholder:"请输入密码",autocomplete:"off"},model:{value:e.adduserRoleForm.password,callback:function(t){e.$set(e.adduserRoleForm,"password",e._n(t))},expression:"adduserRoleForm.password"}})],1)],1)],1),r("el-row",{staticClass:"upload-row",attrs:{gutter:20}},[r("el-form-item",{attrs:{label:"头像","label-width":e.formLabelWidth}},[r("el-col",{attrs:{span:12,offset:0}},[r("upload-img",{attrs:{listType:"picture-card"},on:{reciveImgSrc:e.handleImgSrc}})],1),e.bigImg||e.adduserRoleForm.salt?r("el-col",{attrs:{span:12,offset:0}},[r("img",{style:e.bigImg||e.adduserRoleForm.salt?"width:165px;height:162px":"",attrs:{src:e.bigImg?e.bigImg:e.adduserRoleForm.salt,alt:""}})]):e._e()],1)],1),r("el-row",{attrs:{gutter:20}},[r("el-form-item",{attrs:{label:"用户角色",prop:"roleIds","label-width":e.formLabelWidth}},[r("el-col",{attrs:{span:24,offset:0}},[r("el-select",{attrs:{multiple:"",name:"roleIds ",clearable:"",placeholder:"用户角色"},on:{change:function(t){return e.$forceUpdate()}},model:{value:e.adduserRoleForm.roleIds,callback:function(t){e.$set(e.adduserRoleForm,"roleIds",t)},expression:"adduserRoleForm.roleIds"}},e._l(e.rolesList,(function(e){return r("el-option",{key:e.id,attrs:{label:e.roleName,value:e.value}})})),1)],1)],1)],1)],1),r("div",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[r("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),r("el-button",{attrs:{type:"primary"},on:{click:e.doSave}},[e._v("确 定")])],1)],1)],1)}),o=[],l=(r("d81d"),r("1f91")),c=r("daea"),u={components:{UploadImg:l["a"]},props:{editRoles:{type:Object,default:function(){return{}}},bigImg:{type:String,default:""}},computed:{},created:function(){this.showSelectVal()},mounted:function(){},data:function(){return{rolesList:[],adduserRoleForm:{salt:""},dialogVisible:!1,formLabelWidth:"130px",rules:{username:[{required:!0,message:"用户名不能为空",trigger:"blur"},{min:2,max:8,message:"长度在 2 到 8 个字符",trigger:"blur"}],nickName:[{required:!0,message:"用户昵称不能为空",trigger:"blur"},{min:2,max:8,message:"长度在 2 到 8 个字符",trigger:"blur"}],password:[{required:!0,message:"密码不能为空",trigger:"blur"},{min:6,max:10,message:"长度在 6到 10 个字符",trigger:"blur"}],roleIds:[{required:!0,message:"用户角色不能为空",trigger:"blur"}]}}},methods:{showSelectVal:function(){var e=this;return Object(n["a"])(regeneratorRuntime.mark((function t(){var r,a,s,n;return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:return t.next=2,Object(c["a"])();case 2:if(r=t.sent,a=r.success,s=r.data,n=r.message,a){t.next=8;break}return t.abrupt("return",e.$message.error(n));case 8:e.rolesList=s.items.map((function(e){return{id:e.id,roleName:e.roleName,value:e.id}}));case 9:case"end":return t.stop()}}),t)})))()},handleImgSrc:function(e){this.adduserRoleForm.salt=e.url},clearAll:function(){this.adduserRoleForm={salt:""}},handleClose:function(){this.dialogVisible=!1,console.log("关闭...")},doSave:function(){var e=this;this.$refs.adduserRoleForm.validate((function(t){if(!t)return e.$message.warning("请检查是否输入有误"),!1;e.dialogVisible=!1,e.$emit("refrush",e.adduserRoleForm)}))},openDialog:function(){var e=this;this.$nextTick((function(){e.editRoles.id&&(e.adduserRoleForm=JSON.parse(JSON.stringify(e.editRoles)))})),this.dialogVisible=!0}}},d=u,m=(r("df26"),r("2877")),f=Object(m["a"])(d,i,o,!1,null,"18b0818b",null),p=f.exports,g=r("2f08"),h=(r("99af"),r("0c6d"));function b(e,t,r){return Object(h["a"])({url:"/admin/sysAuth/user/findUsersByPage/".concat(e,"/").concat(t),method:"post",data:r})}function v(e){return Object(h["a"])({url:"/admin/sysAuth/user/removeUser/".concat(e),method:"delete"})}function w(e){return Object(h["a"])({url:"/admin/sysAuth/user/saveUserRoles",method:"post",data:e})}function y(e){return Object(h["a"])({url:"/admin/sysAuth/user/updateUserRoles",method:"put",data:e})}function R(e){return Object(h["a"])({url:"/admin/sysAuth/user/".concat(e)})}var S={name:"Account",components:{copyright:g["a"],Detail:p},computed:{key:function(){return(new Date).getTime()}},data:function(){return{editRoles:{},loading:!1,isShow:!1,list:[],pageInfo:{start:1,limit:10},searchForm:{nickName:"",username:""},rules:{nickName:[{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}],username:[{min:1,max:20,message:"长度在 1 到 20 个字符",trigger:"blur"}]},total:0}},mounted:function(){var e=this;return Object(n["a"])(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){while(1)switch(t.prev=t.next){case 0:e.findUsersByPage();case 1:case"end":return t.stop()}}),t)})))()},methods:{add:function(){this.editRoles={},this.$refs.editRoles.clearAll(),this.$refs.editRoles.openDialog()},getBrandList:function(e){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function r(){var a,s,n,i;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return a=e.id?y:w,r.next=3,a(e);case 3:if(s=r.sent,n=s.success,i=s.message,n){r.next=8;break}return r.abrupt("return",t.$message.error(i));case 8:t.$message.success("保存成功"),t.findUsersByPage();case 10:case"end":return r.stop()}}),r)})))()},edit:function(e){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function r(){var a,s,n,i;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return e.nickName=e.nick_name,r.next=3,R(e.id);case 3:if(a=r.sent,s=a.success,n=a.data,i=a.message,s){r.next=9;break}return r.abrupt("return",t.$message.error(i));case 9:e.roleIds=n.user.roleIds,t.editRoles=e,t.$refs.editRoles.openDialog(),t.$refs.editRoles.showSelectVal();case 13:case"end":return r.stop()}}),r)})))()},del:function(e){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function r(){var a,s,n;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return r.next=2,v(e.id);case 2:if(a=r.sent,s=a.success,n=a.message,s){r.next=7;break}return r.abrupt("return",t.$message.error(n));case 7:t.$message.success("删除成功"),t.findUsersByPage();case 9:case"end":return r.stop()}}),r)})))()},findUsersByPage:function(e){var t=this;return Object(n["a"])(regeneratorRuntime.mark((function r(){var a;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return t.loading=!0,r.next=3,b(t.pageInfo.start,t.pageInfo.limit,e&&e);case 3:if(a=r.sent,a.success){r.next=6;break}return r.abrupt("return",t.$message.error(a.message));case 6:t.total=a.data.total,t.list=a.data.rows,t.loading=!1,a.data.rows.forEach((function(e){e.icon||(e.icon="https://img0.baidu.com/it/u=59285992,513800291&fm=26&fmt=auto&gp=0.jpg")}));case 10:case"end":return r.stop()}}),r)})))()},onCancle:function(e){this.$refs[e].resetFields(),this.findUsersByPage()},onSearch:function(e){var t=this;this.$refs[e].validate((function(e){if(!e)return console.log("error submit!!"),!1;var r=t.searchForm,a=r.nickName,s=r.username;console.log(!a,!s),a||s?(t.findUsersByPage(t.searchForm),t.pageInfo.start=1,t.pageInfo.limit=10):(console.log(!a,!s,"============"),t.$message.warning("请至少输入一项进行查询"))}))},handleError:function(e){e.icon="https://img0.baidu.com/it/u=59285992,513800291&fm=26&fmt=auto&gp=0.jpg"},SizeChange:function(e){this.pageInfo.limit=e,this.findUsersByPage()},CurrentChange:function(e){this.pageInfo.start=e,this.findUsersByPage()}}},k=S,I=(r("f1ba"),Object(m["a"])(k,a,s,!1,null,"7154eb9c",null));t["default"]=I.exports},"56a4":function(e,t,r){},"82f2":function(e,t,r){},"97db":function(e,t,r){"use strict";r("eb78")},a434:function(e,t,r){"use strict";var a=r("23e7"),s=r("23cb"),n=r("a691"),i=r("50c4"),o=r("7b0b"),l=r("65f0"),c=r("8418"),u=r("1dde"),d=r("ae40"),m=u("splice"),f=d("splice",{ACCESSORS:!0,0:0,1:2}),p=Math.max,g=Math.min,h=9007199254740991,b="Maximum allowed length exceeded";a({target:"Array",proto:!0,forced:!m||!f},{splice:function(e,t){var r,a,u,d,m,f,v=o(this),w=i(v.length),y=s(e,w),R=arguments.length;if(0===R?r=a=0:1===R?(r=0,a=w-y):(r=R-2,a=g(p(n(t),0),w-y)),w+r-a>h)throw TypeError(b);for(u=l(v,a),d=0;d<a;d++)m=y+d,m in v&&c(u,d,v[m]);if(u.length=a,r<a){for(d=y;d<w-a;d++)m=d+a,f=d+r,m in v?v[f]=v[m]:delete v[f];for(d=w;d>w-a+r;d--)delete v[d-1]}else if(r>a)for(d=w-a;d>y;d--)m=d+a-1,f=d+r-1,m in v?v[f]=v[m]:delete v[f];for(d=0;d<r;d++)v[d+y]=arguments[d+2];return v.length=w-a+r,u}})},a9e3:function(e,t,r){"use strict";var a=r("83ab"),s=r("da84"),n=r("94ca"),i=r("6eeb"),o=r("5135"),l=r("c6b6"),c=r("7156"),u=r("c04e"),d=r("d039"),m=r("7c73"),f=r("241c").f,p=r("06cf").f,g=r("9bf2").f,h=r("58a8").trim,b="Number",v=s[b],w=v.prototype,y=l(m(w))==b,R=function(e){var t,r,a,s,n,i,o,l,c=u(e,!1);if("string"==typeof c&&c.length>2)if(c=h(c),t=c.charCodeAt(0),43===t||45===t){if(r=c.charCodeAt(2),88===r||120===r)return NaN}else if(48===t){switch(c.charCodeAt(1)){case 66:case 98:a=2,s=49;break;case 79:case 111:a=8,s=55;break;default:return+c}for(n=c.slice(2),i=n.length,o=0;o<i;o++)if(l=n.charCodeAt(o),l<48||l>s)return NaN;return parseInt(n,a)}return+c};if(n(b,!v(" 0o1")||!v("0b1")||v("+0x1"))){for(var S,k=function(e){var t=arguments.length<1?0:e,r=this;return r instanceof k&&(y?d((function(){w.valueOf.call(r)})):l(r)!=b)?c(new v(R(t)),r,k):R(t)},I=a?f(v):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;I.length>x;x++)o(v,S=I[x])&&!o(k,S)&&g(k,S,p(v,S));k.prototype=w,w.constructor=k,i(s,b,k)}},daea:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return n})),r.d(t,"c",(function(){return i})),r.d(t,"d",(function(){return o})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return c}));r("99af");var a=r("0c6d");function s(){return Object(a["a"])({url:"/admin/sysAuth/role/findAllRoles"})}function n(e){return Object(a["a"])({url:"/admin/sysAuth/role/findRolePermissions/".concat(e)})}function i(e,t){return Object(a["a"])({url:"/admin/sysAuth/role/findRolesByPage/".concat(e,"/").concat(t)})}function o(e){return Object(a["a"])({url:"/admin/sysAuth/role/removeRole/".concat(e),method:"delete"})}function l(e){return Object(a["a"])({url:"/admin/sysAuth/role/saveRolePermissions",method:"POST",data:e})}function c(e){return Object(a["a"])({url:"/admin/sysAuth/role/updateRolePermissions",method:"PUT",data:e})}},df26:function(e,t,r){"use strict";r("56a4")},eb78:function(e,t,r){},ed6c:function(e,t,r){},f1ba:function(e,t,r){"use strict";r("82f2")}}]);
19,063
19,063
0.685412
bb9c2a5a2bed8250b07e4d982221a85be469fae3
4,090
js
JavaScript
static/scripts/layout/panel.js
igorhollaender/sirv_dashboard
85aec60b80ef6f561d89398e3da5963d3d0f2aa4
[ "CC-BY-3.0" ]
6
2018-11-03T22:43:35.000Z
2022-02-15T17:51:33.000Z
static/scripts/layout/panel.js
igorhollaender/OBSOLETE_sirv_dashboard
85aec60b80ef6f561d89398e3da5963d3d0f2aa4
[ "CC-BY-3.0" ]
3
2015-06-06T22:16:03.000Z
2015-11-12T00:22:45.000Z
static/scripts/layout/panel.js
igorhollaender/OBSOLETE_sirv_dashboard
85aec60b80ef6f561d89398e3da5963d3d0f2aa4
[ "CC-BY-3.0" ]
10
2017-04-10T21:40:22.000Z
2022-02-21T16:50:10.000Z
define(["jquery","libs/underscore","libs/backbone","mvc/base-mvc"],function(a,b,c,d){"use strict";var e=a,f=160,g=800,h=c.View.extend(d.LoggableMixin).extend({_logNamespace:"layout",initialize:function(a){this.log(this+".initialize:",a),this.title=a.title||this.title||"",this.hidden=!1,this.savedSize=null,this.hiddenByTool=!1},$center:function(){return this.$el.siblings("#center")},$toggleButton:function(){return this.$(".unified-panel-footer > .panel-collapse")},render:function(){this.log(this+".render:"),this.$el.html(this.template(this.id))},template:function(){return[this._templateHeader(),this._templateBody(),this._templateFooter()].join("")},_templateHeader:function(){return['<div class="unified-panel-header" unselectable="on">','<div class="unified-panel-header-inner">','<div class="panel-header-buttons" style="float: right"/>','<div class="panel-header-text">',b.escape(this.title),"</div>","</div>","</div>"].join("")},_templateBody:function(){return'<div class="unified-panel-body"/>'},_templateFooter:function(){return['<div class="unified-panel-footer">','<div class="panel-collapse ',b.escape(this.id),'"/>','<div class="drag"/>',"</div>"].join("")},events:{"mousedown .unified-panel-footer > .drag":"_mousedownDragHandler","click .unified-panel-footer > .panel-collapse":"toggle"},_mousedownDragHandler:function(a){function b(a){var b=a.pageX-h;h=a.pageX;var e=c.$el.width(),i=d?e+b:e-b;i=Math.min(g,Math.max(f,i)),c.resize(i)}var c=this,d="left"===this.id,h=a.pageX;e("#dd-helper").show().on("mousemove",b).one("mouseup",function(){e(this).hide().off("mousemove",b)})},resize:function(a){return this.$el.css("width",a),this.$center().css(this.id,a),self},show:function(){if(this.hidden){var a=this,b={},c=this.id;return b[c]=0,a.$el.css(c,-this.savedSize).show().animate(b,"fast",function(){a.resize(a.savedSize)}),a.hidden=!1,a.$toggleButton().removeClass("hidden"),a}},hide:function(){if(!this.hidden){var a=this,b={},c=this.id;return a.savedSize=this.$el.width(),b[c]=-this.savedSize,this.$el.animate(b,"fast"),this.$center().css(c,0),a.hidden=!0,a.$toggleButton().addClass("hidden"),a}},toggle:function(){var a=this;return a.hidden?a.show():a.hide(),a.hiddenByTool=!1,a},handle_minwidth_hint:function(a){var b=this.$center().width()-(this.hidden?this.savedSize:0);return a>b?this.hidden||(this.toggle(),this.hiddenByTool=!0):this.hiddenByTool&&(this.toggle(),this.hiddenByTool=!1),self},force_panel:function(a){return"show"==a?this.show():"hide"==a?this.hide():self},toString:function(){return"SidePanel("+this.id+")"}}),i=h.extend({id:"left"}),j=h.extend({id:"right"}),k=c.View.extend(d.LoggableMixin).extend({_logNamespace:"layout",initialize:function(a){this.log(this+".initialize:",a),this.prev=null},render:function(){this.log(this+".render:"),this.$el.html(this.template()),this.$("#galaxy_main").on("load",b.bind(this._iframeChangeHandler,this))},_iframeChangeHandler:function(a){var b=a.currentTarget,c=b.contentWindow&&b.contentWindow.location;c&&c.host&&(e(b).show(),this.prev&&this.prev.remove(),this.$("#center-panel").hide(),Galaxy.trigger("galaxy_main:load",{fullpath:c.pathname+c.search+c.hash,pathname:c.pathname,search:c.search,hash:c.hash}),this.trigger("galaxy_main:load",c))},display:function(a){var b=this.$("#galaxy_main")[0].contentWindow||{},c=b.onbeforeunload&&b.onbeforeunload();!c||confirm(c)?(b.onbeforeunload=void 0,this.prev&&this.prev.remove(),this.prev=a,this.$("#galaxy_main").attr("src","about:blank").hide(),this.$("#center-panel").scrollTop(0).append(a.$el).show(),this.trigger("center-panel:load",a)):a&&a.remove()},template:function(){return['<div style="position: absolute; width: 100%; height: 100%">','<iframe name="galaxy_main" id="galaxy_main" frameborder="0" ','style="position: absolute; width: 100%; height: 100%;"/>','<div id="center-panel" ','style="display: none; position: absolute; width: 100%; height: 100%; padding: 10px; overflow: auto;"/>',"</div>"].join("")},toString:function(){return"CenterPanel"}});return{LeftPanel:i,RightPanel:j,CenterPanel:k}}); //# sourceMappingURL=../../maps/layout/panel.js.map
2,045
4,038
0.710269
bb9c6b8b98d2f2a6a969318a8d8e7b8f37029195
5,770
js
JavaScript
source/sketch/library/gui.js
fabrizio5680/data-populator
b846bf34df0ae4091b5b2c2b1456c9073179feb1
[ "MIT" ]
1
2020-03-26T17:17:33.000Z
2020-03-26T17:17:33.000Z
source/sketch/library/gui.js
fabrizio5680/data-populator
b846bf34df0ae4091b5b2c2b1456c9073179feb1
[ "MIT" ]
null
null
null
source/sketch/library/gui.js
fabrizio5680/data-populator
b846bf34df0ae4091b5b2c2b1456c9073179feb1
[ "MIT" ]
null
null
null
/** * Gui * * Provides functionality to create various user interface components. */ import Context from './context' import MochaJSDelegate from '../vendor/MochaJSDelegate' import * as Handlers from './handlers' import * as Utils from './utils' // only exists when a window is currently shown let pendingWindowResolve = null let callResolves = {} export async function showWindow (data) { await setupWindow() return new Promise((resolve, reject) => { // do not open again if a window resolve is pending if (pendingWindowResolve) { return } // get thread dictionary let threadDictionary = NSThread.mainThread().threadDictionary() // nothing to show if the window doesn't exist let webView = threadDictionary['com.datapopulator.sketch.ui.web'] if (!webView) return // store reference to resolve handler to call it later when window closes pendingWindowResolve = resolve // ask window to be shown with given data let windowObject = webView.windowScriptObject() let encodedData = Utils.encode(data) windowObject.evaluateWebScript(`window.callHandler('show', '${encodedData}')`) // NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(threadDictionary['com.datapopulator.sketch.ui.window'], Context().document.window(), null, null, null) }) } export function hideWindow (data) { let threadDictionary = NSThread.mainThread().threadDictionary() let webWindow = threadDictionary['com.datapopulator.sketch.ui.window'] if (!webWindow) return NSApp.endSheet(webWindow) webWindow.orderOut(null) if (pendingWindowResolve) { pendingWindowResolve(data) pendingWindowResolve = null } destroyWindow() } export async function call (uiHandler, data) { await setupWindow() return new Promise((resolve) => { // get thread dictionary let threadDictionary = NSThread.mainThread().threadDictionary() // nothing to show if the window doesn't exist let webView = threadDictionary['com.datapopulator.sketch.ui.web'] if (!webView) return let callId = Utils.encode(`${uiHandler}${Date.now()}`) callResolves[callId] = resolve // ask window to be shown with given data let windowObject = webView.windowScriptObject() let encodedData = Utils.encode(data) windowObject.evaluateWebScript(`window.callHandler('${uiHandler}', '${encodedData}', '${callId}')`) }) } export function setupWindow () { coscript.setShouldKeepAround(true) return new Promise((resolve, reject) => { // get thread dictionary let threadDictionary = NSThread.mainThread().threadDictionary() // ignore creating new window if already exists if (threadDictionary['com.datapopulator.sketch.ui.window']) return resolve() // create window let windowWidth = 868 let windowHeight = 680 + 22 let webWindow = NSWindow.alloc().init() webWindow.setFrame_display(NSMakeRect(0, 0, windowWidth, windowHeight), true) // keep reference to the window threadDictionary['com.datapopulator.sketch.ui.window'] = webWindow // create web view let webView = WebView.alloc().initWithFrame(NSMakeRect(0, -22, windowWidth, windowHeight)) threadDictionary['com.datapopulator.sketch.ui.web'] = webView webWindow.contentView().addSubview(webView) // listen for webview delegate method calls let webViewDelegate = new MochaJSDelegate({ 'webView:didFinishLoadForFrame:': function (webView, webFrame) { resolve() }, 'webView:didChangeLocationWithinPageForFrame:': function (webView, webFrame) { // get data from hash let windowObject = webView.windowScriptObject() let encodedResponse = windowObject.evaluateWebScript('window.location.hash').substring(1) // reset hash to 'waiting' to enable further communication if (encodedResponse === 'waiting') return windowObject.evaluateWebScript('window.location.hash="waiting"') // get response from UI let response = Utils.decode(encodedResponse) // shows window if (response.handler === 'ready') { NSApp.beginSheet_modalForWindow_modalDelegate_didEndSelector_contextInfo(webWindow, Context().document.window(), null, null, null) } // just hide window else if (response.handler === 'cancel') { hideWindow() } // confirmation // hides window and returns response else if (response.handler === 'confirm') { hideWindow(response.data) } // ui handler call response else if (response.handler === 'resolveCall') { let callResolve = callResolves[response.callId] if (callResolve) { callResolve(response.data) delete callResolves[response.callId] destroyWindow() } } // forward to handlers else { let handler = Handlers[response.handler] if (handler) { handler((uiHandler, data) => { let encodedData = Utils.encode(data) windowObject.evaluateWebScript(`window.callHandler('${uiHandler}', '${encodedData}')`) }, response.data) } } } }) // load web UI webView.setFrameLoadDelegate_(webViewDelegate.getClassInstance()) webView.setMainFrameURL_(Context().plugin.urlForResourceNamed('ui/index.html').path()) }) } export function destroyWindow () { // get thread dictionary let threadDictionary = NSThread.mainThread().threadDictionary() // end async session threadDictionary['com.datapopulator.sketch.ui.window'] = null threadDictionary['com.datapopulator.sketch.ui.web'] = null coscript.setShouldKeepAround(false) }
30.691489
182
0.681456
bb9ccd142129602dee4193049eb76ad36d6d4c74
2,639
js
JavaScript
node_modules/mobx-react-lite/lib/observer.js
gsharma-va/tcs-apis
ece9b01ca2e2404629db8412133d2a68135aaed0
[ "MIT" ]
null
null
null
node_modules/mobx-react-lite/lib/observer.js
gsharma-va/tcs-apis
ece9b01ca2e2404629db8412133d2a68135aaed0
[ "MIT" ]
null
null
null
node_modules/mobx-react-lite/lib/observer.js
gsharma-va/tcs-apis
ece9b01ca2e2404629db8412133d2a68135aaed0
[ "MIT" ]
null
null
null
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(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); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.observer = void 0; var react_1 = require("react"); var staticRendering_1 = require("./staticRendering"); var useObserver_1 = require("./useObserver"); // n.b. base case is not used for actual typings or exported in the typing files function observer(baseComponent, options) { // The working of observer is explained step by step in this talk: https://www.youtube.com/watch?v=cPF4iBedoF0&feature=youtu.be&t=1307 if (staticRendering_1.isUsingStaticRendering()) { return baseComponent; } var realOptions = __assign({ forwardRef: false }, options); var baseComponentName = baseComponent.displayName || baseComponent.name; var wrappedComponent = function (props, ref) { return useObserver_1.useObserver(function () { return baseComponent(props, ref); }, baseComponentName); }; wrappedComponent.displayName = baseComponentName; // memo; we are not interested in deep updates // in props; we assume that if deep objects are changed, // this is in observables, which would have been tracked anyway var memoComponent; if (realOptions.forwardRef) { // we have to use forwardRef here because: // 1. it cannot go before memo, only after it // 2. forwardRef converts the function into an actual component, so we can't let the baseComponent do it // since it wouldn't be a callable function anymore memoComponent = react_1.memo(react_1.forwardRef(wrappedComponent)); } else { memoComponent = react_1.memo(wrappedComponent); } copyStaticProperties(baseComponent, memoComponent); memoComponent.displayName = baseComponentName; return memoComponent; } exports.observer = observer; // based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js var hoistBlackList = { $$typeof: true, render: true, compare: true, type: true }; function copyStaticProperties(base, target) { Object.keys(base).forEach(function (key) { if (!hoistBlackList[key]) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key)); } }); } //# sourceMappingURL=observer.js.map
41.888889
138
0.676393
bb9cf0106753c5f6e4a911f37dc0969532203375
5,827
js
JavaScript
test/index.js
nishtacular/querymen
e5abdd6bfa0e7e12679ca27a51e31c220ab44390
[ "MIT" ]
139
2016-05-05T01:22:50.000Z
2022-03-21T16:52:18.000Z
test/index.js
nishtacular/querymen
e5abdd6bfa0e7e12679ca27a51e31c220ab44390
[ "MIT" ]
56
2016-05-05T01:32:00.000Z
2021-12-10T12:03:48.000Z
test/index.js
diegohaz/menquery
d420dbe72ec900cd9665e4aa2cc39b7d79ccefaa
[ "MIT" ]
33
2017-07-03T10:08:45.000Z
2022-02-04T08:29:43.000Z
import request from 'supertest' import express from 'express' import mongoose from 'mongoose' import test from 'tape' import querymen from '../src' import './querymen-param' import './querymen-schema' mongoose.connect('mongodb://localhost/querymen-test') const entitySchema = mongoose.Schema({}) const testSchema = mongoose.Schema({ title: String, entity: { type: mongoose.Schema.ObjectId, ref: 'Entity' }, createdAt: { type: Date, default: Date.now }, location: { type: [Number], index: '2d' } }) const Entity = mongoose.model('Entity', entitySchema) const Test = mongoose.model('Test', testSchema) const route = (...args) => { const app = express() app.get('/tests', querymen.middleware(...args), (req, res) => { Test.find(req.querymen.query, req.querymen.select, req.querymen.cursor).then((items) => { res.status(200).json(items) }).catch((err) => { res.status(500).send(err) }) }) app.use(querymen.errorHandler()) return app } test('Prototype pollution', (t) => { const { toString } = {} querymen.handler('__proto__', 'toString', 'JHU') t.ok({}.toString === toString, 'should not be vulnerable to prototype pollution') querymen.handler('formatters', '__proto__', { toString: 'JHU' }) t.ok({}.toString === toString, 'should not be vulnerable to prototype pollution') querymen.handler('validators', '__proto__', { toString: 'JHU' }) t.ok({}.toString === toString, 'should not be vulnerable to prototype pollution') t.end() }) test('Querymen handler', (t) => { t.notOk(querymen.parser('testParser'), 'should not get nonexistent parser') t.notOk(querymen.formatter('testFormatter'), 'should not get nonexistent formatter') t.notOk(querymen.validator('testValidator'), 'should not get nonexistent validator') querymen.parser('testParser', () => 'test') querymen.formatter('testFormatter', () => 'test') querymen.validator('testValidator', () => ({valid: false})) t.ok(querymen.parser('testParser'), 'should get parser') t.ok(querymen.formatter('testFormatter'), 'should get formatter') t.ok(querymen.validator('testValidator'), 'should get validator') let schema = new querymen.Schema({test: String}) t.ok(schema.parser('testParser'), 'should get parser in schema') t.ok(schema.formatter('testFormatter'), 'should get formatter in schema') t.ok(schema.validator('testValidator'), 'should get validator in schema') t.ok(schema.param('test').parser('testParser'), 'should get parser in param') t.ok(schema.param('test').formatter('testFormatter'), 'should get formatter in param') t.ok(schema.param('test').validator('testValidator'), 'should get validator in param') t.end() }) test('Querymen middleware', (t) => { t.plan(12) Test.remove({}).then(() => { return Entity.create({}) }).then((entity) => { return Test.create( {title: 'Test', entity, createdAt: new Date('2016-04-25T10:05'), location: [-44.1, -22.0]}, {title: 'Example', createdAt: new Date('2016-04-24T10:05'), location: [-44.3, -22.0]}, {title: 'Spaced test', createdAt: new Date('2016-04-23T10:05'), location: [-44.2, -22.0]}, {title: 'nice!', createdAt: new Date('2016-04-22T10:05'), location: [-44.4, -22.0]} ) }).then((test1) => { let app = route({ entity: testSchema.tree.entity }) request(app) .get('/tests') .query({entity: test1.entity.id}) .expect(200) .end((err, res) => { if (err) throw err t.equal(res.body.length, 1, 'should respond to id filter') }) request(app) .get('/tests') .query({page: 50}) .expect(400) .end((err, res) => { if (err) throw err t.equal(res.body.param, 'page', 'should respond with error object') }) request(app) .get('/tests') .expect(200) .end((err, res) => { if (err) throw err t.equal(res.body.length, 4, 'should respond with 4 items') }) request(app) .get('/tests') .query({fields: 'title,-id'}) .expect(200) .end((err, res) => { if (err) throw err t.equal(res.body.length, 4, 'should respond with 4 items') t.true(res.body[0].title, 'should have title property') t.false(res.body[0]._id, 'should not have _id property') t.false(res.body[0].createdAt, 'should not have createdAt property') }) request(route(new querymen.Schema({ before: { type: Date, operator: '$lte', paths: ['createdAt'] }, after: { type: Date, operator: '$gte', paths: ['createdAt'] } }))) .get('/tests') .query({before: '2016-04-23T10:00', after: '2016-04-22T10:00'}) .expect(200) .end((err, res) => { if (err) throw err t.equal(res.body.length, 1, 'should respond with 1 item') t.equal(res.body[0].title, 'nice!', 'should respond with item after and before date') }) request(route(new querymen.Schema({ after: { type: Date, operator: '$gte', paths: ['createdAt'] } }))) .get('/tests') .query({after: '2016-04-25T10:00'}) .expect(200) .end((err, res) => { if (err) throw err t.equal(res.body.length, 1, 'should respond with 1 item') t.equal(res.body[0].title, 'Test', 'should respond with item after date') }) request(route(new querymen.Schema({ near: { geojson: false } }, {near: true}))) .get('/tests') .query({near: '-22.0,-44.0'}) .expect(200) .end((err, res) => { if (err) throw err t.equal(res.body[1].title, 'Spaced test', 'should respond with item near') }) }) }) test.onFinish(() => { mongoose.disconnect() })
29.729592
97
0.597391
bb9d7c7144f99a28ebca87a9c0722020eaf9c712
712
js
JavaScript
commands/help.js
Fchen48/Fchen-s-DiscordJS-Bot-Framework
7938bd3470e33470ef476ae1414d1c4566121c9e
[ "MIT" ]
null
null
null
commands/help.js
Fchen48/Fchen-s-DiscordJS-Bot-Framework
7938bd3470e33470ef476ae1414d1c4566121c9e
[ "MIT" ]
null
null
null
commands/help.js
Fchen48/Fchen-s-DiscordJS-Bot-Framework
7938bd3470e33470ef476ae1414d1c4566121c9e
[ "MIT" ]
1
2018-11-03T15:51:32.000Z
2018-11-03T15:51:32.000Z
const Discord = require("discord.js"); const locale = require("../functions/locale"); // eslint-disable-next-line max-params, no-unused-vars module.exports = (client, message, args, command, argresult, guild) => { const embed = new Discord.MessageEmbed() .setTitle(locale.default().helpTitle) .setDescription(locale.default().helpDesc) .addField(locale.prefix() + locale.default().commandHelp, locale.default().commandHelpDesc) .setColor(locale.default().infoColor) .setFooter(locale.default().botName); message.channel.send({ embed }); // Sending the helppage to the current channel // message.author.send({ embed }); // Sending the helppage to the user via private message };
44.5
95
0.713483
bb9d8741bffe620871adbc8394271e51c722b226
4,721
js
JavaScript
plugins/eslint-plugin-liferay-portal/lib/rules/no-react-dom-render.js
carmenbianca/eslint-config-liferay
d4ce591ae319e2ace26225920dc0f00a59dc2a21
[ "MIT" ]
null
null
null
plugins/eslint-plugin-liferay-portal/lib/rules/no-react-dom-render.js
carmenbianca/eslint-config-liferay
d4ce591ae319e2ace26225920dc0f00a59dc2a21
[ "MIT" ]
null
null
null
plugins/eslint-plugin-liferay-portal/lib/rules/no-react-dom-render.js
carmenbianca/eslint-config-liferay
d4ce591ae319e2ace26225920dc0f00a59dc2a21
[ "MIT" ]
null
null
null
/** * SPDX-FileCopyrightText: © 2017 Liferay, Inc. <https://liferay.com> * SPDX-License-Identifier: MIT */ /* eslint-disable no-for-of-loops/no-for-of-loops */ const DESCRIPTION = 'Direct use of ReactDOM.render is discouraged; instead, use ' + 'the <react:component /> JSP taglib, or do: ' + `import {render} from 'frontend-js-react-web';`; module.exports = { create(context) { const isReactDOMImport = node => { const ancestors = context.getAncestors(node); const parent = ancestors[ancestors.length - 1]; return ( parent.type === 'ImportDeclaration' && parent.source.type === 'Literal' && parent.source.value === 'react-dom' ); }; // Returns true if `identifier` actually refers to // `variable`, by walking up the scope stack. const isSame = (identifier, variable) => { const name = variable.name; let scope = context.getScope(identifier); while (scope) { for (let i = 0; i < scope.variables.length; i++) { if (scope.variables[i] === variable) { return true; } else if (scope.variables[i].name === name) { // Variable is shadowed, so it is not the same. return false; } } scope = scope.upper; } }; const report = node => context.report({ messageId: 'noReactDOMRender', node, }); const foundBindings = new Set(); const foundNamespaces = new Set(); const add = (set, iterable) => { for (const item of iterable) { set.add(item); } }; return { CallExpression(node) { if ( node.callee.type === 'MemberExpression' && node.callee.object.type === 'Identifier' ) { // eg. Foo.bar() for (const namespace of foundNamespaces) { if ( node.callee.object.name === namespace.name && node.callee.property.type === 'Identifier' && node.callee.property.name === 'render' ) { // eg. Foo.render() if (isSame(node.callee.object, namespace)) { // "Foo" came from react-dom. report(node); } } } } else if (node.callee.type === 'Identifier') { // eg. something() for (const binding of foundBindings) { if (node.callee.name === binding.name) { // "something" came from react-dom. if (isSame(node, binding)) { report(node); } } } } }, /** * Check for: * * import X from 'react-dom' */ ImportDefaultSpecifier(node) { if (isReactDOMImport(node)) { add(foundNamespaces, context.getDeclaredVariables(node)); } }, /** * Check for: * * import * as X from 'react-dom' */ ImportNamespaceSpecifier(node) { if (isReactDOMImport(node)) { add(foundNamespaces, context.getDeclaredVariables(node)); } }, /** * Check for: * * import {x} from 'react-dom'; * import {x as y} from 'react-dom'; */ ImportSpecifier(node) { if (isReactDOMImport(node)) { add( foundBindings, context.getDeclaredVariables(node).filter(variable => { return ( variable.defs[0] && variable.defs[0].node && variable.defs[0].node.imported && variable.defs[0].node.imported.name === 'render' ); }) ); } }, VariableDeclarator(node) { if ( node.init && node.init.type === 'CallExpression' && node.init.callee.type === 'Identifier' && node.init.callee.name === 'require' && node.init.arguments.length > 0 && node.init.arguments[0].type === 'Literal' && node.init.arguments[0].value === 'react-dom' ) { const variables = context.getDeclaredVariables(node); if (node.id.type === 'Identifier') { // eg. const x = require('react-dom'); add(foundNamespaces, variables); } else if (node.id.type === 'ObjectPattern') { // eg. const {render} = require('react-dom'); // eg. const {render: x} = require('react-dom'); add( foundBindings, context .getDeclaredVariables(node) .filter(variable => { return ( variable.references[0] && variable.references[0].identifier && variable.references[0].identifier .parent && variable.references[0].identifier.parent .key && variable.references[0].identifier.parent .key.name === 'render' ); }) ); } } }, }; }, meta: { docs: { category: 'Best Practices', description: DESCRIPTION, recommended: false, url: 'https://issues.liferay.com/browse/LPS-99399', }, fixable: null, messages: { noReactDOMRender: DESCRIPTION, }, schema: [], type: 'problem', }, };
24.46114
69
0.565346
bb9dfa3a0cc083d90a6b6fcbbfd29896459f78e1
849
js
JavaScript
node_modules/@devery/devery/utils/simpleWeb3Promisifier.js
blockchain-doppelganger/test
3875f25f1337641776036479ba34ca94b3ecba52
[ "MIT" ]
12
2018-10-02T06:19:40.000Z
2021-06-01T11:05:57.000Z
node_modules/@devery/devery/utils/simpleWeb3Promisifier.js
blockchain-doppelganger/test
3875f25f1337641776036479ba34ca94b3ecba52
[ "MIT" ]
28
2018-10-06T11:02:33.000Z
2022-02-11T23:24:33.000Z
node_modules/@devery/devery/utils/simpleWeb3Promisifier.js
blockchain-doppelganger/test
3875f25f1337641776036479ba34ca94b3ecba52
[ "MIT" ]
11
2018-10-03T20:35:28.000Z
2021-11-05T13:35:34.000Z
// simple proxy to promisify the web3 api. It doesn't deal with edge cases like web3.eth.filter and contracts. const promisify = (inner) => new Promise((resolve, reject) => inner((err, res) => { if (err) { reject(err) } resolve(res); }) ); const proxiedWeb3Handler = { // override getter get: (target, name) => { const inner = target[name]; if (inner instanceof Function) { // Return a function with the callback already set. return (...args) => promisify(cb => inner(...args, cb)); } else if (typeof inner === 'object') { // wrap inner web3 stuff return new Proxy(inner, proxiedWeb3Handler); } else { return inner; } }, }; export default (web3) => new Proxy(web3, proxiedWeb3Handler);
30.321429
110
0.553592
bb9dfd8f7353d4b0c3377d66e13fabda5d36f324
385
js
JavaScript
client/src/utils/queries.js
mevaldovi/Book-Search-Engine
81233c9a743f0e30c7a8e3d0b9f44229ea7d70b7
[ "Info-ZIP" ]
null
null
null
client/src/utils/queries.js
mevaldovi/Book-Search-Engine
81233c9a743f0e30c7a8e3d0b9f44229ea7d70b7
[ "Info-ZIP" ]
null
null
null
client/src/utils/queries.js
mevaldovi/Book-Search-Engine
81233c9a743f0e30c7a8e3d0b9f44229ea7d70b7
[ "Info-ZIP" ]
null
null
null
import { gql } from "@apollo/client"; //ok done but don't I also need to make the other six query/mutation requests pulled fotm typeDefs??? Confused. export const GET_ME = gql` query me { me { _id username email bookCount savedBooks { bookId authors title description image link } } } `;
17.5
111
0.553247
bb9f01e4693698a35ccf5f8b157a0ccfa2401592
3,587
js
JavaScript
src/window-screenshot/paper/paper-brush/text.paper-brush-state.js
Pratnomenis/znyatok
7d6929e866e85b583d4bdb436ea610dc36ce9e77
[ "MIT" ]
1
2021-01-17T04:48:07.000Z
2021-01-17T04:48:07.000Z
src/window-screenshot/paper/paper-brush/text.paper-brush-state.js
Pratnomenis/znyatok
7d6929e866e85b583d4bdb436ea610dc36ce9e77
[ "MIT" ]
1
2021-07-17T14:51:14.000Z
2021-09-05T08:56:43.000Z
src/window-screenshot/paper/paper-brush/text.paper-brush-state.js
Pratnomenis/znyatok
7d6929e866e85b583d4bdb436ea610dc36ce9e77
[ "MIT" ]
null
null
null
import { PaperBrushState } from "./paper-brush-state.js"; import { paper } from '../../paper/paper.js'; import { shot } from '../../shot/shot.js'; import { textInputDOM } from '../../dom-mediator/text-input-dom.js'; export const textType = { 1: { size: 10, offsetY: 4, shadowOffset: 1, shadowBlur: 0 }, 2: { size: 14, offsetY: 5, shadowOffset: 1, shadowBlur: 0 }, 3: { size: 18, offsetY: 6, shadowOffset: 1, shadowBlur: 1 }, 4: { size: 24, offsetY: 8, shadowOffset: 1, shadowBlur: 1 }, 5: { size: 36, offsetY: 12, shadowOffset: 2, shadowBlur: 1 }, 6: { size: 48, offsetY: 17, shadowOffset: 2, shadowBlur: 1 }, 7: { size: 64, offsetY: 22, shadowOffset: 2, shadowBlur: 2 }, 8: { size: 72, offsetY: 25, shadowOffset: 2, shadowBlur: 2 }, 9: { size: 96, offsetY: 33, shadowOffset: 2, shadowBlur: 2 } } export class TextPaperBrushState extends PaperBrushState { constructor() { super(Object.keys(textType)); textInputDOM.setColor(this.color); textInputDOM.setFontSize(textType[this.type]); textInputDOM.clear(); textInputDOM.visible = false; } // Override of PaperBrushState setColor(newColor) { this.color = newColor; textInputDOM.setColor(newColor); textInputDOM.placeCaretAtEnd(); } // Override of PaperBrushState setType(newType) { this.type = Number(newType); textInputDOM.setFontSize(textType[newType]); textInputDOM.placeCaretAtEnd(); } async processMouseDown(data) { if (!textInputDOM.movingInProgress) { const { startCanvasX, startCanvasY, canvasWidth, canvasHeight } = data; await this.drawText(); textInputDOM.visible = false; textInputDOM.clear(); shot.resetUndo(); if (startCanvasX > 0 && startCanvasX < canvasWidth && startCanvasY > 0 && startCanvasY < canvasHeight) { paper.clearCtx(); textInputDOM.visible = true; textInputDOM.setPosition(startCanvasX, startCanvasY, canvasWidth, canvasHeight); shot.setUndoTo(this.ctrlZ.bind(this)); } } } processMouseMove(data) { const { startCanvasX, startCanvasY, distanceX, distanceY, canvasWidth, canvasHeight } = data; textInputDOM.setPosition(startCanvasX + distanceX, startCanvasY + distanceY, canvasWidth, canvasHeight); } processMouseUp(_) { textInputDOM.stopMoving(); textInputDOM.placeCaretAtEnd(); } async drawText() { const value = textInputDOM.value; if (value) { const { x, y, width } = textInputDOM.getPosition(); const ctx = paper.canvasContext; const font = textType[this.type]; const realY = y + font.offsetY; paper.clearCtx(); ctx.save(); ctx.fillStyle = this.color; ctx.font = `${font.size}px sans-serif`; ctx.shadowBlur = font.shadowBlur; ctx.shadowOffsetX = font.shadowOffset; ctx.shadowOffsetY = font.shadowOffset; ctx.shadowColor = textInputDOM.shadowColor; ctx.fillText(value, x, realY, width); await shot.takeShot(); paper.clearCtx(); ctx.restore(); } } ctrlZ() { textInputDOM.visible = false; textInputDOM.clear(); shot.resetUndo(); } async deactivate() { await this.drawText(); textInputDOM.clear(); textInputDOM.visible = false; textInputDOM.stopMoving(); shot.resetUndo(); } }
20.151685
110
0.605241
bb9f75b8ed31c36e3470f23b5d13f13e4d3dd1e6
31,072
js
JavaScript
node_modules/vuejs-datatable/examples/ajax/build/app.js
BaiMaoLi/Brian
e876abbe78a014debaa0340c09da79578fb2e9d8
[ "MIT" ]
2
2019-08-21T12:12:24.000Z
2021-06-12T23:22:26.000Z
node_modules/vuejs-datatable/examples/ajax/build/app.js
BaiMaoLi/Brian
e876abbe78a014debaa0340c09da79578fb2e9d8
[ "MIT" ]
2
2020-07-17T10:27:01.000Z
2021-05-09T08:46:09.000Z
node_modules/vuejs-datatable/examples/ajax/build/app.js
thel5coder/jumbara9jatim
9cb85119b505dd19ac486b81bdffa21e989a62fc
[ "MIT" ]
null
null
null
!function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}};function n(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var r=Object.prototype.toString;function s(e){return"[object Array]"===r.call(e)}function i(e){return null!==e&&"object"==typeof e}function o(e){return"[object Function]"===r.call(e)}function a(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),s(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var l={isArray:s,isArrayBuffer:function(e){return"[object ArrayBuffer]"===r.call(e)},isBuffer:function(e){return null!=e&&(n(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&n(e.slice(0,0))}(e)||!!e._isBuffer)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:i,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===r.call(e)},isFile:function(e){return"[object File]"===r.call(e)},isBlob:function(e){return"[object Blob]"===r.call(e)},isFunction:o,isStream:function(e){return i(e)&&o(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:a,merge:function e(){var t={};function n(n,r){"object"==typeof t[r]&&"object"==typeof n?t[r]=e(t[r],n):t[r]=n}for(var r=0,s=arguments.length;r<s;r++)a(arguments[r],n);return t},extend:function(e,n,r){return a(n,function(n,s){e[s]=r&&"function"==typeof n?t(n,r):n}),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},u="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function c(){throw new Error("setTimeout has not been defined")}function d(){throw new Error("clearTimeout has not been defined")}var f=c,p=d;function h(e){if(f===setTimeout)return setTimeout(e,0);if((f===c||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}"function"==typeof u.setTimeout&&(f=setTimeout),"function"==typeof u.clearTimeout&&(p=clearTimeout);var g,m=[],b=!1,y=-1;function _(){b&&g&&(b=!1,g.length?m=g.concat(m):y=-1,m.length&&v())}function v(){if(!b){var e=h(_);b=!0;for(var t=m.length;t;){for(g=m,m=[];++y<t;)g&&g[y].run();y=-1,t=m.length}g=null,b=!1,function(e){if(p===clearTimeout)return clearTimeout(e);if((p===d||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(e);try{p(e)}catch(t){try{return p.call(null,e)}catch(t){return p.call(this,e)}}}(e)}}function w(e,t){this.fun=e,this.array=t}w.prototype.run=function(){this.fun.apply(null,this.array)};function R(){}var C=R,A=R,S=R,T=R,j=R,P=R,E=R;var x=u.performance||{},N=x.now||x.mozNow||x.msNow||x.oNow||x.webkitNow||function(){return(new Date).getTime()};var F=new Date;var O={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new w(e,t)),1!==m.length||b||h(v)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:C,addListener:A,once:S,off:T,removeListener:j,removeAllListeners:P,emit:E,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*N.call(x),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-F)/1e3}},k=function(e,t,n,r,s){return function(e,t,n,r,s){return e.config=t,n&&(e.code=n),e.request=r,e.response=s,e}(new Error(e),t,n,r,s)};function D(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var B=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],H=l.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=l.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function $(){this.message="String contains an invalid character"}$.prototype=new Error,$.prototype.code=5,$.prototype.name="InvalidCharacterError";var q=function(e){for(var t,n,r=String(e),s="",i=0,o=L;r.charAt(0|i)||(o="=",i%1);s+=o.charAt(63&t>>8-i%1*8)){if((n=r.charCodeAt(i+=.75))>255)throw new $;t=t<<8|n}return s},U=l.isStandardBrowserEnv()?{write:function(e,t,n,r,s,i){var o=[];o.push(e+"="+encodeURIComponent(t)),l.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),l.isString(r)&&o.push("path="+r),l.isString(s)&&o.push("domain="+s),!0===i&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},I="undefined"!=typeof window&&window.btoa&&window.btoa.bind(window)||q,z=function(e){return new Promise(function(t,n){var r=e.data,s=e.headers;l.isFormData(r)&&delete s["Content-Type"];var i=new XMLHttpRequest,o="onreadystatechange",a=!1;if("test"===O.env.NODE_ENV||"undefined"==typeof window||!window.XDomainRequest||"withCredentials"in i||H(e.url)||(i=new window.XDomainRequest,o="onload",a=!0,i.onprogress=function(){},i.ontimeout=function(){}),e.auth){var u=e.auth.username||"",c=e.auth.password||"";s.Authorization="Basic "+I(u+":"+c)}if(i.open(e.method.toUpperCase(),function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(l.isURLSearchParams(t))r=t.toString();else{var s=[];l.forEach(t,function(e,t){null!=e&&(l.isArray(e)?t+="[]":e=[e],l.forEach(e,function(e){l.isDate(e)?e=e.toISOString():l.isObject(e)&&(e=JSON.stringify(e)),s.push(D(t)+"="+D(e))}))}),r=s.join("&")}return r&&(e+=(-1===e.indexOf("?")?"?":"&")+r),e}(e.url,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i[o]=function(){if(i&&(4===i.readyState||a)&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var r,s,o,u,c,d="getAllResponseHeaders"in i?(r=i.getAllResponseHeaders(),c={},r?(l.forEach(r.split("\n"),function(e){if(u=e.indexOf(":"),s=l.trim(e.substr(0,u)).toLowerCase(),o=l.trim(e.substr(u+1)),s){if(c[s]&&B.indexOf(s)>=0)return;c[s]="set-cookie"===s?(c[s]?c[s]:[]).concat([o]):c[s]?c[s]+", "+o:o}}),c):c):null,f={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:1223===i.status?204:i.status,statusText:1223===i.status?"No Content":i.statusText,headers:d,config:e,request:i};!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(k("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,f),i=null}},i.onerror=function(){n(k("Network Error",e,null,i)),i=null},i.ontimeout=function(){n(k("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",i)),i=null},l.isStandardBrowserEnv()){var d=U,f=(e.withCredentials||H(e.url))&&e.xsrfCookieName?d.read(e.xsrfCookieName):void 0;f&&(s[e.xsrfHeaderName]=f)}if("setRequestHeader"in i&&l.forEach(s,function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete s[t]:i.setRequestHeader(t,e)}),e.withCredentials&&(i.withCredentials=!0),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(e){i&&(i.abort(),n(e),i=null)}),void 0===r&&(r=null),i.send(r)})},M={"Content-Type":"application/x-www-form-urlencoded"};function V(e,t){!l.isUndefined(e)&&l.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var X,J={adapter:("undefined"!=typeof XMLHttpRequest?X=z:void 0!==O&&(X=z),X),transformRequest:[function(e,t){return function(e,t){l.forEach(e,function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])})}(t,"Content-Type"),l.isFormData(e)||l.isArrayBuffer(e)||l.isBuffer(e)||l.isStream(e)||l.isFile(e)||l.isBlob(e)?e:l.isArrayBufferView(e)?e.buffer:l.isURLSearchParams(e)?(V(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):l.isObject(e)?(V(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};J.headers={common:{Accept:"application/json, text/plain, */*"}},l.forEach(["delete","get","head"],function(e){J.headers[e]={}}),l.forEach(["post","put","patch"],function(e){J.headers[e]=l.merge(M)});var K=J;function G(){this.handlers=[]}G.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},G.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},G.prototype.forEach=function(e){l.forEach(this.handlers,function(t){null!==t&&e(t)})};var Q=G,W=function(e,t,n){return l.forEach(n,function(n){e=n(e,t)}),e},Y=function(e){return!(!e||!e.__CANCEL__)};function Z(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var ee=function(e){var t,n,r;return Z(e),e.baseURL&&(r=e.url,!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(r))&&(e.url=(t=e.baseURL,(n=e.url)?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t)),e.headers=e.headers||{},e.data=W(e.data,e.headers,e.transformRequest),e.headers=l.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),l.forEach(["delete","get","head","post","put","patch","common"],function(t){delete e.headers[t]}),(e.adapter||K.adapter)(e).then(function(t){return Z(e),t.data=W(t.data,t.headers,e.transformResponse),t},function(t){return Y(t)||(Z(e),t&&t.response&&(t.response.data=W(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)})};function te(e){this.defaults=e,this.interceptors={request:new Q,response:new Q}}te.prototype.request=function(e){"string"==typeof e&&(e=l.merge({url:arguments[0]},arguments[1])),(e=l.merge(K,{method:"get"},this.defaults,e)).method=e.method.toLowerCase();var t=[ee,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach(function(e){t.unshift(e.fulfilled,e.rejected)}),this.interceptors.response.forEach(function(e){t.push(e.fulfilled,e.rejected)});t.length;)n=n.then(t.shift(),t.shift());return n},l.forEach(["delete","get","head","options"],function(e){te.prototype[e]=function(t,n){return this.request(l.merge(n||{},{method:e,url:t}))}}),l.forEach(["post","put","patch"],function(e){te.prototype[e]=function(t,n,r){return this.request(l.merge(r||{},{method:e,url:t,data:n}))}});var ne=te;function re(e){this.message=e}re.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},re.prototype.__CANCEL__=!0;var se=re;function ie(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(e){t=e});var n=this;e(function(e){n.reason||(n.reason=new se(e),t(n.reason))})}ie.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ie.source=function(){var e;return{token:new ie(function(t){e=t}),cancel:e}};var oe=ie;function ae(e){var n=new ne(e),r=t(ne.prototype.request,n);return l.extend(r,ne.prototype,n),l.extend(r,n),r}var le=ae(K);le.Axios=ne,le.create=function(e){return ae(l.merge(K,e))},le.Cancel=se,le.CancelToken=oe,le.isCancel=Y,le.all=function(e){return Promise.all(e)},le.spread=function(e){return function(t){return e.apply(null,t)}};var ue=le,ce=le;ue.default=ce;var de=ue.get;"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;var fe,pe=(function(e){e.exports=function(){var e=Object.prototype.toString;function t(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function n(e){if(!e)return!0;if(s(e)&&0===e.length)return!0;if("string"!=typeof e){for(var n in e)if(t(e,n))return!1;return!0}return!1}function r(t){return e.call(t)}var s=Array.isArray||function(t){return"[object Array]"===e.call(t)};function i(e){var t=parseInt(e);return t.toString()===e?t:e}function o(e){e=e||{};var o=function(e){return Object.keys(o).reduce(function(t,n){return"create"===n?t:("function"==typeof o[n]&&(t[n]=o[n].bind(o,e)),t)},{})};function a(n,r){return e.includeInheritedProps||"number"==typeof r&&Array.isArray(n)||t(n,r)}function l(e,t){if(a(e,t))return e[t]}function u(e,t,n,r){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if("string"==typeof t)return u(e,t.split(".").map(i),n,r);var s=t[0],o=l(e,s);return 1===t.length?(void 0!==o&&r||(e[s]=n),o):(void 0===o&&("number"==typeof t[1]?e[s]=[]:e[s]={}),u(e[s],t.slice(1),n,r))}return o.has=function(n,r){if("number"==typeof r?r=[r]:"string"==typeof r&&(r=r.split(".")),!r||0===r.length)return!!n;for(var o=0;o<r.length;o++){var a=i(r[o]);if(!("number"==typeof a&&s(n)&&a<n.length||(e.includeInheritedProps?a in Object(n):t(n,a))))return!1;n=n[a]}return!0},o.ensureExists=function(e,t,n){return u(e,t,n,!0)},o.set=function(e,t,n,r){return u(e,t,n,r)},o.insert=function(e,t,n,r){var i=o.get(e,t);r=~~r,s(i)||(i=[],o.set(e,t,i)),i.splice(r,0,n)},o.empty=function(e,t){var i,l;if(!n(t)&&null!=e&&(i=o.get(e,t))){if("string"==typeof i)return o.set(e,t,"");if(function(e){return"boolean"==typeof e||"[object Boolean]"===r(e)}(i))return o.set(e,t,!1);if("number"==typeof i)return o.set(e,t,0);if(s(i))i.length=0;else{if(!function(e){return"object"==typeof e&&"[object Object]"===r(e)}(i))return o.set(e,t,null);for(l in i)a(i,l)&&delete i[l]}}},o.push=function(e,t){var n=o.get(e,t);s(n)||(n=[],o.set(e,t,n)),n.push.apply(n,Array.prototype.slice.call(arguments,2))},o.coalesce=function(e,t,n){for(var r,s=0,i=t.length;s<i;s++)if(void 0!==(r=o.get(e,t[s])))return r;return n},o.get=function(e,t,n){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return n;if("string"==typeof t)return o.get(e,t.split("."),n);var r=i(t[0]),s=l(e,r);return void 0===s?n:1===t.length?s:o.get(e[r],t.slice(1),n)},o.del=function(e,t){if("number"==typeof t&&(t=[t]),null==e)return e;if(n(t))return e;if("string"==typeof t)return o.del(e,t.split("."));var r=i(t[0]);return a(e,r)?1!==t.length?o.del(e[r],t.slice(1)):(s(e)?e.splice(r,1):delete e[r],e):e},o}var a=o();return a.create=o,a.withInheritedProps=o({includeInheritedProps:!0}),a}()}(fe={exports:{}},fe.exports),fe.exports),he=pe.get,ge=pe.set;var me=function(e,t,n,r,s,i,o,a){const l=("function"==typeof n?n.options:n)||{};return l.__file="vue-datatable-cell.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,s&&(l.functional=!0)),l._scopeId=r,l}({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("td",{style:{"text-align":e.column.align}},[e.column.component?n(e.column.component,{tag:"component",attrs:{row:e.row,column:e.column}}):e.column.interpolate?n("span",{domProps:{innerHTML:e._s(e.content)}}):n("span",[e._v(e._s(e.content))])],1)},staticRenderFns:[]},0,{props:{column:[Object,Array],row:[Object,Array]},computed:{content(){return this.column.getRepresentation(this.row)}}},void 0,!1);var be=function(e,t,n,r,s,i,o,a){const l=("function"==typeof n?n.options:n)||{};return l.__file="vue-datatable-header.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,s&&(l.functional=!0)),l._scopeId=r,l}({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("th",{class:e.column.headerClass,style:{"text-align":e.column.align}},[e.column.headerComponent?n(e.column.headerComponent,{tag:"component",attrs:{column:e.column}}):n("span",[e._v(e._s(e.column.label))]),e._v(" "),e.column.sortable?n("span",{class:e.classes,on:{click:e.toggleSort}}):e._e()],1)},staticRenderFns:[]},0,{props:{model:{prop:"direction",event:"change"},column:[Object,Array],settings:Object,direction:{type:String,default:null}},computed:{canSort(){return this.column.sortable},is_sorted_ascending(){return"asc"===this.direction},is_sorted_descending(){return"desc"===this.direction},is_sorted(){return this.is_sorted_descending||this.is_sorted_ascending},classes(){var e=this.settings.get("table.sorting.classes"),t=e.canSort;return this.canSort?this.is_sorted?(this.is_sorted_ascending&&(t=t.concat(e.sortAsc)),this.is_sorted_descending&&(t=t.concat(e.sortDesc)),this.joinClasses(t)):(t=t.concat(e.sortNone),this.joinClasses(t)):""}},methods:{joinClasses(e){return this.unique(e).join(" ")},toggleSort(){this.direction&&null!==this.direction?"asc"===this.direction?this.$emit("change","desc",this.column):this.$emit("change",null,this.column):this.$emit("change","asc",this.column)},unique(e){var t={};return e.filter(function(e){return!t.hasOwnProperty(e)&&(t[e]=!0)})}}},void 0,!1);class ye{constructor(){this.properties={table:{class:"table table-hover table-striped",row:{classes:[""]},sorting:{classes:{canSort:["sort"],sortNone:["glyphicon","glyphicon-sort"],sortAsc:["glyphicon","glyphicon-sort-by-alphabet"],sortDesc:["glyphicon","glyphicon-sort-by-alphabet-alt"]}}},pager:{classes:{pager:"pagination",li:"",a:"",selected:"active",disabled:"disabled"},icons:{previous:"&lt;",next:"&gt;"}}}}get(e){return he(this.properties,e)}set(e,t){return ge(this.properties,e,t),this}merge(e){return this.properties=this._mergeObjects(this.properties,e),this}_mergeObjects(e,t){for(var n in t)null!==t[n]?"object"!=typeof t[n]?e[n]=t[n]:e[n]=this._mergeObjects(e[n],t[n]):e[n]=t[n];return e}}var _e=function(e,t,n,r,s,i,o,a){const l=("function"==typeof n?n.options:n)||{};return l.__file="vue-datatable-pager-button.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,s&&(l.functional=!0)),l._scopeId=r,l}({render:function(){var e=this.$createElement,t=this._self._c||e;return t("li",{class:this.li_classes},[t("a",{class:this.a_classes,attrs:{href:"javascript: void(0);"},on:{click:this.sendClick}},[this._t("default",[this._v(this._s(this.value))])],2)])},staticRenderFns:[]},0,{props:{disabled:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},value:{type:Number,default:null}},computed:{li_classes(){var e=[];return this.settings.get("pager.classes.li")&&e.push(this.settings.get("pager.classes.li")),this.disabled&&e.push(this.settings.get("pager.classes.disabled")),this.selected&&e.push(this.settings.get("pager.classes.selected")),e.join(" ")},a_classes(){var e=[];return this.settings.get("pager.classes.a")&&e.push(this.settings.get("pager.classes.a")),e.join(" ")},settings(){return this.$parent.settings}},methods:{sendClick(){this.disabled||this.$emit("click",this.value)}}},void 0,!1);class ve{constructor(e){this.setAlignment(e.align),this.label=e.label||"",this.field=e.field||null,this.representedAs=e.representedAs||null,this.component=e.component||null,this.interpolate=e.interpolate||!1,this.headerComponent=e.headerComponent||null,this.sortable=this.isSortable(e),this.filterable=this.isFilterable(e),this.headerClass=e.headerClass||""}setAlignment(e){return e&&"string"==typeof e?"center"===e.toLowerCase()?(this.align="center",this):"right"===e.toLowerCase()?(this.align="right",this):(this.align="left",this):(this.align="left",this)}isFilterable(e){return!(!1===e.filterable||!e.field&&!e.representedAs||this.component&&!this.representedAs&&!this.field)}isSortable(e){return!(!1===e.sortable||!e.field&&!e.representedAs||this.component&&!this.representedAs&&!this.field)}getRepresentation(e){return this.representedAs&&"function"==typeof this.representedAs?this.representedAs(e):this.component&&this.filterable?this.plain_text_function(e,this):he(e,this.field)}getValue(e){return this.getRepresentation(e)}matches(e,t){return-1!==(""+this.getRepresentation(e)).toLowerCase().indexOf(t.toLowerCase())}}var we=function(e,t,n,r,s,i,o,a){const l=("function"==typeof n?n.options:n)||{};return l.__file="vue-datatable.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,s&&(l.functional=!0)),l._scopeId=r,l}({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("table",{class:e.table_class},[n("thead",[n("tr",e._l(e.normalized_columns,function(t,r){return n("datatable-header",{key:r,attrs:{column:t,settings:e.settings,direction:e.getSortDirectionForColumn(t)},on:{change:e.setSortDirectionForColumn}})}))]),e._v(" "),n("tbody",[e._l(e.processed_rows,function(t,r){return e._t("default",[n("tr",{key:r,class:e.getRowClasses(t)},e._l(e.normalized_columns,function(e,r){return n("datatable-cell",{key:r,attrs:{column:e,row:t}})}))],{row:t,columns:e.normalized_columns})}),e._v(" "),0==e.processed_rows.length?n("tr",[n("td",{attrs:{colspan:e.normalized_columns.length}},[e._t("no-results")],2)]):e._e()],2),e._v(" "),e.$slots.footer||e.$scopedSlots.footer?n("tfoot",[e._t("footer",null,{rows:e.processed_rows})],2):e._e()])},staticRenderFns:[]},0,{props:{name:{type:String,default:"default"},columns:[Object,Array],data:[Object,Array,String,Function],filterBy:{type:[String,Array],default:null},rowClasses:{type:[String,Array,Object,Function],default:null}},data:()=>({sort_by:null,sort_dir:null,total_rows:0,page:1,per_page:null,processed_rows:[]}),computed:{rows(){return this.data.slice(0)},settings(){return this.$options.settings},handler(){return this.$options.handler},normalized_columns(){return this.columns.map(function(e){return new ve(e)})},table_class(){return this.settings.get("table.class")}},methods:{getSortDirectionForColumn(e){return this.sort_by!==e?null:this.sort_dir},setSortDirectionForColumn(e,t){this.sort_by=t,this.sort_dir=e},processRows(){if("function"==typeof this.data){let e={filter:this.filterBy,sort_by:this.sort_by?this.sort_by.field:null,sort_dir:this.sort_dir,page_length:this.per_page,page_number:this.page};return void this.data(e,function(e,t){this.setRows(e),this.setTotalRowCount(t)}.bind(this))}let e=this.handler.filterHandler(this.rows,this.filterBy,this.normalized_columns),t=this.handler.sortHandler(e,this.sort_by,this.sort_dir),n=this.handler.paginateHandler(t,this.per_page,this.page);this.handler.displayHandler(n,{filtered_data:e,sorted_data:t,paged_data:n},this.setRows,this.setTotalRowCount)},setRows(e){this.processed_rows=e},setTotalRowCount(e){this.total_rows=e},getRowClasses(e){var t=this.rowClasses;return null===t&&(t=this.settings.get("table.row.classes")),"function"==typeof t?t(e):t}},created(){this.$datatables[this.name]=this,this.$root.$emit("table.ready",this.name),this.$watch(function(){return this.data}.bind(this),this.processRows,{deep:!0}),this.$watch("columns",this.processRows),this.$watch(function(){return this.filterBy+this.per_page+this.page+this.sort_by+this.sort_dir}.bind(this),this.processRows),this.processRows()},handler:null,settings:null},void 0,!1);var Re=function(e,t,n,r,s,i,o,a){const l=("function"==typeof n?n.options:n)||{};return l.__file="vue-datatable-pager.vue",l.render||(l.render=e.render,l.staticRenderFns=e.staticRenderFns,l._compiled=!0,s&&(l.functional=!0)),l._scopeId=r,l}({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.show?n("nav",["abbreviated"===e.type?n("ul",{class:e.pagination_class},[e.page-3>=1?n("datatable-button",{attrs:{value:1},on:{click:e.setPageNum}}):e._e(),e._v(" "),e.page-4>=1?n("datatable-button",{attrs:{disabled:""}},[e._v("...")]):e._e(),e._v(" "),e.page-2>=1?n("datatable-button",{attrs:{value:e.page-2},on:{click:e.setPageNum}}):e._e(),e._v(" "),e.page-1>=1?n("datatable-button",{attrs:{value:e.page-1},on:{click:e.setPageNum}}):e._e(),e._v(" "),n("datatable-button",{attrs:{value:e.page,selected:""}}),e._v(" "),e.page+1<=e.total_pages?n("datatable-button",{attrs:{value:e.page+1},on:{click:e.setPageNum}}):e._e(),e._v(" "),e.page+2<=e.total_pages?n("datatable-button",{attrs:{value:e.page+2},on:{click:e.setPageNum}}):e._e(),e._v(" "),e.page+4<=e.total_pages?n("datatable-button",{attrs:{disabled:""}},[e._v("...")]):e._e(),e._v(" "),e.page+3<=e.total_pages?n("datatable-button",{attrs:{value:e.total_pages},on:{click:e.setPageNum}}):e._e()],1):"long"===e.type?n("ul",{class:e.pagination_class},e._l(e.total_pages,function(t){return n("datatable-button",{key:t,attrs:{value:t,selected:t===e.page},on:{click:e.setPageNum}})})):"short"===e.type?n("ul",{class:e.pagination_class},[n("datatable-button",{attrs:{disabled:e.page-1<1,value:e.page-1},on:{click:e.setPageNum}},[n("span",{domProps:{innerHTML:e._s(e.previous_icon)}})]),e._v(" "),n("datatable-button",{attrs:{value:e.page,selected:""}}),e._v(" "),n("datatable-button",{attrs:{disabled:e.page+1>e.total_pages,value:e.page+1},on:{click:e.setPageNum}},[n("span",{domProps:{innerHTML:e._s(e.next_icon)}})])],1):e._e()]):e._e()},staticRenderFns:[]},0,{model:{prop:"page",event:"change"},props:{table:{type:String,default:"default"},type:{type:String,default:"long"},perPage:{type:Number,default:10},page:{type:Number,default:1}},data:()=>({table_instance:null}),computed:{show(){return this.table_instance&&this.total_rows>0},total_rows(){return this.table_instance?this.table_instance.total_rows:0},pagination_class(){return this.settings.get("pager.classes.pager")},disabled_class(){return this.settings.get("pager.classes.disabled")},previous_link_classes(){return this.page-1<1?this.settings.get("pager.classes.disabled"):""},next_link_classes(){return this.page+1>this.total_pages?this.settings.get("pager.classes.disabled"):""},total_pages(){return this.total_rows>0?Math.ceil(this.total_rows/this.perPage):0},previous_icon(){return this.settings.get("pager.icons.previous")},next_icon(){return this.settings.get("pager.icons.next")},settings(){return this.$options.settings}},methods:{setPageNum(e){this.table_instance.page=e,this.table_instance.per_page=this.perPage,this.$emit("change",e)},getClassForPage(e){return this.page==e?this.settings.get("pager.classes.selected"):""}},watch:{total_rows(){this.page>this.total_pages&&this.setPageNum(this.total_pages)},perPage(){var e=this.page;e>this.total_pages&&(e=this.total_pages),this.setPageNum(e)}},created(){if(this.$datatables[this.table])return this.table_instance=this.$datatables[this.table],void(this.table_instance.per_page=this.perPage);this.$root.$on("table.ready",function(e){e===this.table&&(this.table_instance=this.$datatables[this.table],this.table_instance.per_page=this.perPage)}.bind(this))},settings:null},void 0,!1);class Ce{constructor(){this.filterHandler=this.handleFilter,this.sortHandler=this.handleSort,this.paginateHandler=this.handlePaginate,this.displayHandler=this.handleDisplay}handleFilter(e,t,n){return t?(Array.isArray(t)||(t=[t]),e.filter(function(e){for(var r in t){let i=t[r].split(/\s/),o=!0;for(var s in i)this.rowMatches(e,i[s],n)||(o=!1);if(o)return!0}return!1}.bind(this))):e}rowMatches(e,t,n){for(var r in n)if(n[r].matches(e,t))return!0;return!1}handleSort(e,t,n){return t&&null!==n?e.sort(function(e,r){var s=t.getRepresentation(e),i=t.getRepresentation(r);if(s==i)return 0;var o=s>i?1:-1;return"desc"===n&&(o*=-1),o}):e}handlePaginate(e,t,n){if(!t)return e;n<1&&(n=1);let r=(n-1)*t,s=n*t;return e.slice(r,s)}handleDisplay(e,t,n,r){n(e),r(t.filtered_data.length)}}class Ae{constructor(e){this.id=e,this.handler=new Ce,this.settings=new ye}getId(){return this.id}setFilterHandler(e){return this.handler.filterHandler=e,this}setSortHandler(e){return this.handler.sortHandler=e,this}setPaginateHandler(e){return this.handler.paginateHandler=e,this}setDisplayHandler(e){return this.handler.displayHandler=e,this}setting(e,t){return void 0===t?this.settings.get(e):(this.settings.set(e,t),this)}mergeSettings(e){return this.settings.merge(e),this}getTableDefinition(){let e=this.clone(we);return e.handler=this.handler,e.settings=this.settings,e.name=this.id,e}getPagerDefinition(){let e=this.clone(Re);return e.settings=this.settings,e.name=this.id,e}clone(e){var t;if(null===e||"object"!=typeof e)return e;if(e instanceof Array){t=[];for(var n=0;n<e.length;n++)t[n]=this.clone(e[n]);return t}if(e instanceof Object){for(var r in t={},e)e.hasOwnProperty(r)&&(t[r]=this.clone(e[r]));return t}throw new Error("Unable to copy obj! Its type isn't supported.")}}var Se=new class{constructor(){this.table_types=[],this.use_default_type=!0,this.default_table_settings=new ye}useDefaultType(e){return this.use_default_type=!!e,this}registerTableType(e,t){let n=new Ae(e);return this.table_types.push(n),t&&"function"==typeof t&&t(n),this}install(e){for(var t in e.prototype.$datatables={},e.component("datatable-cell",me),e.component("datatable-header",be),e.component("datatable-button",_e),this.use_default_type&&this.registerTableType("datatable",function(e){e.mergeSettings(this.default_table_settings.properties)}.bind(this)),this.table_types)this.installTableType(this.table_types[t].getId(),this.table_types[t],e)}installTableType(e,t,n){n.component(e,t.getTableDefinition()),n.component(e+"-pager",t.getPagerDefinition())}};Se.registerTableType("ajaxtable",function(e){e.setFilterHandler(function(e,t,n){return-1===e.indexOf("?")&&(e+="?"),t&&(e+="&q="+t),e=e.replace("?&","?")}),e.setSortHandler(function(e,t,n){return t&&n&&(e+="&_sort="+t.field,e+="&_order="+n),e=e.replace("?&","?")}),e.setPaginateHandler(function(e,t,n){return e+="&_page="+n,e=(e+="&_limit="+t).replace("?&","?")}),e.setDisplayHandler(function(e,t,n,r){de(e).then(function(e){let t=1*e.headers["x-total-count"];r(t),n(e.data)})})}),e.use(Se),e.config.debug=!0,e.config.devtools=!0,window.vm=new e({el:".container",data:{filter:"",columns:[{label:"id",field:"id"},{label:"Username",field:"user.username"},{label:"First Name",field:"user.first_name"},{label:"Last Name",field:"user.last_name"},{label:"Email",field:"user.email"},{label:"address",representedAs:function(e){return e.address+"<br />"+e.city+", "+e.state},interpolate:!0,sortable:!1,filterable:!1}],url:"http://localhost:3000/profiles/",page:1}})}(Vue); //# sourceMappingURL=app.js.map
10,357.333333
31,039
0.70961
bba051d82c748e9d054136d74cc0fac5410ccd43
75
js
JavaScript
node_modules/react-syntax-highlighter/dist/esm/languages/hljs/vbnet.js
jeffpuzzo/jp-rosa-react-form-wizard
fa565d0dddd5310ed3eb7c31bff4abee870bf266
[ "MIT" ]
2
2021-04-02T08:51:01.000Z
2021-05-28T07:14:08.000Z
node_modules/react-syntax-highlighter/dist/esm/languages/hljs/vbnet.js
jeffpuzzo/jp-rosa-react-form-wizard
fa565d0dddd5310ed3eb7c31bff4abee870bf266
[ "MIT" ]
31
2021-10-11T22:01:11.000Z
2021-12-06T22:40:12.000Z
node_modules/react-syntax-highlighter/dist/esm/languages/hljs/vbnet.js
jeffpuzzo/jp-rosa-react-form-wizard
fa565d0dddd5310ed3eb7c31bff4abee870bf266
[ "MIT" ]
4
2020-04-20T17:59:46.000Z
2020-05-12T18:42:49.000Z
import vbnet from "highlight.js/lib/languages/vbnet"; export default vbnet;
37.5
53
0.813333
bba157b454410d9d0838c1241dba54c46fb4f690
366
js
JavaScript
api/routes/auth.router.js
JuanPabloLeber/Project-Solvion
ec68c5640ceb58042b0aff95afa39fd8aee73747
[ "MIT" ]
1
2021-07-16T13:47:16.000Z
2021-07-16T13:47:16.000Z
api/routes/auth.router.js
JuanPabloLeber/Project-Solvion
ec68c5640ceb58042b0aff95afa39fd8aee73747
[ "MIT" ]
null
null
null
api/routes/auth.router.js
JuanPabloLeber/Project-Solvion
ec68c5640ceb58042b0aff95afa39fd8aee73747
[ "MIT" ]
1
2021-09-15T19:05:09.000Z
2021-09-15T19:05:09.000Z
const authRouter = require('express').Router() const { checkAuth, checkCustomerServiceOrManagerOrTechnician} = require('../../utils') const { login, profile } = require('../controllers/auth.controller') authRouter.get('/profile', checkAuth, checkCustomerServiceOrManagerOrTechnician, profile) authRouter.post('/login', login) exports.authRouter = authRouter
26.142857
89
0.762295
bba21844c43f1cb893d420d7ccb79e1d8fe265eb
11,942
js
JavaScript
front-end/api/controllers/ResetpassController.js
hwcarr/manavl
a08f329ecf4a55389fc3b1579f058c33c59e71c6
[ "MIT" ]
null
null
null
front-end/api/controllers/ResetpassController.js
hwcarr/manavl
a08f329ecf4a55389fc3b1579f058c33c59e71c6
[ "MIT" ]
null
null
null
front-end/api/controllers/ResetpassController.js
hwcarr/manavl
a08f329ecf4a55389fc3b1579f058c33c59e71c6
[ "MIT" ]
null
null
null
var Machine = require("machine"); module.exports = { 'create': function(req, res) { Machine.build({ inputs: { "id": { "example": 123, "required": true }, "password": { "example": "password", "required": true }, "redirect": { "example": "index" } }, exits: { respond: {} }, fn: function(inputs, exits) { // Try get cookie sails.machines['5bb05e6f-8a63-474b-99b6-612d0bc3977d_0.6.0'].tryGetCookie({ "Name": "authsid" }).setEnvironment({ req: req }).exec({ "error": function(tryGetCookie) { return exits.error({ data: tryGetCookie, status: 500 }); }, "success": function(tryGetCookie) { // Find One Session by SID sails.machines['eda2a2c7-cd02-479f-a073-4baaae9acd13_1.13.0'].findOne({ "model": "authsession", "criteria": { sid: tryGetCookie } }).setEnvironment({ sails: sails }).exec({ "error": function(findOneSessionBySID) { return exits.error({ data: findOneSessionBySID, status: 500 }); }, "success": function(findOneSessionBySID) { // Return Boolean sails.machines['2e6c2f60-6d69-4c41-851f-5c586760aee8_1.3.0'].returnBoolean({ "boolean": true }).exec({ "error": function(returnBoolean) { return exits.error({ data: returnBoolean, status: 500 }); }, "success": function(returnBoolean) { // Find One sails.machines['eda2a2c7-cd02-479f-a073-4baaae9acd13_1.13.0'].findOne({ "model": "user", "criteria": { id: inputs.id } }).setEnvironment({ sails: sails }).exec({ "error": function(findOne) { return exits.error({ data: findOne, status: 500 }); }, "success": function(findOne) { // Return User sails.machines['2b8be9ac-23ca-43be-bb41-8540b8aebed5_4.1.3'].returnUser({ "user": findOne }).exec({ "error": function(returnUser) { return exits.error({ data: returnUser, status: 500 }); }, "success": function(returnUser) { // Encrypt password sails.machines['e05a71f7-485d-443a-803e-029b84fe73a4_2.3.0'].encryptPassword({ "password": inputs.password }).exec({ "error": function(encryptPassword) { return exits.error({ data: encryptPassword, status: 500 }); }, "success": function(encryptPassword) { // Update sails.machines['eda2a2c7-cd02-479f-a073-4baaae9acd13_1.13.0'].update({ "model": "user", "criteria": { id: (returnUser && returnUser.id) }, "fields": { password: encryptPassword } }).setEnvironment({ sails: sails }).exec({ "error": function(update) { return exits.error({ data: update, status: 500 }); }, "success": function(update) { // Get redirect sails.machines['2e6c2f60-6d69-4c41-851f-5c586760aee8_1.4.1'].returnString({ "string": inputs.redirect }).exec({ "error": function(getRedirect) { return exits.error({ data: getRedirect, status: 500 }); }, "success": function(getRedirect) { return exits.respond({ data: "/" + getRedirect, action: "redirect", status: 200 }); } }); } }); } }); } }); }, "notFound": function(findOne) { return exits.error({ data: findOne, status: 200 }); } }); } }); }, "notFound": function(findOneSessionBySID) { // Not logged 2 sails.machines['2e6c2f60-6d69-4c41-851f-5c586760aee8_1.3.0'].returnBoolean({ "boolean": false }).exec({ "error": function(notLogged2) { return exits.error({ data: notLogged2, status: 500 }); }, "success": function(notLogged2) { return exits.respond({ action: "respond_with_status", status: "404" }); } }); } }); }, "NotFound": function(tryGetCookie) { // Not logged sails.machines['2e6c2f60-6d69-4c41-851f-5c586760aee8_1.3.0'].returnBoolean({ "boolean": false }).exec({ "error": function(notLogged) { return exits.error({ data: notLogged, status: 500 }); }, "success": function(notLogged) { return exits.respond({ action: "respond_with_status", status: "404" }); } }); } }); } }).configure(req.params.all(), { respond: res.response, error: res.negotiate }).exec(); } };
53.3125
147
0.210601
bba25a0af1c950d69458d88a77f2cb3e5bbb989a
276
js
JavaScript
src/reducers/ActiveVideoReducer.js
TdhyunK/DodecSite
a4e0d6d8e069e42bea53faf9a935e9ef3f2bcd3f
[ "MIT" ]
null
null
null
src/reducers/ActiveVideoReducer.js
TdhyunK/DodecSite
a4e0d6d8e069e42bea53faf9a935e9ef3f2bcd3f
[ "MIT" ]
null
null
null
src/reducers/ActiveVideoReducer.js
TdhyunK/DodecSite
a4e0d6d8e069e42bea53faf9a935e9ef3f2bcd3f
[ "MIT" ]
null
null
null
// State argument is not application state // Only the state this reducer is responsible for export default function(state = null /*if argument is undefined, set to null*/, action){ switch(action.type){ case "VIDEO_SELECTED": return action.payload; } return state; }
25.090909
88
0.735507
bba2b8e6008ab3bbd365dfefa217fd6bee935d8f
3,361
js
JavaScript
elements/elmsln-apps/lib/lrnapp-studio-dashboard/lrnapp-block-recent-submissions.js
shuuji3/lrnwebcomponents
7263c2f7ab4c1190cace3a82149e9068f7b5ca0c
[ "Apache-2.0" ]
null
null
null
elements/elmsln-apps/lib/lrnapp-studio-dashboard/lrnapp-block-recent-submissions.js
shuuji3/lrnwebcomponents
7263c2f7ab4c1190cace3a82149e9068f7b5ca0c
[ "Apache-2.0" ]
null
null
null
elements/elmsln-apps/lib/lrnapp-studio-dashboard/lrnapp-block-recent-submissions.js
shuuji3/lrnwebcomponents
7263c2f7ab4c1190cace3a82149e9068f7b5ca0c
[ "Apache-2.0" ]
1
2021-04-27T15:38:32.000Z
2021-04-27T15:38:32.000Z
import { html, PolymerElement } from "@polymer/polymer/polymer-element.js"; import { dom } from "@polymer/polymer/lib/legacy/polymer.dom.js"; import "@polymer/iron-ajax/iron-ajax.js"; import "@polymer/iron-list/iron-list.js"; import "../elmsln-base-deps.js"; import "@lrnwebcomponents/lrndesign-gallerycard/lrndesign-gallerycard.js"; import "@lrnwebcomponents/elmsln-loading/elmsln-loading.js"; class LrnappBlockRecentSubmissions extends PolymerElement { static get template() { return html` <style include="paper-item-styles"> :host { display: block; } button { width: 100%; border: none; background-color: transparent; } lrndesign-gallerycard { width: 100%; } lrndesign-gallerycard[elevation="1"] { box-shadow: none; } </style> <iron-ajax auto="" url="{{sourcePath}}" handle-as="json" last-response="{{response}}" on-response="handleResponse" ></iron-ajax> <div id="loading"> <h3>Loading..</h3> <elmsln-loading color="grey-text" size="large"></elmsln-loading> </div> <iron-list items="[[_toArray(response.data)]]" as="item"> <template> <button on-click="_loadSubmissionUrl"> <lrndesign-gallerycard data-submission-id$="[[item.id]]" title="[[item.attributes.title]]" author="[[item.relationships.author.data]]" comments="[[item.meta.comment_count]]" image="[[item.display.image]]" icon="[[item.display.icon]]" class="ferpa-protect" > </lrndesign-gallerycard> </button> </template> </iron-list> `; } static get tag() { return "lrnapp-block-recent-submissions"; } static get properties() { return { elmslnCourse: { type: String, }, elmslnSection: { type: String, }, basePath: { type: String, }, csrfToken: { type: String, }, endPoint: { type: String, }, sourcePath: { type: String, notify: true, }, response: { type: Array, notify: true, }, }; } /** * Handle tap on button above to redirect to the correct submission url. */ _loadSubmissionUrl(e) { var normalizedEvent = dom(e); var local = normalizedEvent.localTarget; // this will have the id of the current submission var active = local.getAttribute("data-submission-id"); // @todo need a cleaner integration but this at least goes the right place for now window.location.href = this.basePath + "lrnapp-studio-submission/submissions/" + active; } handleResponse(e) { this.$.loading.hidden = true; setTimeout(() => { window.dispatchEvent(new Event("resize")); }, 0); } _getViewLink(nid) { return this.basePath + "lrnapp-studio-submission/submissions/" + nid; } _toArray(obj) { if (obj == null) { return []; } return Object.keys(obj).map(function (key) { return obj[key]; }); } } window.customElements.define( LrnappBlockRecentSubmissions.tag, LrnappBlockRecentSubmissions ); export { LrnappBlockRecentSubmissions };
27.77686
86
0.575722
bba2f764ff764c3986dffcc1a1bda71297097817
385
js
JavaScript
tasks/lib/print-salute.js
daniel1302/git-changelog
2bfb28d137408e11d92b70faf63546c7ddfd0304
[ "MIT" ]
368
2015-02-05T00:28:20.000Z
2022-03-24T12:57:39.000Z
tasks/lib/print-salute.js
jackyhuynh/git-changelog
aae2d4a12ef1abd3944c626249ce14c856fe37c4
[ "MIT" ]
74
2015-04-10T17:50:09.000Z
2021-05-14T08:35:34.000Z
tasks/lib/print-salute.js
jackyhuynh/git-changelog
aae2d4a12ef1abd3944c626249ce14c856fe37c4
[ "MIT" ]
117
2015-04-18T21:09:00.000Z
2022-03-21T11:25:20.000Z
'use strict'; var debug = require('debug')('changelog:printSalute'); function printSalute(stream) { debug('printing salute'); stream.write('\n\n---\n'); stream.write('<sub><sup>*Generated with [git-changelog](https://github.com/rafinskipg/git-changelog). If you have any problems or suggestions, create an issue.* :) **Thanks** </sub></sup>'); } module.exports = printSalute;
32.083333
192
0.693506
bba3ea7e1a6c3cfd8594b4e49bdb91bf8b4dd991
9,721
js
JavaScript
src/pages/checkout.js
Uiseguys/schneckenhof-gatsby
1620e239c09e94e1d3445b4817fbabb1f9b51f9d
[ "MIT" ]
null
null
null
src/pages/checkout.js
Uiseguys/schneckenhof-gatsby
1620e239c09e94e1d3445b4817fbabb1f9b51f9d
[ "MIT" ]
3
2021-03-09T21:21:28.000Z
2021-09-21T04:48:19.000Z
src/pages/checkout.js
Uiseguys/schneckenhof-gatsby
1620e239c09e94e1d3445b4817fbabb1f9b51f9d
[ "MIT" ]
null
null
null
import React from "react"; import { connect } from "react-redux"; import { navigateTo } from "gatsby-link"; import SubpageHeader from "../components/SubpageHeader"; import Cart from "../components/Cart"; const windowGlobal = typeof window !== "undefined" && window; const CHECKOUT_URL = "https://schneckenhof-lb4-live.herokuapp.com/payment/checkout"; // const CHECKOUT_URL = // 'https://calm-cliffs-35577.herokuapp.com/payment/checkout' class Checkout extends React.Component { constructor() { super(); this.handleSubmit = this.handleSubmit.bind(this); this.reset = this.reset.bind(this); } handleSubmit(event) { event.preventDefault(); const form = event.target; const data = new FormData(form); // console.log(this.props) // console.log(form) // console.log(data) let formBody = []; for (let name of data.keys()) { // console.log(name, data.get(name)) let encodedKey = encodeURIComponent(name); let encodedValue = encodeURIComponent(data.get(name)); formBody.push(encodedKey + "=" + encodedValue); } let items = this.props.items.map((item, index) => { formBody.push( encodeURIComponent(`items[${index}][name]`) + "=" + encodeURIComponent( `${item.packaging && (item.packaging.displayName || item.packaging.measure + item.packaging.unitOfMeasure)} ${ item.name } ${item.varietal}` ) ); formBody.push( encodeURIComponent(`items[${index}][price]`) + "=" + encodeURIComponent(parseFloat(item.price).toFixed(2)) ); formBody.push( encodeURIComponent(`items[${index}][quantity]`) + "=" + encodeURIComponent(item.quantity) ); formBody.push( encodeURIComponent(`items[${index}][currency]`) + "=" + encodeURIComponent("EUR") ); formBody.push( encodeURIComponent(`items[${index}][packaging]`) + "=" + JSON.stringify(item.packaging) ); formBody.push( encodeURIComponent(`items[${index}][varietal]`) + "=" + encodeURIComponent(item.varietal) ); formBody.push( encodeURIComponent(`items[${index}][wineId]`) + "=" + encodeURIComponent(item.id) ); }); formBody.push( encodeURIComponent(`shipping`) + "=" + encodeURIComponent(this.props.shipping.toFixed(2)) ); formBody.push( encodeURIComponent(`subtotal`) + "=" + encodeURIComponent(this.props.total.toFixed(2)) ); formBody.push( encodeURIComponent(`total`) + "=" + encodeURIComponent(this.props.grandTotal.toFixed(2)) ); formBody = formBody.join("&"); fetch(CHECKOUT_URL, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded; charset=utf-8" }, body: formBody }) .then(res => res.json()) .then(res => { this.props.clear(); if (res.error) { navigateTo("/fehler"); } else { navigateTo("/danke"); } // windowGlobal && (document.location.href = res.href); }) .catch(e => { this.props.clear(); navigateTo("/fehler"); }); } reset() { console.log("reset"); } render() { return ( <div className="content-container"> <div className="checkout"> <SubpageHeader /> <Cart checkout={true} /> <form onSubmit={this.handleSubmit} id="appnavigation"> <p> Bitte beachten Sie bei Ihrer Bestellung: Wir liefern in{" "} <strong>6</strong>er, <strong>12</strong>er oder{" "} <strong>18</strong>er Kartons! <br /> <br /> </p> <fieldset className="personal"> <legend>Ihre Daten:</legend> <div className="form-group"> <label htmlFor="realname"> Name: <span className="hint">*</span> </label> <input type="text" id="realname" name="realname" className="required form-control" required /> </div> <div className="form-group"> <label htmlFor="street"> Stra&szlig;e, Haus-Nr: <span className="hint">*</span> </label> <input type="text" name="street" id="street" className="required form-control" required /> </div> <div className="form-group"> <label htmlFor="zip"> PLZ: <span className="hint">*</span> </label> <input type="text" name="zip" id="zip" className="required form-control" required /> </div> <div className="form-group"> <label htmlFor="city"> Wohnort: <span className="hint">*</span> </label> <input type="text" name="city" id="city" className="required form-control" required /> </div> <div className="form-group"> <label htmlFor="email" id="email"> Email: <span className="hint">*</span> </label> <input type="email" name="email" className="required email form-control" required /> </div> <div className="form-group"> <label htmlFor="phone"> Telefon (optional, bei evtl. Rückfragen): </label> <input type="text" name="phone" id="phone" className="form-control" /> </div> </fieldset> <fieldset> <div className="form-check"> <label className="form-check-label" htmlFor="agreement-1"> <input type="checkbox" className="form-check-input" required id="agreement-1" name="agreement[1]" value="1" /> Ich habe die{" "} <a href="/agb" target="_blank"> AGB </a>{" "} und die Informationen zum{" "} <a href="/datenschutz" target="_blank"> Datenschutz </a>{" "} gelesen und akzeptiert. </label> <br /> </div> <div className="form-check"> <label className="form-check-label" htmlFor="agreement-2"> <input type="checkbox" className="form-check-input" required id="agreement-2" name="agreement[3]" value="1" /> Ich bestätige, dass ich volljährig bin </label> <br /> <br /> </div> <div className="form-group"> <label htmlFor="message">Bemerkungen:</label> <textarea name="message" id="message" className="form-control" /> </div> <p> <br /> <br /> <strong>Keine Abgabe an Jugendliche unter 18Jahren.</strong> <br /> <br /> </p> {/* <p> <label> <input type='radio' name='pay_method' value='invoice' checked />Invoice </label> <label style={{ marginLeft: '20px' }}> <input type='radio' name='pay_method' value='paypal' />Paypal </label> </p> */} <div className="form-group"> <input type="reset" value="Zurück" className="btn btn-link btn-secondary" onClick={this.reset} /> <input type="submit" name="button" id="submitter" className="btn btn-lg btn-primary" value="Bestellung abschicken" /> <input type="reset" value="Zur&uuml;cksetzen" id="order" className="hidden" /> </div> </fieldset> </form> </div> </div> ); } } // export default Checkout const mapStateToProps = ({ count, items, shipping, total, grandTotal }) => { return { count, items, shipping, total, grandTotal }; }; const mapDispatchToProps = dispatch => { return { clear: () => dispatch({ type: "CLEAR" }) }; }; export default connect(mapStateToProps, mapDispatchToProps)(Checkout);
29.727829
89
0.444707
bba43912600b1897427f5cb5b526f733525ac489
384
js
JavaScript
entry_types/scrolled/package/src/contentElements/inlineBeforeAfter/InlineBeforeAfter.js
marcek/pageflow
51f5aa9a1310493b73a919cd3bf60fd6c4c8382a
[ "MIT" ]
476
2015-01-11T14:02:31.000Z
2022-03-21T14:50:42.000Z
entry_types/scrolled/package/src/contentElements/inlineBeforeAfter/InlineBeforeAfter.js
marcek/pageflow
51f5aa9a1310493b73a919cd3bf60fd6c4c8382a
[ "MIT" ]
1,051
2015-01-20T10:47:40.000Z
2022-02-27T03:11:01.000Z
entry_types/scrolled/package/src/contentElements/inlineBeforeAfter/InlineBeforeAfter.js
marcek/pageflow
51f5aa9a1310493b73a919cd3bf60fd6c4c8382a
[ "MIT" ]
109
2015-01-27T20:05:54.000Z
2022-02-20T00:28:51.000Z
import React from 'react'; import {BeforeAfter} from './BeforeAfter'; import {useContentElementLifecycle} from 'pageflow-scrolled/frontend'; export function InlineBeforeAfter(props) { const {isActive, shouldLoad} = useContentElementLifecycle(); return ( <BeforeAfter {...props.configuration} load={shouldLoad} isActive={isActive} /> ) }
25.6
70
0.682292
bba4ab43e206230b903d6117fcf4a77530e48c44
8,723
js
JavaScript
dist/static/js/chunk-63140e38.1eba7fb1.js
linlinger/vulfocus
42706b82347f3f958be718da785a51fd20837641
[ "Apache-2.0" ]
2,126
2020-04-22T09:43:00.000Z
2022-03-31T08:58:47.000Z
dist/static/js/chunk-63140e38.1eba7fb1.js
linlinger/vulfocus
42706b82347f3f958be718da785a51fd20837641
[ "Apache-2.0" ]
131
2020-04-22T15:56:44.000Z
2022-03-31T10:11:02.000Z
dist/static/js/chunk-63140e38.1eba7fb1.js
linlinger/vulfocus
42706b82347f3f958be718da785a51fd20837641
[ "Apache-2.0" ]
371
2020-04-22T09:44:15.000Z
2022-03-31T07:51:01.000Z
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-63140e38"],{"0cef":function(t,e,a){"use strict";a.d(e,"a",(function(){return i})),a.d(e,"b",(function(){return r})),a.d(e,"e",(function(){return l})),a.d(e,"c",(function(){return o})),a.d(e,"d",(function(){return c}));var n=a("b775");function i(t){return Object(n["a"])({url:"/layout/",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t})}function r(t){return Object(n["a"])({url:"/layout/"+t+"/delete/"})}function l(t){return Object(n["a"])({url:"/img/upload/",method:"post",headers:{"Content-Type":"multipart/form-data"},data:t})}function o(t,e,a){return void 0!==e&&null!==e||(e=1),void 0!==t&&null!=t||(t=""),void 0!==a&&null!==a&&""!==a||(a=""),Object(n["a"])({url:"/layout/?query="+t+"&page="+e+"&flag="+a,method:"get"})}function c(t){return Object(n["a"])({url:"/layout/"+t+"/release/",method:"get"})}},"214f":function(t,e,a){"use strict";a("b0c5");var n=a("2aba"),i=a("32e9"),r=a("79e5"),l=a("be13"),o=a("2b4c"),c=a("520a"),s=o("species"),u=!r((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),d=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var a="ab".split(t);return 2===a.length&&"a"===a[0]&&"b"===a[1]}();t.exports=function(t,e,a){var p=o(t),f=!r((function(){var e={};return e[p]=function(){return 7},7!=""[t](e)})),m=f?!r((function(){var e=!1,a=/a/;return a.exec=function(){return e=!0,null},"split"===t&&(a.constructor={},a.constructor[s]=function(){return a}),a[p](""),!e})):void 0;if(!f||!m||"replace"===t&&!u||"split"===t&&!d){var g=/./[p],h=a(l,p,""[t],(function(t,e,a,n,i){return e.exec===c?f&&!i?{done:!0,value:g.call(e,a,n)}:{done:!0,value:t.call(a,e,n)}:{done:!1}})),v=h[0],b=h[1];n(String.prototype,t,v),i(RegExp.prototype,p,2==e?function(t,e){return b.call(t,this,e)}:function(t){return b.call(t,this)})}}},"386d":function(t,e,a){"use strict";var n=a("cb7c"),i=a("83a1"),r=a("5f1b");a("214f")("search",1,(function(t,e,a,l){return[function(a){var n=t(this),i=void 0==a?void 0:a[e];return void 0!==i?i.call(a,n):new RegExp(a)[e](String(n))},function(t){var e=l(a,t,this);if(e.done)return e.value;var o=n(t),c=String(this),s=o.lastIndex;i(s,0)||(o.lastIndex=0);var u=r(o,c);return i(o.lastIndex,s)||(o.lastIndex=s),null===u?-1:u.index}]}))},"40fd":function(t,e,a){"use strict";a.r(e);var n=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"app-container"},[a("div",{staticClass:"filter-container"},[a("el-input",{staticStyle:{width:"230px"},attrs:{size:"medium"},model:{value:t.search,callback:function(e){t.search=e},expression:"search"}}),t._v(" "),a("el-button",{staticClass:"filter-item",staticStyle:{"margin-left":"10px","margin-bottom":"10px"},attrs:{size:"medium",type:"primary",icon:"el-icon-search"},on:{click:t.handleQuery}},[t._v("\n 查询\n ")]),t._v(" "),a("el-button",{staticClass:"filter-item",staticStyle:{"margin-left":"10px","margin-bottom":"10px"},attrs:{size:"medium",type:"primary",icon:"el-icon-edit"},on:{click:t.handleOpenCreate}},[t._v("\n 添加\n ")])],1),t._v(" "),a("el-dialog",{attrs:{visible:t.imageDialogVisible},on:{"update:visible":function(e){t.imageDialogVisible=e}}},[a("img",{attrs:{width:"100%",src:t.dialogImageUrl,alt:""}})]),t._v(" "),a("el-dialog",{attrs:{visible:t.ymlDialogVisible},on:{"update:visible":function(e){t.ymlDialogVisible=e}}},[a("el-input",{staticStyle:{color:"black"},attrs:{type:"textarea",autosize:"",readonly:""},model:{value:t.dialogYml,callback:function(e){t.dialogYml=e},expression:"dialogYml"}})],1),t._v(" "),a("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:t.tableData,border:"",stripe:""}},[a("el-table-column",{attrs:{type:"index",width:"50"}}),t._v(" "),a("el-table-column",{attrs:{prop:"layout_name",label:"环境名称",width:"180"}}),t._v(" "),a("el-table-column",{attrs:{prop:"layout_desc","show-overflow-tooltip":!0,label:"环境描述",width:"180"}}),t._v(" "),a("el-table-column",{attrs:{label:"图片",width:"120px"},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[n.image_name?a("img",{staticStyle:{width:"60px",height:"60px",display:"block"},attrs:{src:n.image_name,alt:""},on:{click:function(e){return t.handleShowImage(n)}}}):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"日期",width:"240"},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[a("i",{staticClass:"el-icon-time"}),t._v(" "),a("span",{staticStyle:{"margin-left":"5px"}},[t._v(t._s(n.create_date))])]}}])}),t._v(" "),a("el-table-column",{attrs:{label:"是否发布",width:"85"},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[!0===n.is_release?a("el-tag",[t._v("已发布")]):!1===n.is_release?a("el-tag",[t._v("未发布")]):t._e()]}}])}),t._v(" "),a("el-table-column",{attrs:{fixed:"right",label:"操作"},scopedSlots:t._u([{key:"default",fn:function(e){var n=e.row;return[a("el-button",{attrs:{size:"mini",type:"primary",icon:"el-icon-zoom-in"},on:{click:function(e){return t.handleShowYml(n)}}},[t._v("查看")]),t._v(" "),a("el-button",{attrs:{size:"mini",type:"primary",icon:"el-icon-edit"},on:{click:function(e){return t.handleEdit(n)}}},[t._v("修改")]),t._v(" "),!1===n.is_release?a("el-button",{attrs:{size:"mini",type:"primary",icon:"el-icon-position"},on:{click:function(e){return t.handleRelease(n)}}},[t._v("发布")]):t._e(),t._v(" "),a("el-button",{attrs:{size:"mini",type:"danger",icon:"el-icon-delete"},on:{click:function(e){return t.handleDelete(n)}}},[t._v("删除")])]}}])})],1),t._v(" "),a("div",{staticStyle:{"margin-top":"20px"}},[a("el-pagination",{attrs:{"page-size":t.page.size,layout:"total, prev, pager, next, jumper",total:t.page.total},on:{"current-change":t.layoutListData}})],1)],1)},i=[],r=(a("ac6a"),a("386d"),a("0cef")),l={name:"manager",data:function(){return{tableData:[],search:"",page:{total:0,size:20},isRelease:!1,imageDialogVisible:!1,dialogImageUrl:"",ymlDialogVisible:!1,dialogYml:""}},created:function(){this.layoutListData(1)},methods:{layoutListData:function(t){var e=this;this.tableData=[],Object(r["c"])(this.search,t).then((function(t){var a=t.data;a.results.forEach((function(t,a){t.image_name="/images/"+t.image_name,e.tableData.push(t)})),e.page.total=a.count})).catch((function(t){e.$message({type:"error",message:"服务器内部错误!"})}))},handleQuery:function(){this.tableData=[],this.layoutListData(1)},handleOpenCreate:function(){this.$router.push({path:"/layout/index"})},handleDelete:function(t){var e=this;this.$confirm("确认删除?删除会影响用户得分","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(r["b"])(t.layout_id).then((function(t){var a=t.data;200===a.status?(e.$message({message:"删除成功",type:"success"}),e.layoutListData(1)):e.$message({message:a.msg,type:"error"})})).catch((function(t){e.$message({message:"服务器内部错误",type:"error"})}))})).catch()},handleShowImage:function(t){this.dialogImageUrl=t.image_name,this.imageDialogVisible=!0},handleShowYml:function(t){this.dialogYml=t.yml_content,this.ymlDialogVisible=!0},handleEdit:function(t){this.$router.push({path:"/layout/index",query:{layoutId:t.layout_id,layoutData:t}})},handleRelease:function(t){var e=this;Object(r["d"])(t.layout_id).then((function(a){var n=a.data,i=n.status;200===i?(t.is_release=!0,e.$message({message:"发布成功",type:"success"})):e.$message({message:n.msg,type:"error"})})).catch((function(t){e.$message({message:"服务器内部错误",type:"error"})}))}}},o=l,c=a("2877"),s=Object(c["a"])(o,n,i,!1,null,"e4cfb2c8",null);e["default"]=s.exports},"520a":function(t,e,a){"use strict";var n=a("0bfb"),i=RegExp.prototype.exec,r=String.prototype.replace,l=i,o="lastIndex",c=function(){var t=/a/,e=/b*/g;return i.call(t,"a"),i.call(e,"a"),0!==t[o]||0!==e[o]}(),s=void 0!==/()??/.exec("")[1],u=c||s;u&&(l=function(t){var e,a,l,u,d=this;return s&&(a=new RegExp("^"+d.source+"$(?!\\s)",n.call(d))),c&&(e=d[o]),l=i.call(d,t),c&&l&&(d[o]=d.global?l.index+l[0].length:e),s&&l&&l.length>1&&r.call(l[0],a,(function(){for(u=1;u<arguments.length-2;u++)void 0===arguments[u]&&(l[u]=void 0)})),l}),t.exports=l},"5f1b":function(t,e,a){"use strict";var n=a("23c6"),i=RegExp.prototype.exec;t.exports=function(t,e){var a=t.exec;if("function"===typeof a){var r=a.call(t,e);if("object"!==typeof r)throw new TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==n(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,e)}},"83a1":function(t,e){t.exports=Object.is||function(t,e){return t===e?0!==t||1/t===1/e:t!=t&&e!=e}},b0c5:function(t,e,a){"use strict";var n=a("520a");a("5ca1")({target:"RegExp",proto:!0,forced:n!==/./.exec},{exec:n})}}]); //# sourceMappingURL=chunk-63140e38.1eba7fb1.js.map
4,361.5
8,671
0.649318
bba518d752ef0cb07325b3e3251f99401e55fa01
6,182
js
JavaScript
app/views/AuthenticationWebView.js
igit-cn/Rocket.Chat.ReactNative
8af82df7ff6c25cb72b564d8a9efcfa945e35b55
[ "MIT" ]
1,440
2017-08-19T10:43:35.000Z
2022-03-31T19:20:20.000Z
app/views/AuthenticationWebView.js
igit-cn/Rocket.Chat.ReactNative
8af82df7ff6c25cb72b564d8a9efcfa945e35b55
[ "MIT" ]
2,373
2017-08-18T14:48:02.000Z
2022-03-31T22:28:51.000Z
app/views/AuthenticationWebView.js
igit-cn/Rocket.Chat.ReactNative
8af82df7ff6c25cb72b564d8a9efcfa945e35b55
[ "MIT" ]
1,105
2017-08-18T14:47:51.000Z
2022-03-30T08:40:11.000Z
import React from 'react'; import PropTypes from 'prop-types'; import { WebView } from 'react-native-webview'; import { connect } from 'react-redux'; import parse from 'url-parse'; import RocketChat from '../lib/rocketchat'; import { isIOS } from '../utils/deviceInfo'; import StatusBar from '../containers/StatusBar'; import ActivityIndicator from '../containers/ActivityIndicator'; import { withTheme } from '../theme'; import debounce from '../utils/debounce'; import * as HeaderButton from '../containers/HeaderButton'; const userAgent = isIOS ? 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1' : 'Mozilla/5.0 (Linux; Android 6.0.1; SM-G920V Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.98 Mobile Safari/537.36'; // iframe uses a postMessage to send the token to the client // We'll handle this sending the token to the hash of the window.location // https://docs.rocket.chat/guides/developer-guides/iframe-integration/authentication#iframe-url // https://github.com/react-native-community/react-native-webview/issues/24#issuecomment-540130141 const injectedJavaScript = ` window.addEventListener('message', ({ data }) => { if (typeof data === 'object') { window.location.hash = JSON.stringify(data); } }); function wrap(fn) { return function wrapper() { var res = fn.apply(this, arguments); window.ReactNativeWebView.postMessage(window.location.href); return res; } } history.pushState = wrap(history.pushState); history.replaceState = wrap(history.replaceState); window.addEventListener('popstate', function() { window.ReactNativeWebView.postMessage(window.location.href); }); `; class AuthenticationWebView extends React.PureComponent { static propTypes = { navigation: PropTypes.object, route: PropTypes.object, server: PropTypes.string, Accounts_Iframe_api_url: PropTypes.bool, Accounts_Iframe_api_method: PropTypes.bool, theme: PropTypes.string }; constructor(props) { super(props); this.state = { logging: false, loading: false }; this.oauthRedirectRegex = new RegExp(`(?=.*(${props.server}))(?=.*(credentialToken))(?=.*(credentialSecret))`, 'g'); this.iframeRedirectRegex = new RegExp(`(?=.*(${props.server}))(?=.*(event|loginToken|token))`, 'g'); } componentWillUnmount() { if (this.debouncedLogin && this.debouncedLogin.stop) { this.debouncedLogin.stop(); } } dismiss = () => { const { navigation } = this.props; navigation.pop(); }; login = params => { const { logging } = this.state; if (logging) { return; } this.setState({ logging: true }); try { RocketChat.loginOAuthOrSso(params); } catch (e) { console.warn(e); } this.setState({ logging: false }); this.dismiss(); }; // Force 3s delay so the server has time to evaluate the token debouncedLogin = debounce(params => this.login(params), 3000); tryLogin = debounce( async () => { const { Accounts_Iframe_api_url, Accounts_Iframe_api_method } = this.props; const data = await fetch(Accounts_Iframe_api_url, { method: Accounts_Iframe_api_method }).then(response => response.json()); const resume = data?.login || data?.loginToken; if (resume) { this.login({ resume }); } }, 3000, true ); onNavigationStateChange = webViewState => { const url = decodeURIComponent(webViewState.url); const { route } = this.props; const { authType } = route.params; if (authType === 'saml' || authType === 'cas') { const { ssoToken } = route.params; const parsedUrl = parse(url, true); // ticket -> cas / validate & saml_idp_credentialToken -> saml if (parsedUrl.pathname?.includes('validate') || parsedUrl.query?.ticket || parsedUrl.query?.saml_idp_credentialToken) { let payload; if (authType === 'saml') { const token = parsedUrl.query?.saml_idp_credentialToken || ssoToken; const credentialToken = { credentialToken: token }; payload = { ...credentialToken, saml: true }; } else { payload = { cas: { credentialToken: ssoToken } }; } this.debouncedLogin(payload); } } if (authType === 'oauth') { if (this.oauthRedirectRegex.test(url)) { const parts = url.split('#'); const credentials = JSON.parse(parts[1]); this.debouncedLogin({ oauth: { ...credentials } }); } } if (authType === 'iframe') { if (this.iframeRedirectRegex.test(url)) { const parts = url.split('#'); const credentials = JSON.parse(parts[1]); switch (credentials.event) { case 'try-iframe-login': this.tryLogin(); break; case 'login-with-token': this.debouncedLogin({ resume: credentials.token || credentials.loginToken }); break; default: // Do nothing } } } }; render() { const { loading } = this.state; const { route, theme } = this.props; const { url, authType } = route.params; const isIframe = authType === 'iframe'; return ( <> <StatusBar /> <WebView source={{ uri: url }} userAgent={userAgent} // https://github.com/react-native-community/react-native-webview/issues/24#issuecomment-540130141 onMessage={({ nativeEvent }) => this.onNavigationStateChange(nativeEvent)} onNavigationStateChange={this.onNavigationStateChange} injectedJavaScript={isIframe ? injectedJavaScript : undefined} onLoadStart={() => { this.setState({ loading: true }); }} onLoadEnd={() => { this.setState({ loading: false }); }} /> {loading ? <ActivityIndicator size='large' theme={theme} absolute /> : null} </> ); } } const mapStateToProps = state => ({ server: state.server.server, Accounts_Iframe_api_url: state.settings.Accounts_Iframe_api_url, Accounts_Iframe_api_method: state.settings.Accounts_Iframe_api_method }); AuthenticationWebView.navigationOptions = ({ route, navigation }) => { const { authType } = route.params; return { headerLeft: () => <HeaderButton.CloseModal navigation={navigation} />, title: ['saml', 'cas', 'iframe'].includes(authType) ? 'SSO' : 'OAuth' }; }; export default connect(mapStateToProps)(withTheme(AuthenticationWebView));
31.222222
143
0.678745
bba544d23091071099fe39e31cdb3c6d45484aee
2,073
js
JavaScript
packages/lumx-angularjs/src/components/table/table_directive.js
aureldent/design-system
07fc15fb0bb43fce8bb5ca7d53d6f700f3daa882
[ "MIT" ]
18
2019-03-29T14:27:07.000Z
2022-01-01T02:41:25.000Z
packages/lumx-angularjs/src/components/table/table_directive.js
aureldent/design-system
07fc15fb0bb43fce8bb5ca7d53d6f700f3daa882
[ "MIT" ]
220
2019-04-02T13:13:08.000Z
2022-03-24T10:58:54.000Z
packages/lumx-angularjs/src/components/table/table_directive.js
aureldent/design-system
07fc15fb0bb43fce8bb5ca7d53d6f700f3daa882
[ "MIT" ]
6
2019-04-11T01:11:07.000Z
2020-05-13T10:51:41.000Z
import { CSS_PREFIX } from '@lumx/core/js/constants'; import template from './table.html'; ///////////////////////////// function TableController() { 'ngInject'; // eslint-disable-next-line consistent-this const lx = this; ///////////////////////////// // // // Private attributes // // // ///////////////////////////// /** * The default props. * * @type {Object} * @constant * @readonly */ const _DEFAULT_PROPS = { theme: 'light', }; ///////////////////////////// // // // Public functions // // // ///////////////////////////// /** * Get table classes. * * @return {Array} The list of table classes. */ function getClasses() { const classes = []; const theme = lx.theme ? lx.theme : _DEFAULT_PROPS.theme; classes.push(`${CSS_PREFIX}-table--theme-${theme}`); if (lx.hasBefore) { classes.push(`${CSS_PREFIX}-table--has-before`); } if (lx.hasDividers) { classes.push(`${CSS_PREFIX}-table--has-dividers`); } if (lx.isClickable) { classes.push(`${CSS_PREFIX}-table--is-clickable`); } return classes; } ///////////////////////////// lx.getClasses = getClasses; } ///////////////////////////// function TableDirective() { 'ngInject'; return { bindToController: true, controller: TableController, controllerAs: 'lx', replace: true, restrict: 'E', scope: { hasBefore: '=?lxHasBefore', hasDividers: '=?lxHasDividers', isClickable: '=?lxIsClickable', theme: '@?lxTheme', }, template, transclude: true, }; } ///////////////////////////// angular.module('lumx.table').directive('lxTable', TableDirective); ///////////////////////////// export { TableDirective };
21.371134
66
0.42547
bba54e29e1753190d6150c35e09b42eaec883a4f
2,967
js
JavaScript
deps/com.ibm.sbt.dojo180/src/main/webapp/dojox/mobile/TreeView.js
JLLeitschuh/SocialSDK
c9c02d449c296ba6648dc14ecf8ef67cb55e656c
[ "MIT", "Apache-2.0", "MIT-0", "BSD-3-Clause" ]
337
2015-01-14T14:59:33.000Z
2022-03-26T21:01:59.000Z
deps/com.ibm.sbt.dojo180/src/main/webapp/dojox/mobile/TreeView.js
JLLeitschuh/SocialSDK
c9c02d449c296ba6648dc14ecf8ef67cb55e656c
[ "MIT", "Apache-2.0", "MIT-0", "BSD-3-Clause" ]
485
2015-01-08T12:17:53.000Z
2022-03-07T11:53:48.000Z
deps/com.ibm.sbt.dojo180/src/main/webapp/dojox/mobile/TreeView.js
JLLeitschuh/SocialSDK
c9c02d449c296ba6648dc14ecf8ef67cb55e656c
[ "MIT", "Apache-2.0", "MIT-0", "BSD-3-Clause" ]
94
2015-08-29T19:05:43.000Z
2022-01-10T15:36:40.000Z
define("dojox/mobile/TreeView", [ "dojo/_base/kernel", "dojo/_base/array", "dojo/_base/declare", "dojo/_base/lang", "dojo/_base/window", "dojo/dom-construct", "dijit/registry", "./Heading", "./ListItem", "./ProgressIndicator", "./RoundRectList", "./ScrollableView", "./viewRegistry" ], function(kernel, array, declare, lang, win, domConstruct, registry, Heading, ListItem, ProgressIndicator, RoundRectList, ScrollableView, viewRegistry){ // module: // dojox/mobile/TreeView kernel.experimental("dojox.mobile.TreeView"); return declare("dojox.mobile.TreeView", ScrollableView, { // summary: // A scrollable view with tree-style navigation. // description: // This widget can be connected to a dojox/data/FileStore as a // quick directory browser. You may use it when implementing the // Master-Detail pattern. postCreate: function(){ this._load(); this.inherited(arguments); }, _load: function(){ this.model.getRoot( lang.hitch(this, function(item){ var scope = this; var list = new RoundRectList(); var node = {}; var listitem = new ListItem({ label: scope.model.rootLabel, moveTo: '#', onClick: function(){ scope.handleClick(this); }, item: item }); list.addChild(listitem); this.addChild(list); }) ) }, handleClick: function(li){ // summary: // Called when the user clicks a tree item. // li: dojox/mobile/ListItem // The item that the user clicked. var newViewId = "view_"; if(li.item[this.model.newItemIdAttr]){ newViewId += li.item[this.model.newItemIdAttr]; }else{ newViewId += "rootView"; } newViewId = newViewId.replace('/', '_'); if(registry.byId(newViewId)){ // view already exists, just transition to it registry.byNode(li.domNode).transitionTo(newViewId); return; } var prog = ProgressIndicator.getInstance(); win.body().appendChild(prog.domNode); prog.start(); this.model.getChildren(li.item, lang.hitch(this, function(items){ var scope = this; var list = new RoundRectList(); array.forEach(items, function(item, i){ var listItemArgs = { item: item, label: item[scope.model.store.label], transition: "slide" }; if(scope.model.mayHaveChildren(item)){ listItemArgs.moveTo = '#'; listItemArgs.onClick = function(){ scope.handleClick(this); }; } var listitem = new ListItem(listItemArgs); list.addChild(listitem); }); var heading = new Heading({ label: "Dynamic View", back: "Back", moveTo: viewRegistry.getEnclosingView(li.domNode).id }); var newView = ScrollableView({ id: newViewId }, domConstruct.create("div", null, win.body())); newView.addChild(heading); newView.addChild(list); newView.startup(); prog.stop(); registry.byNode(li.domNode).transitionTo(newView.id); }) ) } }); });
26.72973
154
0.638692
bba56b03ff7e2947b8a91d5b5594807919dacab2
28,924
js
JavaScript
public/plugins/sitemap/sitemap.js
evanwilliamsconsulting/nhp
5a54752359d96b9e6d38b4cb826c6690e333fca0
[ "BSD-3-Clause" ]
113
2015-11-01T02:02:16.000Z
2022-01-06T13:24:48.000Z
public/plugins/sitemap/sitemap.js
evanwilliamsconsulting/nhp
5a54752359d96b9e6d38b4cb826c6690e333fca0
[ "BSD-3-Clause" ]
4
2015-12-08T01:51:29.000Z
2021-05-08T11:57:59.000Z
public/plugins/sitemap/sitemap.js
evanwilliamsconsulting/nhp
5a54752359d96b9e6d38b4cb826c6690e333fca0
[ "BSD-3-Clause" ]
20
2015-11-12T10:52:05.000Z
2022-01-07T02:53:47.000Z
// use this to isolate the scope (function() { var SHOW_HIDE_ANIMATION_DURATION = 0; var HIGHLIGHT_INTERACTIVE_VAR_NAME = 'hi'; var FOOTNOTES_VAR_NAME = 'fn'; var SITEMAP_COLLAPSE_VAR_NAME = 'c'; var ADAPTIVE_VIEW_VAR_NAME = 'view'; var currentPageLoc = ''; var currentPlayerLoc = ''; var currentPageHashString = ''; $(window.document).ready(function() { $axure.player.createPluginHost({ id: 'sitemapHost', context: 'interface', title: 'Sitemap' }); generateSitemap(); $('.sitemapPlusMinusLink').toggle(collapse_click, expand_click); $('.sitemapPageLink').click(node_click); $('#sitemapLinksAndOptionsContainer').hide(); $('#searchDiv').hide(); $('#linksButton').click(links_click); $('#adaptiveButton').click(adaptive_click); $('#footnotesButton').click(footnotes_click).addClass('sitemapToolbarButtonSelected'); $('#highlightInteractiveButton').click(highlight_interactive); $('#variablesButton').click(showvars_click); $('#variablesClearLink').click(clearvars_click); $('#searchButton').click(search_click); $('#searchBox').keyup(search_input_keyup); $('.sitemapLinkField').click(function() { this.select(); }); $('input[value="withoutmap"]').click(withoutSitemapRadio_click); $('input[value="withmap"]').click(withSitemapRadio_click); $('#minimizeBox, #footnotesBox, #highlightBox').change(sitemapUrlOptions_change); $('#viewSelect').change(sitemapUrlViewSelect_change); // $('#sitemapHost').parent().resize(function () { // $('#sitemapHost').height($(this).height()); // }); // bind to the page load $axure.page.bind('load.sitemap', function() { currentPageLoc = $axure.page.location.split("#")[0]; var decodedPageLoc = decodeURI(currentPageLoc); var nodeUrl = decodedPageLoc.substr(decodedPageLoc.lastIndexOf('/') ? decodedPageLoc.lastIndexOf('/') + 1 : 0); currentPlayerLoc = $(location).attr('href').split("#")[0].split("?")[0]; currentPageHashString = '#p=' + nodeUrl.substr(0, nodeUrl.lastIndexOf('.')); setVarInCurrentUrlHash('p', nodeUrl.substring(0, nodeUrl.lastIndexOf('.html'))); $('.sitemapPageLink').parent().parent().removeClass('sitemapHighlight'); $('.sitemapPageLink[nodeUrl="' + nodeUrl + '"]').parent().parent().addClass('sitemapHighlight'); $('#sitemapLinksPageName').html($('.sitemapHighlight > .sitemapPageLinkContainer > .sitemapPageLink > .sitemapPageName').html()); //Click the "With sitemap" radio button so that it's selected by default $('input[value="withmap"]').click(); //Update variable div with latest global variable values after page has loaded $axure.messageCenter.postMessage('getGlobalVariables', ''); //If footnotes enabled for this prototype... if($axure.document.configuration.showAnnotations == true) { //If the fn var is defined and set to 0, hide footnotes //else if hide-footnotes button selected, hide them var fnVal = getHashStringVar(FOOTNOTES_VAR_NAME); if(fnVal.length > 0 && fnVal == 0) { $('#footnotesButton').removeClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('annotationToggle', false); } else if(!$('#footnotesButton').is('.sitemapToolbarButtonSelected')) { //If the footnotes button isn't selected, hide them on this loaded page $axure.messageCenter.postMessage('annotationToggle', false); } } //If highlight var is present and set to 1 or else if //sitemap highlight button is selected then highlight interactive elements var hiVal = getHashStringVar(HIGHLIGHT_INTERACTIVE_VAR_NAME); if(hiVal.length > 0 && hiVal == 1) { $('#highlightInteractiveButton').addClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('highlightInteractive', true); } else if($('#highlightInteractiveButton').is('.sitemapToolbarButtonSelected')) { $axure.messageCenter.postMessage('highlightInteractive', true); } //Set the current view if it is defined in the hash string //If the view is invalid, set it to 'auto' in the string //ELSE set the view based on the currently selected view in the toolbar menu var viewStr = getHashStringVar(ADAPTIVE_VIEW_VAR_NAME); if(viewStr.length > 0) { var $view = $('.adaptiveViewOption[val="' + viewStr + '"]'); if($view.length > 0) $view.click(); else $('.adaptiveViewOption[val="auto"]').click(); } else if($('.checkedAdaptive').length > 0) { var $viewOption = $('.checkedAdaptive').parents('.adaptiveViewOption'); if($viewOption.attr('val') != 'auto') $viewOption.click(); } $axure.messageCenter.postMessage('finishInit'); return false; }); var $adaptiveViewsContainer = $('#adaptiveViewsContainer'); var $viewSelect = $('#viewSelect'); //Fill out adaptive view container with prototype's defined adaptive views, as well as the default, and Auto $adaptiveViewsContainer.append('<div class="adaptiveViewOption" val="auto"><div class="adaptiveCheckboxDiv checkedAdaptive"></div>Auto</div>'); $viewSelect.append('<option value="auto">Auto</option>'); if(typeof $axure.document.defaultAdaptiveView.name != 'undefined') { //If the name is a blank string, make the view name the width if non-zero, else 'any' var defaultViewName = $axure.document.defaultAdaptiveView.name; if(defaultViewName == '') { defaultViewName = $axure.document.defaultAdaptiveView.size.width != 0 ? $axure.document.defaultAdaptiveView.size.width : 'Base'; } $adaptiveViewsContainer.append('<div class="adaptiveViewOption currentAdaptiveView" val="default"><div class="adaptiveCheckboxDiv"></div>' + defaultViewName + '</div>'); $viewSelect.append('<option value="default">' + defaultViewName + '</option>'); } var enabledViewIds = $axure.document.configuration.enabledViewIds; for(var viewIndex = 0; viewIndex < $axure.document.adaptiveViews.length; viewIndex++) { var currView = $axure.document.adaptiveViews[viewIndex]; if(enabledViewIds.indexOf(currView.id) < 0) continue; var widthString = currView.size.width == 0 ? 'any' : currView.size.width; var heightString = currView.size.height == 0 ? 'any' : currView.size.height; var conditionString = ''; if(currView.condition == '>' || currView.condition == '>=') { conditionString = ' and above'; } else if(currView.condition == '<' || currView.condition == '<=') { conditionString = ' and below'; } var viewString = currView.name + ' (' + widthString + ' x ' + heightString + conditionString + ')'; $adaptiveViewsContainer.append('<div class="adaptiveViewOption" val="' + currView.id + '"><div class="adaptiveCheckboxDiv"></div>' + viewString + '</div>'); $viewSelect.append('<option value="' + currView.id + '">' + viewString + '</option>'); } $('.adaptiveViewOption').click(adaptiveViewOption_click); $('#leftPanel').mouseup(function() { $('.sitemapPopupContainer').hide(); $('#variablesButton').removeClass('sitemapToolbarButtonSelected'); $('#adaptiveButton').removeClass('sitemapToolbarButtonSelected'); $('#linksButton').removeClass('sitemapToolbarButtonSelected'); }); $('#variablesContainer,#sitemapLinksContainer').mouseup(function(event) { event.stopPropagation(); }); $('#variablesButton').mouseup(function(event) { hideAllContainersExcept(2); event.stopPropagation(); }); $('#adaptiveButton').mouseup(function(event) { hideAllContainersExcept(1); event.stopPropagation(); }); $('.adaptiveViewOption').mouseup(function(event) { event.stopPropagation(); }); $('#linksButton').mouseup(function(event) { hideAllContainersExcept(3); event.stopPropagation(); }); $('#searchBox').focusin(function() { if($(this).is('.searchBoxHint')) { $(this).val(''); $(this).removeClass('searchBoxHint'); } }).focusout(function() { if($(this).val() == '') { $(this).addClass('searchBoxHint'); $(this).val('Search'); } }); var $varContainer = $('#variablesContainer'); $(window).resize(function() { if($varContainer.is(":visible")) { var newHeight = $(this).height() - 120; if(newHeight < 100) newHeight = 100; $varContainer.css('max-height', newHeight); } }); }); function hideAllContainersExcept(exceptContainer) { //1 - adaptive container, 2 - vars container, 3 - links container if(exceptContainer != 1) { $('#adaptiveViewsContainer').hide(); $('#adaptiveButton').removeClass('sitemapToolbarButtonSelected'); } if(exceptContainer != 2) { $('#variablesContainer').hide(); $('#variablesButton').removeClass('sitemapToolbarButtonSelected'); } if(exceptContainer != 3) { $('#sitemapLinksContainer').hide(); $('#linksButton').removeClass('sitemapToolbarButtonSelected'); } } function collapse_click(event) { $(this) .children('.sitemapMinus').removeClass('sitemapMinus').addClass('sitemapPlus').end() .closest('li').children('ul').hide(SHOW_HIDE_ANIMATION_DURATION); $(this).next('.sitemapFolderOpenIcon').removeClass('sitemapFolderOpenIcon').addClass('sitemapFolderIcon'); } function expand_click(event) { $(this) .children('.sitemapPlus').removeClass('sitemapPlus').addClass('sitemapMinus').end() .closest('li').children('ul').show(SHOW_HIDE_ANIMATION_DURATION); $(this).next('.sitemapFolderIcon').removeClass('sitemapFolderIcon').addClass('sitemapFolderOpenIcon'); } function node_click(event) { $axure.page.navigate(this.getAttribute('nodeUrl'), true); } function links_click(event) { $('#sitemapLinksContainer').toggle(); if($('#sitemapLinksContainer').is(":visible")) { $('#linksButton').addClass('sitemapToolbarButtonSelected'); var linksButtonBottom = $('#linksButton').position().top + $('#linksButton').height(); $('#sitemapLinksContainer').css('top', linksButtonBottom + 'px'); } else { $('#linksButton').removeClass('sitemapToolbarButtonSelected'); } } $axure.messageCenter.addMessageListener(function(message, data) { if(message == 'globalVariableValues') { //If variables container isn't visible, then ignore if(!$('#variablesContainer').is(":visible")) { return; } $('#variablesDiv').empty(); for(var key in data) { var value = data[key] == '' ? '(blank)' : data[key]; $('#variablesDiv').append('<div class="variableDiv"><span class="variableName">' + key + '</span><br/>' + value + '</div>'); } } else if(message == 'adaptiveViewChange') { $('.adaptiveViewOption').removeClass('currentAdaptiveView'); if(data) $('div[val="' + data + '"]').addClass('currentAdaptiveView'); else $('div[val="default"]').addClass('currentAdaptiveView'); } }); function showvars_click(event) { $('#variablesContainer').toggle(); if(!$('#variablesContainer').is(":visible")) { $('#variablesButton').removeClass('sitemapToolbarButtonSelected'); } else { $(window).resize(); $('#variablesButton').addClass('sitemapToolbarButtonSelected'); var variablesButtonBottom = $('#variablesButton').position().top + $('#variablesButton').height(); $('#variablesContainer').css('top', variablesButtonBottom + 'px'); $('#variablesContainer').css('left', '30px'); $('#variablesContainer').css('right', '30px'); $axure.messageCenter.postMessage('getGlobalVariables', ''); } } function clearvars_click(event) { $axure.messageCenter.postMessage('resetGlobalVariables', ''); } function footnotes_click(event) { if($('#footnotesButton').is('.sitemapToolbarButtonSelected')) { $('#footnotesButton').removeClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('annotationToggle', false); //Add 'fn' hash string var so that footnotes stay hidden across reloads setVarInCurrentUrlHash(FOOTNOTES_VAR_NAME, 0); } else { $('#footnotesButton').addClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('annotationToggle', true); //Delete 'fn' hash string var if it exists since default is visible deleteVarFromCurrentUrlHash(FOOTNOTES_VAR_NAME); } } function highlight_interactive(event) { if($('#highlightInteractiveButton').is('.sitemapToolbarButtonSelected')) { $('#highlightInteractiveButton').removeClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('highlightInteractive', false); //Delete 'hi' hash string var if it exists since default is unselected deleteVarFromCurrentUrlHash(HIGHLIGHT_INTERACTIVE_VAR_NAME); } else { $('#highlightInteractiveButton').addClass('sitemapToolbarButtonSelected'); $axure.messageCenter.postMessage('highlightInteractive', true); //Add 'hi' hash string var so that stay highlighted across reloads setVarInCurrentUrlHash(HIGHLIGHT_INTERACTIVE_VAR_NAME, 1); } } function adaptive_click(event) { $('#adaptiveViewsContainer').toggle(); if(!$('#adaptiveViewsContainer').is(":visible")) { $('#adaptiveButton').removeClass('sitemapToolbarButtonSelected'); } else { $('#adaptiveButton').addClass('sitemapToolbarButtonSelected'); var adaptiveButtonBottom = $('#adaptiveButton').position().top + $('#adaptiveButton').height(); $('#adaptiveViewsContainer').css('top', adaptiveButtonBottom + 'px'); $('#adaptiveViewsContainer').css('left', $('#adaptiveButton').position().left); } } function adaptiveViewOption_click(event) { var currVal = $(this).attr('val'); $('.checkedAdaptive').removeClass('checkedAdaptive'); $(this).find('.adaptiveCheckboxDiv').addClass('checkedAdaptive'); currentPageLoc = $axure.page.location.split("#")[0]; var decodedPageLoc = decodeURI(currentPageLoc); var nodeUrl = decodedPageLoc.substr(decodedPageLoc.lastIndexOf('/') ? decodedPageLoc.lastIndexOf('/') + 1 : 0); var adaptiveData = { src: nodeUrl }; adaptiveData.view = currVal; $axure.messageCenter.postMessage('switchAdaptiveView', adaptiveData); if(currVal == 'auto') { //Remove view in hash string if one is set deleteVarFromCurrentUrlHash(ADAPTIVE_VIEW_VAR_NAME); } else { //Set current view in hash string so that it can be maintained across reloads setVarInCurrentUrlHash(ADAPTIVE_VIEW_VAR_NAME, currVal); } } function search_click(event) { $('#searchDiv').toggle(); if(!$('#searchDiv').is(":visible")) { $('#searchButton').removeClass('sitemapToolbarButtonSelected'); $('#searchBox').val(''); $('#searchBox').keyup(); $('#sitemapToolbar').css('height', '22px'); $('#sitemapTreeContainer').css('top', '31px'); } else { $('#searchButton').addClass('sitemapToolbarButtonSelected'); $('#searchBox').focus(); $('#sitemapToolbar').css('height', '50px'); $('#sitemapTreeContainer').css('top', '63px'); } } function search_input_keyup(event) { var searchVal = $(this).val().toLowerCase(); //If empty search field, show all nodes, else grey+hide all nodes and //ungrey+unhide all matching nodes, as well as unhide their parent nodes if(searchVal == '') { $('.sitemapPageName').removeClass('sitemapGreyedName'); $('.sitemapNode').show(); } else { $('.sitemapNode').hide(); $('.sitemapPageName').addClass('sitemapGreyedName').each(function() { var nodeName = $(this).text().toLowerCase(); if(nodeName.indexOf(searchVal) != -1) { $(this).removeClass('sitemapGreyedName').parents('.sitemapNode:first').show().parents('.sitemapExpandableNode').show(); } }); } } function withoutSitemapRadio_click() { $('#sitemapLinkWithPlayer').val(currentPageLoc); $('#minimizeBox').attr('disabled', 'disabled'); $('#footnotesBox').attr('disabled', 'disabled'); $('#highlightBox').attr('disabled', 'disabled'); $('#viewSelect').attr('disabled', 'disabled'); } function withSitemapRadio_click() { $('#sitemapLinkWithPlayer').val(currentPlayerLoc + currentPageHashString); $('#minimizeBox').removeAttr('disabled').change(); $('#footnotesBox').removeAttr('disabled').change(); $('#highlightBox').removeAttr('disabled').change(); $('#viewSelect').removeAttr('disabled').change(); } function sitemapUrlOptions_change() { var currLinkHash = '#' + $('#sitemapLinkWithPlayer').val().split("#")[1]; var newHash = null; var varName = ''; var defVal = 1; if($(this).is('#minimizeBox')) { varName = SITEMAP_COLLAPSE_VAR_NAME; } else if($(this).is('#footnotesBox')) { varName = FOOTNOTES_VAR_NAME; defVal = 0; } else if($(this).is('#highlightBox')) { varName = HIGHLIGHT_INTERACTIVE_VAR_NAME; } newHash = $(this).is(':checked') ? setHashStringVar(currLinkHash, varName, defVal) : deleteHashStringVar(currLinkHash, varName); if(newHash != null) { $('#sitemapLinkWithPlayer').val(currentPlayerLoc + newHash); } } function sitemapUrlViewSelect_change() { var currLinkHash = '#' + $('#sitemapLinkWithPlayer').val().split("#")[1]; var newHash = null; var $selectedOption = $(this).find('option:selected'); if($selectedOption.length == 0) return; var selectedVal = $selectedOption.attr('value'); newHash = selectedVal == 'auto' ? deleteHashStringVar(currLinkHash, ADAPTIVE_VIEW_VAR_NAME) : setHashStringVar(currLinkHash, ADAPTIVE_VIEW_VAR_NAME, selectedVal); if(newHash != null) { $('#sitemapLinkWithPlayer').val(currentPlayerLoc + newHash); } } function generateSitemap() { var treeUl = "<div id='sitemapToolbar'>"; treeUl += "<div style='height:30px;'>"; if($axure.document.configuration.enabledViewIds.length > 0) { treeUl += "<a id='adaptiveButton' title='Select Adaptive View' class='sitemapToolbarButton'></a>"; } if($axure.document.configuration.showAnnotations == true) { treeUl += "<a id='footnotesButton' title='Toggle Footnotes' class='sitemapToolbarButton'></a>"; } treeUl += "<a id='highlightInteractiveButton' title='Highlight interactive elements' class='sitemapToolbarButton'></a>"; treeUl += "<a id='variablesButton' title='View Variables' class='sitemapToolbarButton'></a>"; treeUl += "<a id='linksButton' title='Get Links' class='sitemapToolbarButton'></a>"; treeUl += "<a id='searchButton' title='Search Pages' class='sitemapToolbarButton'></a>"; treeUl += "</div>"; treeUl += '<div id="searchDiv" style="width:98%; clear:both;"><input id="searchBox" style="width: 100%;" type="text"/></div>'; treeUl += "<div id='sitemapLinksContainer' class='sitemapPopupContainer'><span id='sitemapLinksPageName'>Page Name</span>"; treeUl += "<div class='sitemapLinkContainer'><input id='sitemapLinkWithPlayer' type='text' class='sitemapLinkField'/></div>"; treeUl += "<div class='sitemapOptionContainer'>"; treeUl += "<div><label><input type='radio' name='sitemapToggle' value='withoutmap'/>without sitemap</label></div>"; treeUl += "<div><label><input type='radio' name='sitemapToggle' value='withmap'/>with sitemap</label>"; treeUl += "<div id='sitemapOptionsDiv'>"; treeUl += "<div class='sitemapUrlOption'><label><input type='checkbox' id='minimizeBox' />minimize sitemap</label></div>"; if($axure.document.configuration.showAnnotations == true) { treeUl += "<div class='sitemapUrlOption'><label><input type='checkbox' id='footnotesBox' />hide footnotes</label></div>"; } treeUl += "<div class='sitemapUrlOption'><label><input type='checkbox' id='highlightBox' />highlight interactive elements</label></div>"; if($axure.document.configuration.enabledViewIds.length > 0) { treeUl += "<div id='viewSelectDiv' class='sitemapUrlOption'><label>View: <select id='viewSelect'></select></label></div>"; } treeUl += "</div></div></div></div>"; treeUl += "<div id='variablesContainer' class='sitemapPopupContainer'><a id='variablesClearLink'>Reset Variables</a><br/><br/><div id='variablesDiv'></div></div>"; if($axure.document.adaptiveViews.length > 0) { treeUl += "<div id='adaptiveViewsContainer' class='sitemapPopupContainer'></div>"; } treeUl += "</div>"; treeUl += "<div id='sitemapTreeContainer'>"; treeUl += "<ul class='sitemapTree' style='clear:both;'>"; var rootNodes = $axure.document.sitemap.rootNodes; for(var i = 0; i < rootNodes.length; i++) { treeUl += generateNode(rootNodes[i], 0); } treeUl += "</ul></div>"; $('#sitemapHost').html(treeUl); } function generateNode(node, level) { var hasChildren = (node.children && node.children.length > 0); if(hasChildren) { var returnVal = "<li class='sitemapNode sitemapExpandableNode'><div><div class='sitemapPageLinkContainer' style='margin-left:" + (15 + level * 17) + "px'><a class='sitemapPlusMinusLink'><span class='sitemapMinus'></span></a>"; } else { var returnVal = "<li class='sitemapNode sitemapLeafNode'><div><div class='sitemapPageLinkContainer' style='margin-left:" + (27 + level * 17) + "px'>"; } var isFolder = node.type == "Folder"; if(!isFolder) returnVal += "<a class='sitemapPageLink' nodeUrl='" + node.url + "'>"; returnVal += "<span class='sitemapPageIcon"; if(node.type == "Flow") { returnVal += " sitemapFlowIcon"; } if(isFolder) { if(hasChildren) returnVal += " sitemapFolderOpenIcon"; else returnVal += " sitemapFolderIcon"; } returnVal += "'></span><span class='sitemapPageName'>"; returnVal += $('<div/>').text(node.pageName).html(); returnVal += "</span>"; if(!isFolder) returnVal += "</a>"; returnVal += "</div></div>"; if(hasChildren) { returnVal += "<ul>"; for(var i = 0; i < node.children.length; i++) { var child = node.children[i]; returnVal += generateNode(child, level + 1); } returnVal += "</ul>"; } returnVal += "</li>"; return returnVal; } function getHashStringVar(query) { var qstring = window.location.href.split("#"); if(qstring.length < 2) return ""; var prms = qstring[1].split("&"); var frmelements = new Array(); var currprmeter, querystr = ""; for(var i = 0; i < prms.length; i++) { currprmeter = prms[i].split("="); frmelements[i] = new Array(); frmelements[i][0] = currprmeter[0]; frmelements[i][1] = currprmeter[1]; } for(var j = 0; j < frmelements.length; j++) { if(frmelements[j][0] == query) { querystr = frmelements[j][1]; break; } } return querystr; } function replaceHash(newHash) { var currentLocWithoutHash = window.location.toString().split('#')[0]; //We use replace so that every hash change doesn't get appended to the history stack. //We use replaceState in browsers that support it, else replace the location if(typeof window.history.replaceState != 'undefined') { window.history.replaceState(null, null, currentLocWithoutHash + newHash); } else { window.location.replace(currentLocWithoutHash + newHash); } } function setHashStringVar(currentHash, varName, varVal) { var varWithEqual = varName + '='; var hashToSet = ''; var pageIndex = currentHash.indexOf('#' + varWithEqual); if(pageIndex == -1) pageIndex = currentHash.indexOf('&' + varWithEqual); if(pageIndex != -1) { var newHash = currentHash.substring(0, pageIndex); newHash = newHash == '' ? '#' + varWithEqual + varVal : newHash + '&' + varWithEqual + varVal; var ampIndex = currentHash.indexOf('&', pageIndex + 1); if(ampIndex != -1) { newHash = newHash + currentHash.substring(ampIndex); } hashToSet = newHash; } else if(currentHash.indexOf('#') != -1) { hashToSet = currentHash + '&' + varWithEqual + varVal; } else { hashToSet = '#' + varWithEqual + varVal; } if(hashToSet != '') { return hashToSet; } return null; } function setVarInCurrentUrlHash(varName, varVal) { var newHash = setHashStringVar(window.location.hash, varName, varVal); if(newHash != null) { replaceHash(newHash); } } function deleteHashStringVar(currentHash, varName) { var varWithEqual = varName + '='; var pageIndex = currentHash.indexOf('#' + varWithEqual); if(pageIndex == -1) pageIndex = currentHash.indexOf('&' + varWithEqual); if(pageIndex != -1) { var newHash = currentHash.substring(0, pageIndex); var ampIndex = currentHash.indexOf('&', pageIndex + 1); //IF begin of string....if none blank, ELSE # instead of & and rest //IF in string....prefix + if none blank, ELSE &-rest if(newHash == '') { //beginning of string newHash = ampIndex != -1 ? '#' + currentHash.substring(ampIndex + 1) : ''; } else { //somewhere in the middle newHash = newHash + (ampIndex != -1 ? currentHash.substring(ampIndex) : ''); } return newHash; } return null; } function deleteVarFromCurrentUrlHash(varName) { var newHash = deleteHashStringVar(window.location.hash, varName); if(newHash != null) { replaceHash(newHash); } } })();
45.406593
239
0.576511
bba6bb61a5ee376a9df651f94452c6060f120f95
554
js
JavaScript
docs/html/search/functions_e.js
ZeroCool940711/PyFlow-1
cc11f788b72d9a47196d5039b24e81121891823c
[ "MIT" ]
7
2018-06-24T15:55:00.000Z
2021-07-13T08:11:25.000Z
docs/html/search/functions_e.js
ZeroCool940711/PyFlow-1
cc11f788b72d9a47196d5039b24e81121891823c
[ "MIT" ]
32
2019-02-18T20:47:46.000Z
2019-05-30T12:51:10.000Z
docs/html/search/functions_e.js
ZeroCool940711/PyFlow-1
cc11f788b72d9a47196d5039b24e81121891823c
[ "MIT" ]
5
2019-02-19T23:26:21.000Z
2020-12-23T00:32:59.000Z
var searchData= [ ['tan',['tan',['../class_py_flow_1_1_function_libraries_1_1_math_lib_1_1_math_lib.html#aedfc1087ec0fbfe556964adc3ccfce67',1,'PyFlow::FunctionLibraries::MathLib::MathLib']]], ['tanh',['tanh',['../class_py_flow_1_1_function_libraries_1_1_math_lib_1_1_math_lib.html#a076d4206eaf284ccdc36ed5731bc27ef',1,'PyFlow::FunctionLibraries::MathLib::MathLib']]], ['trunc',['trunc',['../class_py_flow_1_1_function_libraries_1_1_math_lib_1_1_math_lib.html#a9e3bab51de30f9296e983cca69ceadd7',1,'PyFlow::FunctionLibraries::MathLib::MathLib']]] ];
79.142857
178
0.808664
bba7451b099d21a8326eb836a0ee2a5c329b0a7b
157
js
JavaScript
web/src/containers/HomePage/meta/selectors.js
Baxhen-Technologies/react-node-js-auth-v2
671d215614476fd57d8f881912f7d7efe79cf379
[ "MIT" ]
null
null
null
web/src/containers/HomePage/meta/selectors.js
Baxhen-Technologies/react-node-js-auth-v2
671d215614476fd57d8f881912f7d7efe79cf379
[ "MIT" ]
null
null
null
web/src/containers/HomePage/meta/selectors.js
Baxhen-Technologies/react-node-js-auth-v2
671d215614476fd57d8f881912f7d7efe79cf379
[ "MIT" ]
null
null
null
import { initialState } from './reducer'; /** * Get Home * @param state * @returns {Object} */ export const get = (state) => state.Home || initialState;
19.625
57
0.630573
bba7ee60741b2f2c05a1210146f2237034960178
804
js
JavaScript
webpack/prod.js
VD39/es6-boilerplate
f8d39d7882ca37b66380d6aa3f7359f4cba14077
[ "MIT" ]
null
null
null
webpack/prod.js
VD39/es6-boilerplate
f8d39d7882ca37b66380d6aa3f7359f4cba14077
[ "MIT" ]
null
null
null
webpack/prod.js
VD39/es6-boilerplate
f8d39d7882ca37b66380d6aa3f7359f4cba14077
[ "MIT" ]
null
null
null
// Import dependencies. import { merge } from 'webpack-merge'; import TerserPlugin from 'terser-webpack-plugin'; import CssMinimizerPlugin from 'css-minimizer-webpack-plugin'; // Import Configuration. import { cleanWebpackPlugin, miniCssExtractPlugin, imageMinimizerWebpackPlugin, } from './plugins'; import { WebpackCommonConfig } from './common'; /** * Plugins for production build. */ const plugins = [cleanWebpackPlugin, miniCssExtractPlugin]; /** * Webpack production configuration. */ const WebpackConfig = { plugins, optimization: { minimize: true, minimizer: [ new CssMinimizerPlugin(), new TerserPlugin(), imageMinimizerWebpackPlugin, ], }, }; // Export configuration. export const WebpackProdConfig = merge(WebpackCommonConfig, WebpackConfig);
22.333333
75
0.727612
bba8d1ee390e85c2422b478ee9c3a56b9cb9e7cf
185
js
JavaScript
apps/pulumi-e2e/jest.config.js
KeKs0r/nx-plugins
91a12b39630c2cb5ac314eb176d25e42f51f9306
[ "MIT" ]
null
null
null
apps/pulumi-e2e/jest.config.js
KeKs0r/nx-plugins
91a12b39630c2cb5ac314eb176d25e42f51f9306
[ "MIT" ]
null
null
null
apps/pulumi-e2e/jest.config.js
KeKs0r/nx-plugins
91a12b39630c2cb5ac314eb176d25e42f51f9306
[ "MIT" ]
null
null
null
module.exports = { displayName: 'pulumi-e2e', preset: '../../jest.preset.js', moduleFileExtensions: ['ts', 'js', 'html'], coverageDirectory: '../../coverage/apps/pulumi-e2e', }
26.428571
54
0.632432
bba967a83bc425ba517af148a93c2adc053f9ad9
3,025
js
JavaScript
src/helper/chain.js
abbotto/elemint
68e50513190b2ee897c4f6c9db5bf93e71d7def5
[ "MIT" ]
null
null
null
src/helper/chain.js
abbotto/elemint
68e50513190b2ee897c4f6c9db5bf93e71d7def5
[ "MIT" ]
null
null
null
src/helper/chain.js
abbotto/elemint
68e50513190b2ee897c4f6c9db5bf93e71d7def5
[ "MIT" ]
null
null
null
/** * @private * @description * Return a copy of the $$ chainable stack * * @param {Object} * @return {Object} */ function chain(result) { // Reset `$$.fn.selector` if a selector is passed in if (result) { $$.fn.selector = $$.fn.$ = result; } return { constructor: $$.fn.constructor, context: $$.fn.context, selector: $$.fn.selector, $: $$.fn.$, after: function (selector) { return chain(after(this.$, selector)); }, ascend: function (selector, limit) { return chain(ascend(this.$, selector, limit)); }, before: function (selector) { return chain(before(this.$, selector)); }, child: function (selector) { return chain(child(this.$, selector)); }, class: { set: function (classList) { classes($$.fn.$).set(classList); return $$.fn; }, kill: function (classList) { classes($$.fn.$).kill(classList); return $$.fn; }, sub: function (classA, classB) { classes($$.fn.$).sub(classA, classB); return $$.fn; } }, descend: function (selector, limit) { return chain(descend(this.$, selector, limit)); }, event: { set: function (config) { event($$.fn.$).set(config); return $$.fn; }, kill: function (eventId, callback) { event($$.fn.$).kill(eventId, callback); return $$.fn; }, emit: function (eventName, config) { event($$.fn.$).emit(eventName, config); return $$.fn; } }, layer: { set: function (zIndex) { layer($$.fn.$).set(zIndex); return $$.fn; }, get: function () { return layer($$.fn.$).get(); } }, match: function (selector, callback) { return chain(match(this.$, selector, callback)); }, mount: function (position, payload) { mount(this.$, position, payload); return this; }, offset: { set: function (config) { offset($$.fn.$).set(config); return $$.fn; }, get: function () { return offset($$.fn.$).get(); } }, parent: function (offsetParent) { return chain(parent(this.$, offsetParent)); }, position: function () { return position(this.$[0]); }, prop: { set: function (prp, value) { prop($$.fn.$).set(prp, value); return $$.fn; }, get: function () { return propGet.apply($$.fn.$[0], arguments); }, kill: function (prp) { prop($$.fn.$).kill(prp); return $$.fn; } }, sibling: function (selector) { var result = sibling(this.$, selector); result = (result.length > 1) ? result : [result]; return chain(result); }, size: { set: function (config) { size($$.fn.$).set(config); return $$.fn; }, get: function (heightOrWidth) { return size($$.fn.$).get(heightOrWidth); } }, style: { set: function (objectOrString, value) { style($$.fn.$, $$.fn.context).set(objectOrString, value); return $$.fn; }, get: function (styleName, opt) { return styleGet.apply($$.fn.$[0], arguments); } }, unmount: function (position, target) { unmount(this.$, position, target); return this; } }; }
22.242647
61
0.564628
bba9c064ae88a66b7e33ac031e92db456a3b874d
103
js
JavaScript
test/client/fixtures/advanced/four.js
mmonto7/little-loader
42d233f360162bb01fce5a9664b6ef54751bd96e
[ "MIT" ]
399
2015-11-23T21:40:00.000Z
2021-07-21T11:10:42.000Z
test/client/fixtures/advanced/four.js
mmonto7/little-loader
42d233f360162bb01fce5a9664b6ef54751bd96e
[ "MIT" ]
55
2015-11-23T01:37:21.000Z
2021-09-15T14:07:44.000Z
test/client/fixtures/advanced/four.js
mmonto7/little-loader
42d233f360162bb01fce5a9664b6ef54751bd96e
[ "MIT" ]
34
2015-11-23T01:29:27.000Z
2020-09-16T15:09:50.000Z
(function () { var test = window._LLOAD_TEST = window._LLOAD_TEST || {}; test.four = "four"; }());
20.6
59
0.592233
bbaa333a533fb2f34c77f122deddd1d2edd5ba54
499
js
JavaScript
db/init.js
afmeirelles/iate-showcase
72edfcd9559373509dbb62a74ec612ed8f14fd10
[ "MIT" ]
1
2020-03-16T16:49:55.000Z
2020-03-16T16:49:55.000Z
db/init.js
afmeirelles/iate-showcase
72edfcd9559373509dbb62a74ec612ed8f14fd10
[ "MIT" ]
1
2021-05-11T06:43:26.000Z
2021-05-11T06:43:26.000Z
db/init.js
afmeirelles/iate-showcase
72edfcd9559373509dbb62a74ec612ed8f14fd10
[ "MIT" ]
null
null
null
const { connect } = require('../src/components/mongo') const hash = require('../src/components/hash') ;(async () => { const db = await connect() await db .collection('users') .insertMany([ { email: 'ray.charles@gmail.com', password: hash('hittheroadjack'), role: 'musician' }, { email: 'chuck.norris@gmail.com', password: hash('roundhouse'), role: 'admin' }, ]) })()
24.95
54
0.48497
bbaa6ca8d1be5856b8159d66d5228a22d5e9c342
34,381
js
JavaScript
dist/moaland-frontend-0.2.3.min.js
moaland/moaland-frontend
59ee6c7f4d2cb78319afb464e10b138f508b840f
[ "MIT" ]
1
2020-12-31T06:57:34.000Z
2020-12-31T06:57:34.000Z
dist/moaland-frontend-0.2.3.min.js
moaland/moaland-frontend
59ee6c7f4d2cb78319afb464e10b138f508b840f
[ "MIT" ]
15
2020-12-31T03:50:41.000Z
2022-01-31T20:14:27.000Z
dist/moaland-frontend-0.2.3.min.js
moaland/moaland-frontend
59ee6c7f4d2cb78319afb464e10b138f508b840f
[ "MIT" ]
null
null
null
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define("MoalandFrontend",["exports"],e):e(t.MoalandFrontend={})}(this,function(t){"use strict";function r(t,e){if(window.NodeList.prototype.forEach)return t.forEach(e);for(var n=0;n<t.length;n++)e.call(window,t[n],n,t)}function n(t){this.$module=t,this.moduleId=t.getAttribute("id"),this.$sections=t.querySelectorAll(".moaland-accordion__section"),this.$openAllButton="",this.browserSupportsSessionStorage=e.checkForSessionStorage(),this.controlsClass="moaland-accordion__controls",this.openAllClass="moaland-accordion__open-all",this.iconClass="moaland-accordion__icon",this.sectionHeaderClass="moaland-accordion__section-header",this.sectionHeaderFocusedClass="moaland-accordion__section-header--focused",this.sectionHeadingClass="moaland-accordion__section-heading",this.sectionSummaryClass="moaland-accordion__section-summary",this.sectionButtonClass="moaland-accordion__section-button",this.sectionExpandedClass="moaland-accordion__section--expanded"}(function(t){var s,l,c,u;"defineProperty"in Object&&function(){try{return Object.defineProperty({},"test",{value:42}),!0}catch(t){return!1}}()||(s=Object.defineProperty,l=Object.prototype.hasOwnProperty("__defineGetter__"),c="Getters & setters cannot be defined on this javascript engine",u="A property cannot both have accessors and be writable or have a value",Object.defineProperty=function(t,e,n){if(s&&(t===window||t===document||t===Element.prototype||t instanceof Element))return s(t,e,n);if(null===t||!(t instanceof Object||"object"==typeof t))throw new TypeError("Object.defineProperty called on non-object");if(!(n instanceof Object))throw new TypeError("Property description must be an object");var o=String(e),i="value"in n||"writable"in n,r="get"in n&&typeof n.get,a="set"in n&&typeof n.set;if(r){if("function"!==r)throw new TypeError("Getter must be a function");if(!l)throw new TypeError(c);if(i)throw new TypeError(u);Object.__defineGetter__.call(t,o,n.get)}else t[o]=n.value;if(a){if("function"!==a)throw new TypeError("Setter must be a function");if(!l)throw new TypeError(c);if(i)throw new TypeError(u);Object.__defineSetter__.call(t,o,n.set)}return"value"in n&&(t[o]=n.value),t})}).call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"bind"in Function.prototype||Object.defineProperty(Function.prototype,"bind",{value:function(e){var n,t=Array,o=Object,i=o.prototype,r=t.prototype,a=function a(){},s=i.toString,l="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,c=Function.prototype.toString,u=function u(t){try{return c.call(t),!0}catch(e){return!1}};n=function n(t){if("function"!=typeof t)return!1;if(l)return u(t);var e=s.call(t);return"[object Function]"===e||"[object GeneratorFunction]"===e};var d=r.slice,h=r.concat,p=r.push,f=Math.max,m=this;if(!n(m))throw new TypeError("Function.prototype.bind called on incompatible "+m);for(var b,y=d.call(arguments,1),v=f(0,m.length-y.length),g=[],w=0;w<v;w++)p.call(g,"$"+w);return b=Function("binder","return function ("+g.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof b){var t=m.apply(this,h.call(y,d.call(arguments)));return o(t)===t?t:this}return m.apply(e,h.call(y,d.call(arguments)))}),m.prototype&&(a.prototype=m.prototype,b.prototype=new a,a.prototype=null),b}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(o){var t,e,n;"DOMTokenList"in this&&(!("classList"in(t=document.createElement("x")))||!t.classList.toggle("x",!1)&&!t.className)||("DOMTokenList"in(e=this)&&e.DOMTokenList&&(!document.createElementNS||!document.createElementNS("http://www.w3.org/2000/svg","svg")||document.createElementNS("http://www.w3.org/2000/svg","svg").classList instanceof DOMTokenList)||(e.DOMTokenList=function(){var i=!0,n=function(t,e,n,o){Object.defineProperty?Object.defineProperty(t,e,{configurable:!1===i||!!o,get:n}):t.__defineGetter__(e,n)};try{n({},"support")}catch(t){i=!1}return function(i,r){var a=this,s=[],l={},c=0,t=0,e=function(t){n(a,t,function(){return d(),s[t]},!1)},u=function(){if(t<=c)for(;t<c;++t)e(t)},d=function(){var t,e,n=arguments,o=/\s+/;if(n.length)for(e=0;e<n.length;++e)if(o.test(n[e]))throw(t=new SyntaxError('String "'+n[e]+'" contains an invalid character')).code=5,t.name="InvalidCharacterError",t;for(""===(s="object"==typeof i[r]?(""+i[r].baseVal).replace(/^\s+|\s+$/g,"").split(o):(""+i[r]).replace(/^\s+|\s+$/g,"").split(o))[0]&&(s=[]),l={},e=0;e<s.length;++e)l[s[e]]=!0;c=s.length,u()};return d(),n(a,"length",function(){return d(),c}),a.toLocaleString=a.toString=function(){return d(),s.join(" ")},a.item=function(t){return d(),s[t]},a.contains=function(t){return d(),!!l[t]},a.add=function(){d.apply(a,t=arguments);for(var t,e,n=0,o=t.length;n<o;++n)l[e=t[n]]||(s.push(e),l[e]=!0);c!==s.length&&(c=s.length>>>0,"object"==typeof i[r]?i[r].baseVal=s.join(" "):i[r]=s.join(" "),u())},a.remove=function(){d.apply(a,t=arguments);for(var t,e={},n=0,o=[];n<t.length;++n)e[t[n]]=!0,delete l[t[n]];for(n=0;n<s.length;++n)e[s[n]]||o.push(s[n]);c=(s=o).length>>>0,"object"==typeof i[r]?i[r].baseVal=s.join(" "):i[r]=s.join(" "),u()},a.toggle=function(t,e){return d.apply(a,[t]),o!==e?e?(a.add(t),!0):(a.remove(t),!1):l[t]?(a.remove(t),!1):(a.add(t),!0)},a}}()),"classList"in(n=document.createElement("span"))&&(n.classList.toggle("x",!1),n.classList.contains("x")&&(n.classList.constructor.prototype.toggle=function(t){var e=arguments[1];if(e!==o)return this[(e=!!e)?"add":"remove"](t),e;var n=!this.contains(t);return this[n?"add":"remove"](t),n})),function(){var t=document.createElement("span");if("classList"in t&&(t.classList.add("a","b"),!t.classList.contains("b"))){var o=t.classList.constructor.prototype.add;t.classList.constructor.prototype.add=function(){for(var t=arguments,e=arguments.length,n=0;n<e;n++)o.call(this,t[n])}}}(),function(){var t=document.createElement("span");if("classList"in t&&(t.classList.add("a"),t.classList.add("b"),t.classList.remove("a","b"),t.classList.contains("b"))){var o=t.classList.constructor.prototype.remove;t.classList.constructor.prototype.remove=function(){for(var t=arguments,e=arguments.length,n=0;n<e;n++)o.call(this,t[n])}}}())}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Document"in this||"undefined"==typeof WorkerGlobalScope&&"function"!=typeof importScripts&&(this.HTMLDocument?this.Document=this.HTMLDocument:(this.Document=this.HTMLDocument=document.constructor=new Function("return function Document() {}")(),this.Document.prototype=document))}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"Element"in this&&"HTMLElement"in this||function(){if(!window.Element||window.HTMLElement){window.Element=window.HTMLElement=new Function("return function Element() {}")();var t,e=document.appendChild(document.createElement("body")),n=e.appendChild(document.createElement("iframe")).contentWindow.document,s=Element.prototype=n.appendChild(n.createElement("*")),l={},c=function(t,e){var n,o,i,r=t.childNodes||[],a=-1;if(1===t.nodeType&&t.constructor!==Element)for(n in t.constructor=Element,l)o=l[n],t[n]=o;for(;i=e&&r[++a];)c(i,e);return t},u=document.getElementsByTagName("*"),o=document.createElement,i=100;s.attachEvent("onpropertychange",function(t){for(var e,n=t.propertyName,o=!l.hasOwnProperty(n),i=s[n],r=l[n],a=-1;e=u[++a];)1===e.nodeType&&(!o&&e[n]!==r||(e[n]=i));l[n]=i}),s.constructor=Element,s.hasAttribute||(s.hasAttribute=function(t){return null!==this.getAttribute(t)}),r()||(document.onreadystatechange=r,t=setInterval(r,25)),document.createElement=function(t){var e=o(String(t).toLowerCase());return c(e)},document.removeChild(e)}else window.HTMLElement=window.Element;function r(){return i--||clearTimeout(t),!(!document.body||document.body.prototype||!/(complete|interactive)/.test(document.readyState))&&(c(document,!0),t&&document.body.prototype&&clearTimeout(t),!!document.body.prototype)}}()}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){var e;"document"in this&&"classList"in document.documentElement&&"Element"in this&&"classList"in Element.prototype&&((e=document.createElement("span")).classList.add("a","b"),e.classList.contains("b"))||function(t){var u=!0,d=function(t,e,n,o){Object.defineProperty?Object.defineProperty(t,e,{configurable:!1===u||!!o,get:n}):t.__defineGetter__(e,n)};try{d({},"support")}catch(e){u=!1}var h=function(t,l,c){d(t.prototype,l,function(){var t,e=this,n="__defineGetter__DEFINE_PROPERTY"+l;if(e[n])return t;if(!(e[n]=!0)===u){for(var o,i=h.mirror||document.createElement("div"),r=i.childNodes,a=r.length,s=0;s<a;++s)if(r[s]._R===e){o=r[s];break}o=o||i.appendChild(document.createElement("div")),t=DOMTokenList.call(o,e,c)}else t=new DOMTokenList(e,c);return d(e,l,function(){return t}),delete e[n],t},!0)};h(t.Element,"classList","className"),h(t.HTMLElement,"classList","className"),h(t.HTMLLinkElement,"relList","rel"),h(t.HTMLAnchorElement,"relList","rel"),h(t.HTMLAreaElement,"relList","rel")}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),n.prototype.init=function(){if(this.$module){this.initControls(),this.initSectionHeaders();var t=this.checkIfAllSectionsOpen();this.updateOpenAllButton(t)}},n.prototype.initControls=function(){this.$openAllButton=document.createElement("button"),this.$openAllButton.setAttribute("type","button"),this.$openAllButton.innerHTML='Open all <span class="moaland-visually-hidden">sections</span>',this.$openAllButton.setAttribute("class",this.openAllClass),this.$openAllButton.setAttribute("aria-expanded","false"),this.$openAllButton.setAttribute("type","button");var t=document.createElement("div");t.setAttribute("class",this.controlsClass),t.appendChild(this.$openAllButton),this.$module.insertBefore(t,this.$module.firstChild),this.$openAllButton.addEventListener("click",this.onOpenOrCloseAllToggle.bind(this))},n.prototype.initSectionHeaders=function(){r(this.$sections,function(t,e){var n=t.querySelector("."+this.sectionHeaderClass);this.initHeaderAttributes(n,e),this.setExpanded(this.isExpanded(t),t),n.addEventListener("click",this.onSectionToggle.bind(this,t)),this.setInitialState(t)}.bind(this))},n.prototype.initHeaderAttributes=function(e,t){var n=this,o=e.querySelector("."+this.sectionButtonClass),i=e.querySelector("."+this.sectionHeadingClass),r=e.querySelector("."+this.sectionSummaryClass),a=document.createElement("button");a.setAttribute("type","button"),a.setAttribute("id",this.moduleId+"-heading-"+(t+1)),a.setAttribute("aria-controls",this.moduleId+"-content-"+(t+1));for(var s=0;s<o.attributes.length;s++){var l=o.attributes.item(s);a.setAttribute(l.nodeName,l.nodeValue)}a.addEventListener("focusin",function(t){e.classList.contains(n.sectionHeaderFocusedClass)||(e.className+=" "+n.sectionHeaderFocusedClass)}),a.addEventListener("blur",function(t){e.classList.remove(n.sectionHeaderFocusedClass)}),null!=r&&a.setAttribute("aria-describedby",this.moduleId+"-summary-"+(t+1)),a.innerHTML=o.innerHTML,i.removeChild(o),i.appendChild(a);var c=document.createElement("span");c.className=this.iconClass,c.setAttribute("aria-hidden","true"),a.appendChild(c)},n.prototype.onSectionToggle=function(t){var e=this.isExpanded(t);this.setExpanded(!e,t),this.storeState(t)},n.prototype.onOpenOrCloseAllToggle=function(){var e=this,t=this.$sections,n=!this.checkIfAllSectionsOpen();r(t,function(t){e.setExpanded(n,t),e.storeState(t)}),e.updateOpenAllButton(n)},n.prototype.setExpanded=function(t,e){e.querySelector("."+this.sectionButtonClass).setAttribute("aria-expanded",t),t?e.classList.add(this.sectionExpandedClass):e.classList.remove(this.sectionExpandedClass);var n=this.checkIfAllSectionsOpen();this.updateOpenAllButton(n)},n.prototype.isExpanded=function(t){return t.classList.contains(this.sectionExpandedClass)},n.prototype.checkIfAllSectionsOpen=function(){return this.$sections.length===this.$module.querySelectorAll("."+this.sectionExpandedClass).length},n.prototype.updateOpenAllButton=function(t){var e=t?"Close all":"Open all";e+='<span class="moaland-visually-hidden"> sections</span>',this.$openAllButton.setAttribute("aria-expanded",t),this.$openAllButton.innerHTML=e};var e={checkForSessionStorage:function(){var t,e="this is the test string";try{return window.sessionStorage.setItem(e,e),t=window.sessionStorage.getItem(e)===e.toString(),window.sessionStorage.removeItem(e),t}catch(n){"undefined"!=typeof console&&"undefined"!=typeof console.log||console.log("Notice: sessionStorage not available.")}}};n.prototype.storeState=function(t){if(this.browserSupportsSessionStorage){var e=t.querySelector("."+this.sectionButtonClass);if(e){var n=e.getAttribute("aria-controls"),o=e.getAttribute("aria-expanded");void 0!==n||"undefined"!=typeof console&&"undefined"!=typeof console.log||console.error(new Error("No aria controls present in accordion section heading.")),void 0!==o||"undefined"!=typeof console&&"undefined"!=typeof console.log||console.error(new Error("No aria expanded present in accordion section heading.")),n&&o&&window.sessionStorage.setItem(n,o)}}},n.prototype.setInitialState=function(t){if(this.browserSupportsSessionStorage){var e=t.querySelector("."+this.sectionButtonClass);if(e){var n=e.getAttribute("aria-controls"),o=n?window.sessionStorage.getItem(n):null;null!==o&&this.setExpanded("true"===o,t)}}},function(t){"Window"in this||"undefined"==typeof WorkerGlobalScope&&"function"!=typeof importScripts&&function(t){t.constructor?t.Window=t.constructor:(t.Window=t.constructor=new Function("return function Window() {}")()).prototype=this}(this)}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(r){!function(t){if(!("Event"in t))return!1;if("function"==typeof t.Event)return!0;try{return new Event("click"),!0}catch(e){return!1}}(this)&&function(){var n={click:1,dblclick:1,keyup:1,keypress:1,keydown:1,mousedown:1,mouseup:1,mousemove:1,mouseover:1,mouseenter:1,mouseleave:1,mouseout:1,storage:1,storagecommit:1,textinput:1};if("undefined"!=typeof document&&"undefined"!=typeof window){var t=window.Event&&window.Event.prototype||null;window.Event=Window.prototype.Event=function(t,e){if(!t)throw new Error("Not enough arguments");var n;if("createEvent"in document){n=document.createEvent("Event");var o=!(!e||e.bubbles===r)&&e.bubbles,i=!(!e||e.cancelable===r)&&e.cancelable;return n.initEvent(t,o,i),n}return(n=document.createEventObject()).type=t,n.bubbles=!(!e||e.bubbles===r)&&e.bubbles,n.cancelable=!(!e||e.cancelable===r)&&e.cancelable,n},t&&Object.defineProperty(window.Event,"prototype",{configurable:!1,enumerable:!1,writable:!0,value:t}),"createEvent"in document||(window.addEventListener=Window.prototype.addEventListener=Document.prototype.addEventListener=Element.prototype.addEventListener=function(){var a=this,t=arguments[0],e=arguments[1];if(a===window&&t in n)throw new Error("In IE8 the event: "+t+" is not available on the window object. Please see https://github.com/Financial-Times/polyfill-service/issues/317 for more information.");a._events||(a._events={}),a._events[t]||(a._events[t]=function(t){var e,n=a._events[t.type].list,o=n.slice(),i=-1,r=o.length;for(t.preventDefault=function(){!1!==t.cancelable&&(t.returnValue=!1)},t.stopPropagation=function(){t.cancelBubble=!0},t.stopImmediatePropagation=function(){t.cancelBubble=!0,t.cancelImmediate=!0},t.currentTarget=a,t.relatedTarget=t.fromElement||null,t.target=t.target||t.srcElement||a,t.timeStamp=(new Date).getTime(),t.clientX&&(t.pageX=t.clientX+document.documentElement.scrollLeft,t.pageY=t.clientY+document.documentElement.scrollTop);++i<r&&!t.cancelImmediate;)i in o&&-1!==s(n,e=o[i])&&"function"==typeof e&&e.call(a,t)},a._events[t].list=[],a.attachEvent&&a.attachEvent("on"+t,a._events[t])),a._events[t].list.push(e)},window.removeEventListener=Window.prototype.removeEventListener=Document.prototype.removeEventListener=Element.prototype.removeEventListener=function(){var t,e=this,n=arguments[0],o=arguments[1];e._events&&e._events[n]&&e._events[n].list&&-1!==(t=s(e._events[n].list,o))&&(e._events[n].list.splice(t,1),e._events[n].list.length||(e.detachEvent&&e.detachEvent("on"+n,e._events[n]),delete e._events[n]))},window.dispatchEvent=Window.prototype.dispatchEvent=Document.prototype.dispatchEvent=Element.prototype.dispatchEvent=function(t){if(!arguments.length)throw new Error("Not enough arguments");if(!t||"string"!=typeof t.type)throw new Error("DOM Events Exception 0");var e=this,n=t.type;try{if(!t.bubbles){t.cancelBubble=!0;var o=function(t){t.cancelBubble=!0,(e||window).detachEvent("on"+n,o)};this.attachEvent("on"+n,o)}this.fireEvent("on"+n,t)}catch(i){for(t.target=e;"_events"in(t.currentTarget=e)&&"function"==typeof e._events[n]&&e._events[n].call(e,t),"function"==typeof e["on"+n]&&e["on"+n].call(e,t),(e=9===e.nodeType?e.parentWindow:e.parentNode)&&!t.cancelBubble;);}return!0},document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&document.dispatchEvent(new Event("DOMContentLoaded",{bubbles:!0}))}))}function s(t,e){for(var n=-1,o=t.length;++n<o;)if(n in t&&t[n]===e)return n;return-1}}()}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{});function o(t){this.$module=t,this.debounceFormSubmitTimer=null}o.prototype.handleKeyDown=function(t){var e=t.target;"button"===e.getAttribute("role")&&32===t.keyCode&&(t.preventDefault(),e.click())},o.prototype.debounce=function(t){if("true"===t.target.getAttribute("data-prevent-double-click"))return this.debounceFormSubmitTimer?(t.preventDefault(),!1):void(this.debounceFormSubmitTimer=setTimeout(function(){this.debounceFormSubmitTimer=null}.bind(this),1e3))},o.prototype.init=function(){this.$module.addEventListener("keydown",this.handleKeyDown),this.$module.addEventListener("click",this.debounce)};function i(t){this.$module=t}function a(t){this.$module=t,this.$textarea=t.querySelector(".moaland-js-character-count"),this.$textarea&&(this.$countMessage=t.querySelector('[id="'+this.$textarea.id+'-info"]'))}function s(t){this.$module=t,this.$inputs=t.querySelectorAll('input[type="checkbox"]')}function l(t){this.$module=t}function c(t){this.$module=t}function u(t){this.$module=t,this.$menuButton=t&&t.querySelector(".moaland-js-header-toggle"),this.$menu=this.$menuButton&&t.querySelector("#"+this.$menuButton.getAttribute("aria-controls"))}function d(t){this.$module=t,this.$inputs=t.querySelectorAll('input[type="radio"]')}function h(t){this.$module=t,this.$tabs=t.querySelectorAll(".moaland-tabs__tab"),this.keys={left:37,right:39,up:38,down:40},this.jsHiddenClass="moaland-tabs__panel--hidden"}i.prototype.init=function(){this.$module&&("boolean"==typeof this.$module.open||this.polyfillDetails())},i.prototype.polyfillDetails=function(){var t=this.$module,e=this.$summary=t.getElementsByTagName("summary").item(0),n=this.$content=t.getElementsByTagName("div").item(0);e&&n&&(n.id||(n.id="details-content-"+function o(){var n=(new Date).getTime();return"undefined"!=typeof window.performance&&"function"==typeof window.performance.now&&(n+=window.performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===t?e:3&e|8).toString(16)})}()),t.setAttribute("role","group"),e.setAttribute("role","button"),e.setAttribute("aria-controls",n.id),!(e.tabIndex=0)==(null!==t.getAttribute("open"))?(e.setAttribute("aria-expanded","true"),n.setAttribute("aria-hidden","false")):(e.setAttribute("aria-expanded","false"),n.setAttribute("aria-hidden","true"),n.style.display="none"),this.polyfillHandleInputs(e,this.polyfillSetAttributes.bind(this)))},i.prototype.polyfillSetAttributes=function(){var t=this.$module,e=this.$summary,n=this.$content,o="true"===e.getAttribute("aria-expanded"),i="true"===n.getAttribute("aria-hidden");return e.setAttribute("aria-expanded",o?"false":"true"),n.setAttribute("aria-hidden",i?"false":"true"),n.style.display=o?"none":"",null!==t.getAttribute("open")?t.removeAttribute("open"):t.setAttribute("open","open"),!0},i.prototype.polyfillHandleInputs=function(t,n){t.addEventListener("keypress",function(t){var e=t.target;13!==t.keyCode&&32!==t.keyCode||"summary"===e.nodeName.toLowerCase()&&(t.preventDefault(),e.click?e.click():n(t))}),t.addEventListener("keyup",function(t){var e=t.target;32===t.keyCode&&"summary"===e.nodeName.toLowerCase()&&t.preventDefault()}),t.addEventListener("click",n)},a.prototype.defaults={characterCountAttribute:"data-maxlength",wordCountAttribute:"data-maxwords"},a.prototype.init=function(){var t=this.$module,e=this.$textarea,n=this.$countMessage;if(e&&n){e.insertAdjacentElement("afterend",n),this.options=this.getDataset(t);var o=this.defaults.characterCountAttribute;this.options.maxwords&&(o=this.defaults.wordCountAttribute),this.maxLength=t.getAttribute(o),this.maxLength&&(t.removeAttribute("maxlength"),"onpageshow"in window?window.addEventListener("pageshow",this.sync.bind(this)):window.addEventListener("DOMContentLoaded",this.sync.bind(this)),this.sync())}},a.prototype.sync=function(){this.bindChangeEvents(),this.updateCountMessage()},a.prototype.getDataset=function(t){var e={},n=t.attributes;if(n)for(var o=0;o<n.length;o++){var i=n[o],r=i.name.match(/^data-(.+)/);r&&(e[r[1]]=i.value)}return e},a.prototype.count=function(t){var e;this.options.maxwords?e=(t.match(/\S+/g)||[]).length:e=t.length;return e},a.prototype.bindChangeEvents=function(){var t=this.$textarea;t.addEventListener("keyup",this.checkIfValueChanged.bind(this)),t.addEventListener("focus",this.handleFocus.bind(this)),t.addEventListener("blur",this.handleBlur.bind(this))},a.prototype.checkIfValueChanged=function(){this.$textarea.oldValue||(this.$textarea.oldValue=""),this.$textarea.value!==this.$textarea.oldValue&&(this.$textarea.oldValue=this.$textarea.value,this.updateCountMessage())},a.prototype.updateCountMessage=function(){var t=this.$textarea,e=this.options,n=this.$countMessage,o=this.count(t.value),i=this.maxLength,r=i-o;o<i*(e.threshold?e.threshold:0)/100?(n.classList.add("moaland-character-count__message--disabled"),n.setAttribute("aria-hidden",!0)):(n.classList.remove("moaland-character-count__message--disabled"),n.removeAttribute("aria-hidden")),r<0?(t.classList.add("moaland-textarea--error"),n.classList.remove("moaland-hint"),n.classList.add("moaland-error-message")):(t.classList.remove("moaland-textarea--error"),n.classList.remove("moaland-error-message"),n.classList.add("moaland-hint"));var a,s,l="character";e.maxwords&&(l="word"),l+=-1==r||1==r?"":"s",a=r<0?"too many":"remaining",s=Math.abs(r),n.innerHTML="You have "+s+" "+l+" "+a},a.prototype.handleFocus=function(){this.valueChecker=setInterval(this.checkIfValueChanged.bind(this),1e3)},a.prototype.handleBlur=function(){clearInterval(this.valueChecker)},s.prototype.init=function(){var n=this.$module;r(this.$inputs,function(t){var e=t.getAttribute("data-aria-controls");e&&n.querySelector("#"+e)&&(t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls"))}),"onpageshow"in window?window.addEventListener("pageshow",this.syncAllConditionalReveals.bind(this)):window.addEventListener("DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),n.addEventListener("click",this.handleClick.bind(this))},s.prototype.syncAllConditionalReveals=function(){r(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))},s.prototype.syncConditionalRevealWithInputState=function(t){var e=this.$module.querySelector("#"+t.getAttribute("aria-controls"));if(e&&e.classList.contains("moaland-checkboxes__conditional")){var n=t.checked;t.setAttribute("aria-expanded",n),e.classList.toggle("moaland-checkboxes__conditional--hidden",!n)}},s.prototype.handleClick=function(t){var e=t.target,n="checkbox"===e.getAttribute("type"),o=e.getAttribute("aria-controls");n&&o&&this.syncConditionalRevealWithInputState(e)},function(t){"document"in this&&"matches"in document.documentElement||(Element.prototype.matches=Element.prototype.webkitMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.mozMatchesSelector||function(t){for(var e=(this.document||this.ownerDocument).querySelectorAll(t),n=0;e[n]&&e[n]!==this;)++n;return!!e[n]})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"document"in this&&"closest"in document.documentElement||(Element.prototype.closest=function(t){for(var e=this;e;){if(e.matches(t))return e;e="SVGElement"in window&&e instanceof SVGElement?e.parentNode:e.parentElement}return null})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),l.prototype.init=function(){var t=this.$module;t&&(t.focus(),t.addEventListener("click",this.handleClick.bind(this)))},l.prototype.handleClick=function(t){var e=t.target;this.focusTarget(e)&&t.preventDefault()},l.prototype.focusTarget=function(t){if("A"!==t.tagName||!1===t.href)return!1;var e=this.getFragmentFromUrl(t.href),n=document.getElementById(e);if(!n)return!1;var o=this.getAssociatedLegendOrLabel(n);return!!o&&(o.scrollIntoView(),n.focus({preventScroll:!0}),!0)},l.prototype.getFragmentFromUrl=function(t){return-1!==t.indexOf("#")&&t.split("#").pop()},l.prototype.getAssociatedLegendOrLabel=function(t){var e=t.closest("fieldset");if(e){var n=e.getElementsByTagName("legend");if(n.length){var o=n[0];if("checkbox"===t.type||"radio"===t.type)return o;var i=o.getBoundingClientRect().top,r=t.getBoundingClientRect();if(r.height&&window.innerHeight)if(r.top+r.height-i<window.innerHeight/2)return o}}return document.querySelector("label[for='"+t.getAttribute("id")+"']")||t.closest("label")},c.prototype.init=function(){this.$module&&this.setFocus()},c.prototype.setFocus=function(){var t=this.$module;"true"!==t.getAttribute("data-disable-auto-focus")&&"alert"===t.getAttribute("role")&&(t.getAttribute("tabindex")||(t.setAttribute("tabindex","-1"),t.addEventListener("blur",function(){t.removeAttribute("tabindex")})),t.focus())},u.prototype.init=function(){this.$module&&this.$menuButton&&this.$menu&&(this.syncState(this.$menu.classList.contains("moaland-header__navigation--open")),this.$menuButton.addEventListener("click",this.handleMenuButtonClick.bind(this)))},u.prototype.syncState=function(t){this.$menuButton.classList.toggle("moaland-header__menu-button--open",t),this.$menuButton.setAttribute("aria-expanded",t)},u.prototype.handleMenuButtonClick=function(){var t=this.$menu.classList.toggle("moaland-header__navigation--open");this.syncState(t)},d.prototype.init=function(){var n=this.$module;r(this.$inputs,function(t){var e=t.getAttribute("data-aria-controls");e&&n.querySelector("#"+e)&&(t.setAttribute("aria-controls",e),t.removeAttribute("data-aria-controls"))}),"onpageshow"in window?window.addEventListener("pageshow",this.syncAllConditionalReveals.bind(this)):window.addEventListener("DOMContentLoaded",this.syncAllConditionalReveals.bind(this)),this.syncAllConditionalReveals(),n.addEventListener("click",this.handleClick.bind(this))},d.prototype.syncAllConditionalReveals=function(){r(this.$inputs,this.syncConditionalRevealWithInputState.bind(this))},d.prototype.syncConditionalRevealWithInputState=function(t){var e=document.querySelector("#"+t.getAttribute("aria-controls"));if(e&&e.classList.contains("moaland-radios__conditional")){var n=t.checked;t.setAttribute("aria-expanded",n),e.classList.toggle("moaland-radios__conditional--hidden",!n)}},d.prototype.handleClick=function(t){var n=t.target;"radio"===n.type&&r(document.querySelectorAll('input[type="radio"][aria-controls]'),function(t){var e=t.form===n.form;t.name===n.name&&e&&this.syncConditionalRevealWithInputState(t)}.bind(this))},function(t){"document"in this&&"nextElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"nextElementSibling",{get:function(){for(var t=this.nextSibling;t&&1!==t.nodeType;)t=t.nextSibling;return t}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),function(t){"document"in this&&"previousElementSibling"in document.documentElement||Object.defineProperty(Element.prototype,"previousElementSibling",{get:function(){for(var t=this.previousSibling;t&&1!==t.nodeType;)t=t.previousSibling;return t}})}.call("object"==typeof window&&window||"object"==typeof self&&self||"object"==typeof global&&global||{}),h.prototype.init=function(){"function"==typeof window.matchMedia?this.setupResponsiveChecks():this.setup()},h.prototype.setupResponsiveChecks=function(){this.mql=window.matchMedia("(min-width: 40.0625em)"),this.mql.addListener(this.checkMode.bind(this)),this.checkMode()},h.prototype.checkMode=function(){this.mql.matches?this.setup():this.teardown()},h.prototype.setup=function(){var t=this.$module,e=this.$tabs,n=t.querySelector(".moaland-tabs__list"),o=t.querySelectorAll(".moaland-tabs__list-item");if(e&&n&&o){n.setAttribute("role","tablist"),r(o,function(t){t.setAttribute("role","presentation")}),r(e,function(t){this.setAttributes(t),t.boundTabClick=this.onTabClick.bind(this),t.boundTabKeydown=this.onTabKeydown.bind(this),t.addEventListener("click",t.boundTabClick,!0),t.addEventListener("keydown",t.boundTabKeydown,!0),this.hideTab(t)}.bind(this));var i=this.getTab(window.location.hash)||this.$tabs[0];this.showTab(i),t.boundOnHashChange=this.onHashChange.bind(this),window.addEventListener("hashchange",t.boundOnHashChange,!0)}},h.prototype.teardown=function(){var t=this.$module,e=this.$tabs,n=t.querySelector(".moaland-tabs__list"),o=t.querySelectorAll(".moaland-tabs__list-item");e&&n&&o&&(n.removeAttribute("role"),r(o,function(t){t.removeAttribute("role","presentation")}),r(e,function(t){t.removeEventListener("click",t.boundTabClick,!0),t.removeEventListener("keydown",t.boundTabKeydown,!0),this.unsetAttributes(t)}.bind(this)),window.removeEventListener("hashchange",t.boundOnHashChange,!0))},h.prototype.onHashChange=function(t){var e=window.location.hash,n=this.getTab(e);if(n)if(this.changingHash)this.changingHash=!1;else{var o=this.getCurrentTab();this.hideTab(o),this.showTab(n),n.focus()}},h.prototype.hideTab=function(t){this.unhighlightTab(t),this.hidePanel(t)},h.prototype.showTab=function(t){this.highlightTab(t),this.showPanel(t)},h.prototype.getTab=function(t){return this.$module.querySelector('.moaland-tabs__tab[href="'+t+'"]')},h.prototype.setAttributes=function(t){var e=this.getHref(t).slice(1);t.setAttribute("id","tab_"+e),t.setAttribute("role","tab"),t.setAttribute("aria-controls",e),t.setAttribute("aria-selected","false"),t.setAttribute("tabindex","-1");var n=this.getPanel(t);n.setAttribute("role","tabpanel"),n.setAttribute("aria-labelledby",t.id),n.classList.add(this.jsHiddenClass)},h.prototype.unsetAttributes=function(t){t.removeAttribute("id"),t.removeAttribute("role"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-selected"),t.removeAttribute("tabindex");var e=this.getPanel(t);e.removeAttribute("role"),e.removeAttribute("aria-labelledby"),e.classList.remove(this.jsHiddenClass)},h.prototype.onTabClick=function(t){if(!t.target.classList.contains("moaland-tabs__tab"))return!1;t.preventDefault();var e=t.target,n=this.getCurrentTab();this.hideTab(n),this.showTab(e),this.createHistoryEntry(e)},h.prototype.createHistoryEntry=function(t){var e=this.getPanel(t),n=e.id;e.id="",this.changingHash=!0,window.location.hash=this.getHref(t).slice(1),e.id=n},h.prototype.onTabKeydown=function(t){switch(t.keyCode){case this.keys.left:case this.keys.up:this.activatePreviousTab(),t.preventDefault();break;case this.keys.right:case this.keys.down:this.activateNextTab(),t.preventDefault()}},h.prototype.activateNextTab=function(){var t=this.getCurrentTab(),e=t.parentNode.nextElementSibling;if(e)var n=e.querySelector(".moaland-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))},h.prototype.activatePreviousTab=function(){var t=this.getCurrentTab(),e=t.parentNode.previousElementSibling;if(e)var n=e.querySelector(".moaland-tabs__tab");n&&(this.hideTab(t),this.showTab(n),n.focus(),this.createHistoryEntry(n))},h.prototype.getPanel=function(t){return this.$module.querySelector(this.getHref(t))},h.prototype.showPanel=function(t){this.getPanel(t).classList.remove(this.jsHiddenClass)},h.prototype.hidePanel=function(t){this.getPanel(t).classList.add(this.jsHiddenClass)},h.prototype.unhighlightTab=function(t){t.setAttribute("aria-selected","false"),t.parentNode.classList.remove("moaland-tabs__list-item--selected"),t.setAttribute("tabindex","-1")},h.prototype.highlightTab=function(t){t.setAttribute("aria-selected","true"),t.parentNode.classList.add("moaland-tabs__list-item--selected"),t.setAttribute("tabindex","0")},h.prototype.getCurrentTab=function(){return this.$module.querySelector(".moaland-tabs__list-item--selected .moaland-tabs__tab")},h.prototype.getHref=function(t){var e=t.getAttribute("href");return e.slice(e.indexOf("#"),e.length)},t.initAll=function p(t){var e="undefined"!=typeof(t=void 0!==t?t:{}).scope?t.scope:document;r(e.querySelectorAll('[data-module="moaland-button"]'),function(t){new o(t).init()}),r(e.querySelectorAll('[data-module="moaland-accordion"]'),function(t){new n(t).init()}),r(e.querySelectorAll('[data-module="moaland-details"]'),function(t){new i(t).init()}),r(e.querySelectorAll('[data-module="moaland-character-count"]'),function(t){new a(t).init()}),r(e.querySelectorAll('[data-module="moaland-checkboxes"]'),function(t){new s(t).init()}),new l(e.querySelector('[data-module="moaland-error-summary"]')).init(),new u(e.querySelector('[data-module="moaland-header"]')).init(),r(e.querySelectorAll('[data-module="moaland-notification-banner"]'),function(t){new c(t).init()}),r(e.querySelectorAll('[data-module="moaland-radios"]'),function(t){new d(t).init()}),r(e.querySelectorAll('[data-module="moaland-tabs"]'),function(t){new h(t).init()})},t.Accordion=n,t.Button=o,t.Details=i,t.CharacterCount=a,t.Checkboxes=s,t.ErrorSummary=l,t.Header=u,t.Radios=d,t.Tabs=h});
17,190.5
34,380
0.75152
bbabb0e8482b2dc1b1eb78d095850023c07706b0
1,267
js
JavaScript
dist/log.js
NanoMeow/MirrorEngine
af0958d8374986b79ebbe3b887e905560cb12949
[ "MIT" ]
5
2019-05-13T09:03:22.000Z
2019-11-29T16:06:24.000Z
dist/log.js
NanoMeow/MirrorEngine
af0958d8374986b79ebbe3b887e905560cb12949
[ "MIT" ]
14
2018-11-12T20:35:46.000Z
2020-05-17T02:36:42.000Z
dist/log.js
NanoMeow/MirrorEngine
af0958d8374986b79ebbe3b887e905560cb12949
[ "MIT" ]
2
2020-01-02T11:25:17.000Z
2020-06-26T11:13:08.000Z
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.LogError = exports.LogWarning = exports.LogMessage = exports.LogDebug = exports.LogSetFile = void 0; const fs = require("fs-extra"); let LogStream; exports.LogSetFile = (file) => { if (typeof LogStream !== "undefined") LogStream.end(); LogStream = fs.createWriteStream(file, { flags: "a", encoding: "utf8" }); }; const StringToIterable = function* (str, prefix) { if (str.length === 0) return; const now = (new Date()).toUTCString(); const lines = str.split("\n"); for (let line of lines) { line = "[" + now + "] " + line; if (typeof prefix === "string") yield prefix + " " + line; else yield line; } }; const LogAny = (message, prefix) => { for (const line of StringToIterable(message, prefix)) { console.log(line); if (typeof LogStream !== "undefined") LogStream.write(line + "\n"); } }; exports.LogDebug = (message) => { LogAny(message, "DBG"); }; exports.LogMessage = (message) => { LogAny(message, "MSG"); }; exports.LogWarning = (message) => { LogAny(message, "WRN"); }; exports.LogError = (message) => { LogAny(message, "ERR"); };
29.465116
108
0.585635
bbabbb259832a44d98c08277d3fc4515b3a3a732
84
js
JavaScript
doc/html/search/classes_0.js
milankal/WolkConnect-C
21f5598198e9ca69fdd39c90de03bc248537befb
[ "Apache-2.0" ]
null
null
null
doc/html/search/classes_0.js
milankal/WolkConnect-C
21f5598198e9ca69fdd39c90de03bc248537befb
[ "Apache-2.0" ]
1
2019-09-08T13:25:18.000Z
2019-09-08T13:25:18.000Z
doc/html/search/classes_1.js
milankal/WolkConnect-C
21f5598198e9ca69fdd39c90de03bc248537befb
[ "Apache-2.0" ]
null
null
null
var searchData= [ ['wolk_5fctx',['wolk_ctx',['../structwolk__ctx.html',1,'']]] ];
16.8
62
0.607143
bbac0a5b7311a5980f338ef6ed7160e8a9912ecd
208
js
JavaScript
frontend/src/store/actions/loginModal.js
Code-and-Beyond/whatcha
1d3f6e6461fc8185bc4c373bbd754d8bbf484554
[ "MIT" ]
null
null
null
frontend/src/store/actions/loginModal.js
Code-and-Beyond/whatcha
1d3f6e6461fc8185bc4c373bbd754d8bbf484554
[ "MIT" ]
null
null
null
frontend/src/store/actions/loginModal.js
Code-and-Beyond/whatcha
1d3f6e6461fc8185bc4c373bbd754d8bbf484554
[ "MIT" ]
null
null
null
import * as actionTypes from './actionTypes'; export const toggleLoginModal = (visible, redirect = null) => { return { type: actionTypes.TOGGLE_LOGIN_MODAL, visible: visible, redirect: redirect }; };
23.111111
63
0.716346
bbac21f83c83e4961fc4c4544c37f3e0342e055a
501
js
JavaScript
src/categories.js
Mictian/POIS
5166f9fefdb8abc35e15f0c0234702fee939b020
[ "MIT" ]
null
null
null
src/categories.js
Mictian/POIS
5166f9fefdb8abc35e15f0c0234702fee939b020
[ "MIT" ]
null
null
null
src/categories.js
Mictian/POIS
5166f9fefdb8abc35e15f0c0234702fee939b020
[ "MIT" ]
null
null
null
var _ = require('underscore'); var _categories = []; module.exports = { get: function (appId) { if (!appId) return _categories; return _.where(_categories, {appId: Number(appId)}); }, setDB: function (categoriesDB) { _categories = categoriesDB; }, getCategoriesByName: function (name, appId) { var categorySelected; _.each(this.get(appId), function (category) { if (name == category.name) { categorySelected = category; } }); return categorySelected; } };
16.16129
54
0.652695
bbac3adb3ec4fd40727346fe4516a5d5850094c3
1,300
js
JavaScript
dist/resources/sap/ui/util/XMLHelper.js
fleischr/sapui5-metamask-shoppingcart
51774eca09c3f1c4588b8b70ec5c006df13a8eef
[ "Unlicense" ]
null
null
null
dist/resources/sap/ui/util/XMLHelper.js
fleischr/sapui5-metamask-shoppingcart
51774eca09c3f1c4588b8b70ec5c006df13a8eef
[ "Unlicense" ]
15
2022-02-23T17:30:35.000Z
2022-03-23T02:24:32.000Z
dist/resources/sap/ui/util/XMLHelper.js
fleischr/sapui5-metamask-shoppingcart
51774eca09c3f1c4588b8b70ec5c006df13a8eef
[ "Unlicense" ]
null
null
null
/*! * OpenUI5 * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(["sap/ui/Device"],function(e){"use strict";var r={};r.parse=function(e){var n;var t;var i=new DOMParser;n=i.parseFromString(e,"text/xml");t=r.getParseError(n);if(t){if(!n.parseError){n.parseError=t}}return n};r.getParseError=function(n){var t={errorCode:-1,url:"",reason:"unknown error",srcText:"",line:-1,linepos:-1,filepos:-1};if(e.browser.firefox&&n&&n.documentElement&&n.documentElement.tagName=="parsererror"){var i=n.documentElement.firstChild.nodeValue,o=/XML Parsing Error: (.*)\nLocation: (.*)\nLine Number (\d+), Column (\d+):(.*)/;if(o.test(i)){t.reason=RegExp.$1;t.url=RegExp.$2;t.line=parseInt(RegExp.$3);t.linepos=parseInt(RegExp.$4);t.srcText=RegExp.$5}return t}if(e.browser.webkit&&n&&n.documentElement&&n.getElementsByTagName("parsererror").length>0){var i=r.serialize(n),o=/(error|warning) on line (\d+) at column (\d+): ([^<]*)\n/;if(o.test(i)){t.reason=RegExp.$4;t.url="";t.line=parseInt(RegExp.$2);t.linepos=parseInt(RegExp.$3);t.srcText="";t.type=RegExp.$1}return t}if(!n||!n.documentElement){return t}return{errorCode:0}};r.serialize=function(e){var r=new XMLSerializer;return r.serializeToString(e)};return r});
216.666667
1,149
0.710769
bbad27aeed4ff27201374def2cbcc0680d68c83c
3,340
js
JavaScript
sm-shop/src/main/webapp/resources/js/adminFunctions.js
guymoyo/shopizer
9423cefd9a00d73e340c56a3257e163b5290e064
[ "Apache-2.0" ]
null
null
null
sm-shop/src/main/webapp/resources/js/adminFunctions.js
guymoyo/shopizer
9423cefd9a00d73e340c56a3257e163b5290e064
[ "Apache-2.0" ]
null
null
null
sm-shop/src/main/webapp/resources/js/adminFunctions.js
guymoyo/shopizer
9423cefd9a00d73e340c56a3257e163b5290e064
[ "Apache-2.0" ]
null
null
null
$(function(){ initBindings(); }); function initBindings() { /** numeric formats **/ if($('#productPriceAmount')) { $('#productPriceAmount').blur(function() { $('#help-price').html(null); $(this).formatCurrency({ roundToDecimalPlace: 2, eventOnDecimalsEntered: true, symbol: ''}); }) .keyup(function(e) { var e = window.event || e; var keyUnicode = e.charCode || e.keyCode; if (e !== undefined) { switch (keyUnicode) { case 16: break; // Shift case 17: break; // Ctrl case 18: break; // Alt case 27: this.value = ''; break; // Esc: clear entry case 35: break; // End case 36: break; // Home case 37: break; // cursor left case 38: break; // cursor up case 39: break; // cursor right case 40: break; // cursor down case 78: break; // N (Opera 9.63+ maps the "." from the number key section to the "N" key too!) (See: http://unixpapa.com/js/key.html search for ". Del") case 110: break; // . number block (Opera 9.63+ maps the "." from the number block to the "N" key (78) !!!) case 190: break; // . default: $(this).formatCurrency({ colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -1, eventOnDecimalsEntered: true, symbol: ''}); } } }) .bind('decimalsEntered', function(e, cents) { if (String(cents).length > 2) { var errorMsg = priceFormatMessage + ' (0.' + cents + ')'; $('#help-price').html(errorMsg); } }); } /** numeric formats **/ if($('#productPricePurchase')) { $('#productPricePurchase').blur(function() { $('#help-price').html(null); $(this).formatCurrency({ roundToDecimalPlace: 2, eventOnDecimalsEntered: true, symbol: ''}); //$('#productPriceAmount').val($('#productPricePurchase').val() *1,2); }) .keyup(function(e) { var e = window.event || e; var keyUnicode = e.charCode || e.keyCode; if (e !== undefined) { switch (keyUnicode) { case 16: break; // Shift case 17: break; // Ctrl case 18: break; // Alt case 27: this.value = ''; break; // Esc: clear entry case 35: break; // End case 36: break; // Home case 37: break; // cursor left case 38: break; // cursor up case 39: break; // cursor right case 40: break; // cursor down case 78: break; // N (Opera 9.63+ maps the "." from the number key section to the "N" key too!) (See: http://unixpapa.com/js/key.html search for ". Del") case 110: break; // . number block (Opera 9.63+ maps the "." from the number block to the "N" key (78) !!!) case 190: break; // . default: $(this).formatCurrency({ colorize: true, negativeFormat: '-%s%n', roundToDecimalPlace: -1, eventOnDecimalsEntered: true, symbol: ''}); } } }) .bind('decimalsEntered', function(e, cents) { if (String(cents).length > 2) { var errorMsg = priceFormatMessage + ' (0.' + cents + ')'; $('#help-price').html(errorMsg); } }); } }
38.837209
168
0.51976
bbaed9da284d953b0cd174e009aea2ce54b50db5
445
js
JavaScript
src/components/Navbar/Navbar.js
rezakelidari/whatsapp-plus
f05c3401c8e04a4fed0b3a1a72f4c53ea3ffced2
[ "MIT" ]
null
null
null
src/components/Navbar/Navbar.js
rezakelidari/whatsapp-plus
f05c3401c8e04a4fed0b3a1a72f4c53ea3ffced2
[ "MIT" ]
null
null
null
src/components/Navbar/Navbar.js
rezakelidari/whatsapp-plus
f05c3401c8e04a4fed0b3a1a72f4c53ea3ffced2
[ "MIT" ]
null
null
null
import React from "react"; import Styles from "./Navbar.module.css"; import Title from "../Title/Title"; import { SignOut } from "../../services/Firebase"; import { useNavigate } from "react-router"; function Navbar() { const navigate = useNavigate(); return ( <nav> <Title /> <button className={Styles.navLogout} onClick={() => SignOut(navigate)}> Logout </button> </nav> ); } export default Navbar;
20.227273
77
0.626966
bbaeeb17a126122233b07cafa4504e9887b453b8
171
js
JavaScript
node_modules/buble/src/program/types/TemplateElement.js
hishammk/rapidevelop.my
58b7a092a0c5ca7cfaca7f2518cb4a3c1e0d57ff
[ "MIT" ]
1
2020-07-25T11:27:36.000Z
2020-07-25T11:27:36.000Z
node_modules/buble/src/program/types/TemplateElement.js
hishammk/rapidevelop.my
58b7a092a0c5ca7cfaca7f2518cb4a3c1e0d57ff
[ "MIT" ]
null
null
null
node_modules/buble/src/program/types/TemplateElement.js
hishammk/rapidevelop.my
58b7a092a0c5ca7cfaca7f2518cb4a3c1e0d57ff
[ "MIT" ]
null
null
null
import Node from '../Node.js'; export default class TemplateElement extends Node { initialise ( transforms ) { this.program.templateElements.push( this ); } }
21.375
52
0.695906
bbaf142d74a551b238e3803ec4537037a6dbfe1b
4,199
js
JavaScript
static/js/ros_connection.js
biobotus/biobot_web
be11bebb0e8fe53a405f5ddc11a66d5ba34b6241
[ "CC-BY-4.0" ]
5
2016-03-29T16:22:29.000Z
2021-07-09T14:38:01.000Z
static/js/ros_connection.js
biobotus/biobot_web
be11bebb0e8fe53a405f5ddc11a66d5ba34b6241
[ "CC-BY-4.0" ]
1
2016-10-17T20:12:55.000Z
2016-10-17T20:46:18.000Z
static/js/ros_connection.js
biobotus/biobot_web
be11bebb0e8fe53a405f5ddc11a66d5ba34b6241
[ "CC-BY-4.0" ]
null
null
null
// JS file to connect to ROS var ros; var global_enable_topic; var step_done_topic; var error_topic; var ros_connection_error = false; // Display the current status of the robot at bottom center of the page function update_status(msg) { $('#biobot_status')[0].innerHTML = msg; if (msg.startsWith('powered off')) { $('#pause').hide() $('#resume').hide() } else if (msg.endsWith('(paused)')) { $('#pause').hide() $('#resume').show() } else { $('#pause').show() $('#resume').hide() } } // Create ROS object and connect to the rosbridge server via websocket function ros_init() { // Connecting to ROS ros = new ROSLIB.Ros(); // If there is an error on the backend, an 'error' emit will be emitted. ros.on('error', function(error) { console.log(error); ros_connection_error = true; $('#ros_label_connecting').hide() $('#ros_label_connected').hide() $('#ros_label_closed').hide() $('#ros_label_error').show() update_status('powered off'); }); // Find out exactly when we made a connection. ros.on('connection', function() { console.log('Connection made!'); ros_connection_error = false; $('#ros_label_connecting').hide() $('#ros_label_connected').show() $('#ros_label_closed').hide() $('#ros_label_error').hide() update_status('connected'); }); ros.on('close', function() { console.log('Connection closed.'); $('#ros_label_connecting').hide() $('#ros_label_connected').hide() $('#ros_label_closed').hide() $('#ros_label_error').hide() update_status('powered off'); if (ros_connection_error) { $('#ros_label_error').show() } else { $('#ros_label_closed').show() } }); ros.connect('ws://' + ros_host + ':' + ros_port); add_global_topic(); } // Send emergency stop to the robot - this will kill ROS function e_stop_send() { BootstrapDialog.confirm({ title: 'Emergency stop!', message: 'Cancel all BioBot activities immediately? It will require a manual restart.', type: BootstrapDialog.TYPE_DANGER, btnOKLabel: 'Confirm', callback: function(result){ if(result) { var global_disable = new ROSLIB.Message({ data: false }); global_enable_topic.publish(global_disable); console.log("Publishing e-stop") var error = new ROSLIB.Message({ data: JSON.stringify({"error_code": "Sw0", "name": "BioBot_Web"}) }); error_topic.publish(error) } } }); } // Manually pause the robot at the Planner level (Manual Control actions will still go through) function pause(action) { var message = new ROSLIB.Message({ data: action }); pause_topic.publish(message) } // ROS topics used in every page function add_global_topic() { global_enable_topic = new ROSLIB.Topic({ ros: ros, name: '/Global_Enable', messageType: 'std_msgs/Bool' }); step_done_topic = new ROSLIB.Topic({ ros: ros, name: '/Step_Done', messageType: 'std_msgs/Bool' }); error_topic = new ROSLIB.Topic({ ros: ros, name: '/Error', messageType: 'std_msgs/String' }); pause_topic = new ROSLIB.Topic({ ros: ros, name: '/Pause', messageType: 'std_msgs/Bool' }); status_topic = new ROSLIB.Topic({ ros: ros, name: '/BioBot_Status', messageType: 'std_msgs/String' }); step_done_topic.subscribe(function(message) { if (!message.data) BootstrapDialog.show({ title: 'Error', message: 'BioBot requires a manual restart.', type: BootstrapDialog.TYPE_DANGER }); }); status_topic.subscribe(function(message) { update_status(message.data); }); } window.onload = function() { setHeightSidebar(); ros_init(); };
26.916667
95
0.566325
bbb03095abb413fa351d097e65a71fe5eb28cfbf
1,065
js
JavaScript
src/Sprites/Agbero.js
Ezema-Ugonna-Donald/Keke-Run
df57c04388b0a09ed1e68b3bd90e8ee07eb64b4c
[ "MIT" ]
1
2020-10-03T18:48:07.000Z
2020-10-03T18:48:07.000Z
src/Sprites/Agbero.js
Ezema-Ugonna-Donald/Keke-Run
df57c04388b0a09ed1e68b3bd90e8ee07eb64b4c
[ "MIT" ]
6
2020-05-05T12:23:06.000Z
2021-05-06T14:03:05.000Z
src/Sprites/Agbero.js
Ezema-Ugonna-Donald/Keke-Run
df57c04388b0a09ed1e68b3bd90e8ee07eb64b4c
[ "MIT" ]
null
null
null
import 'phaser'; export default class Agbero extends Phaser.Physics.Arcade.Image { constructor (scene, x, y) { super(scene, x, y, 'agbero'); this.scene = scene; // enable physics this.scene.physics.world.enable(this); // add our player to the scene this.scene.add.existing(this); // move agbero // this.timedEventAgbero = this.scene.time.addEvent({ // delay: 1500, // callback: this.move, // loop: true, // callbackScope: this // }); this.move(); } update () { } move () { this.setCollideWorldBounds(true); this.setVelocity(100, 100); this.setBounce(1, 1); if (this.x === 3410) { this.setVelocity(-100, 100); } if (this.x === 5) { this.setVelocity(100, 100); } this.body.setBoundsRectangle(new Phaser.Geom.Rectangle(5, 220, 3410, 490)); } }
21.734694
81
0.479812
bbb0331024d5a1f7efd0b6dc1259d2e89916d7e8
1,997
js
JavaScript
homepage/static/viewer/imghelper_30b4170.js
mirrowall/beeso
3c6119d00d2f1818417036c7b4034105acc0d72d
[ "Apache-2.0" ]
null
null
null
homepage/static/viewer/imghelper_30b4170.js
mirrowall/beeso
3c6119d00d2f1818417036c7b4034105acc0d72d
[ "Apache-2.0" ]
null
null
null
homepage/static/viewer/imghelper_30b4170.js
mirrowall/beeso
3c6119d00d2f1818417036c7b4034105acc0d72d
[ "Apache-2.0" ]
null
null
null
define("common:widget/ui/imghelper/imghelper",function(h){var t=h("common:widget/ui/base/base"),i={_loaded:{},_loading:{},fetch:function(h){var i=new t.Deferred;if(this._loaded[h])return i.resolve(this._loaded[h]);if(this._loading[h])return this._loading[h];var e=new Image,n=this;return e.onload=function(){var t={width:e.width,height:e.height};n._loaded[h]=t,i.resolve(t)},e.onerror=function(){i.reject()},this._loading[h]=i,e.src=h,i.always(function(){e.onload=e.onerror=null,delete n._loading[h],e=null})}},e={zoom:function(h,t){if(!(h.width&&h.height&&t.width&&t.height))return{width:h.width&&t.width?Math.min(t.width,h.width):"auto",height:h.height&&t.height?Math.min(t.height,h.height):"auto"};var i={};return h.width/h.height>t.width/t.height?(i.width=Math.min(h.width,t.width),i.height=Math.floor(h.height*i.width/h.width)):(i.height=Math.min(h.height,t.height),i.width=Math.floor(h.width*i.height/h.height)),i},scaleFull:function(h,t){if(!(h.width&&h.height&&t.width&&t.height))return{width:h.width&&t.width?Math.min(t.width,h.width):"auto",height:h.height&&t.height?Math.min(t.height,h.height):"auto"};var i={};return h.width/h.height>t.width/t.height?(i.height=t.height,i.width=Math.floor(h.width*i.height/h.height)):(i.width=t.width,i.height=Math.floor(h.height*i.width/h.width)),i.width>t.width&&(i["margin-left"]=(t.width-i.width)/2+"px"),i.height>t.height&&(i["margin-top"]=(t.height-i.height)/3+"px"),i},getFileType:function(h){if(!h)return"";var t=h.lastIndexOf(".");return t>0?h.substr(t+1):""},formatBytes:function(h,t,i){var e=["b","kb","mb","gb"],n=h;for(t=t||0;n>=1024&&t<e.length-1;)n/=1024,t+=1;return t>0&&(n=Math.round(100*n)/100),i&&(n=i.call(null,n)),n+e[t]},bindScaleFull:function(h,t,i){var n=h[0];n.onload=function(){var n=e._imgLoaded(h,t);i&&i(n)}},_imgLoaded:function(h,t){var i=h[0],n=e.scaleFull({width:i.width,height:i.height},t);return h.css(n),i.onload=null,n},loadImage:function(h,e){t(h).each(function(h,t){i.fetch(t).then(e||function(){})})}};return e});
1,997
1,997
0.699049
bbb0df598d5b81b84ce1d6bae9167f235b344db5
4,462
js
JavaScript
front-end/resources/js/routes/survey/resultsDirective.js
caninojories/x-scribe-testing-activity
3c8ada8ad39816309bc9b82eb567408709c3d2bd
[ "MIT" ]
null
null
null
front-end/resources/js/routes/survey/resultsDirective.js
caninojories/x-scribe-testing-activity
3c8ada8ad39816309bc9b82eb567408709c3d2bd
[ "MIT" ]
null
null
null
front-end/resources/js/routes/survey/resultsDirective.js
caninojories/x-scribe-testing-activity
3c8ada8ad39816309bc9b82eb567408709c3d2bd
[ "MIT" ]
null
null
null
(function() { 'use strict'; angular .module('app.survey') .directive('onLoadTable', onLoadTable); onLoadTable.$inject = ['$compile', '$filter', '$rootScope', '$timeout', 'DataQuery', 'userAPI']; /*@ngInject*/ function onLoadTable($compile, $filter, $rootScope, $timeout, DataQuery, userAPI) { var directive = { restrict: 'E', require : 'ngModel', replace : true, scope: { theader : '=tHeader', ngModel : '=' }, template : '<div class="resultPage">' + '<table class="table">'+ '<thead>'+ '<th ng-repeat="thead in theader">{{thead}}</th>' + '</thead>' + '<tbody>' + '<tr ng-repeat="result in ngModel.data" ng-click="showPopupResult(result)">' + '<th>{{result.createdAt | date:"medium"}}</th>' + '<th>{{result.name}}</th>' + '<th>{{result.color}}</th>' + '</tr>' + '</tbody>' + '</table>' + '</div>', link : link }; return directive; function link(scope, element, attrs, ngModel) { scope.showPopupResult = showPopupResult; var self; ngModel.$render = function() { if (ngModel.$viewValue) { if ($('.pagination').length > 0) { return; } var data = ngModel.$viewValue; var pagination = '<ul class="pagination">'; for(var i = 1; i <= Math.ceil(data.count / 10); i++) { /* * Just for demo purposes * Paginate by 10 */ if (i === 1) { pagination += '<li class="paginate" style="background-color: #c0392b">' + i + '</li>'; } else { pagination += '<li class="paginate">' + i + '</li>'; } } pagination += '</ul>'; /* set the default color */ $('.paginate').css('background-color', 'blue'); $('.resultPage').append(pagination); $('.paginate').on('click', function() { if (self) { $(self).css('background-color', '#d9534f'); } else { $('.paginate:first').css('background-color', '#d9534f'); } self = this; $(this).css('background-color', '#c0392b'); var skip = $(this).text(); skip = ((parseInt(skip) - 1) * 10); DataQuery .get( userAPI, 'survey', { skip : skip, limit : 10 } ).then(function(response) { scope.$emit('paginate', response); }) .catch(function(error) { console.log(error); }); }); } }; function showPopupResult(result) { $rootScope.modalOpen = true; var backDrop = '<div class="modal-backdrop"></div>'; var resultPage = '<div ng-show="modalOpen" class="modal xscribe-40-offset-40 modal-popup">' + '<ul class="xscribe-40 modal-popup-content">' + '<li><span class="xscribe-title">Submission Date: </span>' + $filter('date')(result.createdAt, 'short') + '</li>' + '<li><span class="xscribe-title">Name: </span>' + result.name + '</li>' + '<li><span class="xscribe-title">Email: </span>' + result.email + '</li>' + '<li><span class="xscribe-title">Gender: </span>' + result.gender + '</li>' + '<li><span class="xscribe-title">Color: </span>' + result.color + '</li>' + '</ul>' + '<a href="#" style="display:block;width:47%;text-align: center;color: #34495e" ' + 'class="button xscribe-45 closePopup">OK</a>' + '</div>'; $('.resultPage').append(resultPage); $('body').append(backDrop); $('.closePopup').on('click', function() { $rootScope.modalOpen = false; $('.modal-popup').remove(); $('.modal-backdrop').remove(); }); } } } }());
35.412698
110
0.424249
bbb1978baa3a5a41512dcaed11638ee7c2ca5dfa
511
js
JavaScript
src/to-be-in-the-dom.js
callada/jest-dom
200ee31eae89c0b49f0506ae71df711aeb0018aa
[ "MIT" ]
null
null
null
src/to-be-in-the-dom.js
callada/jest-dom
200ee31eae89c0b49f0506ae71df711aeb0018aa
[ "MIT" ]
null
null
null
src/to-be-in-the-dom.js
callada/jest-dom
200ee31eae89c0b49f0506ae71df711aeb0018aa
[ "MIT" ]
null
null
null
import {matcherHint, printReceived} from 'jest-matcher-utils' import {checkHtmlElement} from './utils' export function toBeInTheDOM(received) { if (received) { checkHtmlElement(received, toBeInTheDOM, this) } return { pass: !!received, message: () => { return [ matcherHint(`${this.isNot ? '.not' : ''}.toBeInTheDOM`, 'element', ''), '', 'Received:', ` ${printReceived(received ? received.cloneNode(false) : received)}`, ].join('\n') }, } }
25.55
79
0.590998
bbb1a9197eec9e1c2e68147b78bd800d9c50f006
4,744
js
JavaScript
src/core/Search.js
foursafeair/4safeairfrontendnew
af465cc9bbbb9507971b36282ae077b3becd9ada
[ "MIT" ]
null
null
null
src/core/Search.js
foursafeair/4safeairfrontendnew
af465cc9bbbb9507971b36282ae077b3becd9ada
[ "MIT" ]
null
null
null
src/core/Search.js
foursafeair/4safeairfrontendnew
af465cc9bbbb9507971b36282ae077b3becd9ada
[ "MIT" ]
null
null
null
// import React, { useState, useEffect } from "react"; // import { list } from "./apiCore"; // import { getCategories } from "./apiCore"; // import Card from "./Card"; // import Footer from "./Footer"; // import Menu from "./Menu"; // import SearchBar from "./SearchBar"; // const Search = (props) => { // // const [data, setData] = useState({ // // search: "", // // results: [], // // searched: false, // // }); // // const { search, results, searched } = data; // // const searchData = () => { // // console.log(search); // // if (search) { // // list({ search: search || undefined }).then((response) => { // // if (response.error) { // // console.log(response.error); // // } else { // // setData({ ...data, results: response, searched: true }); // // } // // }); // // } // // }; // // // const searchSubmit = (e) => { // // // e.preventDefault(); // // // searchData(); // // // }; // // // const handleChange = (name) => (event) => { // // // setData({ ...data, [name]: event.target.value, searched: false }); // // // }; // const searchMessage = (searched, results) => { // if (searched && results.length > 1) { // return `Hittade ${results.length} produkter`; // } // if (searched && results.length === 1) { // return `Hittade ${results.length} produkt`; // } // if (searched && results.length < 1) { // return `Hittade inga produkter`; // } // }; // const searchedProducts = (results = []) => { // return ( // <div> // <h2 className="mt-4 mb-4"> {searchMessage(searched, results)}</h2> // <div className="row"> // {results.map((product, i) => ( // <Card key={i} product={product} /> // ))} // </div> // </div> // ); // }; // // const searchForm = () => ( // // <form onSubmit={searchSubmit}> // // <span className="input-group-text"> // // <div className="input-group input-group-lg"> // // {/* <div className="input-group-prepend"> // // <select className="btn mr-2" onChange={handleChange("category")}> // // <option value="All"> Välj en kategori</option> // // {categories.map((c, i) => ( // // <option key={i} value={c._id}> // // {c.name} // // </option> // // ))} // // </select> // // </div> */} // // <input // // type="search" // // className="form-control" // // placeholder="Sök efter produkter eller kategorier" // // onChange={handleChange("search")} // // /> // // </div> // // <div className="btn input-group-append" style={{ border: "none" }}> // // <button className="input-group-text">Sök</button> // // </div> // // </span> // // </form> // // ); // return ( // <div> // <Menu></Menu> // <div className="row"> // <SearchBar input={search} onChange={setData()}></SearchBar> // <div className="container-fluid mb-3">{searchedProducts(results)}</div> // </div> // <Footer></Footer> // </div> // ); // }; // export default Search; import React from "react"; import { list } from "./apiCore"; export default class SearchResultsPage extends React.Component { state = { isLoading: true, searchText: "", searchResults: [] }; handleSearch = () => { let searchText = this.props.location.state.searchText; let results = list.filter(item => item.name.includes(searchText)); this.setState({ isLoading: false, searchText: searchText, searchResults: results }); }; componentDidMount() { this.handleSearch(); } componentDidUpdate(prevProps) { let prevSearch = prevProps.location.state.searchText; let newSearch = this.props.location.state.searchText; if (prevSearch !== newSearch) { this.handleSearch(); } } render() { let toRender = this.state.isLoading ? ( <h1>Loading...</h1> ) : ( <> <h1>Your Search Results</h1> <ul> <li>Search: "{this.state.searchText}"</li> <li>Count: {this.state.searchResults.length}</li> </ul> {this.state.searchResults.length > 0 ? ( <pre> <small>{JSON.stringify(this.state.searchResults, null, 2)}</small> </pre> ) : ( <p>NO RESULTS FOUND</p> )} </> ); return <div style={{ margin: "20px 0px 0px 20px" }}>{toRender}</div>; } }
30.025316
85
0.484612
bbb26c6a08cc8d441acc0879ff5e58a10339edeb
434
js
JavaScript
src/cmds/Tools/prefixes.js
bakapear/JibrilBot
26a34ec2954f7a581e6c90561200f207cb8f4f27
[ "MIT" ]
1
2018-02-16T17:13:13.000Z
2018-02-16T17:13:13.000Z
src/cmds/Tools/prefixes.js
bakapear/JibrilBot
26a34ec2954f7a581e6c90561200f207cb8f4f27
[ "MIT" ]
10
2018-03-07T16:49:29.000Z
2019-06-16T16:37:50.000Z
src/cmds/Tools/prefixes.js
bakapear/Jibril
26a34ec2954f7a581e6c90561200f207cb8f4f27
[ "MIT" ]
null
null
null
/* global cfg */ module.exports = { name: ['prefixes'], desc: 'Shows all bot prefixes', permission: '', usage: '', args: 0, command: async function (msg, cmd, args) { msg.channel.send({ embed: { title: 'My Prefixes', description: `**first**: ${cfg.prefix.first}\n**random**: ${cfg.prefix.random}\n**hidden**: ${cfg.prefix.hidden}\n**mention**: ${cfg.prefix.mention}`, color: 14597321 } }) } }
25.529412
156
0.580645
bbb2a71250d3a58f244aa879b4bcd1fe09b0fd3e
4,485
js
JavaScript
extensions/amp-story-auto-ads/0.1/test/story-mock.js
eohashi/amphtml
515f99a9376f4dc1264fe3834132dc604d296bcd
[ "ECL-2.0", "Apache-2.0" ]
2
2020-04-23T04:46:42.000Z
2021-02-27T18:18:52.000Z
extensions/amp-story-auto-ads/0.1/test/story-mock.js
eohashi/amphtml
515f99a9376f4dc1264fe3834132dc604d296bcd
[ "ECL-2.0", "Apache-2.0" ]
7
2021-01-23T07:30:44.000Z
2022-03-02T10:06:32.000Z
extensions/amp-story-auto-ads/0.1/test/story-mock.js
eohashi/amphtml
515f99a9376f4dc1264fe3834132dc604d296bcd
[ "ECL-2.0", "Apache-2.0" ]
1
2020-05-02T21:40:14.000Z
2020-05-02T21:40:14.000Z
/** * Copyright 2019 The AMP HTML Authors. 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. */ import {CommonSignals} from '../../../../src/common-signals'; /** * Fake story implementation mocking public methods. */ export class MockStoryImpl extends AMP.BaseElement { constructor(element) { super(element); this.element = element; this.pages_ = []; // Fire these events so that story ads thinks the parent story is ready. element.signals().signal(CommonSignals.BUILT); element.signals().signal(CommonSignals.INI_LOAD); } addPage(pageImpl) { this.pages_.push(pageImpl); } getPageById(pageId) { return this.pages_.find(page => page.element.id === pageId); } // This is not very close to the real implementation as it ignores any // advance-to attributes. Should be close enough for testing. getNextPage(pageImpl) { const index = this.getPageIndexById(pageImpl.element.id); return this.pages_[index + 1]; } getPageIndexById(pageId) { for (let i = 0; i < this.pages_.length; i++) { if (this.pages_[i].element.id === pageId) { return i; } } } insertPage(unusedPageBeforeId, unusedPageToBeInsertedId) { // TODO(ccordry): Implement this when writing test for insertion algo. } } /** * Adds a fake config as a child of the given story element. * @param {!Document} doc * @param {!Element} autoAdsEl */ export function addStoryAutoAdsConfig(doc, autoAdsEl, customConfig) { const config = customConfig || { 'ad-attributes': { type: 'doubleclick', 'data-slot': '/30497360/a4a/fake_ad_unit', }, }; const child = doc.createElement('script'); child.setAttribute('type', 'application/json'); child./*OK*/ innerText = JSON.stringify(config); autoAdsEl.append(child); } /** * Adds story pages to the story object as well as appending them to the DOM. * Also fires built signal on created elements. * @param {!Document} doc * @param {!../../amp-story/1.0/amp-story.AmpStory} storyImpl * @param {number=} numPages * @return {Promise} */ export function addStoryPages(doc, storyImpl, numPages = 3) { const {element} = storyImpl; const promises = []; for (let i = 0; i < numPages; i++) { const page = doc.createElement('amp-story-page'); page.id = 'story-page-' + i; element.appendChild(page); page.signals().signal(CommonSignals.BUILT); const implPromise = page .getImpl() .then(pageImpl => storyImpl.addPage(pageImpl)); promises.push(implPromise); } return Promise.all(promises); } /** * Fires `built` signal on elements story ads needs to access. This is necessary * so that calls to getImpl() will resolve. * @param {!Document} doc * @param {Array<string>=} additonalSelectors */ export function fireBuildSignals(doc, additonalSelectors = []) { const defaultSelectors = ['amp-ad', '#i-amphtml-ad-page-1']; const selectors = defaultSelectors.concat(additonalSelectors).join(','); doc .querySelectorAll(selectors) .forEach(element => element.signals().signal(CommonSignals.BUILT)); } /** * Add specified CTA values to most recently created ad. * @param {!../amp-story-auto-autoAds.AmpStoryAutoAds} autoAdsImpl * @param {string} ctaType * @param {string} ctaUrl */ export function addCtaValues(autoAdsImpl, ctaType, ctaUrl) { autoAdsImpl.lastCreatedAdElement_.setAttribute('data-vars-ctatype', ctaType); autoAdsImpl.lastCreatedAdElement_.setAttribute('data-vars-ctaurl', ctaUrl); } /** * Mock creation of iframe that is normally handled by amp-ad. * @param {!../amp-story-auto-autoAds.AmpStoryAutoAds} autoAdsImpl * @param {string} content */ export function insertAdContent(autoAdsImpl, content) { const iframe = autoAdsImpl.doc_.createElement('iframe'); iframe.srcdoc = content; autoAdsImpl.lastCreatedAdElement_.appendChild(iframe); autoAdsImpl.lastCreatedAdImpl_.iframe = iframe; return autoAdsImpl.loadPromise(iframe); }
32.266187
80
0.70078
bbb39588e2aa6e4a501b76eb366cee6ee1d54d45
1,216
js
JavaScript
core/routeMap.js
fengshangbin/LazyPage-Node.js
48177dcb30f39f6b8c5c733983b5df77615ea954
[ "MIT" ]
1
2019-03-07T06:55:31.000Z
2019-03-07T06:55:31.000Z
core/routeMap.js
fengshangbin/LazyPage-node.js
48177dcb30f39f6b8c5c733983b5df77615ea954
[ "MIT" ]
null
null
null
core/routeMap.js
fengshangbin/LazyPage-node.js
48177dcb30f39f6b8c5c733983b5df77615ea954
[ "MIT" ]
null
null
null
var pathNode = require("path"); var application = require("./application"); let htmlPaths = application.data.htmlPaths, map = application.data.map; function clearMap() { htmlPaths.clear(); map.splice(0, map.length); } function sortMap() { map.sort(function (a, b) { return a.sort < b.sort ? 1 : -1; }); } function addMap(filePath) { //console.log(filePah) var fileName = pathNode.win32.basename(filePath); if (!fileName.startsWith("_") && fileName.endsWith(".html")) { let reg = new RegExp(pathNode.sep + pathNode.sep, "g"); let realPath = filePath.replace(reg, "/"); let routePath = realPath.replace("-.html", ""); routePath = routePath.replace(/\+/g, "/"); routePath = routePath.replace(/\$/g, "([^/]*?)"); if (routePath != realPath) { var sort = 0; for (var i = 0; i < realPath.length; i++) { var str = realPath.charAt(i); sort += (str == "$" ? 1 : 2) * 10 * (realPath.length - i); } map.push({ key: "^" + routePath + "$", value: realPath, sort: sort, }); } else { htmlPaths.add(realPath); } } } module.exports = { clearMap: clearMap, sortMap: sortMap, addMap: addMap, };
24.816327
66
0.573191
bbb449ea301272abe77e0e3b1e01047b4d1a2bc4
3,270
js
JavaScript
src/local/core/Drawer/example.js
lucasMontenegro/lucas-montenegro
4abd616713cfe1b9842861dd1ff97dd63114f9e0
[ "MIT" ]
1
2020-06-24T16:09:52.000Z
2020-06-24T16:09:52.000Z
src/local/core/Drawer/example.js
lucasMontenegro/lucas-montenegro
4abd616713cfe1b9842861dd1ff97dd63114f9e0
[ "MIT" ]
2
2019-04-04T23:25:31.000Z
2020-02-12T14:19:53.000Z
src/local/core/Drawer/example.js
lucasMontenegro/lucas-montenegro
4abd616713cfe1b9842861dd1ff97dd63114f9e0
[ "MIT" ]
null
null
null
import React, { useState } from "react" import { Route, Redirect, Switch } from "react-router-dom" import { ThemeProvider } from "@material-ui/styles" import ListItem from "@material-ui/core/ListItem" import Typography from "@material-ui/core/Typography" import Drawer from "local/core/Drawer" import theme from "local/darkTheme" function DrawerExampleRouter () { return ( <Switch> <Redirect exact path="/examples/core/Drawer" to="/examples/core/Drawer/en/false/false/000000/320" /> <Route exact path="/examples/core/Drawer/:languageCode/:isMobile/:isOpen/:foo/:width" component={DrawerExample} /> </Switch> ) } export default (<Route path="/examples/core/Drawer" component={DrawerExampleRouter} />) function P (props) { return <Typography {...props} variant="body2" component="p" /> } function DrawerExample (props) { const { languageCode, isMobile, isOpen, foo, width: widthProp } = props.match.params const width = parseInt(widthProp) || 320 const [count, setCount] = useState(0) return ( <ThemeProvider theme={theme}> <Drawer languageCode={languageCode} viewState={{ isMobile: isMobile === `true`, drawer: { isOpen: isOpen === `true`, close () { setCount(count + 1) }, open () {}, }, }} width={width} navLinks={<ListItem id="nav-link">nav link</ListItem>} > <P>languageCode: <span id="language-code">{languageCode}</span></P> <P>foo: <span id="foo">{foo}</span></P> <P>count: <span id="count">{count}</span></P> <P id="text"> Lorem ipsum est deserunt non fugiat ut cillum dolor in dolor culpa ut voluptate. Exercitation ut fugiat ullamco cupidatat nisi sit nisi ex nulla ullamco exercitation tempor aliquip aliqua ex est cupidatat consequat. Quis velit ullamco ut commodo in veniam amet consectetur velit ut. Lorem ipsum tempor reprehenderit aliqua reprehenderit reprehenderit pariatur irure laboris ut reprehenderit officia consectetur magna dolor commodo enim cupidatat tempor. Consequat aliquip nostrud adipisicing ex officia reprehenderit pariatur elit ut anim in non ex qui dolor velit ad. Pariatur voluptate enim dolore incididunt anim aute aliqua do. Tempor exercitation et cillum dolor ex sint ad occaecat esse. Sit occaecat dolore tempor sunt ut exercitation mollit excepteur sint aliqua labore officia eu incididunt. In consectetur irure commodo sed elit do enim ut magna ullamco. Dolore sed in elit nostrud duis sed ea quis in voluptate minim. Lorem ipsum veniam incididunt nostrud magna et sint eiusmod quis enim. Exercitation sunt enim proident qui occaecat proident aliquip ex id eiusmod velit veniam in adipisicing enim irure duis eiusmod. Labore nulla irure aute dolore dolore aute ex qui. Enim dolor ut incididunt officia magna proident reprehenderit dolor reprehenderit in deserunt. Ut veniam amet ut labore consequat id sunt aliqua dolor exercitation laborum consectetur irure amet commodo qui. Nulla laborum laborum irure minim aute consectetur ullamco non voluptate non voluptate nulla eiusmod proident ea dolor deserunt. </P> </Drawer> </ThemeProvider> ) }
58.392857
1,526
0.708563
bbb4d6100d07a8a22385da10fbc5a458727401c2
570
js
JavaScript
src/tiny/plugins/pjax.js
savjs/jetiny-js
5c9238c32e02dd93c2ef20ba8c22b1c3cfa137c5
[ "MIT" ]
null
null
null
src/tiny/plugins/pjax.js
savjs/jetiny-js
5c9238c32e02dd93c2ef20ba8c22b1c3cfa137c5
[ "MIT" ]
null
null
null
src/tiny/plugins/pjax.js
savjs/jetiny-js
5c9238c32e02dd93c2ef20ba8c22b1c3cfa137c5
[ "MIT" ]
null
null
null
// page-ajax version var RE_ABSOULTE = /((^)|(\:))\/\//; var prev = jet.bridge('route', function(route){ if (route.pjax) { var url = route.pjax; if (!RE_ABSOULTE.test(route.pjax)) { url = (jet.config('pjaxUrl') || jet.config('baseUrl')) + url; } var req = { url: url, dataType: 'html', data: route.args }; route.request = req; route.send = function(cb){ jet.request('xhr', route.request, cb); }; } else { prev(route); } });
23.75
73
0.463158
bbb5aa5b8c91d22f42c2acaca29ed2b325b9ff2b
793
js
JavaScript
server.js
madebybright/NimbleBackend
84a6728126489b15e0e4f5c4aa39ebadc673c762
[ "MIT" ]
2
2015-12-26T08:43:49.000Z
2016-04-21T20:06:39.000Z
server.js
madebybright/BrightBackend
84a6728126489b15e0e4f5c4aa39ebadc673c762
[ "MIT" ]
null
null
null
server.js
madebybright/BrightBackend
84a6728126489b15e0e4f5c4aa39ebadc673c762
[ "MIT" ]
1
2015-04-05T09:56:06.000Z
2015-04-05T09:56:06.000Z
var express = require('express'); var app = express(); var bodyParser = require('body-parser'); var wolfram = require('wolfram-alpha').createClient(process.env.API_KEY, { maxwidth: 348 }); var port, router; // Use bodyParser() and get data from POST app.use(bodyParser.urlencoded({ extended: true})); app.use(bodyParser.json()); port = process.env.PORT || 8080 router = express.Router(); // The main shit here boys router.get('/', function(request, response) { wolfram.query(request.query.i, function(err, result) { if (err) throw err; var url = 'http://www.wolframalpha.com/input/?i=' + encodeURIComponent(request.query.i); result.push({origin_url:url}) response.json(result); }); }); // All routes prefix with /input app.use('/input', router); app.listen(port);
24.78125
92
0.687264
bbb6290d64db4a40e880b720ce2d6055ef994f65
13,042
js
JavaScript
src/components/Validator.js
cristi-paraschiv/formio.js
0ff96b393b299b5f8ad66e3d8d5502b0d5b01e25
[ "MIT" ]
null
null
null
src/components/Validator.js
cristi-paraschiv/formio.js
0ff96b393b299b5f8ad66e3d8d5502b0d5b01e25
[ "MIT" ]
null
null
null
src/components/Validator.js
cristi-paraschiv/formio.js
0ff96b393b299b5f8ad66e3d8d5502b0d5b01e25
[ "MIT" ]
null
null
null
import _ from 'lodash'; import { boolValue, getInputMask, matchInputMask, getDateSetting } from '../utils/utils'; import moment from 'moment'; export default { get: _.get, each: _.each, has: _.has, checkValidator(component, validator, setting, value, data) { let result = null; // Allow each component to override their own validators by implementing the validator.method if (validator.method && (typeof component[validator.method] === 'function')) { result = component[validator.method](setting, value, data); } else { result = validator.check.call(this, component, setting, value, data); } if (typeof result === 'string') { return result; } if (!result) { return validator.message.call(this, component, setting); } return ''; }, validate(component, validator, value, data) { if (validator.key && _.has(component.component, validator.key)) { const setting = this.get(component.component, validator.key); return this.checkValidator(component, validator, setting, value, data); } return this.checkValidator(component, validator, null, value, data); }, check(component, data) { let result = ''; const value = component.validationValue; data = data || component.data; _.each(component.validators, (name) => { if (this.validators.hasOwnProperty(name)) { const validator = this.validators[name]; if (component.validateMultiple(value)) { _.each(value, (val) => { result = this.validate(component, validator, val, data); if (result) { return false; } }); } else { result = this.validate(component, validator, value, data); } if (result) { return false; } } }); const validateCustom = _.get(component, 'component.validate.custom'); const customErrorMessage = _.get(component, 'component.validate.customMessage'); if (result && (customErrorMessage || validateCustom)) { result = component.t(customErrorMessage || result, { field: component.errorLabel, data: component.data }); } return result; }, validators: { required: { key: 'validate.required', method: 'validateRequired', message(component) { return component.t(component.errorMessage('required'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value) { if (!boolValue(setting)) { return true; } return !component.isEmpty(value); } }, min: { key: 'validate.min', message(component, setting) { return component.t(component.errorMessage('min'), { field: component.errorLabel, min: parseFloat(setting), data: component.data }); }, check(component, setting, value) { const min = parseFloat(setting); if (Number.isNaN(min) || (!_.isNumber(value))) { return true; } return parseFloat(value) >= min; } }, max: { key: 'validate.max', message(component, setting) { return component.t(component.errorMessage('max'), { field: component.errorLabel, max: parseFloat(setting), data: component.data }); }, check(component, setting, value) { const max = parseFloat(setting); if (Number.isNaN(max) || (!_.isNumber(value))) { return true; } return parseFloat(value) <= max; } }, minLength: { key: 'validate.minLength', message(component, setting) { return component.t(component.errorMessage('minLength'), { field: component.errorLabel, length: (setting - 1), data: component.data }); }, check(component, setting, value) { const minLength = parseInt(setting, 10); if (!minLength || (typeof value !== 'string')) { return true; } return (value.length >= minLength); } }, maxLength: { key: 'validate.maxLength', message(component, setting) { return component.t(component.errorMessage('maxLength'), { field: component.errorLabel, length: (setting + 1), data: component.data }); }, check(component, setting, value) { const maxLength = parseInt(setting, 10); if (!maxLength || (typeof value !== 'string')) { return true; } return (value.length <= maxLength); } }, maxWords: { key: 'validate.maxWords', message(component, setting) { return component.t(component.errorMessage('maxWords'), { field: component.errorLabel, length: (setting + 1), data: component.data }); }, check(component, setting, value) { const maxWords = parseInt(setting, 10); if (!maxWords || (typeof value !== 'string')) { return true; } return (value.trim().split(/\s+/).length <= maxWords); } }, minWords: { key: 'validate.minWords', message(component, setting) { return component.t(component.errorMessage('minWords'), { field: component.errorLabel, length: (setting + 1), data: component.data }); }, check(component, setting, value) { const minWords = parseInt(setting, 10); if (!minWords || (typeof value !== 'string')) { return true; } return (value.trim().split(/\s+/).length >= minWords); } }, email: { message(component) { return component.t(component.errorMessage('invalid_email'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value) { /* eslint-disable max-len */ // From http://stackoverflow.com/questions/46155/validate-email-address-in-javascript const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; /* eslint-enable max-len */ // Allow emails to be valid if the component is pristine and no value is provided. return !value || re.test(value); } }, url: { message(component) { return component.t(component.errorMessage('invalid_url'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value) { /* eslint-disable max-len */ // From https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url const re = /[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)/; /* eslint-enable max-len */ // Allow urls to be valid if the component is pristine and no value is provided. return !value || re.test(value); } }, date: { message(component) { return component.t(component.errorMessage('invalid_date'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value) { return (value !== 'Invalid date'); } }, day: { message(component) { return component.t(component.errorMessage('invalid_day'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value) { if (!value) { return true; } const [DAY, MONTH, YEAR] = component.dayFirst ? [0, 1, 2] : [1, 0, 2]; const values = value.split('/').map(x => parseInt(x, 10)), day = values[DAY], month = values[MONTH], year = values[YEAR], maxDay = getDaysInMonthCount(month, year); if (day < 0 || day > maxDay) { return false; } if (month < 0 || month > 12) { return false; } if (year < 0 || year > 9999) { return false; } return true; function isLeapYear(year) { // Year is leap if it is evenly divisible by 400 or evenly divisible by 4 and not evenly divisible by 100. return !(year % 400) || (!!(year % 100) && !(year % 4)); } function getDaysInMonthCount(month, year) { switch (month) { case 1: // January case 3: // March case 5: // May case 7: // July case 8: // August case 10: // October case 12: // December return 31; case 4: // April case 6: // June case 9: // September case 11: // November return 30; case 2: // February return isLeapYear(year) ? 29 : 28; default: return 31; } } } }, pattern: { key: 'validate.pattern', message(component, setting) { return component.t(_.get(component, 'component.validate.patternMessage', component.errorMessage('pattern'), { field: component.errorLabel, pattern: setting, data: component.data })); }, check(component, setting, value) { const pattern = setting; if (!pattern) { return true; } const regex = new RegExp(`^${pattern}$`); return regex.test(value); } }, json: { key: 'validate.json', check(component, setting, value, data) { if (!setting) { return true; } const valid = component.evaluate(setting, { data, input: value }); if (valid === null) { return true; } return valid; } }, mask: { message(component) { return component.t(component.errorMessage('mask'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value) { let inputMask; if (component.isMultipleMasksField) { const maskName = value ? value.maskName : undefined; const formioInputMask = component.getMaskByName(maskName); if (formioInputMask) { inputMask = getInputMask(formioInputMask); } value = value ? value.value : value; } else { inputMask = component.defaultMask; } if (value && inputMask) { return matchInputMask(value, inputMask); } return true; } }, custom: { key: 'validate.custom', message(component) { return component.t(component.errorMessage('custom'), { field: component.errorLabel, data: component.data }); }, check(component, setting, value, data) { if (!setting) { return true; } const valid = component.evaluate(setting, { valid: true, data, input: value }, 'valid', true); if (valid === null) { return true; } return valid; } }, maxDate: { key: 'maxDate', message(component, setting) { const date = getDateSetting(setting); return component.t(component.errorMessage('maxDate'), { field: component.errorLabel, maxDate: moment(date).format(component.format), }); }, check(component, setting, value) { //if any parts of day are missing, skip maxDate validation if (component.isPartialDay && component.isPartialDay(value)) { return true; } const date = moment(value); const maxDate = getDateSetting(setting); if (_.isNull(maxDate)) { return true; } else { maxDate.setHours(0, 0, 0, 0); } return date.isBefore(maxDate) || date.isSame(maxDate); } }, minDate: { key: 'minDate', message(component, setting) { const date = getDateSetting(setting); return component.t(component.errorMessage('minDate'), { field: component.errorLabel, minDate: moment(date).format(component.format), }); }, check(component, setting, value) { //if any parts of day are missing, skip minDate validation if (component.isPartialDay && component.isPartialDay(value)) { return true; } const date = moment(value); const minDate = getDateSetting(setting); if (_.isNull(minDate)) { return true; } else { minDate.setHours(0, 0, 0, 0); } return date.isAfter(minDate) || date.isSame(minDate); } } } };
30.189815
170
0.53228
bbb67a056b74dcf8e1c320a5fc5fabcf1a84639a
21
js
JavaScript
backend/resources/js/pages/User.js
m-ogushi/react-shift
6d60b4372aa433dbafa6380cfb8bdea34aa8ac62
[ "MIT" ]
null
null
null
backend/resources/js/pages/User.js
m-ogushi/react-shift
6d60b4372aa433dbafa6380cfb8bdea34aa8ac62
[ "MIT" ]
null
null
null
backend/resources/js/pages/User.js
m-ogushi/react-shift
6d60b4372aa433dbafa6380cfb8bdea34aa8ac62
[ "MIT" ]
null
null
null
function User() { }
5.25
17
0.571429