text
stringlengths 2
1.05M
|
|---|
import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import LinearProgress from '@material-ui/core/LinearProgress';
const styles = {
root: {
flexGrow: 1,
},
};
class LinearBuffer extends React.Component {
state = {
completed: 0,
buffer: 10,
};
timer = null;
componentDidMount() {
this.timer = setInterval(this.progress, 500);
}
componentWillUnmount() {
clearInterval(this.timer);
}
progress = () => {
const { completed } = this.state;
if (completed > 100) {
this.setState({ completed: 0, buffer: 10 });
} else {
const diff = Math.random() * 10;
const diff2 = Math.random() * 10;
this.setState({ completed: completed + diff, buffer: completed + diff + diff2 });
}
};
render() {
const { classes } = this.props;
const { completed, buffer } = this.state;
return (
<div className={classes.root}>
<LinearProgress variant="buffer" value={completed} valueBuffer={buffer} />
<br />
<LinearProgress color="secondary" variant="buffer" value={completed} valueBuffer={buffer} />
</div>
);
}
}
LinearBuffer.propTypes = {
classes: PropTypes.object.isRequired,
};
export default withStyles(styles)(LinearBuffer);
|
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _defineProperty2 = require('babel-runtime/helpers/defineProperty');
var _defineProperty3 = _interopRequireDefault(_defineProperty2);
exports['default'] = createPicker;
var _moment = require('moment');
var moment = _interopRequireWildcard(_moment);
var _omit = require('lodash/omit');
var _omit2 = _interopRequireDefault(_omit);
var _MonthCalendar = require('../vc-calendar/src/MonthCalendar');
var _MonthCalendar2 = _interopRequireDefault(_MonthCalendar);
var _Picker = require('../vc-calendar/src/Picker');
var _Picker2 = _interopRequireDefault(_Picker);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _icon = require('../icon');
var _icon2 = _interopRequireDefault(_icon);
var _interopDefault = require('../_util/interopDefault');
var _interopDefault2 = _interopRequireDefault(_interopDefault);
var _BaseMixin = require('../_util/BaseMixin');
var _BaseMixin2 = _interopRequireDefault(_BaseMixin);
var _propsUtil = require('../_util/props-util');
var _vnode = require('../_util/vnode');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
// export const PickerProps = {
// value?: moment.Moment;
// prefixCls: string;
// }
function noop() {}
function createPicker(TheCalendar, props) {
return {
// static defaultProps = {
// prefixCls: 'ant-calendar',
// allowClear: true,
// showToday: true,
// };
// private input: any;
props: (0, _propsUtil.initDefaultProps)(props, {
prefixCls: 'ant-calendar',
allowClear: true,
showToday: true
}),
mixins: [_BaseMixin2['default']],
model: {
prop: 'value',
event: 'change'
},
data: function data() {
var value = this.value || this.defaultValue;
if (value && !(0, _interopDefault2['default'])(moment).isMoment(value)) {
throw new Error('The value/defaultValue of DatePicker or MonthPicker must be ' + 'a moment object');
}
return {
sValue: value,
showDate: value,
_open: !!this.open
};
},
watch: {
open: function open(val) {
var props = (0, _propsUtil.getOptionProps)(this);
var state = {};
state._open = val;
if ('value' in props && !val && props.value !== this.showDate) {
state.showDate = props.value;
}
this.setState(state);
},
value: function value(val) {
var state = {};
state.sValue = val;
if (val !== this.sValue) {
state.showDate = val;
}
this.setState(state);
}
},
methods: {
renderFooter: function renderFooter() {
var h = this.$createElement;
var prefixCls = this.prefixCls,
$scopedSlots = this.$scopedSlots,
$slots = this.$slots;
var renderExtraFooter = this.renderExtraFooter || $scopedSlots.renderExtraFooter || $slots.renderExtraFooter;
return renderExtraFooter ? h(
'div',
{ 'class': prefixCls + '-footer-extra' },
[typeof renderExtraFooter === 'function' ? renderExtraFooter.apply(undefined, arguments) : renderExtraFooter]
) : null;
},
clearSelection: function clearSelection(e) {
e.preventDefault();
e.stopPropagation();
this.handleChange(null);
},
handleChange: function handleChange(value) {
if (!(0, _propsUtil.hasProp)(this, 'value')) {
this.setState({
sValue: value,
showDate: value
});
}
this.$emit('change', value, value && value.format(this.format) || '');
this.focus();
},
handleCalendarChange: function handleCalendarChange(value) {
this.setState({ showDate: value });
},
handleOpenChange: function handleOpenChange(open) {
var props = (0, _propsUtil.getOptionProps)(this);
if (!('open' in props)) {
this.setState({ _open: open });
}
this.$emit('openChange', open);
},
focus: function focus() {
this.$refs.input.focus();
},
blur: function blur() {
this.$refs.input.blur();
},
onMouseEnter: function onMouseEnter(e) {
this.$emit('mouseenter', e);
},
onMouseLeave: function onMouseLeave(e) {
this.$emit('mouseleave', e);
}
},
render: function render() {
var _classNames;
var h = arguments[0];
var $listeners = this.$listeners,
$scopedSlots = this.$scopedSlots;
var _$data = this.$data,
value = _$data.sValue,
showDate = _$data.showDate,
open = _$data._open;
var suffixIcon = (0, _propsUtil.getComponentFromProp)(this, 'suffixIcon');
suffixIcon = Array.isArray(suffixIcon) ? suffixIcon[0] : suffixIcon;
var _$listeners$panelChan = $listeners.panelChange,
panelChange = _$listeners$panelChan === undefined ? noop : _$listeners$panelChan,
_$listeners$focus = $listeners.focus,
focus = _$listeners$focus === undefined ? noop : _$listeners$focus,
_$listeners$blur = $listeners.blur,
blur = _$listeners$blur === undefined ? noop : _$listeners$blur,
_$listeners$ok = $listeners.ok,
ok = _$listeners$ok === undefined ? noop : _$listeners$ok;
var props = (0, _propsUtil.getOptionProps)(this);
var prefixCls = props.prefixCls,
locale = props.locale,
localeCode = props.localeCode;
var dateRender = props.dateRender || $scopedSlots.dateRender;
var monthCellContentRender = props.monthCellContentRender || $scopedSlots.monthCellContentRender;
var placeholder = 'placeholder' in props ? props.placeholder : locale.lang.placeholder;
var disabledTime = props.showTime ? props.disabledTime : null;
var calendarClassName = (0, _classnames2['default'])((_classNames = {}, (0, _defineProperty3['default'])(_classNames, prefixCls + '-time', props.showTime), (0, _defineProperty3['default'])(_classNames, prefixCls + '-month', _MonthCalendar2['default'] === TheCalendar), _classNames));
if (value && localeCode) {
value.locale(localeCode);
}
var pickerProps = { props: {}, on: {} };
var calendarProps = { props: {}, on: {} };
var pickerStyle = {};
if (props.showTime) {
// fix https://github.com/ant-design/ant-design/issues/1902
calendarProps.on.select = this.handleChange;
pickerStyle.width = '195px';
} else {
pickerProps.on.change = this.handleChange;
}
if ('mode' in props) {
calendarProps.props.mode = props.mode;
}
var theCalendarProps = (0, _propsUtil.mergeProps)(calendarProps, {
props: {
disabledDate: props.disabledDate,
disabledTime: disabledTime,
locale: locale.lang,
timePicker: props.timePicker,
defaultValue: props.defaultPickerValue || (0, _interopDefault2['default'])(moment)(),
dateInputPlaceholder: placeholder,
prefixCls: prefixCls,
dateRender: dateRender,
format: props.format,
showToday: props.showToday,
monthCellContentRender: monthCellContentRender,
renderFooter: this.renderFooter,
value: showDate
},
on: {
ok: ok,
panelChange: panelChange,
change: this.handleCalendarChange
},
'class': calendarClassName,
scopedSlots: $scopedSlots
});
var calendar = h(TheCalendar, theCalendarProps);
var clearIcon = !props.disabled && props.allowClear && value ? h(_icon2['default'], {
attrs: {
type: 'close-circle',
theme: 'filled'
},
'class': prefixCls + '-picker-clear',
on: {
'click': this.clearSelection
}
}) : null;
var inputIcon = suffixIcon && ((0, _propsUtil.isValidElement)(suffixIcon) ? (0, _vnode.cloneElement)(suffixIcon, {
'class': prefixCls + '-picker-icon'
}) : h(
'span',
{ 'class': prefixCls + '-picker-icon' },
[suffixIcon]
)) || h(_icon2['default'], {
attrs: { type: 'calendar' },
'class': prefixCls + '-picker-icon' });
var input = function input(_ref) {
var inputValue = _ref.value;
return h('div', [h('input', {
ref: 'input',
attrs: { disabled: props.disabled,
readOnly: true,
placeholder: placeholder,
tabIndex: props.tabIndex
},
on: {
'focus': focus,
'blur': blur
},
domProps: {
'value': inputValue && inputValue.format(props.format) || ''
},
'class': props.pickerInputClass }), clearIcon, inputIcon]);
};
var vcDatePickerProps = {
props: (0, _extends3['default'])({}, props, pickerProps.props, {
calendar: calendar,
value: value,
prefixCls: prefixCls + '-picker-container'
}),
on: (0, _extends3['default'])({}, (0, _omit2['default'])($listeners, 'change'), pickerProps.on, {
open: open,
onOpenChange: this.handleOpenChange
}),
style: props.popupStyle
};
return h(
'span',
{
'class': props.pickerClass,
style: pickerStyle
// tabIndex={props.disabled ? -1 : 0}
// onFocus={focus}
// onBlur={blur}
, on: {
'mouseenter': this.onMouseEnter,
'mouseleave': this.onMouseLeave
}
},
[h(
_Picker2['default'],
vcDatePickerProps,
[input]
)]
);
}
};
}
|
import React from 'react'
import Link from 'gatsby-link'
const SecondPage = () => (
<div>
<h1>Lear to design code</h1>
<p>Welcome to page 2</p>
<Link to="/">Go back to the homepage</Link>
</div>
)
export default SecondPage
|
export default {
'ADD_PREFIX': 'Add',
'ADD_PREFIX_2': 'Add another',
'ADD_SUFFIX': '',
'ADD_TO_PREFIX': 'Add to',
'ADD_TO_SUFFIX': '',
'less 10MB': '< 10MB',
'more 1GB': '> 1GB',
'SEARCH_PLACEHOLDER': 'Search',
'PHAIDRA_IS': 'Phaidra is the repository for the permanent secure storage of digital assets at the University of Vienna.',
'rdam:P30004': 'Alternative identifier',
'bf:Title': 'Title',
'bf:ParallelTitle': 'Parallel title',
'bf:Note': 'Description',
'bf:Summary': 'Abstract',
'phaidra:Remark': 'Remark',
'arm:ConditionAssessment': 'Condition',
'phaidra:ReproductionNote': 'Reproduction note',
'phaidra:DigitizationNote': 'Digitization note',
'bf:tableOfContents': 'Table of contents',
'dce:subject': 'Keywords',
'dcterms:subject': 'Subject',
'dcterms:language': 'Language',
'schema:subtitleLanguage': 'Subtitle language',
'dcterms:type': 'Resource type',
'edm:hasType': 'Type / Genre',
'bf:physicalLocation': 'Physical location',
'bf:shelfMark': 'Call number',
'edm:rights': 'License',
'dce:rights': 'Rights statement',
'oaire:version': 'Version type',
'dcterms:accessRights': 'Access right',
'dcterms:date': 'Date',
'dcterms:created': 'Date created',
'dcterms:modified': 'Date modified',
'dcterms:available': 'Date available',
'dcterms:issued': 'Date issued',
'dcterms:valid': 'Date valid',
'dcterms:dateAccepted': 'Date accepted',
'dcterms:dateCopyrighted': 'Date copyrighted',
'dcterms:dateSubmitted': 'Date submitted',
'rdau:P60071': 'Date of production',
'phaidra:dateAccessioned': 'Date accessioned',
'schema:pageStart': 'From page',
'schema:pageEnd': 'To page',
'rdau:P60193': 'Is in series',
'rdau:P60101': 'Is contained in',
'rdau:P60101_rdau:P60193': 'Series',
'rdau:P60101_bf:provisionActivity': 'Publisher',
'bf:instanceOf': 'Instance of',
'rdau:P60227': 'Is motion picture adaptation of',
'bf:provisionActivity': 'Provision activity: Publication',
'cito:cites': 'Cites',
'cito:isCitedBy': 'Is cited by',
'rdfs:seeAlso': 'See also',
'dcterms:spatial': 'Depicted / Represented place',
'vra:placeOfCreation': 'Place of creation',
'vra:placeOfSite': 'Place of site',
'ebucore:hasRelatedEvent': 'Event',
'frapo:isOutputOf': 'Project',
'frapo:hasFundingAgency': 'Funder',
'rdax:P00009': 'Association',
'dcterms:provenance': 'Provenance',
'schema:numberOfPages': 'Number of pages',
'bf:soundCharacteristic': 'Sound characteristic',
'bf:supplementaryContent': 'Supplementary content',
'bf:awards': 'Award',
'dcterms:audience': 'Audience',
'rdau:P60059': 'Regional encoding',
'ebucore:filename': 'Filename',
'ebucore:hasMimeType': 'MIME Type',
'opaque:cco_accessionNumber': 'Accession number',
'schema:width': 'Width',
'schema:height': 'Height',
'schema:depth': 'Depth',
'schema:weight': 'Weight',
'vra:diameter': 'Diameter',
'schema:duration': 'Duration',
'bf:scale': 'Scale',
'schema:genre': 'Genre',
'dcterms:temporal': 'Temporal coverage',
'vra:hasTechnique': 'Technique',
'dce:format': 'Format',
'rdau:P60048': 'Carrier type',
'vra:material': 'Material',
'vra:hasInscription': 'Inscription',
'phaidra:systemTag': 'System tag',
'MEMBERS_DELETE_ALERT_CONTAINER': 'This object is a Container with {nrmembers} members. Only an empty Container can be deleted. If you want to delete this object, you need to remove all members from this Container or delete them first.',
'DELETE_OBJECT': 'Here you can delete object {pid}.',
'DELETE_OBJECT_CONFIRM': 'Are you sure you want to permanently delete object {pid}?',
'PUBLISHER_VERLAG': 'Publisher',
'SELECTION_LIMIT': 'Cannot select more than {limit} results.',
'OTHER_FEMININE': 'Other',
'SUBJECT_SECTION': 'Subject',
uwm_etheses: 'E-Theses',
uwm_etheses_note_2: 'Note 2',
uwm_etheses_note_1: 'Note 1',
uwm_etheses_show_abstract: 'Show abstract',
uwm_etheses_pdf_identical: 'PDF identical',
uwm_etheses_title_page_identical: 'Title page identical',
uwm_etheses_title_page: 'Title page',
uwm_etheses_consent_form: 'Consent form',
uwm_digitalbook: 'Digital Book',
uwm_digitalbook_alephurl: 'Aleph-URL',
uwm_digitalbook_medium: 'Medium',
uwm_digitalbook_release_notes: 'Publication Dates',
uwm_digitalbook_edition: 'Edition/ Print Run',
uwm_digitalbook_releaseyear: 'Publication Date',
uwm_digitalbook_publisher: 'Publisher',
uwm_digitalbook_publisherlocation: 'Publishing Address',
uwm_digitalbook_name_collection: 'Name of Collection/Monograph',
uwm_digitalbook_to_page: 'To Page',
uwm_digitalbook_from_page: 'From Page',
uwm_digitalbook_booklet: 'Number',
uwm_digitalbook_volume: 'Volume',
uwm_digitalbook_reihentitel: 'Series Title',
uwm_digitalbook_pagination: 'Pages or Volume',
uwm_digitalbook_name_magazine: 'Name of Publication',
uwm_provenience: 'Provenience',
uwm_provenience_contribute: 'Details about the source',
uwm_provenience_contribute_location: 'Location',
uwm_provenience_contribute_chronological: 'Time Coverage',
uwm_provenience_contribute_date_to: 'Date until',
uwm_provenience_contribute_date_from: 'Date from',
uwm_provenience_contribute_entity: 'Personal or Institutional Data',
uwm_provenience_contribute_entity_institution: 'Institution',
uwm_provenience_contribute_entity_type: 'Type',
uwm_provenience_contribute_entity_title2: 'Title',
uwm_provenience_contribute_entity_title1: 'Title',
uwm_provenience_contribute_entity_lastname: 'Lastname',
uwm_provenience_contribute_entity_firstname: 'Firstname',
uwm_provenience_contribute_role: 'Role',
uwm_provenience_contribute_comment: 'Details about the Source',
uwm_provenience_contribute_resource: 'Digital or other source',
uwm_histkult: 'Contextual Allegation',
uwm_histkult_gps: 'Geograph. Coordinates',
uwm_histkult_note: 'Note',
uwm_histkult_stamp: 'Stamp',
uwm_histkult_reference_number: 'Reference Number',
uwm_histkult_reference_number_number: 'Number',
uwm_histkult_reference_number_reference: 'Reference',
uwm_histkult_dimensions: 'Dimensions',
uwm_histkult_dimensions_diameter: 'Circumference',
uwm_histkult_dimensions_height: 'Height',
uwm_histkult_dimensions_width: 'Width',
uwm_histkult_dimensions_length: 'Length',
uwm_histkult_dimensions_dimension_unit: 'Measuring Unit',
uwm_histkult_dimensions_resource: 'Source',
uwm_histkult_inscription: 'Inscription',
uwm_organization: 'Association',
uwm_organization_further_allocation: 'additional allocation',
uwm_organization_curriculum: 'Study',
uwm_organization_curriculum_kennzahl: 'Study ID',
uwm_organization_curriculum_spl: 'Study Program Direction',
uwm_organization_orgassignment: 'Organization Association',
uwm_organization_orgassignment_department: 'Institute',
uwm_organization_orgassignment_faculty: 'Faculty',
uwm_organization_approbation_period: 'Date of approbation period',
uwm_organization_hoschtyp: 'Type of publication',
uwm_classification: 'Classification',
uwm_classification_keyword: 'Keywords',
uwm_classification_description: 'Description or Additional Data',
uwm_classification_taxonpath: 'Classifications (Classes, Subclasses)',
uwm_classification_taxonpath_taxon: 'Path',
uwm_classification_taxonpath_source: 'Source',
uwm_classification_purpose: 'Purpose',
uwm_annotation: 'Comments',
uwm_annotation_annotations: 'Comments',
uwm_annotation_annotations_description: 'Description or Additional Data',
uwm_annotation_annotations_date: 'Date',
uwm_annotation_annotations_entity: 'Entity / Personal data',
uwm_annotation_annotations_entity_type: 'Type',
uwm_annotation_annotations_entity_title2: 'Title',
uwm_annotation_annotations_entity_title1: 'Title',
uwm_annotation_annotations_entity_institution: 'Institution',
uwm_annotation_annotations_entity_lastname: 'Lastname',
uwm_annotation_annotations_entity_firstname: 'Firstname',
uwm_rights: 'Rights & Licences',
uwm_rights_infoeurepoembargo: 'OpenAIRE Embargo End',
uwm_rights_infoeurepoaccess: 'OpenAIRE Access Rights',
uwm_rights_description: 'Description or Additional Data',
uwm_rights_license: 'Licence Selected',
uwm_rights_copyright: 'Copyright and Other Restrictions',
uwm_rights_cost: 'Costs',
uwm_educational: 'Educational',
uwm_educational_educationals: 'Educational',
uwm_educational_educationals_language: 'Language',
uwm_educational_educationals_description: 'Description',
uwm_educational_educationals_learningtime: 'Typical Learning Time',
uwm_educational_educationals_difficulty: 'Difficulty Level',
uwm_educational_educationals_agerange: 'Typical Age Range',
uwm_educational_educationals_context: 'Didactic Context of Use',
uwm_educational_educationals_enduserrole: 'Intended End User Role',
uwm_educational_educationals_interactivitylevel: 'Interactivity Level',
uwm_educational_educationals_interactivitytype: 'Interactivity Type',
uwm_educational_educationals_learningresourcetype: 'Type of Teaching and Educational Resource',
uwm_technical: 'Technical Data',
uwm_technical_duration: 'Duration',
uwm_technical_otherrequirements: 'Requirements for the Use of the Object',
uwm_technical_installremarks: 'Installation Guide',
uwm_technical_requirement: 'Requirements',
uwm_technical_requirement_orcomposite: 'Or-Composite',
uwm_technical_requirement_orcomposite_maxversion: 'Maximum version',
uwm_technical_requirement_orcomposite_minversion: 'Minimum version',
uwm_technical_requirement_orcomposite_name: 'Name',
uwm_technical_requirement_orcomposite_type: 'Type',
uwm_technical_location: 'Permanent Link',
uwm_technical_size: 'Size',
uwm_technical_format: 'Format',
uwm_lifecycle: 'Lifecycle',
uwm_lifecycle_metadataqualitycheck: 'Metadata quality check',
uwm_lifecycle_infoeurepoversion: 'OpenAIRE Version Type',
uwm_lifecycle_contribute: 'Contribute',
uwm_lifecycle_contribute_date: 'Date',
uwm_lifecycle_contribute_entity: 'Entity / Personal data',
uwm_lifecycle_contribute_entity_isni: 'ISNI',
uwm_lifecycle_contribute_entity_lcnaf: 'LCNAF',
uwm_lifecycle_contribute_entity_gnd: 'GND',
uwm_lifecycle_contribute_entity_wdq: 'WDQ',
uwm_lifecycle_contribute_entity_viaf: 'VIAF',
uwm_lifecycle_contribute_entity_orcid: 'ORCID',
uwm_lifecycle_contribute_entity_student_id: 'Student ID',
uwm_lifecycle_contribute_entity_type: 'Type',
uwm_lifecycle_contribute_entity_title2: 'Title',
uwm_lifecycle_contribute_entity_title1: 'Title',
uwm_lifecycle_contribute_entity_institution: 'Institution',
uwm_lifecycle_contribute_entity_lastname: 'Lastname',
uwm_lifecycle_contribute_entity_firstname: 'Firstname',
uwm_lifecycle_contribute_ext_role: 'Different role',
uwm_lifecycle_contribute_role: 'Role',
uwm_lifecycle_peer_reviewed: 'Peer Reviewed',
uwm_lifecycle_status: 'Status',
uwm_lifecycle_version: 'Version',
uwm_lifecycle_upload_date: 'Phaidra Upload Date',
uwm_general: 'General',
uwm_general_identifiers: 'Identifiers',
uwm_general_identifiers_identifier: 'Identifier',
uwm_general_identifiers_resource: 'Resource',
uwm_general_irdata: 'Institutional Repository',
uwm_general_coverage: 'Coverage',
uwm_general_keyword: 'Keywords',
uwm_general_description: 'Description',
uwm_general_language: 'Language',
uwm_general_alt_title: 'Alternative Title',
uwm_general_subtitle: 'Subtitle',
uwm_general_title: 'Title',
uwm_general_identifier: 'Identifier',
lang_aa: 'Afar',
lang_ab: 'Abkhazian',
lang_ae: 'Avestan',
lang_af: 'Afrikaans',
lang_ak: 'Akan',
lang_am: 'Amharic',
lang_an: 'Aragonese',
lang_ar: 'Arabic',
lang_as: 'Assamese',
lang_av: 'Avaric',
lang_ay: 'Aymara',
lang_az: 'Azerbaijani',
lang_ba: 'Bashkir',
lang_be: 'Byelorussian',
lang_bg: 'Bulgarian',
lang_bh: 'Bihari',
lang_bi: 'Bislama',
lang_bm: 'Bambara',
lang_bn: 'Bengali',
lang_bo: 'Tibetan',
lang_br: 'Breton',
lang_bs: 'Bosnian',
lang_ca: 'Catalan',
lang_ce: 'Chechen',
lang_ch: 'Chamorro',
lang_co: 'Corsican',
lang_cr: 'Cree',
lang_cs: 'Czech',
lang_cu: 'Church Slavic; Old Slavonic;',
lang_cv: 'Chuvash',
lang_cy: 'Welch',
lang_da: 'Danish',
lang_de: 'German',
lang_dv: 'Divehi; Dhivehi; Maldivian',
lang_dz: 'Bhutani',
lang_ee: 'Ewe',
lang_el: 'Greek',
lang_en: 'English',
lang_eo: 'Esperanto',
lang_es: 'Spanish',
lang_et: 'Estonian',
lang_eu: 'Basque',
lang_fa: 'Persian',
lang_ff: 'Fulah',
lang_fi: 'Finnish',
lang_fj: 'Fiji',
lang_fo: 'Faeroese',
lang_fr: 'French',
lang_fy: 'Frisian',
lang_ga: 'Irish',
lang_gd: 'Scots Gaelic',
lang_gl: 'Galician',
lang_gn: 'Guarani',
lang_gu: 'Gujarati',
lang_gv: 'Manx',
lang_ha: 'Hausa',
lang_he: 'Hebrew',
lang_hi: 'Hindi',
lang_hr: 'Croatian',
lang_ht: 'Haitian',
lang_hu: 'Hungarian',
lang_hy: 'Armenian ',
lang_hz: 'Herero',
lang_ia: 'Interlingua',
lang_id: 'Indonesian',
lang_ie: 'Interlingue',
lang_ig: 'Igbo',
lang_ii: 'Sichuan Yi; Nuosu',
lang_ik: 'Inupiak',
lang_in: 'former Indonesian',
lang_io: 'Ido',
lang_is: 'Icelandic',
lang_it: 'Italian',
lang_iu: 'Inuktitut (Eskimo)',
lang_iw: 'former Hebrew',
lang_ja: 'Japanese',
lang_ji: 'former Yiddish',
lang_jv: 'Javanese',
lang_jw: 'Javanese',
lang_ka: 'Georgian',
lang_kg: 'Kongo',
lang_ki: 'Kikuyu; Gikuyu',
lang_kj: 'Kuanyama; Kwanyama',
lang_kk: 'Kazakh',
lang_kl: 'Greenlandic',
lang_km: 'Cambodian',
lang_kn: 'Kannada',
lang_ko: 'Korean',
lang_kr: 'Kanuri',
lang_ks: 'Kashmiri',
lang_ku: 'Kurdish',
lang_kv: 'Komi',
lang_kw: 'Cornish',
lang_ky: 'Kirghiz',
lang_la: 'Latin',
lang_lb: 'Luxembourgish; Letzeburgesch',
lang_lg: 'Ganda',
lang_li: 'Limburgan; Limburger; Limburgish',
lang_ln: 'Lingala',
lang_lo: 'Laothian',
lang_lt: 'Lithuanian',
lang_lu: 'Luba-Katanga',
lang_lv: 'Latvian, Lettish',
lang_mg: 'Malagasy',
lang_mh: 'Marshallese',
lang_mi: 'Maori',
lang_mk: 'Macedonian',
lang_ml: 'Malayalam',
lang_mn: 'Mongolian',
lang_mo: 'Moldavian',
lang_mr: 'Marathi',
lang_ms: 'Malay',
lang_mt: 'Maltese',
lang_my: 'Burmese',
lang_na: 'Nauru',
lang_nb: 'Bokmål, Norwegian; Norwegian Bokmål',
lang_nd: 'Ndebele, North; North Ndebele',
lang_ne: 'Nepali',
lang_ng: 'Ndonga',
lang_nl: 'Dutch',
lang_nn: 'Norwegian Nynorsk; Nynorsk, Norwegian',
lang_no: 'Norwegian',
lang_nr: 'Ndebele, South; South Ndebele',
lang_nv: 'Navajo; Navaho',
lang_ny: 'Chichewa; Chewa; Nyanja',
lang_oc: 'Occitan',
lang_oj: 'Ojibwa',
lang_om: '(Afan) Oromo',
lang_or: 'Oriya',
lang_os: 'Ossetian; Ossetic',
lang_pa: 'Punjabi',
lang_pi: 'Pali',
lang_pl: 'Polish',
lang_ps: 'Pashto, Pushto',
lang_pt: 'Portuguese',
lang_qu: 'Quechua',
lang_rm: 'Rhaeto-Romance',
lang_rn: 'Kirundi',
lang_ro: 'Romanian',
lang_ru: 'Russian',
lang_rw: 'Kinyarwanda',
lang_sa: 'Sanskrit',
lang_sc: 'Sardinian',
lang_sd: 'Sindhi',
lang_se: 'Northern Sami',
lang_sg: 'Sangro',
lang_sh: 'Serbo-Croatian',
lang_si: 'Singhalese',
lang_sk: 'Slovak',
lang_sl: 'Slovenian',
lang_sm: 'Samoan',
lang_sn: 'Shona',
lang_so: 'Somali',
lang_sq: 'Albanian',
lang_sr: 'Serbian',
lang_ss: 'Siswati',
lang_st: 'Sesotho',
lang_su: 'Sudanese',
lang_sv: 'Swedish',
lang_sw: 'Swahili',
lang_ta: 'Tamil',
lang_te: 'Tegulu',
lang_tg: 'Tajik',
lang_th: 'Thai',
lang_ti: 'Tigrinya',
lang_tk: 'Turkmen',
lang_tl: 'Tagalog',
lang_tn: 'Setswana',
lang_to: 'Tonga',
lang_tr: 'Turkish',
lang_ts: 'Tsonga',
lang_tt: 'Tatar',
lang_tw: 'Twi',
lang_ty: 'Tahitian',
lang_ug: 'Uigur',
lang_uk: 'Ukrainian',
lang_ur: 'Urdu',
lang_uz: 'Uzbek',
lang_vi: 'Vietnamese',
lang_vo: 'Volapuk',
lang_wa: 'Walloon',
lang_wo: 'Wolof',
lang_xh: 'Xhosa',
lang_xx: 'Not applicable',
lang_yi: 'Yiddish',
lang_yo: 'Yoruba',
lang_za: 'Zhuang',
lang_zh: 'Chinese',
lang_zu: 'Zulu'
}
|
import { Public } from '../public'
import { ForgotPasswordForm } from '../../forms/forgot-password-form'
import { SignInPage } from './sign-in-page'
export class ForgotPasswordPage extends Public {
pageUrl() {
return '/user/forgot_name'
}
constructor() {
super()
this._form = new ForgotPasswordForm()
}
visit() {
new SignInPage().clickForgotPasswordLink()
return this;
}
forgotPassword(email) {
this.getForm().enter({email})
return this
}
}
|
import PropTypes from 'prop-types'
import Icon from './Icon'
const CelebrateIcon = ({ viewBox }) => (
<Icon fill>
<svg viewBox={viewBox} xmlns="http://www.w3.org/2000/svg">
<g>
<path
d="M72.1,51.9L48.3,32.8c-1.1-0.9-2.6-1.3-4-0.9c-1.4,0.4-2.6,1.5-3,2.8l-16.6,45l-0.1,0.2c-0.6,1.8,0.1,3.8,1.6,5
c0.8,0.6,1.7,0.9,2.6,0.9c0.8,0,1.7-0.2,2.4-0.7l40.4-25.8l0.2-0.1c1.2-0.9,1.9-2.2,1.9-3.7C73.8,53.9,73.1,52.6,72.1,51.9z
M31.9,77.4l3.3-9c0.4,2.1,0.7,4.1,1.1,6.1c0,0,0,0,0,0L31.9,77.4z M40.4,72c-0.7-3.9-1.4-7.8-2.1-11.8l3.9-10.6
c1.3,6.4,2.6,12.7,3.8,18.9L40.4,72z M50,65.9C48.5,58,46.9,50,45.2,41.9c0-0.1-0.1-0.2-0.1-0.3l1.1-2.9l6.3,5.1
c0.5,3.1,1.1,6.1,1.7,9.2c0.6,3,1.1,6.1,1.6,9.1L50,65.9z M59.9,59.5c-0.4-2.4-0.9-4.8-1.3-7.3c-0.3-1.4-0.5-2.7-0.7-4.1l8.8,7.1
L59.9,59.5z"
/>
<path
d="M88.3,37.9c-3.9,1-8,1.9-11.9,2.9l-2.3,0.5c-1.2,0.3-2,1.5-1.7,2.7c0.2,1,1.2,1.7,2.2,1.7c0.2,0,0.3,0,0.5-0.1l2.2-0.5
c3.9-0.9,8-1.9,12-2.9c1.2-0.3,1.9-1.5,1.6-2.7C90.8,38.3,89.5,37.6,88.3,37.9z"
/>
<path
d="M57.1,29.5c0.2,0.1,0.4,0.1,0.6,0.1c1,0,1.9-0.7,2.2-1.6c1.2-4.2,2.4-8.6,3.7-12.9c0.4-1.2-0.3-2.4-1.5-2.8
c-1.2-0.4-2.4,0.3-2.8,1.5c-1.3,4.3-2.5,8.7-3.7,12.9C55.2,27.9,55.9,29.1,57.1,29.5z"
/>
<path
d="M67.8,35.9c0.5,0,1.1-0.2,1.5-0.6c4.7-5.1,9.4-10.2,14.2-15.4c0.8-0.8,0.7-2.1-0.1-2.8c-0.8-0.8-2.1-0.7-2.8,0.1
c-4.8,5.2-9.5,10.3-14.2,15.4c-0.8,0.8-0.7,2.1,0.1,2.8C66.8,35.7,67.3,35.9,67.8,35.9z"
/>
<path
d="M97.8,37.5l-0.5-0.1c-0.2,0-0.3-0.1-0.4-0.3l-0.2-0.5c-0.2-0.5-0.9-0.5-1.1-0.1l-0.3,0.4c-0.1,0.2-0.3,0.3-0.5,0.3h-0.5
c-0.5,0.1-0.7,0.6-0.4,1l0.3,0.4c0.1,0.1,0.1,0.3,0.1,0.5l-0.1,0.5c-0.1,0.5,0.4,0.9,0.8,0.7l0.6-0.2c0.1-0.1,0.3-0.1,0.5,0
l0.4,0.3c0.4,0.2,0.9-0.1,1.1-0.6l-0.1-0.5c0-0.2,0.1-0.4,0.2-0.5l0.4-0.3C98.4,38.2,98.3,37.6,97.8,37.5z"
/>
<path
d="M61.6,7c0.1,0.1,0.1,0.3,0.1,0.5L61.6,8c-0.1,0.5,0.4,0.9,0.8,0.7l0.5-0.2c0.1-0.1,0.3-0.1,0.5,0l0.4,0.3
c0.4,0.3,1-0.1,1-0.6l-0.1-0.5c0-0.2,0.1-0.4,0.2-0.5l0.4-0.3c0.3-0.3,0.2-0.9-0.3-1l-0.6-0.2c-0.2,0-0.3-0.1-0.4-0.3L64.1,5
c-0.2-0.5-0.9-0.5-1.1-0.1l-0.3,0.4c-0.1,0.2-0.3,0.3-0.5,0.3h-0.5c-0.5,0.1-0.7,0.6-0.4,1L61.6,7z"
/>
<path
d="M85.2,12.4c0.2,0.2,0.3,0.5,0.2,0.8l-0.2,0.7c-0.1,0.7,0.6,1.3,1.2,1l0.7-0.3c0.3-0.2,0.6-0.1,0.8,0l0.6,0.4
c0.6,0.4,1.3-0.1,1.3-0.9l-0.1-0.7c0-0.2,0.1-0.5,0.3-0.7l0.5-0.4c0.5-0.5,0.3-1.4-0.4-1.5l-0.7-0.1c-0.3-0.1-0.5-0.2-0.6-0.5
l-0.3-0.7c-0.3-0.7-1.2-0.7-1.5-0.1L86.6,10c-0.2,0.2-0.4,0.4-0.7,0.4l-0.7,0.1c-0.7,0-1,0.9-0.5,1.4L85.2,12.4z"
/>
</g>
</svg>
</Icon>
)
CelebrateIcon.propTypes = {
viewBox: PropTypes.string,
}
CelebrateIcon.defaultProps = {
viewBox: '0 0 120 90',
}
export default CelebrateIcon
|
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var React = _interopRequireWildcard(require("react"));
var _classnames = _interopRequireDefault(require("classnames"));
var _Cell = _interopRequireDefault(require("../Cell"));
var _TableContext = _interopRequireDefault(require("../context/TableContext"));
var _BodyContext = _interopRequireDefault(require("../context/BodyContext"));
var _valueUtil = require("../utils/valueUtil");
var _fixUtil = require("../utils/fixUtil");
var _ExpandedRow = _interopRequireDefault(require("./ExpandedRow"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function BodyRow(props) {
var className = props.className,
style = props.style,
stickyOffsets = props.stickyOffsets,
record = props.record,
index = props.index,
rowKey = props.rowKey,
getRowKey = props.getRowKey,
rowExpandable = props.rowExpandable,
onRow = props.onRow,
_props$indent = props.indent,
indent = _props$indent === void 0 ? 0 : _props$indent,
RowComponent = props.rowComponent,
cellComponent = props.cellComponent,
childrenColumnName = props.childrenColumnName;
var _React$useContext = React.useContext(_TableContext.default),
prefixCls = _React$useContext.prefixCls,
direction = _React$useContext.direction;
var _React$useContext2 = React.useContext(_BodyContext.default),
fixHeader = _React$useContext2.fixHeader,
fixColumn = _React$useContext2.fixColumn,
horizonScroll = _React$useContext2.horizonScroll,
componentWidth = _React$useContext2.componentWidth,
flattenColumns = _React$useContext2.flattenColumns,
expandableType = _React$useContext2.expandableType,
expandRowByClick = _React$useContext2.expandRowByClick,
onTriggerExpand = _React$useContext2.onTriggerExpand,
rowClassName = _React$useContext2.rowClassName,
expandedRowClassName = _React$useContext2.expandedRowClassName,
indentSize = _React$useContext2.indentSize,
expandIcon = _React$useContext2.expandIcon,
expandedRowRender = _React$useContext2.expandedRowRender,
expandIconColumnIndex = _React$useContext2.expandIconColumnIndex;
var _React$useState = React.useState(false),
_React$useState2 = _slicedToArray(_React$useState, 2),
expandRended = _React$useState2[0],
setExpandRended = _React$useState2[1];
var expanded = props.expandedKeys.has(props.recordKey);
React.useEffect(function () {
if (expanded) {
setExpandRended(true);
}
}, [expanded]); // Move to Body to enhance performance
var fixedInfoList = flattenColumns.map(function (column, colIndex) {
return (0, _fixUtil.getCellFixedInfo)(colIndex, colIndex, flattenColumns, stickyOffsets, direction);
});
var rowSupportExpand = expandableType === 'row' && (!rowExpandable || rowExpandable(record)); // Only when row is not expandable and `children` exist in record
var nestExpandable = expandableType === 'nest';
var hasNestChildren = childrenColumnName in record && record[childrenColumnName];
var mergedExpandable = rowSupportExpand || nestExpandable; // =========================== onRow ===========================
var additionalProps;
if (onRow) {
additionalProps = onRow(record, index);
}
var onClick = function onClick(event) {
if (expandRowByClick && mergedExpandable) {
onTriggerExpand(record, event);
}
if (additionalProps && additionalProps.onClick) {
var _additionalProps;
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
(_additionalProps = additionalProps).onClick.apply(_additionalProps, [event].concat(args));
}
}; // ======================== Base tr row ========================
var computeRowClassName;
if (typeof rowClassName === 'string') {
computeRowClassName = rowClassName;
} else if (typeof rowClassName === 'function') {
computeRowClassName = rowClassName(record, index, indent);
}
var columnsKey = (0, _valueUtil.getColumnsKey)(flattenColumns);
var baseRowNode = React.createElement(RowComponent, Object.assign({}, additionalProps, {
"data-row-key": rowKey,
className: (0, _classnames.default)(className, "".concat(prefixCls, "-row"), "".concat(prefixCls, "-row-level-").concat(indent), computeRowClassName, additionalProps && additionalProps.className),
style: _objectSpread({}, style, {}, additionalProps ? additionalProps.style : null),
onClick: onClick
}), flattenColumns.map(function (column, colIndex) {
var render = column.render,
dataIndex = column.dataIndex,
columnClassName = column.className;
var key = columnsKey[colIndex];
var fixedInfo = fixedInfoList[colIndex]; // ============= Used for nest expandable =============
var appendCellNode;
if (colIndex === (expandIconColumnIndex || 0) && nestExpandable) {
appendCellNode = React.createElement(React.Fragment, null, React.createElement("span", {
style: {
paddingLeft: "".concat(indentSize * indent, "px")
},
className: "".concat(prefixCls, "-row-indent indent-level-").concat(indent)
}), expandIcon({
prefixCls: prefixCls,
expanded: expanded,
expandable: hasNestChildren,
record: record,
onExpand: onTriggerExpand
}));
}
var additionalCellProps;
if (column.onCell) {
additionalCellProps = column.onCell(record, index);
}
return React.createElement(_Cell.default, Object.assign({
className: columnClassName,
ellipsis: column.ellipsis,
align: column.align,
component: cellComponent,
prefixCls: prefixCls,
key: key,
record: record,
index: index,
dataIndex: dataIndex,
render: render
}, fixedInfo, {
appendNode: appendCellNode,
additionalProps: additionalCellProps
}));
})); // ======================== Expand Row =========================
var expandRowNode;
if (rowSupportExpand && (expandRended || expanded)) {
var expandContent = expandedRowRender(record, index, indent + 1, expanded);
var computedExpandedRowClassName = expandedRowClassName && expandedRowClassName(record, index, indent);
expandRowNode = React.createElement(_ExpandedRow.default, {
expanded: expanded,
className: (0, _classnames.default)("".concat(prefixCls, "-expanded-row"), "".concat(prefixCls, "-expanded-row-level-").concat(indent + 1), computedExpandedRowClassName),
prefixCls: prefixCls,
fixHeader: fixHeader,
fixColumn: fixColumn,
horizonScroll: horizonScroll,
component: RowComponent,
componentWidth: componentWidth,
cellComponent: cellComponent,
colSpan: flattenColumns.length
}, expandContent);
} // ========================= Nest Row ==========================
var nestRowNode;
if (hasNestChildren && expanded) {
nestRowNode = (record[childrenColumnName] || []).map(function (subRecord, subIndex) {
var subKey = getRowKey(subRecord, subIndex);
return React.createElement(BodyRow, Object.assign({}, props, {
key: subKey,
rowKey: subKey,
record: subRecord,
recordKey: subKey,
index: subIndex,
indent: indent + 1
}));
});
}
return React.createElement(React.Fragment, null, baseRowNode, expandRowNode, nestRowNode);
}
BodyRow.displayName = 'BodyRow';
var _default = BodyRow;
exports.default = _default;
|
import Transform2D from 'components/Transform2D.js';
import MainLoop from 'system/MainLoop.js';
import Canvas from 'canvas/Canvas.js';
import GetContext from 'canvas/GetContext.js';
import AddToDOM from 'dom/AddToDOM.js';
import CLS from 'canvas/graphics/Clear.js';
import DrawImage from 'canvas/DrawImage.js';
import SetTransformFromMatrix from 'canvas/SetTransformFromMatrix.js';
import Loader from 'loader/Loader.js';
export default class TransformTest {
constructor () {
this.canvas = Canvas(800, 600);
AddToDOM(this.canvas, 'game');
this.ctx = GetContext(this.canvas);
this.sprite1 = new Transform2D({}, null, 200, 200);
// Coords relative to parent, so display position will be 264x264
this.sprite2 = new Transform2D({}, this.sprite1, 64, 64);
// Loader
this.image = null;
this.loader = new Loader();
this.loader.path = 'assets/';
this.loader.image('mushroom2').then((file) => this.loadComplete(file));
this.loader.start();
}
loadComplete (file) {
this.image = file.data;
this.loop = new MainLoop(60);
this.loop.begin = (t => this.begin(t));
this.loop.update = (delta => this.update(delta));
this.loop.draw = (t => this.draw(t));
this.loop.start();
}
begin () {
CLS(this.ctx, true, 50, 50, 100);
}
update (delta) {
// this.sprite1.angle += 2;
// this.sprite1.x += 100 * this.loop.physicsStep;
// if (this.sprite1.x > 800)
// {
// this.sprite1.x = 0;
// }
}
draw (i) {
SetTransformFromMatrix(this.ctx, this.sprite1._local);
DrawImage(this.ctx, this.image);
SetTransformFromMatrix(this.ctx, this.sprite2._local);
DrawImage(this.ctx, this.image);
}
}
new TransformTest();
|
require("babel-register");
require('./server.js');
|
import React from "react";
import { BrowserRouter } from "react-router-dom";
// hydrate is responsible for server rendering going forward
import { hydrate as render } from "react-dom";
import App from "./app";
import { Provider } from "react-redux";
import store from "./store";
import registerServiceWorker from "./registerServiceWorker";
render(
<Provider store={store}>
<BrowserRouter>
<App />
</BrowserRouter>
</Provider>,
document.getElementById("app")
);
registerServiceWorker();
// Hot Module Replacement API
if (module.hot) {
module.hot.accept();
}
|
importScripts("lunr.min.js");
addEventListener('message', function (e) {
var index = lunr(function () {
this.field('title', {boost: 10})
this.field('body')
this.ref('id')
e.data.forEach(function (doc) {
this.add(doc)
}, this);
});
self.postMessage(JSON.stringify(index));
});
|
'use strict';
describe('applicationCreate', function() {
var scope, _utils, location, controller, _apiService, _window, q;
beforeEach(module('app'));
beforeEach(inject(function($controller, $location, $rootScope, $q, apiService, utils) {
controller = $controller;
scope = $rootScope.$new();
location = $location;
q = $q;
_utils = utils;
_apiService = apiService;
_window = {};
}));
var createController = function() {
return controller('applicationCreate', {
$scope: scope,
$location: location,
$window: _window,
apiService: _apiService,
utils: _utils
});
};
it('should have a method to check if the path is active', function() {
});
it('should have scope initialized', function() {
var applicationCreate = createController();
expect(scope.name).toBe("");
expect(scope.owner).toBe("");
expect(scope.guid).not.toBe("");
expect(scope.save).not.toBeUndefined();
});
it("should call save when save", function(done) {
var applicationCreate = createController();
debugger;
var defer = q.defer();
sinon.stub(_apiService.application, "create").returns(defer.promise);
_window.alert = sinon.spy();
sinon.spy(location, "path");
scope.save({});
defer.resolve({});
scope.$apply();
sinon.assert.calledOnce(_apiService.application.create);
sinon.assert.calledOnce(location.path);
expect(_window.alert.callCount).toBe(0);
});
it("should call save and show alert when error", function() {
var applicationCreate = createController();
var defer = q.defer();
sinon.stub(_apiService.application, "create").returns(defer.promise);
_window.alert = sinon.spy();
sinon.spy(location, "path");
scope.save({});
defer.reject(new Error("Error"));
scope.$apply();
sinon.assert.calledOnce(_apiService.application.create);
sinon.assert.calledOnce(_window.alert);
expect(location.path.callCount).toBe(0);
});
});
|
import WidgetSettings from "../templates/widget-settings.html";
export default {
name: "template-settings",
props: ["widget", "form", "config"],
template: WidgetSettings,
};
|
'use strict'
module.exports = {
gitRawCommitsOpts: {
// null => 所有 commit 上的 tag 计入 changelog
// true => 仅 merge commit 上的 tag 计入 changelog
// null => 仅非 merge commit 上的 tag 计入 changelog
merges: null
}
}
|
var should = require('should')
var mockFS = require('mock-fs')
var envRestorer = require( 'env-restorer' )
var authenticator = require('../lib/authenticator')
var testHelper = require('./_helper')
// Restore File system mocks, authentication state and environment variables
var restoreAll = function () {
mockFS.restore();
authenticator.purge();
envRestorer.restore();
}
describe('authenticator_test', function () {
describe('#getToken()', function () {
it('should read the access token from the config file', function () {
mockFS({
'data/strava_config': JSON.stringify({
'access_token': 'abcdefghi',
'client_id': 'jklmnopqr',
'client_secret': 'stuvwxyz',
'redirect_uri': 'https://sample.com'
})
})
delete process.env.STRAVA_ACCESS_TOKEN
authenticator.purge();
(authenticator.getToken()).should.be.exactly('abcdefghi')
})
it('should read the access token from the env vars', function () {
mockFS({
'data': {}
})
process.env.STRAVA_ACCESS_TOKEN = 'abcdefghi'
authenticator.purge();
(authenticator.getToken()).should.be.exactly('abcdefghi')
})
afterEach(restoreAll)
})
describe('#getClientId()', function () {
it('should read the client id from the config file', function () {
mockFS({
'data/strava_config': JSON.stringify({
'access_token': 'abcdefghi',
'client_id': 'jklmnopqr',
'client_secret': 'stuvwxyz',
'redirect_uri': 'https://sample.com'
})
})
delete process.env.STRAVA_CLIENT_ID
authenticator.purge();
(authenticator.getClientId()).should.be.exactly('jklmnopqr')
})
it('should read the client id from the env vars', function () {
mockFS({
'data': {}
})
process.env.STRAVA_CLIENT_ID = 'abcdefghi'
authenticator.purge();
(authenticator.getClientId()).should.be.exactly('abcdefghi')
})
afterEach(restoreAll)
})
describe('#getClientSecret()', function () {
it('should read the client secret from the config file', function () {
mockFS({
'data/strava_config': JSON.stringify({
'access_token': 'abcdefghi',
'client_id': 'jklmnopqr',
'client_secret': 'stuvwxyz',
'redirect_uri': 'https://sample.com'
})
})
delete process.env.STRAVA_CLIENT_SECRET
authenticator.purge();
(authenticator.getClientSecret()).should.be.exactly('stuvwxyz')
})
it('should read the client secret from the env vars', function () {
mockFS({
'data': {}
})
process.env.STRAVA_CLIENT_SECRET = 'abcdefghi'
authenticator.purge();
(authenticator.getClientSecret()).should.be.exactly('abcdefghi')
})
afterEach(restoreAll)
})
describe('#getRedirectUri()', function () {
it('should read the redirect URI from the config file', function () {
mockFS({
'data/strava_config': JSON.stringify({
'access_token': 'abcdefghi',
'client_id': 'jklmnopqr',
'client_secret': 'stuvwxyz',
'redirect_uri': 'https://sample.com'
})
})
delete process.env.STRAVA_REDIRECT_URI
authenticator.purge();
(authenticator.getRedirectUri()).should.be.exactly('https://sample.com')
})
it('should read the redirect URI from the env vars', function () {
mockFS({
'data': {}
})
process.env.STRAVA_REDIRECT_URI = 'https://sample.com'
authenticator.purge();
(authenticator.getRedirectUri()).should.be.exactly('https://sample.com')
})
afterEach(restoreAll)
})
})
|
import vhttp from './index'
// 是否是登录用户
export const get_whoami = params => vhttp('/whoami', params, 'GET')
//注册
export const register = params => vhttp('/v1/register/', params, 'POST')
//登陆
export const login = params => vhttp('/v1/login/', params, 'POST')
//发表文章
export const publishArticle = params => vhttp('/v1/article/', params, 'POST')
//得到作者所有文章
export const getArticle = params => vhttp('/v1/article/', params, 'GET')
//获取首页数据
export const getHomeArticle = params => vhttp('/v1/index/', params, 'GET')
//发表评论
export const postComment = params => vhttp('/v1/comment/', params, 'POST')
//获取评论
export const getCommentList = params => vhttp('/v1/comment/', params, 'GET')
//得到文章详情
export const getArticleDetail = params => vhttp('/v1/one_article/', params, 'GET')
|
'use strict'
const co = require('co')
const prompt = require('co-prompt')
const config = require('../templates.json')
const chalk = require('chalk')
const fs = require('fs')
const path = require('path')
module.exports = () => {
co(function* () {
const tplName = yield prompt(chalk.green('Please input will delete template name: '))
if (config.tpl[tplName]) {
delete config.tpl[tplName]
} else {
console.log(chalk.red('Template does not exist!'))
process.exit()
}
fs.writeFile(path.resolve(__dirname, '../templates.json'), JSON.stringify(config), 'utf-8', (err) => {
if (err) console.log(err)
console.log(chalk.green('Delete template success!'))
console.log(chalk.grey('The last template list is:'))
console.log(config)
process.exit()
})
})
}
|
var searchData=
[
['walldirection_2509',['WallDirection',['../structdg_1_1geo_1_1_wall_direction.html#a19b7dd3e978f1cb73eabdfb7c113ccdb',1,'dg::geo::WallDirection']]],
['walldistance_2510',['WallDistance',['../../../dg/html/structdg_1_1_wall_distance.html#a4b28821101928d2250225b2e30546ef2',1,'dg::WallDistance']]],
['weights_2511',['weights',['../../../dg/html/classdg_1_1_d_l_t.html#a48ac177dc428c7334ab96de785b34e4c',1,'dg::DLT::weights()'],['../../../dg/html/classdg_1_1_d_l_t.html#a48ac177dc428c7334ab96de785b34e4c',1,'DLT< double >::weights()'],['../../../dg/html/classdg_1_1_elliptic.html#ab4148f491c864f360285a1b9504a9a1b',1,'dg::Elliptic::weights()'],['../../../dg/html/classdg_1_1_elliptic3d.html#a6da8361eee9bf8c718ba7f2d1a4366b0',1,'dg::Elliptic3d::weights()'],['../../../dg/html/structdg_1_1_helmholtz.html#a12138d8e14e9fcf795f391a285e4526f',1,'dg::Helmholtz::weights()'],['../../../dg/html/structdg_1_1_helmholtz2.html#a825bd67bc60d477e90dc716a81b241e6',1,'dg::Helmholtz2::weights()'],['../../../dg/html/structdg_1_1_helmholtz3d.html#aa37f3b3f8f6b7dee66d58144a6994e06',1,'dg::Helmholtz3d::weights()'],['../../../dg/html/classdg_1_1_refined_elliptic.html#adec28852a55205f4035e7a5eb668f05e',1,'dg::RefinedElliptic::weights()'],['../structdg_1_1geo_1_1_d_s.html#a186161681f43813d2036347e0b7efa17',1,'dg::geo::DS::weights()'],['../../../dg/html/group__highlevel.html#ga771996962c7762bc7ee00b522a17259f',1,'dg::create::weights(const aRealMPITopology2d< real_type > &g)'],['../../../dg/html/group__highlevel.html#gab194a38ffb031d3a97a64c4ff53e65d0',1,'dg::create::weights(const aRealMPITopology2d< real_type > &g, enum coo2d coo)'],['../../../dg/html/group__highlevel.html#ga9cd616fb93237339752470a4eb7a680f',1,'dg::create::weights(const aRealMPITopology3d< real_type > &g)'],['../../../dg/html/group__highlevel.html#ga4492c68c4ff6fde4ddcef6222faa7878',1,'dg::create::weights(const aRealMPITopology3d< real_type > &g, enum coo3d coo)'],['../../../dg/html/group__lowlevel.html#gafa18a25598ba1bf8e2dc735a6440e305',1,'dg::create::weights(const DLT< real_type > &dlt)'],['../../../dg/html/group__highlevel.html#gad64ee328d6171328dfd229343b9173dc',1,'dg::create::weights(const RealGrid1d< real_type > &g)'],['../../../dg/html/group__highlevel.html#ga2e4411ee5bcba4f192b41ed42d915ede',1,'dg::create::weights(const aRealTopology2d< real_type > &g)'],['../../../dg/html/group__highlevel.html#gad4df6ba2d246d113a5d9011a54da0dcf',1,'dg::create::weights(const aRealTopology2d< real_type > &g, enum coo2d coo)'],['../../../dg/html/group__highlevel.html#ga1da9d8d5de8c187d3f17d17c60aa0ae6',1,'dg::create::weights(const aRealTopology3d< real_type > &g)'],['../../../dg/html/group__highlevel.html#gad8cd595e5a376727cc749717f019e094',1,'dg::create::weights(const aRealTopology3d< real_type > &g, enum coo3d coo)'],['../../../dg/html/group__highlevel.html#gaabba080c7fd359db781e2b778de84ca8',1,'dg::create::weights(const dg::RealGridX1d< real_type > &g)'],['../../../dg/html/group__highlevel.html#gaf150437a87e1dccfe01da7f8a7d5e8eb',1,'dg::create::weights(const aRealTopologyX2d< real_type > &g)'],['../../../dg/html/group__highlevel.html#ga03329b99834eee0c5fe2ecfdd2d7bfe2',1,'dg::create::weights(const aRealTopologyX3d< real_type > &g)'],['../../../dg/html/group__highlevel.html#ga771996962c7762bc7ee00b522a17259f',1,'weights(const aRealMPITopology2d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#gab194a38ffb031d3a97a64c4ff53e65d0',1,'weights(const aRealMPITopology2d< real_type > &g, enum coo2d coo)(Global Namespace)'],['../../../dg/html/group__highlevel.html#ga9cd616fb93237339752470a4eb7a680f',1,'weights(const aRealMPITopology3d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#ga4492c68c4ff6fde4ddcef6222faa7878',1,'weights(const aRealMPITopology3d< real_type > &g, enum coo3d coo)(Global Namespace)'],['../../../dg/html/group__highlevel.html#gad64ee328d6171328dfd229343b9173dc',1,'weights(const RealGrid1d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#ga2e4411ee5bcba4f192b41ed42d915ede',1,'weights(const aRealTopology2d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#gad4df6ba2d246d113a5d9011a54da0dcf',1,'weights(const aRealTopology2d< real_type > &g, enum coo2d coo)(Global Namespace)'],['../../../dg/html/group__highlevel.html#ga1da9d8d5de8c187d3f17d17c60aa0ae6',1,'weights(const aRealTopology3d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#gad8cd595e5a376727cc749717f019e094',1,'weights(const aRealTopology3d< real_type > &g, enum coo3d coo)(Global Namespace)'],['../../../dg/html/group__highlevel.html#gaabba080c7fd359db781e2b778de84ca8',1,'weights(const dg::RealGridX1d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#gaf150437a87e1dccfe01da7f8a7d5e8eb',1,'weights(const aRealTopologyX2d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__highlevel.html#ga03329b99834eee0c5fe2ecfdd2d7bfe2',1,'weights(const aRealTopologyX3d< real_type > &g)(Global Namespace)'],['../../../dg/html/group__lowlevel.html#gafa18a25598ba1bf8e2dc735a6440e305',1,'weights(const DLT< real_type > &dlt)(Global Namespace)']]],
['what_2512',['what',['../../../dg/html/classdg_1_1_error.html#a9ae766312be4753aaf940cf90601551d',1,'dg::Error::what()'],['../../../dg/html/structdg_1_1_fail.html#aa9d59ccd968061ba1aec553a3dc09e76',1,'dg::Fail::what()'],['../../../dg/html/classdg_1_1_no_root1d.html#a4d0a1c232bb8915642a5ec636f3af608',1,'dg::NoRoot1d::what()']]],
['width_2513',['width',['../structdg_1_1geo_1_1a_real_generator2d.html#ad2f83e627dcf61953136a282c6cf901f',1,'dg::geo::aRealGenerator2d']]]
];
|
(function(e){const t=e["fa"]=e["fa"]||{};t.dictionary=Object.assign(t.dictionary||{},{"%0 of %1":"0% از 1%","Align cell text to the bottom":"","Align cell text to the center":"","Align cell text to the left":"","Align cell text to the middle":"","Align cell text to the right":"متن سلول را در سمت راست تراز کنید","Align cell text to the top":"","Align center":"تراز وسط","Align left":"تراز چپ","Align right":"تراز راست","Align table to the left":"","Align table to the right":"جدول را در سمت راست تراز کنید",Alignment:"ترازبندی",Aquamarine:"زمرد کبود",Background:"زمینه",Big:"بزرگ",Black:"سیاه","Block quote":" بلوک نقل قول",Blue:"آبی","Blue marker":"نشانگر آبی",Bold:"درشت",Border:"حاشیه","Break text":"","Bulleted List":"لیست نشانهدار","Bulleted list styles toolbar":"",Cancel:"لغو","Cannot upload file:":"فایل آپلود نمیشود:","Cell properties":"خصوصیات سلول","Center table":"جدول وسط","Centered image":"تصویر در وسط","Change image text alternative":"تغییر متن جایگزین تصویر","Characters: %0":"تعداد حروف : 0%","Choose heading":"انتخاب عنوان",Circle:"",Code:"کد",Color:"رنگ","Color picker":"",Column:"ستون",Dashed:"نقطه چین",Decimal:"","Decimal with leading zero":"","Decrease indent":"کاهش تورفتگی",Default:"پیش فرض","Delete column":"حذف ستون","Delete row":"حذف سطر","Dim grey":"خاکستری تیره",Dimensions:"ابعاد",Disc:"","Document colors":"رنگ اسناد",Dotted:"خط چین",Double:"دوبل",Downloadable:"قابل بارگیری","Dropdown toolbar":"نوارابزار کشویی","Edit block":"ویرایش قطعه","Edit link":"ویرایش پیوند","Editor toolbar":"نوارابزار ویرایشگر","Enter image caption":"عنوان تصویر را وارد کنید","Enter table caption":"","Font Background Color":"رنگ پس زمینه فونت","Font Color":"رنگ فونت","Font Family":"خانواده فونت","Font Size":"اندازه فونت","Full size image":"تصویر در اندازه کامل",Green:"سبز","Green marker":"نشانگر سبز","Green pen":"قلم سبز",Grey:"خاکستری",Groove:"خط دار کردن","Header column":"ستون سربرگ","Header row":"سطر سربرگ",Heading:"عنوان","Heading 1":"عنوان 1","Heading 2":"عنوان 2","Heading 3":"عنوان 3","Heading 4":"عنوان 4","Heading 5":"عنوان 5","Heading 6":"عنوان 6",Height:"ارتفاع",Highlight:"برجسته","Horizontal line":"خط افقی","Horizontal text alignment toolbar":"",Huge:"بسیار بزرگ","Image resize list":"","Image toolbar":"نوارابزار تصویر","image widget":"ابزاره تصویر","In line":"","Increase indent":"افزایش تورفتگی",Insert:"","Insert code block":"درج بلوک کد","Insert column left":"درج ستون در سمت چپ","Insert column right":"درج ستون در سمت راست","Insert image":"قرار دادن تصویر","Insert image via URL":"","Insert media":"وارد کردن رسانه","Insert paragraph after block":"درج پاراگراف بعد از بلوک","Insert paragraph before block":"درج پاراگراف قبل از بلوک","Insert row above":"درج سطر در بالا","Insert row below":"درج سطر در پایین","Insert table":"درج جدول",Inset:"",Italic:"کج",Justify:"هم تراز کردن","Justify cell text":"","Left aligned image":"تصویر تراز شده چپ","Light blue":"آبی روشن","Light green":"سبز روشن","Light grey":"خاکستری روشن",Link:"پیوند","Link image":"اتصال پیوند به تصویر","Link URL":"نشانی اینترنتی پیوند","Lower-latin":"","Lower–roman":"","Media URL":"آدرس اینترنتی رسانه","media widget":"ویجت رسانه","Merge cell down":"ادغام سلول پایین","Merge cell left":"ادغام سلول چپ","Merge cell right":"ادغام سلول راست","Merge cell up":"ادغام سلول بالا","Merge cells":"ادغام سلول ها",Next:"بعدی",None:"هیچ کدام","Numbered List":"لیست عددی","Numbered list styles toolbar":"","Open in a new tab":"بازکردن در برگه جدید","Open link in new tab":"باز کردن پیوند در برگه جدید",Orange:"نارنجی",Original:"",Outset:"",Padding:"حاشیه داخلی","Page break":"برش صفحه",Paragraph:"پاراگراف","Paste the media URL in the input.":"آدرس رسانه را در ورودی قرار دهید","Pink marker":"نشانگر صورتی","Plain text":"متن ساده",Previous:"قبلی",Purple:"بنفش",Red:"قرمز","Red pen":"قلم قرمز",Redo:"باز انجام","Remove color":"حذف رنگ","Remove Format":"حذف کردن قالب","Remove highlight":"حذف برجسته","Resize image":"","Resize image to %0":"","Resize image to the original size":"","Restore default":"","Rich Text Editor":"ویرایشگر متن غنی","Rich Text Editor, %0":"ویرایشگر متن غنی، %0",Ridge:"","Right aligned image":"تصویر تراز شده راست",Row:"سطر",Save:"ذخیره","Select all":"انتخاب همه","Select column":"","Select row":"","Show more items":"نمایش گزینههای بیشتر","Side image":"تصویر جانبی",Small:"کوچک",Solid:"توپر","Split cell horizontally":"تقسیم افقی سلول","Split cell vertically":"تقسیم عمودی سلول",Square:"",Strikethrough:"خط خورده",Style:"",Subscript:"پایین نویس",Superscript:"بالانویس","Table alignment toolbar":"","Table cell text alignment":"","Table properties":"خصوصیات جدول","Table toolbar":"نوارابزار جدول","Text alignment":"تراز متن","Text alignment toolbar":"نوار ابزار ترازبندی متن","Text alternative":"متن جایگزین","Text highlight toolbar":"نوارابزار برجستگی متن",'The color is invalid. Try "#FF0000" or "rgb(255,0,0)" or "red".':"","The URL must not be empty.":"آدرس اینترنتی URL نباید خالی باشد.",'The value is invalid. Try "10px" or "2em" or simply "2".':"","This link has no URL":"این پیوند نشانی اینترنتی ندارد","This media URL is not supported.":"این آدرس اینترنتی رسانه پشتیبانی نمیشود",Tiny:"بسیار کوچک","Tip: Paste the URL into the content to embed faster.":"نکته : آدرس را در محتوا قراردهید تا سریع تر جاسازی شود","To-do List":"لیست انجام کار","Toggle caption off":"","Toggle caption on":"","Toggle the circle list style":"","Toggle the decimal list style":"","Toggle the decimal with leading zero list style":"","Toggle the disc list style":"","Toggle the lower–latin list style":"","Toggle the lower–roman list style":"","Toggle the square list style":"","Toggle the upper–latin list style":"","Toggle the upper–roman list style":"",Turquoise:"فیروزه ای",Underline:"خط زیر",Undo:"بازگردانی",Unlink:"لغو پیوند",Update:"","Update image URL":"","Upload failed":"آپلود ناموفق بود","Upload in progress":"آپلود در حال انجام","Upper-latin":"","Upper-roman":"","Vertical text alignment toolbar":"",White:"سفید","Widget toolbar":"نوار ابزار ویجت",Width:"عرض","Words: %0":"تعداد لغات : 0%","Wrap text":"",Yellow:"زرد","Yellow marker":"نشانگر زرد"});t.getPluralForm=function(e){return e>1}})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={}));
|
import {fetch, post} from '../http';
/**
* @param params 对象参数
* @returns {*}
*/
// 查询列表
export function findVideoList (params) {
return fetch('video/findList', params);
}
export function delVideo (params) {
return fetch('video/del', params);
}
export function addVideo (params) {
return post('video/add', params);
}
export function editVideo (params) {
return post('video/update', params);
}
|
/*! Copyright (c) 2011, Lloyd Hilaiel, ISC License */
/*
* This is the JSONSelect reference implementation, in javascript.
*/
(function(exports) {
var // localize references
toString = Object.prototype.toString;
function jsonParse(str) {
try {
if(JSON && JSON.parse){
return JSON.parse(str);
}
return (new Function("return " + str))();
} catch(e) {
te("ijs", e.message);
}
}
// emitted error codes.
var errorCodes = {
"bop": "binary operator expected",
"ee": "expression expected",
"epex": "closing paren expected ')'",
"ijs": "invalid json string",
"mcp": "missing closing paren",
"mepf": "malformed expression in pseudo-function",
"mexp": "multiple expressions not allowed",
"mpc": "multiple pseudo classes (:xxx) not allowed",
"nmi": "multiple ids not allowed",
"pex": "opening paren expected '('",
"se": "selector expected",
"sex": "string expected",
"sra": "string required after '.'",
"uc": "unrecognized char",
"ucp": "unexpected closing paren",
"ujs": "unclosed json string",
"upc": "unrecognized pseudo class"
};
// throw an error message
function te(ec, context) {
throw new Error(errorCodes[ec] + ( context && " in '" + context + "'"));
}
// THE LEXER
var toks = {
psc: 1, // pseudo class
psf: 2, // pseudo class function
typ: 3, // type
str: 4, // string
ide: 5 // identifiers (or "classes", stuff after a dot)
};
// The primary lexing regular expression in jsonselect
var pat = new RegExp(
"^(?:" +
// (1) whitespace
"([\\r\\n\\t\\ ]+)|" +
// (2) one-char ops
"([~*,>\\)\\(])|" +
// (3) types names
"(string|boolean|null|array|object|number)|" +
// (4) pseudo classes
"(:(?:root|first-child|last-child|only-child))|" +
// (5) pseudo functions
"(:(?:nth-child|nth-last-child|has|expr|val|contains))|" +
// (6) bogusly named pseudo something or others
"(:\\w+)|" +
// (7 & 8) identifiers and JSON strings
"(?:(\\.)?(\\\"(?:[^\\\\\\\"]|\\\\[^\\\"])*\\\"))|" +
// (8) bogus JSON strings missing a trailing quote
"(\\\")|" +
// (9) identifiers (unquoted)
"\\.((?:[_a-zA-Z]|[^\\0-\\0177]|\\\\[^\\r\\n\\f0-9a-fA-F])(?:[_a-zA-Z0-9\\-]|[^\\u0000-\\u0177]|(?:\\\\[^\\r\\n\\f0-9a-fA-F]))*)" +
")"
);
// A regular expression for matching "nth expressions" (see grammar, what :nth-child() eats)
var nthPat = /^\s*\(\s*(?:([+\-]?)([0-9]*)n\s*(?:([+\-])\s*([0-9]))?|(odd|even)|([+\-]?[0-9]+))\s*\)/;
function lex(str, off) {
if (!off) off = 0;
var m = pat.exec(str.substr(off));
if (!m) return undefined;
off+=m[0].length;
var a;
if (m[1]) a = [off, " "];
else if (m[2]) a = [off, m[0]];
else if (m[3]) a = [off, toks.typ, m[0]];
else if (m[4]) a = [off, toks.psc, m[0]];
else if (m[5]) a = [off, toks.psf, m[0]];
else if (m[6]) te("upc", str);
else if (m[8]) a = [off, m[7] ? toks.ide : toks.str, jsonParse(m[8])];
else if (m[9]) te("ujs", str);
else if (m[10]) a = [off, toks.ide, m[10].replace(/\\([^\r\n\f0-9a-fA-F])/g,"$1")];
return a;
}
// THE EXPRESSION SUBSYSTEM
var exprPat = new RegExp(
// skip and don't capture leading whitespace
"^\\s*(?:" +
// (1) simple vals
"(true|false|null)|" +
// (2) numbers
"(-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)|" +
// (3) strings
"(\"(?:[^\\]|\\[^\"])*\")|" +
// (4) the 'x' value placeholder
"(x)|" +
// (5) binops
"(&&|\\|\\||[\\$\\^<>!\\*]=|[=+\\-*/%<>])|" +
// (6) parens
"([\\(\\)])" +
")"
);
function is(o, t) { return typeof o === t; }
var operators = {
'*': [ 9, function(lhs, rhs) { return lhs * rhs; } ],
'/': [ 9, function(lhs, rhs) { return lhs / rhs; } ],
'%': [ 9, function(lhs, rhs) { return lhs % rhs; } ],
'+': [ 7, function(lhs, rhs) { return lhs + rhs; } ],
'-': [ 7, function(lhs, rhs) { return lhs - rhs; } ],
'<=': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs <= rhs || is(lhs, 'string') && is(rhs, 'string') && lhs <= rhs; } ],
'>=': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs >= rhs || is(lhs, 'string') && is(rhs, 'string') && lhs >= rhs; } ],
'$=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.lastIndexOf(rhs) === lhs.length - rhs.length; } ],
'^=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.indexOf(rhs) === 0; } ],
'*=': [ 5, function(lhs, rhs) { return is(lhs, 'string') && is(rhs, 'string') && lhs.indexOf(rhs) !== -1; } ],
'>': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs > rhs || is(lhs, 'string') && is(rhs, 'string') && lhs > rhs; } ],
'<': [ 5, function(lhs, rhs) { return is(lhs, 'number') && is(rhs, 'number') && lhs < rhs || is(lhs, 'string') && is(rhs, 'string') && lhs < rhs; } ],
'=': [ 3, function(lhs, rhs) { return lhs === rhs; } ],
'!=': [ 3, function(lhs, rhs) { return lhs !== rhs; } ],
'&&': [ 2, function(lhs, rhs) { return lhs && rhs; } ],
'||': [ 1, function(lhs, rhs) { return lhs || rhs; } ]
};
function exprLex(str, off) {
var v, m = exprPat.exec(str.substr(off));
if (m) {
off += m[0].length;
v = m[1] || m[2] || m[3] || m[5] || m[6];
if (m[1] || m[2] || m[3]) return [off, 0, jsonParse(v)];
else if (m[4]) return [off, 0, undefined];
return [off, v];
}
}
function exprParse2(str, off) {
if (!off) off = 0;
// first we expect a value or a '('
var l = exprLex(str, off),
lhs;
if (l && l[1] === '(') {
lhs = exprParse2(str, l[0]);
var p = exprLex(str, lhs[0]);
if (!p || p[1] !== ')') te('epex', str);
off = p[0];
lhs = [ '(', lhs[1] ];
} else if (!l || (l[1] && l[1] != 'x')) {
te("ee", str + " - " + ( l[1] && l[1] ));
} else {
lhs = ((l[1] === 'x') ? undefined : l[2]);
off = l[0];
}
// now we expect a binary operator or a ')'
var op = exprLex(str, off);
if (!op || op[1] == ')') return [off, lhs];
else if (op[1] == 'x' || !op[1]) {
te('bop', str + " - " + ( op[1] && op[1] ));
}
// tail recursion to fetch the rhs expression
var rhs = exprParse2(str, op[0]);
off = rhs[0];
rhs = rhs[1];
// and now precedence! how shall we put everything together?
var v;
if (typeof rhs !== 'object' || rhs[0] === '(' || operators[op[1]][0] < operators[rhs[1]][0] ) {
v = [lhs, op[1], rhs];
}
else {
v = rhs;
while (typeof rhs[0] === 'object' && rhs[0][0] != '(' && operators[op[1]][0] >= operators[rhs[0][1]][0]) {
rhs = rhs[0];
}
rhs[0] = [lhs, op[1], rhs[0]];
}
return [off, v];
}
function exprParse(str, off) {
function deparen(v) {
if (typeof v !== 'object' || v === null) return v;
else if (v[0] === '(') return deparen(v[1]);
else return [deparen(v[0]), v[1], deparen(v[2])];
}
var e = exprParse2(str, off ? off : 0);
return [e[0], deparen(e[1])];
}
function exprEval(expr, x) {
if (expr === undefined) return x;
else if (expr === null || typeof expr !== 'object') {
return expr;
}
var lhs = exprEval(expr[0], x),
rhs = exprEval(expr[2], x);
return operators[expr[1]][1](lhs, rhs);
}
// THE PARSER
function parse(str, off, nested, hints) {
if (!nested) hints = {};
var a = [], am, readParen;
if (!off) off = 0;
while (true) {
var s = parse_selector(str, off, hints);
a.push(s[1]);
s = lex(str, off = s[0]);
if (s && s[1] === " ") s = lex(str, off = s[0]);
if (!s) break;
// now we've parsed a selector, and have something else...
if (s[1] === ">" || s[1] === "~") {
if (s[1] === "~") hints.usesSiblingOp = true;
a.push(s[1]);
off = s[0];
} else if (s[1] === ",") {
if (am === undefined) am = [ ",", a ];
else am.push(a);
a = [];
off = s[0];
} else if (s[1] === ")") {
if (!nested) te("ucp", s[1]);
readParen = 1;
off = s[0];
break;
}
}
if (nested && !readParen) te("mcp", str);
if (am) am.push(a);
var rv;
if (!nested && hints.usesSiblingOp) {
rv = normalize(am ? am : a);
} else {
rv = am ? am : a;
}
return [off, rv];
}
function normalizeOne(sel) {
var sels = [], s;
for (var i = 0; i < sel.length; i++) {
if (sel[i] === '~') {
// `A ~ B` maps to `:has(:root > A) > B`
// `Z A ~ B` maps to `Z :has(:root > A) > B, Z:has(:root > A) > B`
// This first clause, takes care of the first case, and the first half of the latter case.
if (i < 2 || sel[i-2] != '>') {
s = sel.slice(0,i-1);
s = s.concat([{has:[[{pc: ":root"}, ">", sel[i-1]]]}, ">"]);
s = s.concat(sel.slice(i+1));
sels.push(s);
}
// here we take care of the second half of above:
// (`Z A ~ B` maps to `Z :has(:root > A) > B, Z :has(:root > A) > B`)
// and a new case:
// Z > A ~ B maps to Z:has(:root > A) > B
if (i > 1) {
var at = sel[i-2] === '>' ? i-3 : i-2;
s = sel.slice(0,at);
var z = {};
for (var k in sel[at]) if (sel[at].hasOwnProperty(k)) z[k] = sel[at][k];
if (!z.has) z.has = [];
z.has.push([{pc: ":root"}, ">", sel[i-1]]);
s = s.concat(z, '>', sel.slice(i+1));
sels.push(s);
}
break;
}
}
if (i == sel.length) return sel;
return sels.length > 1 ? [','].concat(sels) : sels[0];
}
function normalize(sels) {
if (sels[0] === ',') {
var r = [","];
for (var i = i; i < sels.length; i++) {
var s = normalizeOne(s[i]);
r = r.concat(s[0] === "," ? s.slice(1) : s);
}
return r;
} else {
return normalizeOne(sels);
}
}
function parse_selector(str, off, hints) {
var soff = off;
var s = { };
var l = lex(str, off);
// skip space
if (l && l[1] === " ") { soff = off = l[0]; l = lex(str, off); }
if (l && l[1] === toks.typ) {
s.type = l[2];
l = lex(str, (off = l[0]));
} else if (l && l[1] === "*") {
// don't bother representing the universal sel, '*' in the
// parse tree, cause it's the default
l = lex(str, (off = l[0]));
}
// now support either an id or a pc
while (true) {
if (l === undefined) {
break;
} else if (l[1] === toks.ide) {
if (s.id) te("nmi", l[1]);
s.id = l[2];
} else if (l[1] === toks.psc) {
if (s.pc || s.pf) te("mpc", l[1]);
// collapse first-child and last-child into nth-child expressions
if (l[2] === ":first-child") {
s.pf = ":nth-child";
s.a = 0;
s.b = 1;
} else if (l[2] === ":last-child") {
s.pf = ":nth-last-child";
s.a = 0;
s.b = 1;
} else {
s.pc = l[2];
}
} else if (l[1] === toks.psf) {
if (l[2] === ":val" || l[2] === ":contains") {
s.expr = [ undefined, l[2] === ":val" ? "=" : "*=", undefined];
// any amount of whitespace, followed by paren, string, paren
l = lex(str, (off = l[0]));
if (l && l[1] === " ") l = lex(str, off = l[0]);
if (!l || l[1] !== "(") te("pex", str);
l = lex(str, (off = l[0]));
if (l && l[1] === " ") l = lex(str, off = l[0]);
if (!l || l[1] !== toks.str) te("sex", str);
s.expr[2] = l[2];
l = lex(str, (off = l[0]));
if (l && l[1] === " ") l = lex(str, off = l[0]);
if (!l || l[1] !== ")") te("epex", str);
} else if (l[2] === ":has") {
// any amount of whitespace, followed by paren
l = lex(str, (off = l[0]));
if (l && l[1] === " ") l = lex(str, off = l[0]);
if (!l || l[1] !== "(") te("pex", str);
var h = parse(str, l[0], true);
l[0] = h[0];
if (!s.has) s.has = [];
s.has.push(h[1]);
} else if (l[2] === ":expr") {
if (s.expr) te("mexp", str);
var e = exprParse(str, l[0]);
l[0] = e[0];
s.expr = e[1];
} else {
if (s.pc || s.pf ) te("mpc", str);
s.pf = l[2];
var m = nthPat.exec(str.substr(l[0]));
if (!m) te("mepf", str);
if (m[5]) {
s.a = 2;
s.b = (m[5] === "odd") ? 1 : 0;
} else if (m[6]) {
s.a = 0;
s.b = parseInt(m[6], 10);
} else {
s.a = parseInt((m[1] ? m[1] : "+") + (m[2] ? m[2] : "1"),10);
s.b = m[3] ? parseInt(m[3] + m[4],10) : 0;
}
l[0] += m[0].length;
}
} else {
break;
}
l = lex(str, (off = l[0]));
}
// now if we didn't actually parse anything it's an error
if (soff === off) te("se", str);
return [off, s];
}
// THE EVALUATOR
function isArray(o) {
return Array.isArray ? Array.isArray(o) :
toString.call(o) === "[object Array]";
}
function mytypeof(o) {
if (o === null) return "null";
var to = typeof o;
if (to === "object" && isArray(o)) to = "array";
return to;
}
function mn(node, sel, id, num, tot) {
var sels = [];
var cs = (sel[0] === ">") ? sel[1] : sel[0];
var m = true, mod;
if (cs.type) m = m && (cs.type === mytypeof(node));
if (cs.id) m = m && (cs.id === id);
if (m && cs.pf) {
if (cs.pf === ":nth-last-child") num = tot - num;
else num++;
if (cs.a === 0) {
m = cs.b === num;
} else {
mod = ((num - cs.b) % cs.a);
m = (!mod && ((num*cs.a + cs.b) >= 0));
}
}
if (m && cs.has) {
// perhaps we should augment forEach to handle a return value
// that indicates "client cancels traversal"?
var bail = function() { throw 42; };
for (var i = 0; i < cs.has.length; i++) {
try {
forEach(cs.has[i], node, bail);
} catch (e) {
if (e === 42) continue;
}
m = false;
break;
}
}
if (m && cs.expr) {
m = exprEval(cs.expr, node);
}
// should we repeat this selector for descendants?
if (sel[0] !== ">" && sel[0].pc !== ":root") sels.push(sel);
if (m) {
// is there a fragment that we should pass down?
if (sel[0] === ">") { if (sel.length > 2) { m = false; sels.push(sel.slice(2)); } }
else if (sel.length > 1) { m = false; sels.push(sel.slice(1)); }
}
return [m, sels];
}
function forEach(sel, obj, fun, id, num, tot) {
var a = (sel[0] === ",") ? sel.slice(1) : [sel],
a0 = [],
call = false,
i = 0, j = 0, k, x;
for (i = 0; i < a.length; i++) {
x = mn(obj, a[i], id, num, tot);
if (x[0]) {
call = true;
}
for (j = 0; j < x[1].length; j++) {
a0.push(x[1][j]);
}
}
if (a0.length && typeof obj === "object") {
if (a0.length >= 1) {
a0.unshift(",");
}
if (isArray(obj)) {
for (i = 0; i < obj.length; i++) {
forEach(a0, obj[i], fun, undefined, i, obj.length);
}
} else {
for (k in obj) {
if (obj.hasOwnProperty(k)) {
forEach(a0, obj[k], fun, k);
}
}
}
}
if (call && fun) {
fun(obj);
}
}
function match(sel, obj) {
var a = [];
forEach(sel, obj, function(x) {
a.push(x);
});
if (a.length === 1) {
return a[0]
}
return a;
}
function compile(sel) {
return {
sel: parse(sel)[1],
match: function(obj){
return match(this.sel, obj);
},
forEach: function(obj, fun) {
return forEach(this.sel, obj, fun);
}
};
}
exports._lex = lex;
exports._parse = parse;
exports.match = function (sel, obj) {
return compile(sel).match(obj);
};
exports.forEach = function(sel, obj, fun) {
return compile(sel).forEach(obj, fun);
};
exports.compile = compile;
})(typeof exports === "undefined" ? (window.JSONSelect = {}) : exports);
|
const Base = require('../base')
class Add extends Base {
/**
* 添加歌曲到歌单
* @param {number} playlistId 歌单 ID
* @param {string|number|Array<number>} songIds 音乐 ID
*/
async addSongs (playlistId, songIds) {
if (typeof songIds === 'string' || typeof songIds === 'number') {
// 如果是 string or Number
songIds = [parseInt(songIds)]
}
const requestData = {
csrf_token: '',
op: 'add',
pid: playlistId,
tracks: songIds.toString(),
trackIds: JSON.stringify(songIds)
}
return this.requestWithSetCookie(
'music.163.com',
'/weapi/playlist/manipulate/tracks',
'POST',
requestData
)
}
/**
* 删除歌单内的歌曲
* @param {number} playlistId 歌单 ID
* @param {string|number|Array<number>} songIds 音乐 ID
*/
async deleteSongs (playlistId, songIds) {
if (typeof songIds === 'string' || typeof songIds === 'number') {
// 如果是 string or Number
songIds = [parseInt(songIds)]
}
const requestData = {
csrf_token: '',
op: 'del',
pid: playlistId,
tracks: songIds.toString(),
trackIds: JSON.stringify(songIds)
}
return this.requestWithSetCookie(
'music.163.com',
'/weapi/playlist/manipulate/tracks',
'POST',
requestData
)
}
}
module.exports = Add
|
'use strict'
class ParserInterface {
constructor () {
if (new.target === ParserInterface) {
throw new Error('ParserInterface cannot be directly constructed')
}
}
parse () {
throw new Error('Unimplemented method')
}
}
module.exports = ParserInterface
|
/* eslint-disable max-len */
import React, { Component, Fragment } from 'react';
import { Link } from 'react-router-dom';
import { connect } from 'react-redux';
import { withRouter } from 'react-router-dom';
import Preloader from '@components/shared/Preloader/Preloader';
import { authPropTypes } from '@helpers/proptypes';
import RenderInput from '@components/shared/FormComponent/RenderInput';
import classNames from 'classnames';
import { validation, syncValidate, validateRequiredFormFields } from '@helpers/validations';
import { auth } from '@actions/auth';
import './Form.scss';
class SignupForm extends Component {
constructor(props) {
super(props);
this.state = {
firstname: '',
lastname: '',
email: '',
password: '',
passwordConfirm: '',
errors: {},
formErrors: {},
formValid: false,
};
// this.isValid = this.isValid.bind(this);
}
componentWillReceiveProps(nextProps) {
if (nextProps.errors) {
this.setState({ errors: nextProps.errors });
}
}
handleChange(e) {
e.preventDefault();
const { firstname, lastname, email, password, passwordConfirm } = this.state;
const { name, value } = e.target;
const values = {
firstname,
lastname,
email,
password,
passwordConfirm
};
const errors = syncValidate(values, validation.signup);
const isValid = validateRequiredFormFields(errors);
this.setState({
[name]: value,
formErrors: errors,
formValid: isValid
});
}
handleFocus() {
this.setState({
errors: Object.assign({}, this.state.errors, { [event.target.name]: '' })
});
}
handleSubmit(event) {
event.preventDefault();
const { firstname, lastname, email, password, passwordConfirm } = this.state;
const userDetails = {
firstname,
lastname,
email,
password,
passwordConfirm
};
this.props.auth('signup', userDetails, this.props.history);
}
render() {
const { isLoading } = this.props;
const { formErrors, errors, formValid } = this.state;
return (
<Fragment>
{ typeof errors === 'string' ?
<div className="alert-form">
<p>{errors}</p>
</div> : ''
}
<form role="signup" className="auth_form" method="POST" onSubmit={this.handleSubmit.bind(this)} noValidate>
<div className="d-flex-lg">
<RenderInput
name="firstname"
label="First name"
id="firstname"
type="text"
className={classNames('w-full py-4 border-purple-600 border-b-2', { 'error': formErrors.firstname })}
placeholder="First name"
value={this.state.firstname}
handleChange={this.handleChange.bind(this)}
onFocus={this.handleFocus.bind(this)}
error={formErrors.firstname}
/>
<RenderInput
name="lastname"
label="Last name"
id="lastname"
type="text"
className={classNames('w-full py-4 border-purple-600 border-b-2', { 'error': formErrors.lastname })}
placeholder="First name"
value={this.state.lastname}
handleChange={this.handleChange.bind(this)}
onFocus={this.handleFocus.bind(this)}
error={formErrors.lastname}
/>
</div>
<div className="d-flex-col">
<RenderInput
name="email"
label="Email Address"
id="email"
type="email"
className={classNames('w-full py-4 border-purple-600 border-b-2', { 'error': formErrors.email })}
placeholder="Email Address"
value={this.state.email}
handleChange={this.handleChange.bind(this)}
onFocus={this.handleFocus.bind(this)}
error={formErrors.email}
/>
</div>
<div className="d-flex-col">
<RenderInput
name="password"
label="Password"
id="password"
type="password"
className={classNames('w-full py-4 border-purple-600 border-b-2', { 'error': formErrors.password })}
placeholder="***********"
value={this.state.password}
handleChange={this.handleChange.bind(this)}
onFocus={this.handleFocus.bind(this)}
error={formErrors.password}
/>
</div>
<div className="d-flex-col">
<RenderInput
name="passwordConfirm"
label="Confirm Password"
id="passwordConfirm"
type="password"
className={classNames('w-full py-4 border-purple-600 border-b-2', { 'error': formErrors.passwordConfirm })}
placeholder="***********"
value={this.state.passwordConfirm}
handleChange={this.handleChange.bind(this)}
onFocus={this.handleFocus.bind(this)}
error={formErrors.passwordConfirm}
/>
</div>
<button className={classNames('w-1/4 p-4 border rounded-lg my-4 hover:text-white border-purple-600 hover:bg-purple-600', { 'bg-purple-600': isLoading })} disabled={isLoading || !formValid} type="submit">
{isLoading === true ?
<Preloader
type="button"
style="TailSpin"
height={15}
width={15}
color="white"
/>
: 'Sign Up'}
</button>
</form>
<div className="addon_info">
<p>By clicking the “Sign Up” button, you have agreed to our
<Link to="#" className="text-purple-600"> Privacy Policy</Link>,
<Link to="#" className="text-purple-600"> Terms and Conditions</Link> and you are a Nigerian
</p>
<p>Already have an account, <Link to="/auth/login" className="text-purple-600"> Login</Link></p>
</div>
</Fragment>
);
}
}
SignupForm.propTypes = {
...authPropTypes
};
SignupForm.defaultProps = {
loading: false,
working: false
};
const mapStateToProps = state => ({
errors: state.auth.errors,
isLoading: state.auth.loading,
user: state.auth.user,
isAuthenticated: state.auth.isAuthenticated
});
export default connect(mapStateToProps, { auth })(withRouter(SignupForm));
|
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.widget.FloatingPane");
dojo.provide("dojo.widget.html.FloatingPane");
//
// this widget provides a window-like floating pane
//
dojo.require("dojo.widget.*");
dojo.require("dojo.widget.Manager");
dojo.require("dojo.html");
dojo.require("dojo.html.shadow");
dojo.require("dojo.style");
dojo.require("dojo.dom");
dojo.require("dojo.html.layout");
dojo.require("dojo.widget.ContentPane");
dojo.require("dojo.dnd.HtmlDragMove");
dojo.require("dojo.dnd.HtmlDragMoveSource");
dojo.require("dojo.dnd.HtmlDragMoveObject");
dojo.require("dojo.widget.ResizeHandle");
dojo.widget.html.FloatingPane = function(){
dojo.widget.html.ContentPane.call(this);
}
dojo.inherits(dojo.widget.html.FloatingPane, dojo.widget.html.ContentPane);
dojo.lang.extend(dojo.widget.html.FloatingPane, {
widgetType: "FloatingPane",
// Constructor arguments
title: '',
iconSrc: '',
hasShadow: false,
constrainToContainer: false,
taskBarId: "",
resizable: true,
titleBarDisplay: "fancy",
windowState: "normal",
displayCloseAction: false,
displayMinimizeAction: false,
displayMaximizeAction: false,
maxTaskBarConnectAttempts: 5,
taskBarConnectAttempts: 0,
templatePath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.html"),
templateCssPath: dojo.uri.dojoUri("src/widget/templates/HtmlFloatingPane.css"),
drag: null,
fillInTemplate: function(args, frag){
// Copy style info from input node to output node
var source = this.getFragNodeRef(frag);
dojo.html.copyStyle(this.domNode, source);
// necessary for safari, khtml (for computing width/height)
document.body.appendChild(this.domNode);
// if display:none then state=minimized, otherwise state=normal
if(!this.isShowing()){
this.windowState="minimized";
}
// <img src=""> can hang IE! better get rid of it
if(this.iconSrc==""){
dojo.dom.removeNode(this.titleBarIcon);
}else{
this.titleBarIcon.src = this.iconSrc.toString();// dojo.uri.Uri obj req. toString()
}
if(this.titleBarDisplay!="none"){
this.titleBar.style.display="";
dojo.html.disableSelection(this.titleBar);
this.titleBarIcon.style.display = (this.iconSrc=="" ? "none" : "");
this.minimizeAction.style.display = (this.displayMinimizeAction ? "" : "none");
this.maximizeAction.style.display=
(this.displayMaximizeAction && this.windowState!="maximized" ? "" : "none");
this.restoreAction.style.display=
(this.displayMaximizeAction && this.windowState=="maximized" ? "" : "none");
this.closeAction.style.display= (this.displayCloseAction ? "" : "none");
this.drag = new dojo.dnd.HtmlDragMoveSource(this.domNode);
if (this.constrainToContainer) {
this.drag.constrainTo();
}
this.drag.setDragHandle(this.titleBar);
var self = this;
dojo.event.topic.subscribe("dragMove",
function (info){
if (info.source.domNode == self.domNode){
dojo.event.topic.publish('floatingPaneMove', { source: self } );
}
}
);
}
if(this.resizable){
this.resizeBar.style.display="";
var rh = dojo.widget.createWidget("ResizeHandle", {targetElmId: this.widgetId, id:this.widgetId+"_resize"});
this.resizeBar.appendChild(rh.domNode);
}
// add a drop shadow
if(this.hasShadow){
this.shadow=new dojo.html.shadow(this.domNode);
}
// Prevent IE bleed-through problem
this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
if( this.taskBarId ){
this.taskBarSetup();
}
if (dojo.hostenv.post_load_) {
this.setInitialWindowState();
} else {
dojo.addOnLoad(this, "setInitialWindowState");
}
// counteract body.appendChild above
document.body.removeChild(this.domNode);
dojo.widget.html.FloatingPane.superclass.fillInTemplate.call(this, args, frag);
},
postCreate: function(){
if(this.isShowing()){
this.width=-1; // force resize
this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
}
},
maximizeWindow: function(evt) {
this.previous={
width: dojo.style.getOuterWidth(this.domNode) || this.width,
height: dojo.style.getOuterHeight(this.domNode) || this.height,
left: this.domNode.style.left,
top: this.domNode.style.top,
bottom: this.domNode.style.bottom,
right: this.domNode.style.right
};
this.domNode.style.left =
dojo.style.getPixelValue(this.domNode.parentNode, "padding-left", true) + "px";
this.domNode.style.top =
dojo.style.getPixelValue(this.domNode.parentNode, "padding-top", true) + "px";
if ((this.domNode.parentNode.nodeName.toLowerCase() == 'body')) {
this.resizeTo(
dojo.html.getViewportWidth()-dojo.style.getPaddingWidth(document.body),
dojo.html.getViewportHeight()-dojo.style.getPaddingHeight(document.body)
);
} else {
this.resizeTo(
dojo.style.getContentWidth(this.domNode.parentNode),
dojo.style.getContentHeight(this.domNode.parentNode)
);
}
this.maximizeAction.style.display="none";
this.restoreAction.style.display="";
this.windowState="maximized";
},
minimizeWindow: function(evt) {
this.hide();
this.windowState = "minimized";
},
restoreWindow: function(evt) {
if (this.windowState=="minimized") {
this.show()
} else {
for(var attr in this.previous){
this.domNode.style[attr] = this.previous[attr];
}
this.resizeTo(this.previous.width, this.previous.height);
this.previous=null;
this.restoreAction.style.display="none";
this.maximizeAction.style.display=this.displayMaximizeAction ? "" : "none";
}
this.windowState="normal";
},
closeWindow: function(evt) {
dojo.dom.removeNode(this.domNode);
this.destroy();
},
onMouseDown: function(evt) {
this.bringToTop();
},
bringToTop: function() {
var floatingPanes= dojo.widget.manager.getWidgetsByType(this.widgetType);
var windows = [];
for (var x=0; x<floatingPanes.length; x++) {
if (this.widgetId != floatingPanes[x].widgetId) {
windows.push(floatingPanes[x]);
}
}
windows.sort(function(a,b) {
return a.domNode.style.zIndex - b.domNode.style.zIndex;
});
windows.push(this);
var floatingPaneStartingZ = 100;
for (x=0; x<windows.length;x++) {
windows[x].domNode.style.zIndex = floatingPaneStartingZ + x;
}
},
setInitialWindowState: function() {
if (this.windowState == "maximized") {
this.maximizeWindow();
this.show();
return;
}
if (this.windowState=="normal") {
this.show();
return;
}
if (this.windowState=="minimized") {
this.hide();
return;
}
this.windowState="minimized";
},
// add icon to task bar, connected to me
taskBarSetup: function() {
var taskbar = dojo.widget.getWidgetById(this.taskBarId);
if (!taskbar){
if (this.taskBarConnectAttempts < this.maxTaskBarConnectAttempts) {
dojo.lang.setTimeout(this, this.taskBarSetup, 50);
this.taskBarConnectAttempts++;
} else {
dojo.debug("Unable to connect to the taskBar");
}
return;
}
taskbar.addChild(this);
},
show: function(){
dojo.widget.html.FloatingPane.superclass.show.apply(this, arguments);
this.bringToTop();
},
onShow: function(){
dojo.widget.html.FloatingPane.superclass.onShow.call(this);
this.resizeTo(dojo.style.getOuterWidth(this.domNode), dojo.style.getOuterHeight(this.domNode));
},
// This is called when the user adjusts the size of the floating pane
resizeTo: function(w, h){
dojo.style.setOuterWidth(this.domNode, w);
dojo.style.setOuterHeight(this.domNode, h);
dojo.html.layout(this.domNode,
[
{domNode: this.titleBar, layoutAlign: "top"},
{domNode: this.resizeBar, layoutAlign: "bottom"},
{domNode: this.containerNode, layoutAlign: "client"}
] );
// If any of the children have layoutAlign specified, obey it
dojo.html.layout(this.containerNode, this.children, "top-bottom");
this.bgIframe.onResized();
if(this.shadow){ this.shadow.size(w, h); }
this.onResized();
},
checkSize: function() {
// checkSize() is called when the user has resized the browser window,
// but that doesn't affect this widget (or this widget's children)
// so it can be safely ignored...
// TODO: unless we are maximized. then we should resize ourself.
}
});
dojo.widget.tags.addParseTreeHandler("dojo:FloatingPane");
|
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// create a schema for live data from Device
var deviceStatusSchema = new Schema({
sensor_name: String,
sensor_id: String,
IsActive: Boolean,
created_at: Date,
updated_at: Date
});
// on every save, add the date
deviceStatusSchema.pre('save', function(next) {
var currentDate = new Date();
this.updated_at = currentDate;
if (!this.created_at)
this.created_at = currentDate;
next();
});
var deviceStatus = mongoose.model('deviceStatus', deviceStatusSchema);
module.exports = deviceStatus;
|
jQuery.sap.registerPreloadedModules({
"version":"2.0",
"modules":{
"library/d/some.js":function(){/*!
* ${copyright}
*/
console.log("HelloWorld");
}
}});
|
// Bootstrap & Popper.js
try {
window.Popper = require('popper.js').default;
window.$ = window.jQuery = require('jquery');
require('bootstrap');
} catch (e) {}
// Lbc
import LazyLoad from "vanilla-lazyload";
import Prism from 'prismjs'
require('prismjs/components/prism-haxe')
let codes = document.querySelectorAll('.prism-code')
codes.forEach((code) => {
code.innerHTML = Prism.highlight(code.innerText, Prism.languages.haxe, 'haxe');
})
let lazyLoadInstance = new LazyLoad({
elements_selector: '[data-lazy="true"]'
})
// Lbc components
require('./components/stripe-nav')
// Lbc theme liara
require('../../themes/liara/assets/js/app')
|
OC.L10N.register(
"core",
{
"Please select a file." : "請選擇檔案",
"File is too big" : "檔案太大",
"Invalid image" : "無效的圖檔",
"Preparing update" : "更新準備中",
"Sunday" : "星期日",
"Monday" : "星期一",
"Tuesday" : "星期二",
"Wednesday" : "星期三",
"Thursday" : "星期四",
"Friday" : "星期五",
"Saturday" : "星期六",
"Sun." : "星期日",
"Mon." : "星期一",
"Tue." : "星期二",
"Wed." : "星期三",
"Thu." : "星期四",
"Fri." : "星期五",
"Sat." : "星期六",
"Su" : "日",
"Mo" : "一",
"Tu" : "二",
"We" : "三",
"Th" : "四",
"Fr" : "五",
"Sa" : "六",
"January" : "一月",
"February" : "二月",
"March" : "三月",
"April" : "四月",
"May" : "五月",
"June" : "六月",
"July" : "七月",
"August" : "八月",
"September" : "九月",
"October" : "十月",
"November" : "十一月",
"December" : "十二月",
"Settings" : "設定",
"Saving..." : "儲存中...",
"seconds ago" : "秒前",
"No" : "否",
"Yes" : "是",
"Choose" : "選擇",
"Ok" : "確認",
"read-only" : "唯讀",
"New Files" : "新檔案",
"Cancel" : "取消",
"Continue" : "繼續",
"Shared" : "已分享",
"Error" : "錯誤",
"Error while sharing" : "分享時發生錯誤",
"Error while unsharing" : "取消分享時發生錯誤",
"Edit" : "編輯",
"Remove" : "刪除",
"Name" : "名稱",
"Password" : "密碼",
"Share" : "分享",
"Save" : "儲存",
"Shared with you and the group {group} by {owner}" : "{owner}與你及群組的分享",
"Shared with you by {owner}" : "{owner}與你的分享",
"group" : "組別",
"notify by email" : "以電郵提示",
"Unshare" : "取消分享",
"can share" : "可分享",
"can edit" : "可編輯",
"create" : "新增",
"delete" : "刪除",
"Group" : "群組",
"Delete" : "刪除",
"Rename" : "重新命名",
"Add" : "加入",
"Please reload the page." : "請重新載入此頁",
"The update was successful. Redirecting you to ownCloud now." : "更新成功",
"Personal" : "個人",
"Users" : "用戶",
"Apps" : "應用程式",
"Admin" : "管理",
"Help" : "幫助",
"Message: %s" : "訊息: %s",
"File: %s" : "檔案: %s",
"Imprint" : "版本說明",
"Create an <strong>admin account</strong>" : "建立管理員帳戶",
"Username" : "用戶名稱",
"Storage & database" : "儲存及數據庫",
"Data folder" : "資料文件夾",
"Configure the database" : "設定資料庫",
"Database user" : "資料庫帳戶",
"Database password" : "資料庫密碼",
"Database name" : "資料庫名稱",
"Finish setup" : "完成設定",
"Need help?" : "需要協助?",
"See the documentation" : "參閱說明文檔",
"Log out" : "登出",
"Search" : "尋找",
"Please contact your administrator." : "請聯絡您的管理員",
"An internal error occurred." : "產生內部錯誤",
"Please try again or contact your administrator." : "請重試或聯絡您的管理員",
"Login" : "登入",
"Username or email" : "用戶名或電郵地址",
"Wrong password. Reset it?" : "密碼錯誤. 需要重設密碼?",
"Wrong password." : "密碼錯誤",
"Stay logged in" : "保持登入",
"Alternative Logins" : "其他登入",
"Use the following link to reset your password: {link}" : "請用以下連結重設你的密碼: {link}",
"New password" : "新密碼",
"New Password" : "新密碼",
"Reset password" : "重設密碼",
"Thank you for your patience." : "感謝您的耐心等待.",
"Two-step verification" : "雙重驗証",
"Cancel login" : "取消登入"
},
"nplurals=1; plural=0;");
|
import React, { Component } from 'react';
import { withRouter } from 'react-router-dom';
import { COLORS } from '../../constants';
import Anchor from "../anchor/Anchor";
const Article = ({children}) =>
<div>{children}</div>;
const articleTitleStyle = {
display: 'flex',
alignItems: 'center',
color: COLORS.TITLE,
fontSize: '1.25em',
fontWeight: 400,
lineHeight: '32px',
marginBottom: 20,
width: '100%',
};
class _ArticleTitle extends Component {
constructor(props) {
super(props);
this.state = {isHovered: false};
}
render() {
return (
<h1 style={articleTitleStyle}
id={this.props.id}
onMouseEnter={() => this.setState({isHovered: true})}
onMouseLeave={() => this.setState({isHovered: false})}
>
{this.props.children}
<Anchor show={this.state.isHovered} link={`${this.props.location.pathname}${this.props.location.hash}`}/>
</h1>
);
}
}
const ArticleTitle = withRouter(_ArticleTitle);
const articleContentStyle = {
margin: '40px 0',
fontSize: '0.8em',
};
const ArticleContent = ({children, ...props}) =>
<div style={{...articleContentStyle, ...props.style}}>{children}</div>;
export {
Article,
ArticleTitle,
ArticleContent,
};
|
/**
* Copyright 2019 The AMPHTML Authors
*
* 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 path = require('path');
const express = require('express');
// eslint-disable-next-line new-cap
const playground = express.Router();
playground.use(
'/boilerplate',
express.static(path.join(__dirname, '../dist'), {extensions: ['html']})
);
module.exports = playground;
|
/**
* Function to load the current version from json file
*/
function loadVersion() {
$.ajax({
datatype: "json",
url: 'version.json',
contentType: 'application/json',
beforeSend: function (xhr) {
if (xhr.overrideMimeType) {
xhr.overrideMimeType("application/json");
}
},
success: function (json) {
var version = "v" + json.major + "." + json.minor + "." + json.patch;
console.log("Version", version);
$('#version').text(version);
}
});
}
function goToLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var txt = "" + position.coords.longitude + "," + position.coords.latitude + "";
var view = map.getView();
view.setCenter(ol.proj.fromLonLat(txt.split(',').map(Number)));
view.setZoom(12);
});
}
}
|
import React, {Component} from 'react';
import {render} from 'react-dom';
import {SortableContainer, SortableElement, arrayMove} from 'react-sortable-hoc';
import {List} from 'react-virtualized';
const SortableItem = SortableElement(({value}) => {
return (
<li>
{value}
</li>
);
});
class VirtualList extends Component {
render() {
const {items} = this.props;
return (
<List
ref={(instance) => {
this.List = instance;
}}
rowHeight={({index}) => items[index].height}
rowRenderer={({index}) => {
const {value} = items[index];
return <SortableItem index={index} value={value} />;
}}
rowCount={items.length}
width={400}
height={600}
/>
);
}
}
/*
* Important note:
* To access the ref of a component that has been wrapped with the SortableContainer HOC,
* you *must* pass in {withRef: true} as the second param. Refs are opt-in.
*/
const SortableList = SortableContainer(VirtualList, {withRef: true});
class SortableComponent extends Component {
state = {
items: [
{value: 'Item 1', height: 89},
{value: 'Item 2', height: 59},
{value: 'Item 3', height: 130},
{value: 'Item 4', height: 59},
{value: 'Item 5', height: 200},
{value: 'Item 6', height: 150},
],
};
onSortEnd = ({oldIndex, newIndex}) => {
if (oldIndex !== newIndex) {
const {items} = this.state;
this.setState({
items: arrayMove(items, oldIndex, newIndex),
});
// We need to inform React Virtualized that the items have changed heights
const instance = this.SortableList.getWrappedInstance();
instance.List.recomputeRowHeights();
instance.forceUpdate();
}
};
render() {
const {items} = this.state;
return (
<SortableList
ref={(instance) => {
this.SortableList = instance;
}}
items={items}
onSortEnd={this.onSortEnd}
/>
);
}
}
render(<SortableComponent />, document.getElementById('root'));
|
import PropTypes from 'prop-types'
import React, {Component} from 'react'
import NextSeo from 'next-seo'
import groq from 'groq'
import imageUrlBuilder from '@sanity/image-url'
import Layout from '../components/Layout'
import client from '../client'
import RenderSections from '../components/RenderSections'
const builder = imageUrlBuilder(client)
const pageQuery = groq`
*[_type == "route" && slug.current == $slug][0]{
page-> {
...,
content[] {
...,
cta {
...,
route->
},
ctas[] {
...,
route->
}
}
}
}
`
class LandingPage extends Component {
static propTypes = {
title: PropTypes.string,
description: PropTypes.string,
// TODO: improve types
disallowRobots: PropTypes.any,
openGraphImage: PropTypes.any,
content: PropTypes.any,
config: PropTypes.any,
slug: PropTypes.any
}
static async getInitialProps ({query}) {
const {slug} = query
if (!query) {
console.error('no query')
return
}
if (slug && slug !== '/') {
return client.fetch(pageQuery, {slug}).then(res => ({...res.page, slug}))
}
// Frontpage
if (slug && slug === '/') {
return client
.fetch(
groq`
*[_id == "global-config"][0]{
frontpage -> {
...,
content[] {
...,
cta {
...,
route->
},
ctas[] {
...,
route->
}
}
}
}
`
)
.then(res => ({...res.frontpage, slug}))
}
return null
}
render () {
const {
title = 'Missing title',
description,
disallowRobots,
openGraphImage,
content = [],
config = {},
slug
} = this.props
const openGraphImages = openGraphImage
? [
{
url: builder
.image(openGraphImage)
.width(800)
.height(600)
.url(),
width: 800,
height: 600,
alt: title
},
{
// Facebook recommended size
url: builder
.image(openGraphImage)
.width(1200)
.height(630)
.url(),
width: 1200,
height: 630,
alt: title
},
{
// Square 1:1
url: builder
.image(openGraphImage)
.width(600)
.height(600)
.url(),
width: 600,
height: 600,
alt: title
}
]
: []
return (
<Layout config={config}>
<NextSeo
config={{
title,
titleTemplate: `${config.title} | %s`,
description,
canonical: config.url && `${config.url}/${slug}`,
openGraph: {
images: openGraphImages
},
noindex: disallowRobots
}}
/>
{content && <RenderSections sections={content} />}
</Layout>
)
}
}
export default LandingPage
|
var rutassierraleona = [
{
"origen":"sierra leona",
"ip_origen":"197.157.232.1",
"destino":"www.google.com",
"ip_destino":"216.58.206.68",
"saltos":[
{
"salto":1,
"ip":"197.157.232.1",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":0.649 ,
"time2":0.790 ,
"time3":0.584
},
{
"salto":2,
"ip":"197.157.232.237",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":1.797 ,
"time2":1.653 ,
"time3":1.350
},
{
"salto":3,
"ip":"197.157.232.173",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":143.597 ,
"time2":143.804 ,
"time3":143.801
},
{
"salto":4,
"ip":"197.157.232.169",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":143.825 ,
"time2":144.045 ,
"time3":144.230
},
{
"salto":5,
"ip":"197.157.232.161",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":143.559 ,
"time2":143.602 ,
"time3":142.998
},
{
"salto":6,
"ip":"63.218.243.81",
"tipo":"publica",
"lat":40.7808,
"lng":-73.9772,
"time1":144.116 ,
"time2":144.181 ,
"time3":143.664
},
{
"salto":7,
"ip":"63.223.14.154",
"tipo":"publica",
"lat":38.9841,
"lng":-77.3827,
"time1":144.755 ,
"time2":143.619 ,
"time3":144.328
},
{
"salto":8,
"ip":"72.14.198.60",
"tipo":"publica",
"lat":37.419200000000004,
"lng":-122.0574,
"time1":144.119 ,
"time2":143.358 ,
"time3":144.118
},
{
"salto":9,
"ip":"108.170.246.225",
"tipo":"publica",
"lat":34.0995,
"lng":-118.4143,
"time1":145.171 ,
"time2":144.671 ,
"time3":144.061
},
{
"salto":10,
"ip":"216.239.42.57",
"tipo":"publica",
"lat":34.0544,
"lng":-118.244,
"time1":144.933 ,
"time2":145.412 ,
"time3":144.419
},
{
"salto":11,
"ip":"216.58.206.68",
"tipo":"publica",
"lat":37.419200000000004,
"lng":-122.0574,
"time1":143.897 ,
"time2":144.544 ,
"time3":144.631
}
]
},
{
"origen":"sierra leona",
"ip_origen":"197.157.232.1",
"destino":"www.youtube.com",
"ip_destino":"216.58.206.78",
"saltos":[
{
"salto":1,
"ip":"197.157.232.1",
"tipo":"publica",
"lat": 8.5,
"lng":-11.5,
"time1":0.846 ,
"time2":0.850 ,
"time3":0.584
},
{
"salto":2,
"ip":"197.157.232.237",
"tipo":"publica",
"lat": 8.5,
"lng":-11.5,
"time1":1.651 ,
"time2":2.045 ,
"time3":1.542
},
{
"salto":3,
"ip":"197.157.232.173",
"tipo":"publica",
"lat": 8.5,
"lng":-11.5,
"time1":144.068 ,
"time2":143.715 ,
"time3":144.111
},
{
"salto":4,
"ip":"197.157.232.169",
"tipo":"publica",
"lat": 8.5,
"lng":-11.5,
"time1":144.920 ,
"time2":143.132 ,
"time3":143.584
},
{
"salto":5,
"ip":"197.157.232.161",
"tipo":"publica",
"lat": 8.5,
"lng":-11.5 ,
"time1":144.267 ,
"time2":142.791 ,
"time3":143.086
},
{
"salto":6,
"ip":"63.218.243.81",
"tipo":"publica",
"lat":40.7808,
"lng":-73.9772,
"time1":145.032 ,
"time2":143.536 ,
"time3":143.442
},
{
"salto":7,
"ip":"63.223.14.150",
"tipo":"publica",
"lat":38.9841,
"lng":-77.3827,
"time1":144.675 ,
"time2":143.762 ,
"time3":143.912
},
{
"salto":8,
"ip":"72.14.198.60",
"tipo":"publica",
"lat":37.419200000000004,
"lng":-122.0574,
"time1":144.356 ,
"time2":144.946 ,
"time3":143.649
},
{
"salto":9,
"ip":"108.170.246.225",
"tipo":"publica",
"lat":34.0995,
"lng":-118.4143,
"time1":145.136 ,
"time2":144.198 ,
"time3":144.495
},
{
"salto":10,
"ip":"216.239.42.57",
"tipo":"publica",
"lat": 34.0544,
"lng":-118.244,
"time1":145.048 ,
"time2":144.273 ,
"time3":144.189
},
{
"salto":11,
"ip":"216.58.206.78",
"tipo":"publica",
"lat":37.419200000000004,
"lng":-122.0574,
"time1":144.496 ,
"time2":144.188 ,
"time3":144.758
}
]
},
{
"origen":"sierra leona",
"ip_origen":"197.157.232.1",
"destino":"www.facebook.com",
"ip_destino":"31.13.90.36",
"saltos":[
{
"salto":1,
"ip":"197.157.232.1",
"tipo":"publica",
"lat":8.5,
"lng":-11.5 ,
"time1":0.635 ,
"time2":0.750 ,
"time3":1.046
},
{
"salto":2,
"ip":"197.157.232.237",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":2.036 ,
"time2":1.418 ,
"time3":1.480
},
{
"salto":3,
"ip":"197.157.232.173",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":144.326 ,
"time2":143.356 ,
"time3":143.468
},
{
"salto":4,
"ip":"197.157.232.169",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":144.157 ,
"time2":143.498 ,
"time3":143.872
},
{
"salto":5,
"ip":"197.157.232.161",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":144.522 ,
"time2":143.433,
"time3":142.849
},
{
"salto":6,
"ip":"185.144.221.9",
"tipo":"publica",
"lat":51.5167,
"lng":-1.7833,
"time1":144.448,
"time2":154.178,
"time3":143.133
},
{
"salto":7,
"ip":"195.66.227.19",
"tipo":"publica",
"lat": 51.5142,
"lng":-0.0931,
"time1":149.402,
"time2":145.086,
"time3":146.032
},
{
"salto":8,
"ip":"157.240.33.8",
"tipo":"publica",
"lat":37.459,
"lng":-122.1781,
"time1":143.388 ,
"time2":143.913 ,
"time3":144.537
},
{
"salto":9,
"ip":"157.240.42.155",
"tipo":"publica",
"lat":37.459,
"lng":-122.1781,
"time1":145.127 ,
"time2":144.572 ,
"time3":144.066
},
{
"salto":10,
"ip":"173.252.67.9",
"tipo":"publica",
"lat":37.459,
"lng":-122.1781,
"time1":144.115 ,
"time2":144.911 ,
"time3":145.024
},
{
"salto":11,
"ip":"31.13.90.36",
"tipo":"publica",
"lat":53,
"lng":-8 ,
"time1":143.882 ,
"time2":143.810 ,
"time3":144.105
}
]
},
{
"origen":"sierra leona",
"ip_origen":"197.157.232.1",
"destino":"www.baidu.com",
"ip_destino":"103.235.46.39",
"saltos":[
{
"salto":1,
"ip":"197.157.232.1",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":0.796 ,
"time2":0.826 ,
"time3":0.144
},
{
"salto":2,
"ip":"197.157.232.237",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":2.098 ,
"time2":1.298 ,
"time3":1.250
},
{
"salto":3,
"ip":"197.157.232.169",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":144.391 ,
"time2":143.809 ,
"time3":143.743
},
{
"salto":4,
"ip":"197.157.232.169",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":144.126 ,
"time2":143.163 ,
"time3":143.682
},
{
"salto":5,
"ip":"197.157.232.161",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":144.181 ,
"time2":143.189 ,
"time3":143.623
},
{
"salto":6,
"ip":"195.219.92.73",
"tipo":"publica",
"lat":47,
"lng":8,
"time1":198.206 ,
"time2":143.288 ,
"time3":143.026
},
{
"salto":7,
"ip":"80.231.130.141",
"tipo":"publica",
"lat":47,
"lng":8,
"time1":318.530 ,
"time2":317.936 ,
"time3":317.662
},
{
"salto":8,
"ip":"80.231.154.142",
"tipo":"publica",
"lat":52.3464,
"lng":4.8977,
"time1":319.697 ,
"time2":320.746 ,
"time3":322.294
},
{
"salto":9,
"ip":"80.231.217.5",
"tipo":"publica",
"lat":47,
"lng":8,
"time1":332.357 ,
"time2":311.203 ,
"time3":311.036
},
{
"salto":10,
"ip":"80.231.217.30",
"tipo":"publica",
"lat":47,
"lng":8,
"time1":321.839 ,
"time2":322.436 ,
"time3":315.660
},
{
"salto":11,
"ip":"180.87.38.2",
"tipo":"publica",
"lat":18.5333,
"lng":73.8667,
"time1":314.016 ,
"time2":320.348 ,
"time3":319.368
},
{
"salto":12,
"ip":"180.87.36.6",
"tipo":"publica",
"lat":18.5333,
"lng":73.8667,
"time1":319.585 ,
"time2":319.838 ,
"time3":319.789
},
{
"salto":13,
"ip":"180.87.37.14",
"tipo":"publica",
"lat":18.5333,
"lng":73.8667,
"time1":325.591 ,
"time2":322.260 ,
"time3":316.321
},
{
"salto":14,
"ip":"180.87.96.21",
"tipo":"publica",
"lat":18.5333,
"lng":73.8667,
"time1":319.761 ,
"time2":321.668 ,
"time3":324.937
},
{
"salto":15,
"ip":"120.29.215.238",
"tipo":"publica",
"lat":18.5333,
"lng":73.8667,
"time1":314.855 ,
"time2":310.663 ,
"time3":311.674
},
{
"salto":16,
"ip":"103.235.45.30",
"tipo":"publica",
"lat": 22.2833,
"lng":114.15,
"time1":347.573 ,
"time2":350.568 ,
"time3":346.814
}
]
},
{
"origen":"sierra leona",
"ip_origen":"197.157.232.1",
"destino":"www.wikipedia.com",
"ip_destino":"91.198.174.192",
"saltos":[
{
"salto":1,
"ip":"197.157.232.1",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":0.910 ,
"time2":0.160 ,
"time3":0.137
},
{
"salto":2,
"ip":"197.157.232.237",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":2.561 ,
"time2":0.908 ,
"time3":0.777
},
{
"salto":3,
"ip":"197.157.232.173",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":142.998 ,
"time2":143.196 ,
"time3":142.977
},
{
"salto":4,
"ip":"197.157.232.169",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":143.174 ,
"time2":142.851 ,
"time3":143.222
},
{
"salto":5,
"ip":"197.157.232.161",
"tipo":"publica",
"lat":8.5,
"lng":-11.5,
"time1":143.222 ,
"time2":143.005 ,
"time3":143.141
},
{
"salto":6,
"ip":"63.218.243.81",
"tipo":"publica",
"lat":40.7808,
"lng":-73.9772,
"time1":143.712 ,
"time2":143.565 ,
"time3":143.621
},
{
"salto":7,
"ip":"63.223.51.82",
"tipo":"publica",
"lat": 38.9841,
"lng":-77.3827,
"time1":149.792 ,
"time2":150.122 ,
"time3":149.933
},
{
"salto":8,
"ip":"63.223.51.106",
"tipo":"publica",
"lat": 38.9841,
"lng":-77.3827,
"time1":149.342 ,
"time2":149.415 ,
"time3":149.215
}
]
}
]
|
import './styles.scss'
import { Link } from 'react-router-dom'
import { FaFacebook, FaLinkedin, FaTwitter } from 'react-icons/fa'
const Footer = (props) => {
return (
<footer className="footer">
<div className="wrap-footer1">
<h4 style={{ fontWeight: '400' }}>
© Acrotech {new Date().getFullYear()}
</h4>
<a>
<FaLinkedin fontSize="20" color="#0e76a8" />
<span>LinkedIn</span>
</a>
<a>
<FaFacebook fontSize="20" color="#3b5998" />
<span>Facebook</span>
</a>
<a>
<FaTwitter fontSize="20" color="#00acee" />
<span> Twitter</span>
</a>
</div>
<div className="wrap-footer2">
<h4> Contact Us </h4>
<span>Email:</span>
<a href="mailto:acrotech@gmail.com" target="_blank">
acrotech@gmail.com
</a>
<h5>Our Developer:</h5>
<span>LinkedIn:</span>
<a
href="https://www.linkedin.com/in/darwin-camahalan-8395201b5/"
target="_blank"
>
Darwin Camahalan
</a>
<span>GitHub:</span>
<a href="https://github.com/DarwinCamahalan" target="_blank">
Darwin Camahalan
</a>
<span>Facebook:</span>
<a href="https://www.facebook.com/darpax101/" target="_blank">
Darwin
</a>
<span>Phone number:</span>
<a>+639754270609</a>
</div>
<div className="wrap-footer3">
<h4> All Links</h4>
<Link to="/">Homepage</Link>
<Link to="/cart">Cart</Link>
<Link to="/payment">Payment</Link>
<Link to="/dashboard">Order History</Link>
<Link to="/login">Login</Link>
<Link to="/registration">Sign Up</Link>
<Link to="/recovery">Recovery</Link>
</div>
<div className="wrap-footer4">
<h4>Sponsors</h4>
<p>Student Project</p>
<p>
University of Science and <br />
Technology
</p>
<p>
Software Design & <br />
Engineering Students
</p>
</div>
</footer>
)
}
export default Footer
|
'use strict';
import {Comment} from './comment';
import {Param} from './param';
export function PostData(opts = {}) {
// internal properties
Object.defineProperties(this, {
_params: {
enumerable: false,
configurable: false,
writable: true,
value: []
}
});
Comment.call(this, opts.comment);
Object.defineProperty(this, 'mimeType', {
enumerable: true,
writable: true,
value: opts.mimeType || 'application/octet-stream'
});
Object.defineProperty(this, 'text', {
enumerable: true,
writable: true,
value: opts.text || ''
});
Object.defineProperty(this, 'params', {
enumerable: true,
get: function() {
return this._params;
},
set: function(params) {
this._params = [];
params.forEach(this.addParam, this);
}
});
if (opts.params) {
opts.params.forEach(this.addParam, this);
}
}
PostData.prototype.addParam = function(param) {
this._params.push(new Param(param));
return this;
};
/**
* Override toJSON behaviour so it will eliminate
* all _* properies and replace it with a proper ones.
*/
PostData.prototype.toJSON = function() {
var copy = Object.assign({}, this);
var keys = Object.keys(copy);
var under = keys.filter((key) => key.indexOf('_') === 0);
under.forEach((key) => {
let realKey = key.substr(1);
copy[realKey] = copy[key];
delete copy[key];
});
return copy;
};
|
import { fromJS } from 'immutable';
import { ENTITIES_LOADED } from 'entities/constants';
import { CLUE_UPDATED } from 'entities/Clues/constants';
import { PUZZLE_DELETED } from 'containers/DeletePuzzleModal/constants';
import {
PUZZLE_TITLE_UPDATED,
PUZZLE_NOTES_EDITED,
PUZZLE_SYMMETRY_SET,
} from './constants';
const initialState = fromJS({});
export default function(state = initialState, action) {
switch (action.type) {
case PUZZLE_TITLE_UPDATED:
return state.setIn([action.id, 'title'], action.title);
case PUZZLE_NOTES_EDITED:
return state.setIn([action.id, 'notes'], action.notes);
case PUZZLE_SYMMETRY_SET:
return state.setIn([action.id, 'symmetry'], action.symmetry);
case CLUE_UPDATED:
return state.setIn(
[
action.puzzleId,
'clues',
action.across ? 'across' : 'down',
action.number,
],
`${action.puzzleId}-${action.number}-${
action.across ? 'Across' : 'Down'
}`,
);
case ENTITIES_LOADED:
return state.merge(action.entities.puzzles);
case PUZZLE_DELETED:
return state.delete(action.id);
default:
return state;
}
}
|
import { createSelector } from '@reduxjs/toolkit';
import { rolesByName, twoFAStates } from '../constants/userConstants';
import { getDemoDeviceAddress as getDemoDeviceAddressHelper } from '../helpers';
const getAppDocsVersion = state => state.app.docsVersion;
const getFeatures = state => state.app.features;
const getRolesById = state => state.users.rolesById;
const getOrganization = state => state.organization.organization;
const getAcceptedDevices = state => state.devices.byStatus.accepted;
const getDeviceLimit = state => state.devices.limit;
const getDevicesList = state => Object.values(state.devices.byId);
const getOnboarding = state => state.onboarding;
const getShowHelptips = state => state.users.showHelptips;
const getGlobalSettings = state => state.users.globalSettings;
export const getCurrentUser = state => state.users.byId[state.users.currentUser] || {};
export const getUserSettings = state => state.users.globalSettings[state.users.currentUser] || {};
export const getHas2FA = createSelector(
[getCurrentUser],
currentUser => currentUser.hasOwnProperty('tfa_status') && currentUser.tfa_status === twoFAStates.enabled
);
export const getDemoDeviceAddress = createSelector([getDevicesList, getOnboarding], (devices, { approach, demoArtifactPort }) => {
return getDemoDeviceAddressHelper(devices, approach, demoArtifactPort);
});
export const getIdAttribute = createSelector([getGlobalSettings], ({ id_attribute = {} }) => id_attribute);
export const getLimitMaxed = createSelector([getAcceptedDevices, getDeviceLimit], ({ total: acceptedDevices = 0 }, deviceLimit) =>
Boolean(deviceLimit && deviceLimit <= acceptedDevices)
);
export const getOnboardingState = createSelector([getOnboarding, getShowHelptips], ({ complete, progress, showTips }, showHelptips) => ({
complete,
progress,
showHelptips,
showTips
}));
export const getDocsVersion = createSelector([getAppDocsVersion, getFeatures], (appDocsVersion, { isHosted }) => {
// if hosted, use latest docs version
const docsVersion = appDocsVersion ? `${appDocsVersion}/` : 'development/';
return isHosted ? '' : docsVersion;
});
export const getIsEnterprise = createSelector(
[getOrganization, getFeatures],
({ plan = 'os' }, { isEnterprise, isHosted }) => isEnterprise || (isHosted && plan === 'enterprise')
);
export const getUserRoles = createSelector(
[getCurrentUser, getRolesById, getIsEnterprise, getFeatures, getOrganization],
(currentUser, rolesById, isEnterprise, { isHosted, hasMultitenancy }, { plan = 'os' }) => {
let isAdmin = !(hasMultitenancy || isEnterprise || (isHosted && plan !== 'os'));
let allowUserManagement = isAdmin;
let isGroupRestricted = false;
let hasWriteAccess = isAdmin;
let canTroubleshoot = isAdmin;
if (currentUser.roles) {
isAdmin = currentUser.roles.some(role => role === rolesByName.admin);
allowUserManagement =
isAdmin ||
currentUser.roles.some(role =>
rolesById[role]?.permissions.some(
permission =>
permission.action === rolesByName.userManagement.action &&
permission.object.value === rolesByName.userManagement.object.value &&
[rolesByName.userManagement.object.type].includes(permission.object.type)
)
);
isGroupRestricted =
!isAdmin &&
currentUser.roles.some(role => rolesById[role]?.permissions.some(permission => permission.object.type === rolesByName.groupAccess.object.type));
hasWriteAccess = isAdmin || currentUser.roles.some(role => role === rolesByName.readOnly);
canTroubleshoot = isAdmin || currentUser.roles.some(role => role === rolesByName.terminalAccess);
}
return { allowUserManagement, canTroubleshoot, hasWriteAccess, isAdmin, isGroupRestricted };
}
);
export const getTenantCapabilities = createSelector(
[getFeatures, getOrganization],
(
{ hasAuditlogs, hasDeviceConfig: isDeviceConfigEnabled, hasDeviceConnect: isDeviceConnectEnabled, hasMonitor: isMonitorEnabled, isHosted },
{ addons = [] }
) => {
const hasDeviceConfig = isDeviceConfigEnabled && (!isHosted || addons.some(addon => addon.name === 'configure' && Boolean(addon.enabled)));
const hasDeviceConnect = isDeviceConnectEnabled && (!isHosted || addons.some(addon => addon.name === 'troubleshoot' && Boolean(addon.enabled)));
const hasMonitor = isMonitorEnabled && (!isHosted || addons.some(addon => addon.name === 'monitor' && Boolean(addon.enabled)));
return { hasAuditlogs, hasDeviceConfig, hasDeviceConnect, hasMonitor };
}
);
|
exports.$ = (id) => document.getElementById(id)
|
import React, { Component } from "react";
import { Button, Icon } from "components";
import Label from "egov-ui-kit/utils/translationNode";
import { SuccessMessage } from "modules/common";
import CommonSuccessMessage from "../../modules/CommonSuccessMessage";
import { connect } from "react-redux";
class AssignToDriverSuccess extends Component {
continueComplaintSubmit = () => {
this.props.history.push(`/egov-services/all-applications`);
};
render() {
let {applicationNumber} = this.props;
return (
<div className="success-message-main-screen resolve-success">
<CommonSuccessMessage
headermessage="BK_ES_APPLICATION_HEADER_MESSAGE_ASSIGNED_DRIVER"
successmessage="BK_ES_ASSIGN_TO_DRIVER_SUCCESS_MESSAGE"
secondaryLabel="BK_MYBK_SUCCESSFULLY_ASSIGNED_DRIVER_SEND_MESSAGE"
containerStyle={{ display: "inline-block" }}
icon={<Icon action="navigation" name="check" />}
backgroundColor={"#22b25f"}
applicationNumber={applicationNumber && applicationNumber}
/>
<div className="responsive-action-button-cont">
<Button
id="resolve-success-continue"
primary={true}
label={<Label buttonLabel={true} label="CORE_COMMON_GOTOHOME" />}
fullWidth={true}
onClick={this.continueComplaintSubmit}
className="responsive-action-button"
/>
</div>
</div>
);
}
}
const mapStateToProps = state => {
const { bookings, common, auth, form } = state;
const { applicationData } = bookings;
let bookingDetails = applicationData ? applicationData.bookingsModelList[0] : '';
//bkApplicationNumber
let applicationNumber = applicationData ? applicationData.bookingsModelList[0].bkApplicationNumber : '';
return {
bookingDetails,
applicationNumber
}
}
const mapDispatchToProps = dispatch => {
return {}
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(AssignToDriverSuccess);
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const React = require("react");
const wrapIcon_1 = require("../utils/wrapIcon");
const rawSvg = (iconProps) => {
const { className, primaryFill } = iconProps;
return React.createElement("svg", { width: 20, height: 20, viewBox: "0 0 20 20", xmlns: "http://www.w3.org/2000/svg", className: className },
React.createElement("path", { d: "M6.86 6.5h2.39a.75.75 0 010 1.5h-4.4A.85.85 0 014 7.15v-4.4a.75.75 0 011.5 0V5.7l3.06-2.66a5.25 5.25 0 016.89 7.92l-8.17 7.1a.75.75 0 11-.99-1.13l8.17-7.1a3.75 3.75 0 10-4.92-5.66L6.86 6.5z", fill: primaryFill }));
};
const ArrowUndo20Filled = wrapIcon_1.default(rawSvg({}), 'ArrowUndo20Filled');
exports.default = ArrowUndo20Filled;
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@syncfusion/ej2-react-base"),require("react"),require("@syncfusion/ej2-progressbar")):"function"==typeof define&&define.amd?define(["exports","@syncfusion/ej2-react-base","react","@syncfusion/ej2-progressbar"],t):t(e.ej={},e.ej2ReactBase,e.React,e.ej2Progressbar)}(this,function(e,t,n,r){"use strict";var o=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.moduleName="progressBarAnnotation",t}(t.ComplexBase),s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyName="annotations",t.moduleName="progressBarAnnotations",t}(t.ComplexBase),a=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),c=function(e){function t(t){var n=e.call(this,t)||this;return n.initRenderCalled=!1,n.checkInjectedModules=!0,n.directivekeys={progressBarAnnotations:"progressBarAnnotation"},n.immediateRender=!1,n}return a(t,e),t.prototype.render=function(){if(!(this.element&&!this.initRenderCalled||this.refreshing))return n.createElement("div",this.getDefaultAttributes(),this.props.children);e.prototype.render.call(this),this.initRenderCalled=!0},t}(r.ProgressBar);t.applyMixins(c,[t.ComponentBase,n.PureComponent]),e.Inject=t.Inject,e.ProgressBarAnnotationDirective=i,e.ProgressBarAnnotationsDirective=s,e.ProgressBarComponent=c,Object.keys(r).forEach(function(t){e[t]=r[t]}),Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=ej2-react-progressbar.umd.min.js.map
|
webpackJsonp([44],{"5wFO":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var l={name:"complexTable",components:{listPage:n("68S3").default}},s={render:function(){var e=this.$createElement;return(this._self._c||e)("listPage")},staticRenderFns:[]},a=n("VU/8")(l,s,!1,null,null,null);t.default=a.exports}});
|
import React, { Component } from 'react';
import momment from "moment";
export default class App extends Component {
render() {
return (
<div className='app'>
<h1>React thingy</h1>
<h2>Dope</h2>
<div>
{momment().format('MMMM Do YYYY, h:mm:ss a')}
</div>
</div>
);
}
}
|
export function l10n(s) {
const language = l10n.locale.substring(0, 2);
let result = '';
// Attempt to find a match for the current locale
if (l10n.strings[l10n.locale]) result = l10n.strings[l10n.locale][s];
// If none is found, attempt to find a match for the language
if (!result && l10n.strings[language]) result = l10n.strings[language][s];
// If none is found, try english
if (!result) result = l10n.strings['en'][s];
// If that didn't work, use the key...
if (!result) result = s;
return result;
}
l10n.plural = function(value, s, options) {
options = options || {};
options.type = options.type || 'cardinal';
const language = l10n.locale.substring(0, 2);
const rules = options.type === 'ordinal' ? l10n.ordinal : l10n.cardinal;
let rule = options.type === 'ordinal' ?
l10n._ordinalPluralCategories.indexOf(rules.select(value)) :
l10n._cardinalPluralCategories.indexOf(rules.select(value));
let result;
if (l10n.strings[l10n.locale]) result = l10n.strings[l10n.locale][s];
if (!result && l10n.strings[language]) result = l10n.strings[language][s];
if (!result) {
result = l10n.strings['en'][s];
if (!result) result = s;
if (options.type === 'ordinal') {
rule = l10n._ordinalPluralCategories.indexOf(l10n._ordinalEnglish.select(value));
} else {
rule = l10n._cardinalPluralCategories.indexOf(l10n._cardinalEnglish.select(value));
}
}
return result.split(';')[rule] || result.split(';')[0]
}
/*
* Two forms for this function:
* - merge(locale, strings)
* Merge a dictionary of keys -> values for the specified locale
* - merge(strings)
* Merge a dictionary of locale code -> dictionary of keys -> values
*
*/
l10n.merge = function(locale, strings) {
if (locale && strings) {
const savedLocale = l10n._locale;
l10n.locale = locale; // Load the necessary json file
l10n.strings[locale] = {...l10n.strings[locale], ...strings };
l10n.locale = savedLocale;
} else if (locale && !strings) {
strings = locale;
Object.keys(strings).forEach(l => l10n.merge(l, strings[l]));
}
}
// Add getter and setter for the _locale property of l10n
Object.defineProperty(l10n, 'locale', {
set(locale) {
l10n._locale = locale;
l10n._ordinal = null;
l10n._cardinal = null;
},
get() {
// Use the browser defined language as the default language,
// "english" if not running in a browser (node.js)
if (!l10n._locale) {
// Use the setter, which will load the necessary .json files.
l10n._locale = typeof navigator === 'undefined' ? 'en' :
navigator.language.slice(0, 5);
}
return l10n._locale
}
});
Object.defineProperty(l10n, 'ordinal', {
get() {
if (!l10n._ordinal) {
l10n._ordinalEnglish = new Intl.PluralRules('en', {type: 'ordinal'});
l10n._ordinalEnglishPluralCategories = l10n._ordinalEnglish.resolvedOptions().pluralCategories;
l10n._ordinal = new Intl.PluralRules(l10n.locale, {type: 'ordinal'});
l10n._ordinalPluralCategories = l10n._ordinal.resolvedOptions().pluralCategories;
// "zero", "one", "two", "few", "many" and "other"
}
return l10n._ordinal;
}
});
Object.defineProperty(l10n, 'cardinal', {
get() {
if (!l10n._cardinal) {
l10n._cardinalEnglish = new Intl.PluralRules('en', {type: 'cardinal'});
l10n._cardinalEnglishPluralCategories = l10n._cardinalEnglish.resolvedOptions().pluralCategories;
l10n._cardinal = new Intl.PluralRules(l10n.locale, {type: 'cardinal'});
l10n._cardinaPluralCategories = l10n._ordinal.resolvedOptions().pluralCategories;
}
return l10n._cardinal;
}
});
l10n.strings = {
"en": {
"keyboard.tooltip.functions": "Functions",
"keyboard.tooltip.greek": "Greek Letters",
"keyboard.tooltip.command": "LaTeX Command Mode",
"keyboard.tooltip.numeric": "Numeric",
"keyboard.tooltip.roman": "Symbols and Roman Letters",
"tooltip.copy to clipboard": "Copy to Clipboard",
"tooltip.redo": "Redo",
"tooltip.toggle virtual keyboard": "Toggle Virtual Keyboard",
"tooltip.undo": "Undo"
},
"ar": {
"keyboard.tooltip.functions": "مهام",
"keyboard.tooltip.greek": "حروف يونانية",
"keyboard.tooltip.command": "حالة تلقي الأوامر اللاتك",
"keyboard.tooltip.numeric": "الرقمية",
"keyboard.tooltip.roman": "رموز الاحرف الرومانية",
"tooltip.copy to clipboard": "نسخ إلى الحافظة",
"tooltip.redo": "الإعادة",
"tooltip.toggle virtual keyboard": "تبديل لوحة المفاتيح الإفتراضية",
"tooltip.undo": "إلغاء"
},
"de": {
"keyboard.tooltip.functions": "Funktionen",
"keyboard.tooltip.greek": "Griechische Buchstaben",
"keyboard.tooltip.command": "LaTeX-Befehlsmodus",
"keyboard.tooltip.numeric": "Numerisch",
"keyboard.tooltip.roman": "Symbole und römische Buchstaben",
"tooltip.copy to clipboard": "In die Zwischenablage kopieren",
"tooltip.redo": "Wiederholen",
"tooltip.toggle virtual keyboard": "Virtuelle Tastatur umschalten",
"tooltip.undo": "Widerrufen"
},
"el": {
"keyboard.tooltip.functions": "συναρτήσεις",
"keyboard.tooltip.greek": "ελληνικά γράμματα",
"keyboard.tooltip.command": "Λειτουργία εντολών LaTeX",
"keyboard.tooltip.numeric": "Αριθμητικός",
"keyboard.tooltip.roman": "Σύμβολα και ρωμαϊκά γράμματα",
"tooltip.copy to clipboard": "Αντιγραφή στο πρόχειρο",
"tooltip.redo": "Ξανακάνω",
"tooltip.toggle virtual keyboard": "Εναλλαγή εικονικού πληκτρολογίου",
"tooltip.undo": "Ξεκάνω"
},
"es": {
"keyboard.tooltip.functions": "Funciones",
"keyboard.tooltip.greek": "Letras griegas",
"keyboard.tooltip.command": "Modo Comando LaTeX",
"keyboard.tooltip.numeric": "Numérico",
"keyboard.tooltip.roman": "Símbolos y letras romanas",
"tooltip.copy to clipboard": "Copiar al portapapeles",
"tooltip.redo": "Rehacer",
"tooltip.toggle virtual keyboard": "Alternar teclado virtual",
"tooltip.undo": "Deshacer"
},
"fa": {
"keyboard.tooltip.functions": "توابع",
"keyboard.tooltip.greek": "حروف یونانی",
"keyboard.tooltip.command": "حالت دستور لاتک",
"keyboard.tooltip.numeric": "عددی",
"keyboard.tooltip.roman": "علائم و حروف لاتین",
"tooltip.copy to clipboard": "کپی به کلیپبورد",
"tooltip.redo": "بازگشت به بعد",
"tooltip.toggle virtual keyboard": "نمایش/نهفتن کیبورد مجازی",
"tooltip.undo": "بازگشت به قبل"
},
"fr": {
"keyboard.tooltip.functions": "Fonctions",
"keyboard.tooltip.greek": "Lettres grecques",
"keyboard.tooltip.command": "Mode de commandes LaTeX",
"keyboard.tooltip.numeric": "Numérique",
"keyboard.tooltip.roman": "Lettres et symboles romains",
"tooltip.copy to clipboard": "Copier dans le presse-papiers",
"tooltip.redo": "Rétablir",
"tooltip.toggle virtual keyboard": "Afficher/Masquer le clavier virtuel",
"tooltip.undo": "Annuler"
},
"it": {
"keyboard.tooltip.functions": "Funzioni",
"keyboard.tooltip.greek": "Lettere greche",
"keyboard.tooltip.command": "Modalità di comando LaTeX",
"keyboard.tooltip.numeric": "Numerico",
"keyboard.tooltip.roman": "Simboli e lettere romane",
"tooltip.copy to clipboard": "Copia negli appunti",
"tooltip.redo": "Rifare",
"tooltip.toggle virtual keyboard": "Attiva / disattiva la tastiera virtuale",
"tooltip.undo": "Disfare"
},
"ja": {
"keyboard.tooltip.functions": "関数",
"keyboard.tooltip.greek": "ギリシャ文字",
"keyboard.tooltip.command": "LaTeXコマンドモード",
"keyboard.tooltip.numeric": "数値",
"keyboard.tooltip.roman": "記号とローマ字",
"tooltip.copy to clipboard": "クリップボードにコピー",
"tooltip.redo": "やり直し",
"tooltip.toggle virtual keyboard": "仮想キーボードの切り替え",
"tooltip.undo": "元に戻す"
},
"pl": {
"keyboard.tooltip.functions": "Funkcje",
"keyboard.tooltip.greek": "Litery greckie",
"keyboard.tooltip.command": "Tryb poleceń LaTeX",
"keyboard.tooltip.numeric": "Numeryczne",
"keyboard.tooltip.roman": "Symbole i litery rzymskie",
"tooltip.copy to clipboard": "Kopiuj do Schowka",
"tooltip.redo": "Przywróć",
"tooltip.toggle virtual keyboard": "Przełącz wirtualną klawiaturę",
"tooltip.undo": "Cofnij"
},
"ru": {
"keyboard.tooltip.functions": "Функции",
"keyboard.tooltip.greek": "Греческие буквы",
"keyboard.tooltip.command": "Режим командной строки LaTeX",
"keyboard.tooltip.numeric": "числовой",
"keyboard.tooltip.roman": "Символы и римские буквы",
"tooltip.copy to clipboard": "Скопировать в буфер обмена",
"tooltip.redo": "переделывать",
"tooltip.toggle virtual keyboard": "Переключить виртуальную клавиатуру",
"tooltip.undo": "расстегивать"
}
};
export default {
l10n
}
|
'use strict';
//we want some specific information from postData (our entire request)
//so we'll use querystring to get it.
var querystring = require("querystring");
var fs = require("fs");
var formidable = require("formidable");
function start(response, postData) {
console.log("requestHandler 'start' called");
//exec("ls -lah", function(error, stdout, stderr){
var body = '<html><head>'+
'<meta http-equiv="Content-Type" content="text/html; '+
'charset=UTF-8"'+
'</head><body>'+
'<form action="/upload" enctype="multipart/form-data" method="post">'+
'<input type="file" name="upload"><br/>'+
'<input type="submit" value="Upload file" />'+
'</form></body></html>';
response.writeHead(200, {"Content-Type" : "text/html"});
response.write(body);
response.end();
};
function upload(response, request) {
console.log("requestHandler 'upload' called");
var form = new formidable.IncomingForm();
console.log("about to parse");
form.parse(request, function(error, fields, files){
console.log("parsing done");
/*possible error on windows systems: tried to rename to an already existing file*/
fs.rename(files.upload.path, "/tmp/test.png", function(err){
if (err) {
fs.unlink("/tmp/test.png");
fs.rename(files.upload.path, "/tmp/test.png");
}//if
});//fs.rename
});//form.parse
response.writeHead(200, {"Content-Type" : "text/html"});
response.write("received image: <br/>");
response.write("<img src='/show' />");
response.end();
};
function show(response, postData){
console.log("request handler 'show' was called.");
fs.readFile("/tmp/test.png", "binary", function(error, file){
if (error){
response.writeHead(500, {"Content-Type" : "text/plain"});
response.write(error + "\n");
response.end();
} else {
response.writeHead(500, {"Content-Type" : "image/png"});
response.write(file, "binary");
response.end();
}
});
};
exports.start = start;
exports.upload = upload;
exports.show = show;
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[283],{732:function(module,exports,__webpack_require__){module.exports=__webpack_require__(1)("FnO0")}}]);
|
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-admin-custom_date-index"],{"0cae":function(n,e,t){"use strict";var a=t("e8ed"),r=t.n(a);r.a},"141e":function(n,e,t){"use strict";t.d(e,"b",(function(){return r})),t.d(e,"c",(function(){return c})),t.d(e,"a",(function(){return a}));var a={uniCalendar:t("aefa").default},r=function(){var n=this,e=n.$createElement,t=n._self._c||e;return t("v-uni-view",[t("uni-calendar",{attrs:{range:!0},on:{change:function(e){arguments[0]=e=n.$handleEvent(e),n.change.apply(void 0,arguments)}}}),t("v-uni-navigator",{staticClass:"back",attrs:{"open-type":"navigateBack","hover-class":"none"}},[n._v("取消")])],1)},c=[]},"29cf":function(n,e,t){"use strict";t.r(e);var a=t("141e"),r=t("3c6f");for(var c in r)"default"!==c&&function(n){t.d(e,n,(function(){return r[n]}))}(c);t("0cae");var i,o=t("f0c5"),u=Object(o["a"])(r["default"],a["b"],a["c"],!1,null,"43372164",null,!1,a["a"],i);e["default"]=u.exports},"3c6f":function(n,e,t){"use strict";t.r(e);var a=t("9ac1"),r=t.n(a);for(var c in a)"default"!==c&&function(n){t.d(e,n,(function(){return a[n]}))}(c);e["default"]=r.a},"9ac1":function(n,e,t){"use strict";var a=t("4ea4");t("99af"),Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r=a(t("aefa")),c={components:{uniCalendar:r.default},data:function(){return{type:""}},onLoad:function(n){this.type=n.type},methods:{change:function(n){var e=n.range,t=e.before,a=e.after;t&&a&&uni.navigateTo({url:"/pages/admin/statistics/index?type=".concat(this.type,"&before=").concat(t,"&after=").concat(a,"&time=date")})}}};e.default=c},af7c:function(n,e,t){var a=t("24fb");e=a(!1),e.push([n.i,'@charset "UTF-8";\n/**\n * 这里是uni-app内置的常用样式变量\n *\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\n *\n */\n/**\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\n *\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\n */\n/* 颜色变量 */\n/* 行为相关颜色 */\n/* crmeb颜色变量 */\n/* 背景颜色 */\n/* 边框颜色 */\n/* 尺寸变量 */\n/* 文字尺寸 */\n/* 图片尺寸 */\n/* Border Radius */\n/* 水平间距 */\n/* 垂直间距 */\n/* 透明度 */\n/* 文章场景相关 */.back[data-v-43372164]{height:%?86?%;border:%?1?% solid #e93323;border-radius:%?43?%;margin:%?60?% %?30?%;font-size:%?30?%;line-height:%?84?%;text-align:center;color:#e93323}',""]),n.exports=e},e8ed:function(n,e,t){var a=t("af7c");"string"===typeof a&&(a=[[n.i,a,""]]),a.locals&&(n.exports=a.locals);var r=t("4f06").default;r("19303e0e",a,!0,{sourceMap:!1,shadowMode:!1})}}]);
|
var Future = Npm.require("fibers/future");
AppConfig = {};
AppConfig.findGalaxy = _.once(function () {
if (!('GALAXY' in process.env || 'ULTRAWORLD_DDP_ENDPOINT' in process.env)) {
return null;
}
return Follower.connect(process.env.ULTRAWORLD_DDP_ENDPOINT || process.env.GALAXY);
});
var ultra = AppConfig.findGalaxy();
var subFuture = new Future();
if (ultra)
ultra.subscribe("oneApp", process.env.GALAXY_APP, subFuture.resolver());
var OneAppApps;
var Services;
var collectionFuture = new Future();
Meteor.startup(function () {
if (ultra) {
OneAppApps = new Meteor.Collection("apps", {
connection: ultra
});
Services = new Meteor.Collection('services', {
connection: ultra
});
// allow us to block on the collections being ready
collectionFuture.return();
}
});
// XXX: Remove this once we allow the same collection to be new'd from multiple
// places.
AppConfig._getAppCollection = function () {
collectionFuture.wait();
return OneAppApps;
};
var staticAppConfig;
try {
if (process.env.APP_CONFIG) {
staticAppConfig = JSON.parse(process.env.APP_CONFIG);
} else {
var settings;
try {
if (process.env.METEOR_SETTINGS) {
settings = JSON.parse(process.env.METEOR_SETTINGS);
}
} catch (e) {
Log.warn("Could not parse METEOR_SETTINGS as JSON");
}
staticAppConfig = {
settings: settings,
packages: {
'mongo-livedata': {
url: process.env.MONGO_URL
},
'email': {
url: process.env.MAIL_URL
}
}
};
}
} catch (e) {
Log.warn("Could not parse initial APP_CONFIG environment variable");
};
AppConfig.getAppConfig = function () {
if (!subFuture.isResolved() && staticAppConfig) {
return staticAppConfig;
}
subFuture.wait();
var myApp = OneAppApps.findOne(process.env.GALAXY_APP);
if (myApp)
return myApp.config;
throw new Error("there is no app config for this app");
};
AppConfig.configurePackage = function (packageName, configure) {
var appConfig = AppConfig.getAppConfig(); // Will either be based in the env var,
// or wait for galaxy to connect.
var lastConfig = appConfig && appConfig.packages && appConfig.packages[packageName];
if (lastConfig) {
configure(lastConfig);
}
var configureIfDifferent = function (app) {
if (!EJSON.equals(app.config && app.config.packages && app.config.packages[packageName],
lastConfig)) {
lastConfig = app.config.packages[packageName];
configure(lastConfig);
}
};
var subHandle;
var observed = new Future();
// This is not required to finish, so defer it so it doesn't block anything
// else.
Meteor.defer( function () {
// there's a Meteor.startup() that produces the various collections, make
// sure it runs first before we continue.
collectionFuture.wait();
subHandle = OneAppApps.find(process.env.GALAXY_APP).observe({
added: configureIfDifferent,
changed: configureIfDifferent
});
observed.return();
});
return {
stop: function () {
observed.wait();
subHandle.stop();
}
};
};
AppConfig.configureService = function (serviceName, configure) {
if (ultra) {
// there's a Meteor.startup() that produces the various collections, make
// sure it runs first before we continue.
collectionFuture.wait();
ultra.subscribe('servicesByName', serviceName);
return Services.find({name: serviceName}).observe({
added: configure,
changed: configure
});
}
};
|
'use strict'
const fs = require('fs')
const { selectedRanges, shortListOfRanges } = require('./code-point-ranges')
const Measurer = require('./measurer')
const { format, formatRange } = require('./format')
const { compact } = require('./compact')
const { eachCharOfRanges } = require('./range')
async function computeWidthsOfRanges(ranges, { verbose = true } = {}) {
const measurer = new Measurer()
await measurer.init()
let collected = []
for (const [lower, upper] of ranges) {
if (verbose) {
console.log(`Computing widths for ${formatRange(lower, upper)}`)
}
const widths = await measurer.widthOfRange([lower, upper])
const compacted = compact(widths, lower)
collected = collected.concat(compacted)
}
measurer.destroy()
return collected
}
async function computeKerning(ranges, { verbose = true } = {}) {
const measurer = new Measurer()
await measurer.init()
const eachChar = eachCharOfRanges(ranges)
const collected = []
for (const second of eachChar) {
console.log(format(second))
for (const first of eachChar) {
const kerningAdjustment = await measurer.kerningAdjustmentFor(
first,
second
)
if (kerningAdjustment) {
collected.push([first, second, kerningAdjustment])
if (verbose) {
console.log(`${format(first)} ${format(second)} ${kerningAdjustment}`)
}
}
}
}
measurer.destroy()
return collected
}
async function main() {
const widths = await computeWidthsOfRanges(selectedRanges)
// const widths = await computeWidthsOfRanges(shortListOfRanges)
fs.writeFileSync('widths.json', JSON.stringify(widths))
const kerning = await computeKerning(shortListOfRanges)
fs.writeFileSync('kerning.json', JSON.stringify(kerning))
}
;(async () => main())()
|
const assert = require('assert')
const UnityAuthenticationClient = require('../').UnityAuthenticationClient
const constants = require('./constants')
describe('UnityAuthenticationClient', () => {
it('should construct', () => {
new UnityAuthenticationClient('')
new UnityAuthenticationClient('', '')
new UnityAuthenticationClient('', '', '')
})
it('should reformat apiRoots if needed', () => {
const clientOne = new UnityAuthenticationClient('', 'pie/')
const clientTwo = new UnityAuthenticationClient('', '', 'pie/')
assert.equal(clientOne.authApiRoot, 'pie')
assert.equal(clientTwo.sessionApiRoot, 'pie')
})
it('should define freeLicenseHash', () => {
const expected = 'd4f8a001defddbe4b05bfe41e52630a3809e297a'
assert.equal(UnityAuthenticationClient.freeLicenseHash, expected)
})
it('should generateHardwareHash', () => {
const client = new UnityAuthenticationClient()
const hashOne = client.generateHardwareHash()
const hashTwo = client.generateHardwareHash('hi mom')
assert.ok(hashOne != hashTwo)
})
it('should authenticate', (done) => {
const client = new UnityAuthenticationClient()
client.authenticate(constants.testUsername, constants.testPassword)
.then((session) => {
assert.ok(typeof session != 'undefined')
done()
})
}).timeout(5000)
it('should authenticate with explicits', (done) => {
const client = new UnityAuthenticationClient()
const licenseHash = UnityAuthenticationClient.freeLicenseHash
const hardwareHash = client.generateHardwareHash('test machine')
client.authenticate(constants.testUsername, constants.testPassword, licenseHash, hardwareHash)
.then((session) => {
assert.ok(typeof session != 'undefined')
done()
})
}).timeout(5000)
it('should gracefully fail to authenticate', (done) => {
const client = new UnityAuthenticationClient()
// no valid creds
client.authenticate('garbage','creds', '', '')
.catch((err) => {
assert.ok(typeof err != 'undefined')
done()
})
}).timeout(5000)
})
|
var struct___t_o_p_s_e_n_s___j_o_i_n_t =
[
[ "Orientation", "struct___t_o_p_s_e_n_s___j_o_i_n_t.html#adc2d7dce255f281b0debb5823f8f69f1", null ],
[ "Position", "struct___t_o_p_s_e_n_s___j_o_i_n_t.html#a2903185f44307386081a2311648cc313", null ],
[ "Rotation", "struct___t_o_p_s_e_n_s___j_o_i_n_t.html#ab5e3d8ffa6d74f5d5fde62c925ef85cb", null ]
];
|
import React from 'react';
import bgImage from './img/hero-bg.jpg'
const Hero = () => {
return (
<section>
<div
className="p-24 bg-cover bg-center"
style={{
backgroundImage: `url(${bgImage})`
}}></div>
<div className="max-w-5xl mx-auto">
<div className="flex flex-col sm:flex-row items-center justify-center mt-12 md:mt-16">
<div className="text-center">
<h1
className="font-black text-4xl sm:text-4xl md:text-5xl italic leading-tight px-4">Inspire creators with your ideas</h1>
<p className="max-w-xl mt-4 mx-auto text-xl px-4">Creative ideas can be shared in
from of challenges on GoSocial. Budding creators take these
as self-challenges to learn new things.</p>
<div className="mt-10">
<div className="flex flex-row items-center justify-center">
<svg
width="20"
height="34"
xmlns="http://www.w3.org/2000/svg"
xlink="http://www.w3.org/1999/xlink">
<defs>
<path
d="M.893 17.214l16.941-6.613a2.143 2.143 0 000-3.917L.893.071v32.143"
id="a"/>
</defs>
<use
stroke="#264BBB"
strokeWidth="1.5"
fill="#264BBB"
strokeLinecap="round"
strokeLinejoin="round"
href="#a"
transform="translate(0 1)"
fillRule="evenodd"/>
</svg>
<p className="text-lg md:text-xl uppercase ml-4">35k Submissions in challenges</p>
</div>
</div>
</div>
</div>
</div>
</section>
);
};
export default Hero;
|
$(document).ready(function () {
$('.dropdown-toggle').dropdown();
$(".collapse").collapse();
$('.date-ago').each(function (index, value) {
var el = $(value);
var date = moment(el.html());
el.html(date.fromNow());
});
$('.at-on-date').each(function (index, value) {
var el = $(value);
var date = moment(el.html());
el.html(date.format("MMM Do YYYY \\at h:mm:ss a"));
});
});
|
const clonedeep = require('lodash.clonedeep');
const env = process.env.DEPLOYMENT_ENV || 'development';
const development = {
frameworks: {
minExitPeriod: process.env.MIN_EXIT_PERIOD || 60 * 10, // The minimum exit period for testing is 10 minutes.
initialImmuneVaults: 2, // Allow 2 vaults (ETH and ERC20) to be used without going through quarantine.
initialImmuneExitGames: 1, // Allow 1 exit game (PaymentExitGame) to be used without going through quarantine.
protocols: {
mvp: 1,
moreVp: 2,
},
// Defines how much gas should be considered safe when transferring ETH
// Under version control so that it can be upgraded to reflect Ethereum network changes,
// while keeping a record of the previous gas stipend.
safeGasStipend: {
v1: 2300,
},
},
registerKeys: {
txTypes: {
payment: 1,
paymentV2: 2,
},
outputTypes: {
payment: 1,
},
vaultId: {
eth: 1,
erc20: 2,
},
},
};
const production = clonedeep(development);
production.frameworks.minExitPeriod = 60 * 60 * 24 * 7; // The minimum exit period in production is 1 week.
const config = {
development,
production,
};
module.exports = config[env];
|
(function() {
function addListener(callback) {
if (wbinfo.proxy_magic) {
window.addEventListener("__wb_to_event", callback);
} else {
window.addEventListener("message", callback);
}
}
function getMessage(event) {
if (wbinfo.proxy_magic) {
return event.detail;
} else {
if (event.source != window.__WB_top_frame) {
return;
}
return event.data;
}
}
function sendMessage(data) {
if (wbinfo.proxy_magic) {
window.dispatchEvent(new CustomEvent("__wb_from_event", {"detail": data}));
} else {
window.__WB_top_frame.postMessage(data, "*", undefined);
}
}
// Static Snapshots
(function() {
var counter = 0;
function process(win, topinfo, top_page) {
var return_url;
try {
return_url = addSnapshot(win, topinfo, top_page);
} catch(e) {
console.log("Can't snapshot: " + e);
return;
}
for (var i = 0; i < win.frames.length; i++) {
var url = process(win.frames[i], topinfo, false);
if (url) {
try {
win.frames[i].frameElement.setAttribute("data-src-target", url);
} catch(e) {
}
}
}
return return_url;
}
function addSnapshot(win, topinfo, top_page) {
if (win.WB_wombat_location && win.WB_wombat_location.href) {
url = win.WB_wombat_location.href;
//url = url.replace(/^(https?:\/\/)/, '$1snapshot:')
} else if (win.document.all.length <= 3) {
url = "about:blank";
return url;
} else {
url = "http://embed.snapshot/" + counter;
counter++;
}
var contents = new XMLSerializer().serializeToString(win.document);
var params = {prefix: topinfo.prefix,
url: url,
top_url: topinfo.url,
top_ts: topinfo.timestamp,
}
if (top_page) {
params['title'] = win.document.title;
}
var data = {params: params,
wb_type: "snapshot",
top_page: top_page,
contents: contents}
sendMessage(data);
return url;
}
function doSnapshot(event) {
var message = getMessage(event);
if (!message) {
return;
}
if (message.wb_type == "snapshot-req") {
process(window, window.wbinfo, true);
}
}
function ready() {
addListener(doSnapshot);
}
window.addEventListener("DOMContentLoaded", ready);
}());
// Password Check
(function() {
var pass_form_targets = {};
function exclude_password_targets() {
var passFields = document.querySelectorAll("input[type=password]");
for (var i = 0; i < passFields.length; i++) {
var input = passFields[i];
if (input && input.form && input.form.action) {
var form_action = input.form.action;
if (window._wb_wombat) {
form_action = window._wb_wombat.extract_orig(form_action);
}
if (!form_action) {
return;
}
// Skip password check if checked within last 5 mins
if (pass_form_targets[form_action] && ((Date.now() / 1000) - pass_form_targets[form_action]) < 300) {
return;
}
sendMessage({wb_type: "skipreq", url: form_action});
pass_form_targets[form_action] = Date.now() / 1000;
}
}
}
function ready() {
if (!window.wbinfo.is_live) {
return;
}
exclude_password_targets();
setInterval(exclude_password_targets, 4900);
}
window.addEventListener("DOMContentLoaded", ready);
})();
// Autoscroll
(function() {
var sid = undefined;
var scroll_timeout = 2000;
var doneCallback = undefined;
var lastScrolled = undefined;
function scroll() {
if (window.scrollY + window.innerHeight < Math.max(document.body.scrollHeight, document.documentElement.scrollHeight)) {
window.scrollBy(0, 200);
lastScrolled = Date.now();
} else if (!lastScrolled || (Date.now() - lastScrolled) > scroll_timeout) {
stop();
};
}
function start(done, timeout) {
doneCallback = done;
lastScrolled = Date.now();
if (timeout) {
scroll_timeout = timeout;
}
sid = setInterval(scroll, 100);
}
function stop(skipCallback) {
if (sid == undefined) {
return;
}
clearInterval(sid);
sid = undefined;
if (doneCallback && !skipCallback) {
doneCallback();
}
}
function isDone() {
return sid == undefined;
}
function setDoneCallback(donecb) {
doneCallback = donecb;
}
function receiveEvent(event) {
var message = getMessage(event);
if (!message) {
return;
}
function sendDone() {
sendMessage({wb_type: "autoscroll_resp", on: false});
}
if (message.wb_type == "autoscroll") {
if (message.start) {
start(sendDone, message.timeout);
} else {
stop(message.skipCallback);
}
}
}
function ready() {
addListener(receiveEvent);
}
window.addEventListener("DOMContentLoaded", ready);
//return {"start": start, "stop": stop, "isDone": isDone, "setDoneCallback": setDoneCallback};
})();
})();
|
import React from "react";
import ReactDOM from "react-dom";
import { createMemoryHistory, createBrowserHistory } from "history";
import App from "./App";
const mount = (el, { onSignIn, onNavigate, defaultHistory, initialPath }) => {
const historyFn = defaultHistory || createMemoryHistory;
const history = historyFn({
initialEntries: [initialPath],
});
history.listen(onNavigate);
ReactDOM.render(<App history={history} onSignIn={onSignIn} />, el);
return {
onParentNavigate({ pathname: nextPathname }) {
const { pathname } = history.location;
if (pathname !== nextPathname) {
history.push(nextPathname);
}
},
};
};
if (process.env.NODE_ENV === "development") {
const el = document.getElementById("_auth-dev-root");
if (el) {
mount(el, { defaultHistory: createBrowserHistory });
}
}
export { mount };
|
// This file is part of React-Invenio-Deposit
// Copyright (C) 2020 CERN.
// Copyright (C) 2020 Northwestern University.
//
// React-Invenio-Deposit is free software; you can redistribute it and/or modify it
// under the terms of the MIT License; see LICENSE file for more details.
export { AccessRightField } from './AccessRightField';
export { AdditionalTitlesField } from './AdditionalTitlesField';
export { AffiliationsField } from './AffiliationsField';
export { CreatibutorsField } from './CreatibutorsField';
export { DatesField } from './DatesField';
export { DescriptionsField } from './DescriptionsField';
export { FileUploader } from './FileUploader';
export { FundingField } from './FundingField';
export { IdentifiersField } from './IdentifiersField';
export { PublicationDateField } from './PublicationDateField';
export { PublisherField } from './PublisherField';
export { ResourceTypeField } from './ResourceTypeField';
export { SubjectsField } from './SubjectsField';
export { TitlesField } from './TitlesField';
export { LanguagesField } from './LanguagesField';
export { RelatedIdentifiersField } from './RelatedIdentifiersField';
export { VersionField } from './VersionField';
|
'use strict';
let matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
];
function spin ( matrix ) {
let temp_index = matrix[0].length - 1;
let matrix_index = 0;
let matrix_clone = matrix.slice();
while ( temp_index >= 0 ) {
let temp = [];
for ( let i=0; i<matrix_clone.length; i++) {
temp.push( matrix_clone[i][temp_index] );
}
matrix[matrix_index] = temp;
temp_index--;
matrix_index++;
}
return matrix;
}
console.log( matrix );
console.log(spin( matrix ) );
console.log(spin( matrix ) );
console.log(spin( matrix ) );
console.log(spin( matrix ) );
|
// Your task is to create functionisDivideBy (or is_divide_by) to check if an integer number is divisible by each out of two arguments.
// A few cases:
// (-12, 2, -6) -> true
// (-12, 2, -5) -> false
// (45, 1, 6) -> false
// (45, 5, 15) -> true
// (4, 1, 4) -> true
// (15, -5, 3) -> true
function isDivideBy(number, a, b) {
return (number % a === 0 && number % b === 0) || false;
}
|
/*var json = {
"string": "foo",
"number": 5,
"array": [1, 2, 3],
"object": {
"property": "value",
"subobj": {
"arr": ["foo", "ha"],
"numero": 1
}
}
};*/
function printJSON() {
$('#json').val(JSON.stringify(json));
}
function updateJSON(data) {
json = data;
printJSON();
}
function showPath(path) {
$('#path').text(path);
}
$(document).ready(function() {
$('#rest > button').click(function() {
var url = $('#rest-url').val();
$.ajax({
url: url,
dataType: 'jsonp',
jsonp: $('#rest-callback').val(),
success: function(data) {
json = data;
$('#editor').jsonEditor(json, { change: updateJSON, propertyclick: showPath });
printJSON();
},
error: function() {
alert('Something went wrong, double-check the URL and callback parameter.');
}
});
});
$('#json').change(function() {
var val = $('#json').val();
if (val) {
try { json = JSON.parse(val); }
catch (e) { alert('Error in parsing json. ' + e); }
} else {
json = {};
}
$('#editor').jsonEditor(json, { change: updateJSON, propertyclick: showPath });
});
$('#expander').click(function() {
var editor = $('#editor');
editor.toggleClass('expanded');
$(this).text(editor.hasClass('expanded') ? 'Collapse' : 'Expand all');
});
printJSON();
$('#editor').jsonEditor(json, { change: updateJSON, propertyclick: showPath });
});
|
/**
* @license Highmaps JS v9.0.1 (2021-02-16)
* @module highcharts/modules/heatmap
* @requires highcharts
*
* (c) 2009-2021 Torstein Honsi
*
* License: www.highcharts.com/license
*/
'use strict';
import '../../Core/Axis/ColorAxis.js';
import '../../Mixins/ColorMapSeries.js';
import '../../Series/Heatmap/HeatmapSeries.js';
|
// Copyright 2018 Google Inc. 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.
// To be copied to GCS so it can be uses with Dataflow template
function from_prediction_output_to_datastore_object(prediction_row, entity){
/*
* prediction_row looks like what is given by the export function in model.py
* {"properties": 427.7606201171875, "key": ["'abc'"]}
* entity should match https://cloud.google.com/datastore/docs/reference/data/rest/v1/Entity
*/
//[START row_to_ds]
var prediction_object = JSON.parse(prediction_row);
to_write = {
key: {
path: [{
//id: prediction_object.key,
kind: 'clv',
name: prediction_object.customer_id
}]
},
properties: {
predicted_monetary: {doubleValue: prediction_object.predicted_monetary}
}
};
return JSON.stringify(to_write);
//[END row_to_ds]
}
|
module.exports = require("npm:amdefine@1.0.1/amdefine.js");
|
import { GraphQLObjectType } from "graphql/type";
/**
* Creates a trivial implementation resource object type for given Interfaces and a singular
* interfaceFields.
*/
export default function implementInterface (ObjectName, objectDescription, Interfaces,
interfaceFields) {
return new GraphQLObjectType({
name: ObjectName,
interfaces: Interfaces,
fields: () => ({
...interfaceFields(objectDescription).fields(),
}),
});
}
|
import { declareRuntimeEnv } from 'resolve-scripts'
const prodConfig = {
target: 'local',
port: declareRuntimeEnv('PORT', '3000'),
mode:
'production' /*,
readModelConnectors: {
default: {
module: 'resolve-readmodel-lite',
options: {
databaseFile: 'data/read-models.db'
}
}
}*/,
eventstoreAdapter: {
module: 'resolve-eventstore-lite',
options: {
databaseFile: 'data/event-store.db',
secretsFile: 'data/secrets.db',
snapshotBucketSize: 100
}
},
eventBroker: {
databaseFile: 'data/local-bus-broker.db'
}
}
export default prodConfig
|
'use strict';
import * as types from '../constants/ActionTypes';
import {ToastShort} from '../utils/ToastUtils';
import {request} from '../utils/HttpServices';
import * as host from '../constants/Urls';
export function fetchReddit (isRefreshing, loading, typeId, isLoadMore, count, after) {
if (count == undefined) {
count = 25;
}
return dispatch => {
dispatch(fetchRedditList(isRefreshing, loading, isLoadMore));
return request(host.BASE_URL + host.DOMAINS[typeId] + '?count=' + count + '&after=' + after)
.then((redditList) => {
dispatch(receiveRedditList(redditList.data, typeId, redditList.data.after));
})
.catch((error) => {
dispatch(receiveRedditList([], typeId));
ToastShort(error.message);
})
}
}
function fetchRedditList (isRefreshing, loading, isLoadMore) {
if (isLoadMore == undefined) {
isLoadMore = false;
}
return {
type: types.FETCH_REDDIT_LIST,
isRefreshing: isRefreshing,
loading: loading,
isLoadMore: isLoadMore
}
}
function receiveRedditList (redditData, typeId, after) {
return {
type: types.RECEIVE_REDDIT_LIST,
redditData: redditData,
typeId: typeId,
after: after
}
}
|
var PromiseProvider = require('../../lib/promise_provider');
var assert = require('power-assert');
var mongoose = require('../../');
describe('promises docs', function () {
var Band;
var db;
before(function (done) {
db = mongoose.createConnection('mongodb://localhost:27017/mongoose_test');
Band = db.model('band-promises', {name: String, members: [String]});
done();
});
beforeEach(function (done) {
Band.remove({}, done);
});
after(function (done) {
db.close(done);
});
/**
* Mongoose async operations, like `.save()` and queries, return
* [ES6 promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
* This means that you can do things like `MyModel.findOne({}).then()` and
* `await MyModel.findOne({}).exec()` (if you're using [async/await](http://thecodebarbarian.com/80-20-guide-to-async-await-in-node.js.html).
*/
it('Built-in Promises', function (done) {
var gnr = new Band({
name: "Guns N' Roses",
members: ['Axl', 'Slash']
});
var promise = gnr.save();
assert.ok(promise instanceof Promise);
promise.then(function (doc) {
assert.equal(doc.name, "Guns N' Roses");
// acquit:ignore:start
done();
// acquit:ignore:end
});
});
/**
* Mongoose queries are **not** promises. However, they do have a `.then()`
* function for `yield` and async/await. If you need
* a fully-fledged promise, use the `.exec()` function.
*/
it('Queries are not promises', function (done) {
var query = Band.findOne({name: "Guns N' Roses"});
assert.ok(!(query instanceof Promise));
// acquit:ignore:start
var outstanding = 2;
// acquit:ignore:end
// A query is not a fully-fledged promise, but it does have a `.then()`.
query.then(function (doc) {
// use doc
// acquit:ignore:start
assert.ok(!doc);
--outstanding || done();
// acquit:ignore:end
});
// `.exec()` gives you a fully-fledged promise
var promise = query.exec();
assert.ok(promise instanceof Promise);
promise.then(function (doc) {
// use doc
// acquit:ignore:start
assert.ok(!doc);
--outstanding || done();
// acquit:ignore:end
});
});
/**
* If you're an advanced user, you may want to plug in your own promise
* library like [bluebird](https://www.npmjs.com/package/bluebird). Just set
* `mongoose.Promise` to your favorite
* ES6-style promise constructor and mongoose will use it.
*/
it('Plugging in your own Promises Library', function (done) {
// acquit:ignore:start
if (!global.Promise) {
return done();
}
// acquit:ignore:end
var query = Band.findOne({name: "Guns N' Roses"});
// Use bluebird
mongoose.Promise = require('bluebird');
assert.equal(query.exec().constructor, require('bluebird'));
// Use q. Note that you **must** use `require('q').Promise`.
mongoose.Promise = require('q').Promise;
assert.ok(query.exec() instanceof require('q').makePromise);
// acquit:ignore:start
done();
// acquit:ignore:end
});
/**
* The `mongoose.Promise` property sets the promises mongoose uses. However,
* this does **not** affect the underlying MongoDB driver. If you use the
* underlying driver, for instance `Model.collection.db.insert()`, you
* need to do a little extra work to change the underlying promises library.
* Note that the below code assumes mongoose >= 4.4.4.
*/
it('Promises for the MongoDB Driver', function (done) {
// acquit:ignore:start
if (!global.Promise) {
return done();
}
// acquit:ignore:end
var uri = 'mongodb://localhost:27017/mongoose_test';
// Use bluebird
var options = { promiseLibrary: require('bluebird') };
var db = mongoose.createConnection(uri, options);
Band = db.model('band-promises', { name: String });
db.on('open', function() {
assert.equal(Band.collection.findOne().constructor, require('bluebird'));
// acquit:ignore:start
done();
// acquit:ignore:end
});
});
});
|
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.a0f515eb3eedb069a10ae287d5569715.js"
);
self.addEventListener('message', (event) => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});
workbox.core.clientsClaim();
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
workbox.routing.registerNavigationRoute(workbox.precaching.getCacheKeyForURL("/index.html"), {
blacklist: [/^\/_/,/\/[^/?]+\.[^/]+$/],
});
|
"use strict";
exports.__esModule = true;
exports.c_button_m_secondary_m_danger_active_Color = {
"name": "--pf-c-button--m-secondary--m-danger--active--Color",
"value": "#a30000",
"var": "var(--pf-c-button--m-secondary--m-danger--active--Color)"
};
exports["default"] = exports.c_button_m_secondary_m_danger_active_Color;
|
integration.meta = {
'sectionID' : '129372',
'siteName' : 'ISM_Gentside- (desktop only) - Header Bidding - (IT) (129372 )',
'platform' : 'header bidding'
};
integration.params = {
'mf_siteId' : '1074685',
// DO NOT REMOVE CONTENT WIDTH FROM HERE - REQUIRED FOR DESKTOP
'plr_ContentW': 980,
'srv_SectionID': '129372',
'plr_ContentType': 'PAGESKINEXPRESS',
'plr_UseFullVersion': true,
'plr_UseCreativeSettings': true,
'plr_HideElementsByID' : '',
'plr_HideElementsByClass' : '',
'plr_Multiwin' : false,
};
integration.on('adCallResult', function (e) {
if (e.data.hasSkin) {
desktopIntegration = function () {
integration.base.setCfg({
'plr_ContentW': 980,
'plr_PageAlignment': 'center'
});
if (e.data.productType == "PageSkinSuperWide" || e.data.productType == "PageSkinPlusSuperWide" || e.data.treatment.Superwide) {
integration.custom.isSuper = true;
}
if (integration.custom.isSuper) {
var width = $(window).width();
var sideWidth = (width - 984) / 2;
$(".invite-popin").css({
"left": sideWidth + 20
});
}
if ($(".header").length == 1) {
$("<div id='inskinanchor'></div>").insertAfter(".header");
integration.base.setCfg({
plr_AnchorParent: "#inskinanchor",
'plr_PageHeightAdjustment': -64
});
}
$("head").append("<style>.mdc-toolbar--fix{margin-top: 0 !important;}</style>");
$('.wrapper, .footer').css({
"max-width": "980px",
"margin": "0 auto"
});
$('#inskinanchor').css({
"position": "relative",
"margin-top": 64
});
integration.on('adServed', function (e) {
setTimeout(function () {
window.dispatchEvent(new Event('resize'));
}, 500);
});
}
switch (e.data.device) {
case 'Desktop':
desktopIntegration();
break;
}
}
});
|
import { makeStyles } from '@material-ui/core/styles';
export const useStyles = makeStyles((theme) => ({
categoryItemAdd: {
display: 'flex',
flexDirection: 'column',
margin: '20px 0'
},
textField: {
margin: '10px 5px'
},
categoryAdd: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-around'
},
saveButton: {
margin: theme.spacing(2)
},
container: {
width: '100%',
padding: 20,
'@media (max-width: 600px)': {
padding: '10px 20px'
},
'@media (max-width: 481px)': {
marginTop: '10px'
}
},
tabs: {
backgroundColor: 'white',
color: 'black'
},
controlsBlock: {
display: 'flex',
justifyContent: 'space-between'
},
inputError: {
color: '#e60000',
marginLeft: '5px'
},
categoryImage: {
width: '5rem',
height: '5rem',
margin: '5px',
fontSize: '.7rem',
padding: '.2rem'
},
categoryInputFile: { display: 'none' },
categoryTitle: {
marginBottom: '10px',
fontSize: 24,
color: theme.palette.text.disabled,
fontWeight: 'bold'
}
}));
|
// / <reference types="Cypress" />
import SettingsPageObject from '../../../../../support/pages/module/sw-settings.page-object';
describe('Product Search: Test crud operations of custom field', () => {
beforeEach(() => {
cy.loginViaApi()
.then(() => {
return cy.createDefaultFixture('custom-field-set');
});
});
it('@settings: Create a config field', () => {
const page = new SettingsPageObject();
// Request we want to wait for later
cy.intercept({
url: `${Cypress.env('apiPath')}/product-search-config-field`,
method: 'POST'
}).as('createSearchConfig');
cy.intercept({
url: `${Cypress.env('apiPath')}/search/custom-field`,
method: 'POST'
}).as('getCustomField');
cy.intercept({
url: `${Cypress.env('apiPath')}/search/product-search-config-field`,
method: 'POST'
}).as('getData');
cy.openInitialPage(`${Cypress.env('admin')}#/sw/settings/search/index`);
cy.wait('@getData')
.its('response.statusCode').should('equal', 200);
// change to custom field tab
cy.get('.sw-settings-search__searchable-content-tab-title').last().click();
cy.get('.sw-settings-search__view-general .sw-card').eq(0).scrollIntoView();
cy.wait('@getCustomField')
.its('response.statusCode').should('equal', 200);
cy.contains('.sw-settings-search__searchable-content-customfields .sw-empty-state__title',
'No searchable content added yet.');
cy.get('.sw-settings-search__searchable-content-add-button').should('exist');
cy.get('.sw-settings-search__searchable-content-add-button').click();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0`).dblclick();
cy.get('.sw-settings-search-custom-field-select')
.typeSingleSelectAndCheck('custom_field_set_property', '.sw-settings-search-custom-field-select');
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 #sw-field--item-ranking`).clear().type('9999');
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 ${page.elements.dataGridColumn}--searchable input`).click();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 ${page.elements.dataGridColumn}--tokenize input`).click();
cy.get(`${page.elements.dataGridRowInlineEdit}`).click();
cy.wait('@createSearchConfig')
.its('response.statusCode').should('equal', 204);
// Check field already created
cy.get('.sw-settings-search__searchable-content-customfields ' +
'.sw-data-grid__row--0 .sw-data-grid__cell-content:first').invoke('text').then((text) => {
expect(text.trim()).equal('My custom field - custom_field_set_property');
});
});
it('@settings: Update config field', () => {
const page = new SettingsPageObject();
// Request we want to wait for later
cy.intercept({
url: `${Cypress.env('apiPath')}/product-search-config-field`,
method: 'POST'
}).as('createSearchConfig');
cy.intercept({
url: `${Cypress.env('apiPath')}/product-search-config-field/*`,
method: 'PATCH'
}).as('updateSearchConfig');
cy.intercept({
url: `${Cypress.env('apiPath')}/search/custom-field`,
method: 'POST'
}).as('getCustomField');
cy.intercept({
url: `${Cypress.env('apiPath')}/search/product-search-config-field`,
method: 'POST'
}).as('getData');
cy.openInitialPage(`${Cypress.env('admin')}#/sw/settings/search/index`);
cy.wait('@getData')
.its('response.statusCode').should('equal', 200);
// change to custom field tab
cy.get('.sw-settings-search__searchable-content-tab-title').last().click();
cy.get('.sw-settings-search__view-general .sw-card').eq(1).scrollIntoView();
cy.wait('@getCustomField')
.its('response.statusCode').should('equal', 200);
// Create a new item first and then update it.
cy.get('.sw-settings-search__searchable-content-add-button').click();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0`).dblclick();
cy.get('.sw-settings-search-custom-field-select')
.typeSingleSelectAndCheck('custom_field_set_property', '.sw-settings-search-custom-field-select');
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 #sw-field--item-ranking`).clear().type('2000');
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 ${page.elements.dataGridColumn}--searchable input`).click();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 ${page.elements.dataGridColumn}--tokenize input`).click();
cy.get(`${page.elements.dataGridRowInlineEdit}`).click();
cy.wait('@createSearchConfig')
.its('response.statusCode').should('equal', 204);
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0`).dblclick();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 #sw-field--item-ranking`).clear().type('1000');
cy.get(`${page.elements.dataGridRowInlineEdit}`).click();
cy.wait('@updateSearchConfig')
.its('response.statusCode').should('equal', 204);
// Check ranking points already updated
cy.get('.sw-settings-search__searchable-content-customfields ' +
'.sw-data-grid__row--0 .sw-data-grid__cell-value').invoke('text').then((text) => {
expect(text.trim()).equal('1000');
});
});
it('@settings: Delete config field', () => {
const page = new SettingsPageObject();
// Request we want to wait for later
cy.intercept({
url: `${Cypress.env('apiPath')}/product-search-config-field`,
method: 'POST'
}).as('createSearchConfig');
cy.intercept({
url: `${Cypress.env('apiPath')}/product-search-config-field/*`,
method: 'delete'
}).as('deleteSearchConfig');
cy.intercept({
url: `${Cypress.env('apiPath')}/search/custom-field`,
method: 'POST'
}).as('getCustomField');
cy.intercept({
url: `${Cypress.env('apiPath')}/search/product-search-config-field`,
method: 'POST'
}).as('getData');
cy.openInitialPage(`${Cypress.env('admin')}#/sw/settings/search/index`);
cy.wait('@getData')
.its('response.statusCode').should('equal', 200);
// change to customfield tab
cy.get('.sw-settings-search__searchable-content-tab-title').last().click();
cy.get('.sw-settings-search__view-general .sw-card').eq(1).scrollIntoView();
cy.wait('@getCustomField')
.its('response.statusCode').should('equal', 200);
// Create a new item first and then delete it.
cy.get('.sw-settings-search__searchable-content-add-button').click();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0`).dblclick();
cy.get('.sw-settings-search-custom-field-select')
.typeSingleSelectAndCheck('custom_field_set_property', '.sw-settings-search-custom-field-select');
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 #sw-field--item-ranking`).clear().type('2000');
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 ${page.elements.dataGridColumn}--searchable input`).click();
cy.get('.sw-settings-search__searchable-content-customfields ' +
`${page.elements.dataGridRow}--0 ${page.elements.dataGridColumn}--tokenize input`).click();
cy.get(`${page.elements.dataGridRowInlineEdit}`).click();
cy.wait('@createSearchConfig')
.its('response.statusCode').should('equal', 204);
cy.get('.sw-settings-search__view-general .sw-card').eq(1).scrollIntoView();
cy.clickContextMenuItem(
'.sw-settings-search__searchable-content-list-remove',
page.elements.contextMenuButton,
`.sw-settings-search__searchable-content-customfields ${page.elements.dataGridRow}--0`
);
cy.wait('@deleteSearchConfig')
.its('response.statusCode').should('equal', 204);
cy.get('.sw-empty-state').should('exist');
});
});
|
IntlPolyfill.__addLocaleData({locale:"tig-ER",date:{ca:["gregory","buddhist","chinese","coptic","ethioaa","ethiopic","generic","hebrew","indian","islamic","japanese","persian","roc"],hourNo0:true,hour12:true,formats:[{year:"numeric",month:"long",day:"numeric",weekday:"long",hour:"numeric",minute:"2-digit",second:"2-digit",pattern:"{year} {month} {day}, {weekday} {hour}:{minute}:{second}",pattern12:"{year} {month} {day}, {weekday} {hour}:{minute}:{second} {ampm}"},{year:"numeric",month:"long",day:"numeric",weekday:"long",pattern:"{year} {month} {day}, {weekday}"},{year:"numeric",month:"long",day:"numeric",pattern:"{year} {month} {day}"},{year:"numeric",month:"2-digit",day:"2-digit",pattern:"{year}-{month}-{day}"},{year:"numeric",month:"2-digit",pattern:"{year}-{month}"},{year:"numeric",month:"long",pattern:"{year} {month}"},{month:"long",day:"numeric",pattern:"{month} {day}"},{month:"2-digit",day:"2-digit",pattern:"{month}-{day}"},{hour:"numeric",minute:"2-digit",second:"2-digit",pattern:"{hour}:{minute}:{second}",pattern12:"{hour}:{minute}:{second} {ampm}"},{hour:"numeric",minute:"2-digit",pattern:"{hour}:{minute}",pattern12:"{hour}:{minute} {ampm}"}],calendars:{buddhist:{eras:{short:["BE"]}},chinese:{months:{long:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"]}},coptic:{months:{long:["Tout","Baba","Hator","Kiahk","Toba","Amshir","Baramhat","Baramouda","Bashans","Paona","Epep","Mesra","Nasie"]},eras:{short:["ERA0","ERA1"]}},ethiopic:{months:{long:["Meskerem","Tekemt","Hedar","Tahsas","Ter","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehasse","Pagumen"]},eras:{short:["ERA0","ERA1"]}},ethioaa:{eras:{short:["ERA0"]}},generic:{months:{long:["M01","M02","M03","M04","M05","M06","M07","M08","M09","M10","M11","M12"]},eras:{short:["ERA0","ERA1"]}},gregory:{months:{short:["ጃንዩ","ፌብሩ","ማርች","ኤፕረ","ሜይ","ጁን","ጁላይ","ኦገስ","ሴፕቴ","ኦክተ","ኖቬም","ዲሴም"],long:["ጃንዩወሪ","ፌብሩወሪ","ማርች","ኤፕረል","ሜይ","ጁን","ጁላይ","ኦገስት","ሴፕቴምበር","ኦክተውበር","ኖቬምበር","ዲሴምበር"]},days:{short:["ሰ/ዓ","ሰኖ","ታላሸ","ኣረር","ከሚሽ","ጅምዓ","ሰ/ን"],long:["ሰንበት ዓባይ","ሰኖ","ታላሸኖ","ኣረርባዓ","ከሚሽ","ጅምዓት","ሰንበት ንኢሽ"]},eras:{short:["ዓ/ዓ","ዓ/ም"]},dayPeriods:{am:"ቀደም ሰርምዕል",pm:"ሓቆ ስርምዕል"}},hebrew:{months:{long:["Tishri","Heshvan","Kislev","Tevet","Shevat","Adar I","Adar","Nisan","Iyar","Sivan","Tamuz","Av","Elul","Adar II"]},eras:{short:["AM"]}},indian:{months:{long:["Chaitra","Vaisakha","Jyaistha","Asadha","Sravana","Bhadra","Asvina","Kartika","Agrahayana","Pausa","Magha","Phalguna"]},eras:{short:["Saka"]}},islamic:{months:{short:["Muh.","Saf.","Rab. I","Rab. II","Jum. I","Jum. II","Raj.","Sha.","Ram.","Shaw.","Dhuʻl-Q.","Dhuʻl-H."],long:["Muharram","Safar","Rabiʻ I","Rabiʻ II","Jumada I","Jumada II","Rajab","Shaʻban","Ramadan","Shawwal","Dhuʻl-Qiʻdah","Dhuʻl-Hijjah"]},eras:{short:["AH"]}},japanese:{eras:{narrow:["Taika (645-650)","Hakuchi (650-671)","Hakuhō (672-686)","Shuchō (686-701)","Taihō (701-704)","Keiun (704-708)","Wadō (708-715)","Reiki (715-717)","Yōrō (717-724)","Jinki (724-729)","Tempyō (729-749)","Tempyō-kampō (749-749)","Tempyō-shōhō (749-757)","Tempyō-hōji (757-765)","Temphō-jingo (765-767)","Jingo-keiun (767-770)","Hōki (770-780)","Ten-ō (781-782)","Enryaku (782-806)","Daidō (806-810)","Kōnin (810-824)","Tenchō (824-834)","Jōwa (834-848)","Kajō (848-851)","Ninju (851-854)","Saiko (854-857)","Tennan (857-859)","Jōgan (859-877)","Genkei (877-885)","Ninna (885-889)","Kampyō (889-898)","Shōtai (898-901)","Engi (901-923)","Enchō (923-931)","Shōhei (931-938)","Tengyō (938-947)","Tenryaku (947-957)","Tentoku (957-961)","Ōwa (961-964)","Kōhō (964-968)","Anna (968-970)","Tenroku (970-973)","Ten-en (973-976)","Jōgen (976-978)","Tengen (978-983)","Eikan (983-985)","Kanna (985-987)","Ei-en (987-989)","Eiso (989-990)","Shōryaku (990-995)","Chōtoku (995-999)","Chōhō (999-1004)","Kankō (1004-1012)","Chōwa (1012-1017)","Kannin (1017-1021)","Jian (1021-1024)","Manju (1024-1028)","Chōgen (1028-1037)","Chōryaku (1037-1040)","Chōkyū (1040-1044)","Kantoku (1044-1046)","Eishō (1046-1053)","Tengi (1053-1058)","Kōhei (1058-1065)","Jiryaku (1065-1069)","Enkyū (1069-1074)","Shōho (1074-1077)","Shōryaku (1077-1081)","Eiho (1081-1084)","Ōtoku (1084-1087)","Kanji (1087-1094)","Kaho (1094-1096)","Eichō (1096-1097)","Shōtoku (1097-1099)","Kōwa (1099-1104)","Chōji (1104-1106)","Kashō (1106-1108)","Tennin (1108-1110)","Ten-ei (1110-1113)","Eikyū (1113-1118)","Gen-ei (1118-1120)","Hoan (1120-1124)","Tenji (1124-1126)","Daiji (1126-1131)","Tenshō (1131-1132)","Chōshō (1132-1135)","Hoen (1135-1141)","Eiji (1141-1142)","Kōji (1142-1144)","Tenyō (1144-1145)","Kyūan (1145-1151)","Ninpei (1151-1154)","Kyūju (1154-1156)","Hogen (1156-1159)","Heiji (1159-1160)","Eiryaku (1160-1161)","Ōho (1161-1163)","Chōkan (1163-1165)","Eiman (1165-1166)","Nin-an (1166-1169)","Kaō (1169-1171)","Shōan (1171-1175)","Angen (1175-1177)","Jishō (1177-1181)","Yōwa (1181-1182)","Juei (1182-1184)","Genryuku (1184-1185)","Bunji (1185-1190)","Kenkyū (1190-1199)","Shōji (1199-1201)","Kennin (1201-1204)","Genkyū (1204-1206)","Ken-ei (1206-1207)","Shōgen (1207-1211)","Kenryaku (1211-1213)","Kenpō (1213-1219)","Shōkyū (1219-1222)","Jōō (1222-1224)","Gennin (1224-1225)","Karoku (1225-1227)","Antei (1227-1229)","Kanki (1229-1232)","Jōei (1232-1233)","Tempuku (1233-1234)","Bunryaku (1234-1235)","Katei (1235-1238)","Ryakunin (1238-1239)","En-ō (1239-1240)","Ninji (1240-1243)","Kangen (1243-1247)","Hōji (1247-1249)","Kenchō (1249-1256)","Kōgen (1256-1257)","Shōka (1257-1259)","Shōgen (1259-1260)","Bun-ō (1260-1261)","Kōchō (1261-1264)","Bun-ei (1264-1275)","Kenji (1275-1278)","Kōan (1278-1288)","Shōō (1288-1293)","Einin (1293-1299)","Shōan (1299-1302)","Kengen (1302-1303)","Kagen (1303-1306)","Tokuji (1306-1308)","Enkei (1308-1311)","Ōchō (1311-1312)","Shōwa (1312-1317)","Bunpō (1317-1319)","Genō (1319-1321)","Genkyō (1321-1324)","Shōchū (1324-1326)","Kareki (1326-1329)","Gentoku (1329-1331)","Genkō (1331-1334)","Kemmu (1334-1336)","Engen (1336-1340)","Kōkoku (1340-1346)","Shōhei (1346-1370)","Kentoku (1370-1372)","Bunchũ (1372-1375)","Tenju (1375-1379)","Kōryaku (1379-1381)","Kōwa (1381-1384)","Genchũ (1384-1392)","Meitoku (1384-1387)","Kakei (1387-1389)","Kōō (1389-1390)","Meitoku (1390-1394)","Ōei (1394-1428)","Shōchō (1428-1429)","Eikyō (1429-1441)","Kakitsu (1441-1444)","Bun-an (1444-1449)","Hōtoku (1449-1452)","Kyōtoku (1452-1455)","Kōshō (1455-1457)","Chōroku (1457-1460)","Kanshō (1460-1466)","Bunshō (1466-1467)","Ōnin (1467-1469)","Bunmei (1469-1487)","Chōkyō (1487-1489)","Entoku (1489-1492)","Meiō (1492-1501)","Bunki (1501-1504)","Eishō (1504-1521)","Taiei (1521-1528)","Kyōroku (1528-1532)","Tenmon (1532-1555)","Kōji (1555-1558)","Eiroku (1558-1570)","Genki (1570-1573)","Tenshō (1573-1592)","Bunroku (1592-1596)","Keichō (1596-1615)","Genwa (1615-1624)","Kan-ei (1624-1644)","Shōho (1644-1648)","Keian (1648-1652)","Shōō (1652-1655)","Meiryaku (1655-1658)","Manji (1658-1661)","Kanbun (1661-1673)","Enpō (1673-1681)","Tenwa (1681-1684)","Jōkyō (1684-1688)","Genroku (1688-1704)","Hōei (1704-1711)","Shōtoku (1711-1716)","Kyōhō (1716-1736)","Genbun (1736-1741)","Kanpō (1741-1744)","Enkyō (1744-1748)","Kan-en (1748-1751)","Hōryaku (1751-1764)","Meiwa (1764-1772)","An-ei (1772-1781)","Tenmei (1781-1789)","Kansei (1789-1801)","Kyōwa (1801-1804)","Bunka (1804-1818)","Bunsei (1818-1830)","Tenpō (1830-1844)","Kōka (1844-1848)","Kaei (1848-1854)","Ansei (1854-1860)","Man-en (1860-1861)","Bunkyū (1861-1864)","Genji (1864-1865)","Keiō (1865-1868)","M","T","S","H"],short:["Taika (645-650)","Hakuchi (650-671)","Hakuhō (672-686)","Shuchō (686-701)","Taihō (701-704)","Keiun (704-708)","Wadō (708-715)","Reiki (715-717)","Yōrō (717-724)","Jinki (724-729)","Tempyō (729-749)","Tempyō-kampō (749-749)","Tempyō-shōhō (749-757)","Tempyō-hōji (757-765)","Temphō-jingo (765-767)","Jingo-keiun (767-770)","Hōki (770-780)","Ten-ō (781-782)","Enryaku (782-806)","Daidō (806-810)","Kōnin (810-824)","Tenchō (824-834)","Jōwa (834-848)","Kajō (848-851)","Ninju (851-854)","Saiko (854-857)","Tennan (857-859)","Jōgan (859-877)","Genkei (877-885)","Ninna (885-889)","Kampyō (889-898)","Shōtai (898-901)","Engi (901-923)","Enchō (923-931)","Shōhei (931-938)","Tengyō (938-947)","Tenryaku (947-957)","Tentoku (957-961)","Ōwa (961-964)","Kōhō (964-968)","Anna (968-970)","Tenroku (970-973)","Ten-en (973-976)","Jōgen (976-978)","Tengen (978-983)","Eikan (983-985)","Kanna (985-987)","Ei-en (987-989)","Eiso (989-990)","Shōryaku (990-995)","Chōtoku (995-999)","Chōhō (999-1004)","Kankō (1004-1012)","Chōwa (1012-1017)","Kannin (1017-1021)","Jian (1021-1024)","Manju (1024-1028)","Chōgen (1028-1037)","Chōryaku (1037-1040)","Chōkyū (1040-1044)","Kantoku (1044-1046)","Eishō (1046-1053)","Tengi (1053-1058)","Kōhei (1058-1065)","Jiryaku (1065-1069)","Enkyū (1069-1074)","Shōho (1074-1077)","Shōryaku (1077-1081)","Eiho (1081-1084)","Ōtoku (1084-1087)","Kanji (1087-1094)","Kaho (1094-1096)","Eichō (1096-1097)","Shōtoku (1097-1099)","Kōwa (1099-1104)","Chōji (1104-1106)","Kashō (1106-1108)","Tennin (1108-1110)","Ten-ei (1110-1113)","Eikyū (1113-1118)","Gen-ei (1118-1120)","Hoan (1120-1124)","Tenji (1124-1126)","Daiji (1126-1131)","Tenshō (1131-1132)","Chōshō (1132-1135)","Hoen (1135-1141)","Eiji (1141-1142)","Kōji (1142-1144)","Tenyō (1144-1145)","Kyūan (1145-1151)","Ninpei (1151-1154)","Kyūju (1154-1156)","Hogen (1156-1159)","Heiji (1159-1160)","Eiryaku (1160-1161)","Ōho (1161-1163)","Chōkan (1163-1165)","Eiman (1165-1166)","Nin-an (1166-1169)","Kaō (1169-1171)","Shōan (1171-1175)","Angen (1175-1177)","Jishō (1177-1181)","Yōwa (1181-1182)","Juei (1182-1184)","Genryuku (1184-1185)","Bunji (1185-1190)","Kenkyū (1190-1199)","Shōji (1199-1201)","Kennin (1201-1204)","Genkyū (1204-1206)","Ken-ei (1206-1207)","Shōgen (1207-1211)","Kenryaku (1211-1213)","Kenpō (1213-1219)","Shōkyū (1219-1222)","Jōō (1222-1224)","Gennin (1224-1225)","Karoku (1225-1227)","Antei (1227-1229)","Kanki (1229-1232)","Jōei (1232-1233)","Tempuku (1233-1234)","Bunryaku (1234-1235)","Katei (1235-1238)","Ryakunin (1238-1239)","En-ō (1239-1240)","Ninji (1240-1243)","Kangen (1243-1247)","Hōji (1247-1249)","Kenchō (1249-1256)","Kōgen (1256-1257)","Shōka (1257-1259)","Shōgen (1259-1260)","Bun-ō (1260-1261)","Kōchō (1261-1264)","Bun-ei (1264-1275)","Kenji (1275-1278)","Kōan (1278-1288)","Shōō (1288-1293)","Einin (1293-1299)","Shōan (1299-1302)","Kengen (1302-1303)","Kagen (1303-1306)","Tokuji (1306-1308)","Enkei (1308-1311)","Ōchō (1311-1312)","Shōwa (1312-1317)","Bunpō (1317-1319)","Genō (1319-1321)","Genkyō (1321-1324)","Shōchū (1324-1326)","Kareki (1326-1329)","Gentoku (1329-1331)","Genkō (1331-1334)","Kemmu (1334-1336)","Engen (1336-1340)","Kōkoku (1340-1346)","Shōhei (1346-1370)","Kentoku (1370-1372)","Bunchū (1372-1375)","Tenju (1375-1379)","Kōryaku (1379-1381)","Kōwa (1381-1384)","Genchū (1384-1392)","Meitoku (1384-1387)","Kakei (1387-1389)","Kōō (1389-1390)","Meitoku (1390-1394)","Ōei (1394-1428)","Shōchō (1428-1429)","Eikyō (1429-1441)","Kakitsu (1441-1444)","Bun-an (1444-1449)","Hōtoku (1449-1452)","Kyōtoku (1452-1455)","Kōshō (1455-1457)","Chōroku (1457-1460)","Kanshō (1460-1466)","Bunshō (1466-1467)","Ōnin (1467-1469)","Bunmei (1469-1487)","Chōkyō (1487-1489)","Entoku (1489-1492)","Meiō (1492-1501)","Bunki (1501-1504)","Eishō (1504-1521)","Taiei (1521-1528)","Kyōroku (1528-1532)","Tenmon (1532-1555)","Kōji (1555-1558)","Eiroku (1558-1570)","Genki (1570-1573)","Tenshō (1573-1592)","Bunroku (1592-1596)","Keichō (1596-1615)","Genwa (1615-1624)","Kan-ei (1624-1644)","Shōho (1644-1648)","Keian (1648-1652)","Shōō (1652-1655)","Meiryaku (1655-1658)","Manji (1658-1661)","Kanbun (1661-1673)","Enpō (1673-1681)","Tenwa (1681-1684)","Jōkyō (1684-1688)","Genroku (1688-1704)","Hōei (1704-1711)","Shōtoku (1711-1716)","Kyōhō (1716-1736)","Genbun (1736-1741)","Kanpō (1741-1744)","Enkyō (1744-1748)","Kan-en (1748-1751)","Hōryaku (1751-1764)","Meiwa (1764-1772)","An-ei (1772-1781)","Tenmei (1781-1789)","Kansei (1789-1801)","Kyōwa (1801-1804)","Bunka (1804-1818)","Bunsei (1818-1830)","Tenpō (1830-1844)","Kōka (1844-1848)","Kaei (1848-1854)","Ansei (1854-1860)","Man-en (1860-1861)","Bunkyū (1861-1864)","Genji (1864-1865)","Keiō (1865-1868)","Meiji","Taishō","Shōwa","Heisei"]}},persian:{months:{long:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"]},eras:{short:["AP"]}},roc:{eras:{short:["Before R.O.C.","R.O.C."]}}}},number:{nu:["latn"],patterns:{decimal:{positivePattern:"{number}",negativePattern:"-{number}"},currency:{positivePattern:"{currency}{number}",negativePattern:"-{currency}{number}"},percent:{positivePattern:"{number}%",negativePattern:"-{number}%"}},symbols:{latn:{decimal:".",group:",",nan:"NaN",percent:"%",infinity:"∞"}},currencies:{AUD:"A$",BRL:"R$",CAD:"CA$",CNY:"CN¥",ERN:"Nfk",EUR:"€",GBP:"£",HKD:"HK$",ILS:"₪",INR:"₹",JPY:"JP¥",KRW:"₩",MXN:"MX$",NZD:"NZ$",THB:"฿",TWD:"NT$",USD:"US$",VND:"₫",XAF:"FCFA",XCD:"EC$",XOF:"CFA",XPF:"CFPF"}}})
|
'use strict';
const helmet = require('helmet');
module.exports = ({ app, conf }) =>
app.use(helmet(conf.get('helmet', {})));
|
/* jshint esversion: 6 */
var caffe2 = caffe2 || {};
var protobuf = protobuf || require('./protobuf');
caffe2.ModelFactory = class {
match(context) {
const identifier = context.identifier.toLowerCase();
const extension = identifier.split('.').pop().toLowerCase();
switch (extension) {
case 'pb': {
const tags = context.tags('pb');
if (tags.size > 0 &&
Array.from(tags.keys()).every((tag) => tag <= 9) &&
Array.from(tags.values()).every((type) => type <= 4)) {
if (tags.size === 1 && tags.get(2) === 2 && identifier.endsWith('saved_model.pb')) {
return false;
}
const schema = [[1,2],[2,2],[3,2],[4,0],[5,2],[6,2],[7,2],[8,2],[9,2]];
if (schema.every((pair) => !tags.has(pair[0]) || tags.get(pair[0]) === pair[1])) {
const stream = context.stream;
if (stream.length > 3) {
const buffer = stream.peek(Math.min(stream.length, 67));
if (buffer[0] == 0x0A) {
const size = buffer[1];
if (size < 64 &&
buffer.length > 2 + size + 1 &&
buffer.slice(2, 2 + size).every((c) => c >= 32 && c <= 127) &&
buffer[2 + size] == 0x12) {
return true;
}
}
if (buffer[0] == 0x12) {
return true;
}
}
}
}
break;
}
case 'pbtxt':
case 'prototxt': {
const tags = context.tags('pbtxt');
if (tags.has('op') && !tags.has('op.attr') && !tags.has('op.graph_op_name') && !tags.has('op.endpoint')) {
return true;
}
break;
}
}
return false;
}
open(context) {
return context.require('./caffe2-proto').then(() => {
return caffe2.Metadata.open(context).then((metadata) => {
const identifier = context.identifier;
const parts = identifier.split('.');
const extension = parts.pop().toLowerCase();
const base = parts.join('.');
if (extension == 'pbtxt' || extension == 'prototxt') {
const openText = (predictBuffer, initBuffer, initTextFormat) => {
let predict_net = null;
let init_net = null;
try {
caffe2.proto = protobuf.get('caffe2').caffe2;
const reader = protobuf.TextReader.create(predictBuffer);
reader.field = function(tag, message) {
if (message instanceof caffe2.proto.DeviceOption) {
message[tag] = this.read();
return;
}
throw new Error("Unknown field '" + tag + "'" + this.location());
};
predict_net = caffe2.proto.NetDef.decodeText(reader);
}
catch (error) {
const message = error && error.message ? error.message : error.toString();
throw new caffe2.Error('File text format is not caffe2.NetDef (' + message.replace(/\.$/, '') + ').');
}
try {
caffe2.proto = protobuf.get('caffe2').caffe2;
init_net = initTextFormat ?
caffe2.proto.NetDef.decodeText(protobuf.TextReader.create(initBuffer)) :
caffe2.proto.NetDef.decode(protobuf.Reader.create(initBuffer));
}
catch (error) {
// continue regardless of error
}
return new caffe2.Model(metadata, predict_net, init_net);
};
if (base.toLowerCase().endsWith('init_net') || base.toLowerCase().startsWith('init_net')) {
return context.request(identifier.replace('init_net', 'predict_net'), null).then((stream) => {
const buffer = stream.read();
return openText(buffer, context.stream.peek(), true);
}).catch(() => {
return openText(context.stream.peek(), null, true);
});
}
else if (base.toLowerCase().endsWith('predict_net') || base.toLowerCase().startsWith('predict_net')) {
return context.request(identifier.replace('predict_net', 'init_net').replace(/\.pbtxt/, '.pb'), null).then((stream) => {
const buffer = stream.read();
return openText(context.stream.peek(), buffer, false);
}).catch(() => {
return context.request(identifier.replace('predict_net', 'init_net'), null).then((stream) => {
const buffer = stream.read();
return openText(context.stream.peek(), buffer, true);
}).catch(() => {
return openText(context.stream.peek(), null, true);
});
});
}
else {
return context.request(base + '_init.pb', null).then((stream) => {
const buffer = stream.read();
return openText(context.stream.peek(), buffer, false);
}).catch(() => {
return openText(context.stream.peek(), null, false);
});
}
}
else {
const openBinary = (predictBuffer, initBuffer) => {
let predict_net = null;
let init_net = null;
try {
caffe2.proto = protobuf.get('caffe2').caffe2;
const reader = protobuf.Reader.create(predictBuffer);
predict_net = caffe2.proto.NetDef.decode(reader);
}
catch (error) {
const message = error && error.message ? error.message : error.toString();
throw new caffe2.Error('File format is not caffe2.NetDef (' + message.replace(/\.$/, '') + ').');
}
try {
if (initBuffer) {
caffe2.proto = protobuf.get('caffe2').caffe2;
const reader = protobuf.Reader.create(initBuffer);
init_net = caffe2.proto.NetDef.decode(reader);
}
}
catch (error) {
// continue regardless of error
}
return new caffe2.Model(metadata, predict_net, init_net);
};
if (base.toLowerCase().endsWith('init_net')) {
return context.request(base.replace(/init_net$/, '') + 'predict_net.' + extension, null).then((stream) => {
const buffer = stream.read();
return openBinary(buffer, context.stream.peek());
}).catch(() => {
return openBinary(context.stream.peek(), null);
});
}
else if (base.toLowerCase().endsWith('_init')) {
return context.request(base.replace(/_init$/, '') + '.' + extension, null).then((stream) => {
const buffer = stream.read();
return openBinary(buffer, context.stream.peek());
}).catch(() => {
return openBinary(context.stream.peek(), null);
});
}
else if (base.toLowerCase().endsWith('predict_net') || base.toLowerCase().startsWith('predict_net')) {
return context.request(identifier.replace('predict_net', 'init_net'), null).then((stream) => {
const buffer = stream.read();
return openBinary(context.stream.peek(), buffer);
}).catch(() => {
return openBinary(context.stream.peek(), null);
});
}
else {
return context.request(base + '_init.' + extension, null).then((stream) => {
const buffer = stream.read();
return openBinary(context.stream.peek(), buffer);
}).catch(() => {
return openBinary(context.stream.peek(), null);
});
}
}
});
});
}
};
caffe2.Model = class {
constructor(metadata, predict_net, init_net) {
this._domain = predict_net.domain || null;
const graph = new caffe2.Graph(metadata, predict_net, init_net);
this._graphs = [ graph ];
}
get format() {
return 'Caffe2';
}
get domain() {
return this._domain;
}
get graphs() {
return this._graphs;
}
};
caffe2.Graph = class {
constructor(metadata, netDef, init) {
this._name = netDef.name || '';
this._type = netDef.type || '';
this._nodes = [];
const inputs = new Map();
for (const input of netDef.external_input) {
inputs.set(input, {});
}
if (init) {
for (const op of init.op) {
if (op.output && op.output.length == 1) {
const name = op.output[0];
if (!inputs.has(name)) {
inputs.set(name, {});
}
const initializer = inputs.get(name);
for (const arg of op.arg) {
initializer[arg.name] = arg;
}
switch (op.type) {
case 'GivenTensorFill':
initializer.dataType = 'float32';
break;
case 'GivenTensorDoubleFill':
initializer.dataType = 'float64';
break;
case 'GivenTensorBoolFill':
initializer.dataType = 'boolean';
break;
case 'GivenTensorByteStringToUInt8Fill':
initializer.dataType = 'uint8';
break;
case 'GivenTensorInt16Fill':
case 'GivenTensorSInt16Fill':
initializer.dataType = 'int16';
break;
case 'GivenTensorIntFill':
initializer.dataType = 'int32';
break;
case 'GivenTensorInt64Fill':
initializer.dataType = 'int64';
break;
case 'GivenTensorStringFill':
initializer.dataType = 'string';
break;
case 'Int8GivenIntTensorFill':
initializer.dataType = 'int32';
break;
case 'Int8GivenTensorFill':
initializer.dataType = 'int8';
break;
case 'XavierFill':
break;
case 'ConstantFill':
break;
default:
throw new caffe2.Error("Unknown init op '" + op.type + "'.");
}
if (initializer.values && initializer.values.floats && (initializer.values.floats.length !== 1 || initializer.values.floats[0] !== 0)) {
initializer.input = false;
}
}
}
}
const scope = {};
let index = 0;
for (const op of netDef.op) {
op.input = op.input.map((input) => scope[input] ? scope[input] : input);
op.output = op.output.map((output) => {
if (scope[output]) {
const next = output + '\n' + index.toString(); // custom argument id
scope[output] = next;
return next;
}
scope[output] = output;
return output;
});
index++;
}
let lastNode = null;
let lastOutput = null;
for (const op of netDef.op) {
const node = new caffe2.Node(metadata, op, inputs);
if (op.input.length == 1 &&
op.output.length >= 1 &&
op.input[0].split('\n').shift() == op.output[0].split('\n').shift() &&
lastNode &&
lastOutput == op.input[0].split('\n').shift()) {
lastNode.chain.push(node);
}
else {
this._nodes.push(node);
lastNode = null;
lastOutput = null;
if (op.output.length == 1) {
lastNode = node;
lastOutput = op.output[0].split('\n').shift();
}
}
}
this._inputs = [];
for (const input of netDef.external_input) {
if (netDef.external_input.length > 1) {
const initializer = inputs.get(input);
if (initializer && initializer.input === false) {
continue;
}
}
this._inputs.push(new caffe2.Parameter(input, [ new caffe2.Argument(input, null, null) ]));
}
this._outputs = [];
for (const output of netDef.external_output) {
this._outputs.push(new caffe2.Parameter(output, [ new caffe2.Argument(output, null, null) ]));
}
}
get name() {
return this._name;
}
get type() {
return this._type;
}
get inputs() {
return this._inputs;
}
get outputs() {
return this._outputs;
}
get nodes() {
return this._nodes;
}
toString() {
return 'graph(' + this.name + ')';
}
};
caffe2.Parameter = class {
constructor(name, args) {
this._name = name;
this._arguments = args;
}
get name() {
return this._name;
}
get visible() {
return true;
}
get arguments() {
return this._arguments;
}
};
caffe2.Argument = class {
constructor(name, type, initializer) {
if (typeof name !== 'string') {
throw new caffe2.Error("Invalid argument identifier '" + JSON.stringify(name) + "'.");
}
this._name = name;
this._type = type || null;
this._initializer = initializer || null;
}
get name() {
return this._name;
}
get type() {
if (this._initializer) {
return this._initializer.type;
}
return this._type;
}
get quantization() {
if (this._initializer) {
return this._initializer.quantization;
}
return null;
}
get initializer() {
return this._initializer;
}
};
caffe2.Node = class {
constructor(metadata, op, initializers) {
this._name = op.name || '';
this._device = op.engine || '';
this._metadata = metadata;
this._type = op.type;
this._chain = [];
this._attributes = [];
for (const arg of op.arg) {
this._attributes.push(new caffe2.Attribute(metadata, metadata.attribute(this._type, arg.name), arg));
}
const schema = metadata.type(this._type);
const inputs = op.input;
const outputs = op.output;
const tensors = {};
let index = 0;
for (const input of inputs) {
if (index > 0 && initializers.has(input)) {
const initializer = initializers.get(input);
tensors[input] = new caffe2.Tensor(input, initializer);
initializer.input = false;
}
index++;
}
for (const output of outputs) {
if (initializers.has(output)) {
const initializer = initializers.get(output);
initializer.input = false;
}
}
this._inputs = [];
let inputIndex = 0;
if (schema && schema.inputs) {
for (const inputDef of schema.inputs) {
if (inputIndex < inputs.length || inputDef.option != 'optional') {
const inputCount = (inputDef.option == 'variadic') ? (inputs.length - inputIndex) : 1;
const inputArguments = inputs.slice(inputIndex, inputIndex + inputCount).filter((id) => id != '' || inputDef.option != 'optional').map((id) => {
return new caffe2.Argument(id, null, tensors[id]);
});
this._inputs.push(new caffe2.Parameter(inputDef.name, inputArguments));
inputIndex += inputCount;
}
}
}
else {
this._inputs.push(...inputs.slice(inputIndex).map((input, index) => {
const inputName = ((inputIndex + index) == 0) ? 'input' : (inputIndex + index).toString();
return new caffe2.Parameter(inputName, [
new caffe2.Argument(input, null, tensors[input])
]);
}));
}
this._outputs = [];
let outputIndex = 0;
if (schema && schema.outputs) {
for (const outputDef of schema.outputs) {
if (outputIndex < outputs.length || outputDef.option != 'optional') {
const outputCount = (outputDef.option == 'variadic') ? (outputs.length - outputIndex) : 1;
const outputArguments = outputs.slice(outputIndex, outputIndex + outputCount).map((id) => new caffe2.Argument(id));
this._outputs.push(new caffe2.Parameter(outputDef.name, outputArguments));
outputIndex += outputCount;
}
}
}
else {
this._outputs.push(...outputs.slice(outputIndex).map((output, index) => {
const outputName = ((outputIndex + index) == 0) ? 'output' : (outputIndex + index).toString();
return new caffe2.Parameter(outputName, [
new caffe2.Argument(output, null, null)
]);
}));
}
}
get name() {
return this._name || '';
}
get device() {
return this._device || '';
}
get type() {
return this._type;
}
get metadata() {
return this._metadata.type(this._type);
}
get inputs() {
return this._inputs;
}
get outputs() {
return this._outputs;
}
get attributes() {
return this._attributes;
}
get chain() {
return this._chain;
}
};
caffe2.Attribute = class {
constructor(metadata, schema, arg) {
this._name = arg.name;
if (arg.floats && arg.floats.length > 0) {
this._value = arg.floats;
}
else if (arg.ints && arg.ints.length > 0) {
this._value = arg.ints;
}
else if (arg.nets && arg.nets.length > 0) {
this._value = arg.nets.map((net) => new caffe2.Graph(metadata, net, null));
this._type = 'graph[]';
}
else if (arg.n) {
this._value = new caffe2.Graph(metadata, arg.n, null);
this._type = 'graph';
}
else if (arg.i != 0) {
this._value = arg.i;
}
else {
this._value = arg.i;
}
if (schema) {
if (Object.prototype.hasOwnProperty.call(schema, 'type')) {
this._type = schema.type;
if (this._type == 'boolean') {
switch (this._value) {
case 1: this._value = true; break;
case 0: this._value = false; break;
}
}
}
}
if (schema) {
if (Object.prototype.hasOwnProperty.call(schema, 'visible') && !schema.visible) {
this._visible = false;
}
else if (Object.prototype.hasOwnProperty.call(schema, 'default')) {
if (this._value == schema.default || (this._value && this._value.toString() == schema.default.toString())) {
this._visible = false;
}
}
}
}
get name() {
return this._name;
}
get type() {
return this._type || null;
}
get value() {
return this._value;
}
get visible() {
return this._visible == false ? false : true;
}
};
caffe2.Tensor = class {
constructor(name, tensor) {
this._name = name;
const shape = tensor.shape && tensor.shape.ints ? tensor.shape.ints : null;
this._type = new caffe2.TensorType(tensor.dataType, new caffe2.TensorShape(shape));
this._values = tensor.values || null;
this._scale = tensor.Y_scale ? tensor.Y_scale.f : 0;
this._zeroPoint = tensor.Y_zero_point ? tensor.Y_zero_point.i : 0;
}
get name() {
return this._name;
}
get type() {
return this._type;
}
get kind() {
return 'Initializer';
}
get quantization() {
if (this._scale != 0 || this._zeroPoint != 0) {
return this._scale.toString() + ' * ' + (this._zeroPoint == 0 ? 'q' : ('(q - ' + this._zeroPoint.toString() + ')'));
}
return null;
}
get state() {
return this._context().state;
}
get value() {
const context = this._context();
if (context.state) {
return null;
}
context.limit = Number.MAX_SAFE_INTEGER;
return this._decode(context, 0);
}
toString() {
const context = this._context();
if (context.state) {
return '';
}
context.limit = 10000;
const value = this._decode(context, 0);
return caffe2.Tensor._stringify(value, '', ' ');
}
_context() {
const context = {};
context.state = null;
context.index = 0;
context.count = 0;
if (!this._values) {
context.state = 'Tensor data is empty.';
return context;
}
if (this._values.floats === undefined) {
context.state = 'Tensor data is too large to load in Chrome.';
return context;
}
switch (this._type.dataType) {
case 'float32':
context.data = this._values.floats;
break;
case 'boolean':
context.data = this._values.ints;
break;
case 'int8':
context.data = new Int8Array(this._values.s);
break;
case 'int32':
context.data = this._values.ints;
break;
default:
context.state = 'Unknown data type.';
return context;
}
context.shape = this._type.shape.dimensions;
context.dataType = this._type.dataType;
return context;
}
_decode(context, dimension) {
const results = [];
const size = context.shape[dimension];
if (dimension == context.shape.length - 1) {
for (let i = 0; i < size; i++) {
if (context.count > context.limit) {
results.push('...');
return results;
}
switch (context.dataType) {
case 'float32':
results.push(context.data[context.index]);
break;
case 'boolean':
results.push(context.data[context.index] == 0 ? false : true);
break;
case 'int8':
results.push(context.data[context.index]);
break;
case 'int32':
results.push(context.data[context.index]);
break;
default:
context.state = 'Unknown data type.';
break;
}
context.index++;
context.count++;
}
}
else {
for (let j = 0; j < size; j++) {
if (context.count > context.limit) {
results.push('...');
return results;
}
results.push(this._decode(context, dimension + 1));
}
}
return results;
}
static _stringify(value, indentation, indent) {
if (Array.isArray(value)) {
const result = [];
result.push(indentation + '[');
const items = value.map((item) => caffe2.Tensor._stringify(item, indentation + indent, indent));
if (items.length > 0) {
result.push(items.join(',\n'));
}
result.push(indentation + ']');
return result.join('\n');
}
if (typeof value == 'string') {
return indentation + value;
}
if (value == Infinity) {
return indentation + 'Infinity';
}
if (value == -Infinity) {
return indentation + '-Infinity';
}
if (isNaN(value)) {
return indentation + 'NaN';
}
return indentation + value.toString();
}
};
caffe2.TensorType = class {
constructor(dataType, shape) {
this._dataType = dataType;
this._shape = shape;
}
get dataType() {
return this._dataType || '?';
}
get shape() {
return this._shape;
}
toString() {
return this.dataType + this._shape.toString();
}
};
caffe2.TensorShape = class {
constructor(dimensions) {
this._dimensions = dimensions;
}
get dimensions() {
return this._dimensions;
}
toString() {
return this._dimensions ? ('[' + this._dimensions.map((dimension) => dimension.toString()).join(',') + ']') : '';
}
};
caffe2.Metadata = class {
static open(context) {
if (caffe2.Metadata._metadata) {
return Promise.resolve(caffe2.Metadata._metadata);
}
return context.request('caffe2-metadata.json', 'utf-8', null).then((data) => {
caffe2.Metadata._metadata = new caffe2.Metadata(data);
return caffe2.Metadata._metadata;
}).catch(() => {
caffe2.Metadata._metadata = new caffe2.Metadata(null);
return caffe2.Metadata._metadata;
});
}
constructor(data) {
this._map = {};
this._attributeCache = {};
if (data) {
const items = JSON.parse(data);
if (items) {
for (const item of items) {
if (item.name && item.schema) {
item.schema.name = item.name;
this._map[item.name] = item.schema;
}
}
}
}
}
type(name) {
return this._map[name] || null;
}
attribute(type, name) {
let map = this._attributeCache[type];
if (!map) {
map = {};
const schema = this.type(type);
if (schema && schema.attributes && schema.attributes.length > 0) {
for (const attribute of schema.attributes) {
map[attribute.name] = attribute;
}
}
this._attributeCache[type] = map;
}
return map[name] || null;
}
};
caffe2.Error = class extends Error {
constructor(message) {
super(message);
this.name = 'Error loading Caffe2 model.';
}
};
if (typeof module !== 'undefined' && typeof module.exports === 'object') {
module.exports.ModelFactory = caffe2.ModelFactory;
}
|
"use strict";
exports.__esModule = true;
exports.c_nav__list_link_m_current_FontWeight = {
"name": "--pf-c-nav__list-link--m-current--FontWeight",
"value": "500",
"var": "var(--pf-c-nav__list-link--m-current--FontWeight)"
};
exports["default"] = exports.c_nav__list_link_m_current_FontWeight;
|
/* global __dirname */
'use strict';
var assign = require('deep-assign'),
chalk = require('chalk'),
fs = require('fs'),
loaderUtils = require('loader-utils'),
stylelint = require('stylelint');
var defaultOptions = {
displayOutput: true,
ignoreCache: false
};
var lintedFiles = [];
/**
* Determine if the provided file is in the cache
* @param {string} filePath the file to check
* @returns {bool} true if the file is in the cache
*/
function isCached(filePath) {
return lintedFiles.findIndex((entry) => { return entry === filePath; }) !== -1;
}
/**
* Returns the relative path
* @param {string} filePath the path to make relative
* @returns {string} the relative path
*/
function relativePath(filePath) {
return filePath.indexOf(__dirname) === 0 ? filePath.replace(__dirname, '.') : filePath;
}
/**
* Display a single error or warning
* @param {Object} warning the warning object
* @param {Number} warning.line the line number
* @param {Number} warning.column the column number
* @param {string} warning.text the error or warning message
* @param {string} warning.severity the severity (warning or error)
* @param {Object} options the loader options
* @param {Object} context the Webpack context
* @returns {void}
*/
function printWarningOrError(warning, options, context) {
var text = `${warning.line}:${warning.column} ${warning.text}`;
if (warning.severity === 'warning' || warning.severity === 'warn') {
if (options.displayOutput)
console.log(chalk.yellow(text));
context.emitWarning(text);
} else if (warning.severity === 'error') {
if (options.displayOutput)
console.log(chalk.red(text));
context.emitError(text);
} else if (typeof warning.severity === 'undefined') {
if (options.displayOutput)
console.log(chalk.red(warning.text));
context.emitError(text);
}
}
/**
* Lint the provided file
*
* @param {string|Buffer} content the content to be linted (not used in general)
* @param {object} options the loader options
* @param {object} context the webpack context
* @param {Function} callback the async callback
* @returns {object} the result from the callback
* @async
*/
function linter(content, options, context, callback) {
var filePath = relativePath(context.resourcePath),
lintOptions = {};
// Figure out if we need to process this file
if (!options.ignoreCache)
if (!isCached(context.resourcePath))
lintedFiles.push(context.resourcePath);
else {
return callback(null, content);
}
lintOptions = assign({}, options, {
files: context.resourcePath,
formatter: 'json'
});
// If the config file does not exist, then produce a warning
if (lintOptions.configFile)
try {
fs.statSync(lintOptions.configFile, fs.R_OK);
} catch (error) {
if (options.displayOutput)
console.log(chalk.yellow(`Configuration File ${lintOptions.configFile} cannot be found/read`));
context.emitWarning(`Configuration File ${lintOptions.configFile} cannot be found/read`);
return callback(null, content);
}
stylelint.lint(lintOptions)
.then((result) => {
return result.results[0];
})
.then((result) => {
var hasWarnings = typeof result.warnings !== 'undefined' &&
Array.isArray(result.warnings) &&
result.warnings.length > 0;
var hasDeprecations = typeof result.deprecations !== 'undefined' &&
Array.isArray(result.deprecations) &&
result.deprecations.length > 0;
var hasInvalidOptions = typeof result.invalidOptionWarnings !== 'undefined' &&
Array.isArray(result.invalidOptionWarnings) &&
result.invalidOptionWarnings.length > 0;
if (options.displayOutput && (hasWarnings || hasDeprecations || hasInvalidOptions))
console.log(chalk.blue.underline.bold(filePath));
if (hasDeprecations)
result.deprecations.forEach((deprecation) => {
deprecation.severity = 'warn';
deprecation.line = deprecation.line || 'config';
deprecation.column = deprecation.column || 'deprecated';
printWarningOrError(deprecation, options, context);
});
if (hasInvalidOptions)
result.invalidOptionWarnings.forEach((warning) => {
warning.severity = 'error';
warning.line = warning.line || 'config';
warning.column = warning.column || 'invalid';
printWarningOrError(warning, options, context);
});
if (hasWarnings)
result.warnings.forEach((warning) => {
printWarningOrError(warning, options, context);
});
if (options.displayOutput && (hasWarnings || hasDeprecations || hasInvalidOptions))
console.log('');
return callback(null, content);
}).catch((error) => {
return callback(error);
});
// If we get here, we are complete, but synchronous, so just return something
return null;
}
/**
* Webpack Loader Definition
*
* @param {string|buffer} content = the content to be linted
* @returns {object} the result of the callback
*/
module.exports = function (content) {
var callback = this.async();
var packOptions = this.options.stylelint || {};
var loaderOptions = loaderUtils.parseQuery(this.query);
var options = assign({}, defaultOptions, packOptions, loaderOptions);
if (this.cacheable) this.cacheable();
try {
return linter(content, options, this, callback);
} catch (error) {
console.error('[stylelint-loader] error = ', error.stack);
return callback(error);
}
};
|
import React from 'react'
import Isvg from 'react-inlinesvg'
import cloudboltItem from '../../icons/cloudbolt.svg'
import styles from './LoadingBolt.scss'
const LoadingBolt = () => (
<div className={styles.container}>
<div className={styles.content}>
<Isvg className={styles.bolt} src={cloudboltItem} />
<h1>loading</h1>
</div>
</div>
)
export default LoadingBolt;
|
import React from "react";
import Modal from "react-responsive-modal";
import { transitionStyles, customStyles } from "./reactModal.config";
import "./show.scss";
class MixableShow extends React.Component {
componentDidMount() {
if (this.props.mixableId) {
this.props.fetchMixable(this.props.mixableId);
}
}
componentWillReceiveProps(nextProps) {
if (nextProps.mixableId !== this.props.mixableId) {
this.props.fetchMixable(nextProps.mixableId);
}
}
render() {
const { mixables, mixableId } = this.props;
const drink = mixables[mixableId];
return (
<section className="mixableShow">
<Modal
open={this.props.modalOpen}
onClose={this.props.closeModal}
little
classNames={transitionStyles}
styles={customStyles}
animationDuration={100}
>
{this.content(drink)}
</Modal>
</section>
);
}
steps(instructions) {
return (
<ol className="mixableShow__steps">
{instructions.map((step, idx) => {
const period = idx === instructions.length - 1 ? "" : ".";
return (
<li className="mixableShow__step" key={idx}>
{step + period}
</li>
);
})}
</ol>
);
}
ingredients(drink) {
return (
<ul>
{drink.ingredients.map(ingredient => {
const { _id, amount } = ingredient;
let amtSuffix = amount.length > 0 ? `, ${amount}` : "";
return <li key={_id}>{_id + amtSuffix}</li>;
})}
</ul>
);
}
content(drink) {
if (!drink) {
return "<Loading />";
}
const instructions = drink.instructions.split(". ");
return (
<article>
<img
className="mixableShow__image"
src={drink.imgUrl}
alt={drink._id}
width="150"
height="150"
/>
<h1 className="mixableShow__title">{drink._id}</h1>
<h4 className="mixableShow__subTitle">Steps:</h4>
{this.steps(instructions)}
<h4 className="mixableShow__subTitle">Ingredients:</h4>
{this.ingredients(drink)}
<div className="mixableShow__bottomFiller" />
</article>
);
}
}
export default MixableShow;
|
var DYDRA_TOKEN = "replace this with your Dydra API access token";
var DYDRA_ACCOUNT = "replace this with your Dydra account name";
var DYDRA_REPOSITORY = "replace this with your Dydra repository name";
|
// ================================================================================
// Color Toggling
var form_blue = "rgb(111, 217, 239)";
var form_red = "rgb(255, 0, 0)";
var color_change_interval = 500;
function toggle_background_color(ele, color1, color2) {
if ($(ele).css("background-color") === color1 ) {
$(ele).css("background-color", color2);
}
else {
$(ele).css("background-color", color1);
}
}
function toggle_text_shadow(ele, color1, color2) {
let prev_shadow = $(ele).css("text-shadow");
let next_color = prev_shadow.includes(color1) ? color2 : color1;
let new_val = next_color + " -1px 0px 0px, " + next_color + " 0px 1px 0px, " + next_color + " 1px 0px 0px, " + next_color + " 0px 1px 0px";
$(ele).css("text-shadow", new_val);
}
function toggle_form_btn_background() {
toggle_background_color("#embed_form #mc-embedded-subscribe", form_red, form_blue);
}
function toggle_form_background() {
toggle_background_color("#embed_form", form_blue, form_red);
toggle_text_shadow("#embed_form h2", form_blue, form_red);
toggle_text_shadow("#embed_form label", form_blue, form_red);
}
function toggle_title_background() {
toggle_background_color("#header_text", form_red, form_blue);
toggle_text_shadow("#header_text h1", form_red, form_blue);
}
setInterval(toggle_form_btn_background, color_change_interval);
setInterval(toggle_form_background, color_change_interval);
setInterval(toggle_title_background, color_change_interval);
// ================================================================================
// JBOX
var correct_btn = new jBox('Modal', {
attach: '#trigger_form_btn',
title: '<h2>Congratulations! You found the button!</h2>',
content: '<p>You have found the button and have unlocked the secret form on this website.</p> <p>Do you dare to fill it?</p>',
addClass: "jbox_box",
maxWidth: 500
});
var auto_trigger = new jBox('Modal', {
title: 'Auto Triggered message',
content: 'There is a secret in this website. Can you find it?',
addClass: "jbox_box",
maxWidth: 500
});
auto_trigger.open();
// Drag anywhere
/*
new jBox('Modal', {
attach: $('#modal-drag-anywhere'),
width: 220,
title: 'jBox',
overlay: false,
createOnInit: true,
content: 'Drag me around by clicking anywhere',
draggable: true,
repositionOnOpen: false,
repositionOnContent: false
});
*/
// ================================================================================
// Form trigger button
$("#trigger_form_btn").on("click", function() {
$("#embed_form").css("display", "block");
correct_btn.detach();
});
|
import React from 'react';
import { Table } from 'antd';
import './index.less';
export default props => {
const { columns: dataSource } = props;
const columns = [
{
title: '列名',
dataIndex: 'Field',
key: 'Field'
},
{
title: '类型',
dataIndex: 'Type',
key: 'Type',
width: 60,
},
{
title: '长度',
dataIndex: 'MaxLength',
width: 60,
key: 'MaxLength'
},
{
title: '可空',
dataIndex: 'Null',
width: 60,
key: 'Null'
},
{
title: '主键',
dataIndex: 'Key',
width: 60,
key: 'Key',
},
{
title: '备注',
dataIndex: 'Comment',
key: 'Comment',
width: 240,
ellipsis: true
},
{
title: 'Extra',
dataIndex: 'Extra',
key: 'Extra',
width: 160,
ellipsis: true
}
];
return (
<div className="structure-page">
<Table
dataSource={dataSource}
columns={columns}
pagination={false}
rowKey="Field"
size="small"
/>
</div>
);
}
|
const usersData = [
{No_Transaksi: 0, Jenis_Jurnal: 'Jurnal 001', Keterangan: 'Add React to a Website - Create a New React App - Hello World', Status: 'Aktif'},
{No_Transaksi: 1, Jenis_Jurnal: 'Jurnal 002', Keterangan: 'React is a declarative, efficient, and flexible JavaScript library', Status: 'Aktif'},
{No_Transaksi: 2, Jenis_Jurnal: 'Jurnal 003', Keterangan: 'React Top-Level API. React is the entry point to the React library. ', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
{No_Transaksi: 3, Jenis_Jurnal: 'Jurnal 004', Keterangan: 'Conceptually, components are like JavaScript functions.st', Status: 'Aktif'},
]
export default usersData
|
/**
* Copyright 2021 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.
*/
// src/polyfills.js must be the first import.
import '../polyfills';
import {draw3p, init} from '../integration-lib';
import {register} from '../3p';
import {yektanet} from '../../ads/vendors/yektanet';
init(window);
register('yektanet', yektanet);
window.draw3p = draw3p;
|
// $Id: uc_cart.js,v 1.7.2.6 2008/11/03 21:26:35 rszrama Exp $
var copy_box_checked = false;
/**
* Scan the DOM and display the cancel and continue buttons.
*/
$(document).ready(
function() {
$('.show-onload').show();
$('form#uc-cart-checkout-review-form input#edit-submit').click(function() {
$(this).clone().insertAfter(this).attr('disabled', true).after('<span id=\"submit-throbber\" style=\"background: url(' + Drupal.settings['base_path'] + 'misc/throbber.gif) no-repeat 100% -20px;\"> </span>').end().hide();
$('#uc-cart-checkout-review-form #edit-back').attr('disabled', true);
});
}
);
/**
* When a customer clicks a Next button, expand the next pane, remove the
* button, and don't let it collapse again.
*/
function uc_cart_next_button_click(button, pane_id, current) {
if (current !== 'false') {
$('#' + current + '-pane legend a').click();
}
else {
button.disabled = true;
}
if ($('#' + pane_id + '-pane').attr('class').indexOf('collapsed') > -1 && $('#' + pane_id + '-pane').html() !== null) {
$('#' + pane_id + '-pane legend a').click();
}
return false;
}
/**
* Copy the delivery information to the payment information on the checkout
* screen if corresponding fields exist.
*/
function uc_cart_copy_address(checked, source, target) {
if (!checked) {
$('#' + target + '-pane div.address-pane-table').slideDown();
copy_box_checked = false;
return false;
}
if (target == 'billing') {
var x = 28;
}
else {
var x = 26;
}
// Hide the target information fields.
$('#' + target + '-pane div.address-pane-table').slideUp();
copy_box_checked = true;
// Copy over the zone options manually.
if ($('#edit-panes-' + target + '-' + target + '-zone').html() != $('#edit-panes-' + source + '-' + source + '-zone').html()) {
$('#edit-panes-' + target + '-' + target + '-zone').empty().append($('#edit-panes-' + source + '-' + source + '-zone').children().clone());
$('#edit-panes-' + target + '-' + target + '-zone').attr('disabled', $('#edit-panes-' + source + '-' + source + '-zone').attr('disabled'));
}
// Copy over the information and set it to update if delivery info changes.
$('#' + source + '-pane input, select, textarea').each(
function() {
if (this.id.substring(0, x) == 'edit-panes-' + source + '-' + source) {
$('#edit-panes-' + target + '-' + target + this.id.substring(x)).val($(this).val());
if (target == 'billing') {
$(this).change(function () { update_billing_field(this); });
}
else {
$(this).change(function () { update_delivery_field(this); });
}
}
}
);
return false;
}
function update_billing_field(field) {
if (copy_box_checked) {
if (field.id.substring(29) == 'zone') {
$('#edit-panes-billing-billing-zone').empty().append($('#edit-panes-delivery-delivery-zone').children().clone());
$('#edit-panes-billing-billing-zone').attr('disabled', $('#edit-panes-delivery-delivery-zone').attr('disabled'));
}
$('#edit-panes-billing-billing' + field.id.substring(28)).val($(field).val());
}
}
function update_delivery_field(field) {
if (copy_box_checked) {
if (field.id.substring(27) == 'zone') {
$('#edit-panes-delivery-delivery-zone').empty().append($('#edit-panes-billing-billing-zone').children().clone());
$('#edit-panes-delivery-delivery-zone').attr('disabled', $('#edit-panes-billing-billing-zone').attr('disabled'));
}
$('#edit-panes-delivery-delivery' + field.id.substring(26)).val($(field).val());
}
}
/**
* Apply the selected address to the appropriate fields in the cart form.
*/
function apply_address(type, address_str) {
if (address_str == '0') {
return;
}
eval('var address = ' + address_str + ';');
var temp = type + '-' + type;
$('#edit-panes-' + temp + '-first-name').val(address.first_name).trigger('change');
$('#edit-panes-' + temp + '-last-name').val(address.last_name).trigger('change');
$('#edit-panes-' + temp + '-phone').val(address.phone).trigger('change');
$('#edit-panes-' + temp + '-company').val(address.company).trigger('change');
$('#edit-panes-' + temp + '-street1').val(address.street1).trigger('change');
$('#edit-panes-' + temp + '-street2').val(address.street2).trigger('change');
$('#edit-panes-' + temp + '-city').val(address.city).trigger('change');
$('#edit-panes-' + temp + '-postal-code').val(address.postal_code).trigger('change');
if ($('#edit-panes-' + temp + '-country').val() != address.country) {
$('#edit-panes-' + temp + '-country').val(address.country).trigger('change');
try {
uc_update_zone_select('edit-panes-' + temp + '-country', address.zone);
}
catch (err) { }
}
$('#edit-panes-' + temp + '-zone').val(address.zone).trigger('change');
}
|
/*
* ! SAP UI development toolkit for HTML5 (SAPUI5) (c) Copyright 2009-2012 SAP AG. All rights reserved
*/
// Provides control sap.ui.vbm.Area.
sap.ui.define([
'./VoBase', './library'
], function(VoBase, library) {
"use strict";
/**
* Constructor for a new Area.
*
* @param {string} [sId] id for the new control, generated automatically if no id is given
* @param {object} [mSettings] initial settings for the new control
* @class Specific Visual Object element for an <i>Area</i>. An Area is a filled polygon, which border is given as a list of geo-coordinates.
* Areas can have multiple disjunct parts as well as each part can have an arbitrary number of exclusions/holes.<br>
* The inner part and the edges of areas are interactive and fire events on click.<br>
* Since the actual size of an area depends on the zoom level it might be only partly visible. Thus detail windows will open at the click
* position.
* @extends sap.ui.vbm.VoBase
* @constructor
* @public
* @alias sap.ui.vbm.Area
* @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
*/
var Area = VoBase.extend("sap.ui.vbm.Area", /** @lends sap.ui.vbm.Area.prototype */
{
metadata: {
library: "sap.ui.vbm",
properties: {
/**
* The position array for the Area. For single part areas the format is "lon0;lat0;0.0;...;lonN,latN,0.0". For multi part areas you
* need to provide an array of arrays of the above position string: "[['lon0...'],['lon0...']]" (sequence of single and double quotes
* is important). <b>Single and Multi part areas must not be mixed within one Areas aggregation.</b><br>
* Finally each area part can have multiple exclusions/holes. In that case the position list of excluded areas has follow the list of
* the base shape: "['lon0...', 'exLon0...']".
*/
position: {
type: "string",
group: "Misc",
defaultValue: null
},
/**
* The fill color of the Area.
*/
color: {
type: "string",
group: "Misc",
defaultValue: null
},
/**
* The border color of the Area.
*/
colorBorder: {
type: "string",
group: "Misc"
},
/**
* Defines the dashing style of the area border using an array.
*/
borderDash: {
type: "string",
group: "Misc"
}
},
events: {
// Events are implemented in Areas.js!
/**
* This event is raised when the edge of an Area is clicked.
*/
edgeClick: {
/**
* The number of the edge where the click occured; edges are numbered zero based: e.g. edge from point 1 to point 2 has number 0
*/
edge: {
type: "int"
}
},
/**
* This event is raised when the edge of an Area is right clicked.
*/
edgeContextMenu: {
/**
* The number of the edge where the click occured; edges are numbered zero based: e.g. edge from point 1 to point 2 has number 0
*/
edge: {
type: "int"
}
}
}
}
});
// /**
// * This file defines behavior for the control,
// */
// sap.ui.vbm.Area.prototype.init = function(){
// // do something for initialization...
// };
// Overwrite default impl from VoBase
Area.prototype.openDetailWindow = function(sCaption, sOffsetX, sOffsetY) {
this.oParent.openDetailWindow(this, {
caption: sCaption,
offsetX: sOffsetX,
offsetY: sOffsetY
}, true);
};
// Implement function defined in VoBase
Area.prototype.openContextMenu = function(oMenu) {
this.oParent.openContextMenu("Area", this, oMenu);
};
Area.prototype.getDataElement = function() {
var oElement = VoBase.prototype.getDataElement.apply(this, arguments);
var oBindInfo = this.oParent.mBindInfo;
// add the VO specific properties..................................//
if (oBindInfo.C) {
oElement.C = this.getColor();
}
if (oBindInfo.CB) {
var cb = this.getColorBorder();
if (cb != undefined && cb != "") {
oElement.CB = cb;
}
}
if (oBindInfo.BD) {
var bd = this.getBorderDash();
if (bd != undefined && bd != "") {
oElement.BD = bd;
}
}
var pos = this.getPosition();
if (pos.substring(0, 1) === "[") {
pos = pos.replace(/\'/g, "\"");
oElement.PM = JSON.parse(pos);
} else {
oElement.P = pos;
}
return oElement;
};
Area.prototype.handleChangedData = function(oElement) {
if (oElement.P) {
this.setPosition(oElement.P);
}
if (oElement.PM) {
jQuery.sap.log.error("sap.ui.vbm.Area: Change of areas with multiple parts not supported");
}
};
return Area;
});
|
var $$;
HBFav.UI.styles = {
timeline: {
profileImage: {
backgroundColor: "#fff",
width: 48,
height: 48,
top: 10,
left: 10
},
profileImageContainer: {
backgroundColor: "#fff",
width: Ti.UI.SIZE,
height: 68,
top: 0,
left: 0
},
bodyContainer: {
layout: 'vertical',
width: 245,
height: Ti.UI.SIZE,
left: 65,
top: 0
},
nameLabel: {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
left: 0,
top: 10,
bottom: 5,
color: '#000',
backgroundColor: "#fff",
font: {
fontSize: 16,
fontWeight: 'bold'
}
},
commentLabel: {
backgroundColor: "#fff",
opaque: true,
color: '#000',
top: 0,
left: 0,
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
bottom: 10,
font: {
fontSize: 16
}
},
titleContainer: {
layout: 'horizontal',
width: 245,
height: Ti.UI.SIZE,
backgroundColor: '#fff',
top: 0,
left: 0,
bottom: 10
},
titleLabel: {
backgroundColor: "#fff",
opacity: 1.0,
opaque: true,
color: '#3B5998',
top: 0,
left: 3,
width: 225,
height: Ti.UI.SIZE,
font: {
fontSize: 16
}
},
favicon: {
backgroundColor: "#fff",
opacity: 1.0,
width: 16,
height: 16,
top: 2,
left: 0
},
dateLabel: {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
top: 10,
right: 10,
color: '#999',
backgroundColor: "#fff",
opacity: 1.0,
font: {
fontSize: 14
}
}
},
form: {
label: {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
color: "#333",
shadowColor: "#fff",
shadowOffset: {
x: 0,
y: 1
},
font: {
fontSize: 14,
fontWeight: "bold"
}
},
textInput: {
color: '#194C7F',
top: 6,
left: 10,
width: 300,
height: 40,
backgroundColor: "#fff",
borderRadius: 10,
font: {
fontSize: 16
},
paddingLeft: 10,
paddingRight: 10
},
notice: {
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
left: 30,
right: 30,
textAlign: "center",
color: "#333",
shadowColor: "#fff",
shadowOffset: {
x: 0,
y: 1
},
font: {
fontSize: 12,
fontWeight: "bold"
}
}
}
};
$$ = HBFav.UI.styles;
|
/*
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
WebInspector.TextUtils = {
/**
* @param {string} char
* @return {boolean}
*/
isStopChar: function(char)
{
return (char > " " && char < "0") ||
(char > "9" && char < "A") ||
(char > "Z" && char < "_") ||
(char > "_" && char < "a") ||
(char > "z" && char <= "~");
},
/**
* @param {string} char
* @return {boolean}
*/
isWordChar: function(char)
{
return !WebInspector.TextUtils.isStopChar(char) && !WebInspector.TextUtils.isSpaceChar(char);
},
/**
* @param {string} char
* @return {boolean}
*/
isSpaceChar: function(char)
{
return WebInspector.TextUtils._SpaceCharRegex.test(char);
},
/**
* @param {string} word
* @return {boolean}
*/
isWord: function(word)
{
for (var i = 0; i < word.length; ++i) {
if (!WebInspector.TextUtils.isWordChar(word.charAt(i)))
return false;
}
return true;
},
/**
* @param {string} char
* @return {boolean}
*/
isOpeningBraceChar: function(char)
{
return char === "(" || char === "{";
},
/**
* @param {string} char
* @return {boolean}
*/
isClosingBraceChar: function(char)
{
return char === ")" || char === "}";
},
/**
* @param {string} char
* @return {boolean}
*/
isBraceChar: function(char)
{
return WebInspector.TextUtils.isOpeningBraceChar(char) || WebInspector.TextUtils.isClosingBraceChar(char);
},
/**
* @param {string} text
* @param {function(string):boolean} isWordChar
* @param {function(string)} wordCallback
*/
textToWords: function(text, isWordChar, wordCallback)
{
var startWord = -1;
for (var i = 0; i < text.length; ++i) {
if (!isWordChar(text.charAt(i))) {
if (startWord !== -1)
wordCallback(text.substring(startWord, i));
startWord = -1;
} else if (startWord === -1)
startWord = i;
}
if (startWord !== -1)
wordCallback(text.substring(startWord));
},
/**
* @param {string} line
* @return {string}
*/
lineIndent: function(line)
{
var indentation = 0;
while (indentation < line.length && WebInspector.TextUtils.isSpaceChar(line.charAt(indentation)))
++indentation;
return line.substr(0, indentation);
},
/**
* @param {string} text
* @return {boolean}
*/
isUpperCase: function(text)
{
return text === text.toUpperCase();
},
/**
* @param {string} text
* @return {boolean}
*/
isLowerCase: function(text)
{
return text === text.toLowerCase();
}
}
WebInspector.TextUtils._SpaceCharRegex = /\s/;
/**
* @enum {string}
*/
WebInspector.TextUtils.Indent = {
TwoSpaces: " ",
FourSpaces: " ",
EightSpaces: " ",
TabCharacter: "\t"
}
/**
* @constructor
* @param {function(string)} callback
* @param {boolean=} findMultiple
*/
WebInspector.TextUtils.BalancedJSONTokenizer = function(callback, findMultiple)
{
this._callback = callback;
this._index = 0;
this._balance = 0;
this._buffer = "";
this._findMultiple = findMultiple || false;
this._closingDoubleQuoteRegex = /[^\\](?:\\\\)*"/g;
}
WebInspector.TextUtils.BalancedJSONTokenizer.prototype = {
/**
* @param {string} chunk
*/
write: function(chunk)
{
this._buffer += chunk;
var lastIndex = this._buffer.length;
var buffer = this._buffer;
for (var index = this._index; index < lastIndex; ++index) {
var character = buffer[index];
if (character === "\"") {
this._closingDoubleQuoteRegex.lastIndex = index;
if (!this._closingDoubleQuoteRegex.test(buffer))
break;
index = this._closingDoubleQuoteRegex.lastIndex - 1;
} else if (character === "{") {
++this._balance;
} else if (character === "}") {
if (--this._balance === 0) {
this._lastBalancedIndex = index + 1;
if (!this._findMultiple)
break;
}
}
}
this._index = index;
this._reportBalanced();
},
_reportBalanced: function()
{
if (!this._lastBalancedIndex)
return;
this._callback(this._buffer.slice(0, this._lastBalancedIndex));
this._buffer = this._buffer.slice(this._lastBalancedIndex);
this._index -= this._lastBalancedIndex;
this._lastBalancedIndex = 0;
},
/**
* @return {string}
*/
remainder: function()
{
return this._buffer;
}
}
/**
* @interface
*/
WebInspector.TokenizerFactory = function() { }
WebInspector.TokenizerFactory.prototype = {
/**
* @param {string} mimeType
* @return {function(string, function(string, ?string, number, number))}
*/
createTokenizer: function(mimeType) { }
}
|
const { JSDOM } = require("jsdom");
const { promisify } = require("util");
const sizeOf = promisify(require("image-size"));
const blurryPlaceholder = require("./blurry-placeholder");
const srcset = require("./srcset");
const path = require("path");
const ACTIVATE_AVIF = false;
const processImage = async (img, outputPath) => {
let src = img.getAttribute("src");
if (/^(https?\:\/\/|\/\/)/i.test(src)) {
return;
}
if (/^\.+\//.test(src)) {
// resolve relative URL
src =
"/" +
path.relative("./_site/", path.resolve(path.dirname(outputPath), src));
}
let dimensions;
try {
dimensions = await sizeOf("_site/" + src);
} catch (e) {
console.warn(e.message, src);
return;
}
if (!img.getAttribute("width")) {
img.setAttribute("width", dimensions.width);
img.setAttribute("height", dimensions.height);
}
if (dimensions.type == "svg") {
return;
}
if (img.tagName == "IMG") {
// img.setAttribute("decoding", "async");
// img.setAttribute("loading", "lazy");
// Contain the intrinsic to the `--main-width` (width of the main article body)
// and the aspect ratio times that size. But because images are `max-width: 100%`
// use the `min` operator to set the actual dimensions of the image as the
// ceiling 🤯.
const containSize = `min(var(--main-width), ${
dimensions.width
}px) min(calc(var(--main-width) * ${
dimensions.height / dimensions.width
}), ${dimensions.height}px)`;
// img.setAttribute(
// "style",
// `background-size:cover;` +
// `contain-intrinsic-size: ${containSize};` +
// `background-image:url("${await blurryPlaceholder(src)}")`
// );
const doc = img.ownerDocument;
const picture = doc.createElement("amp-img");
//picture.setAttribute("src", await srcset(src, "webp"));
var src_webp = src.replace(".jpg", "-1920w.webp");
picture.setAttribute("src", src_webp);
picture.setAttribute("layout", "responsive");
await setSrcset(picture, src, "webp");
picture.setAttribute("width","1920"); // original:640
picture.setAttribute("height","900"); // original:457
// fallback jpg below
const picturejpg = doc.createElement("amp-img");
var src_jpg = src.replace(".jpg", "-1920w.jpg");
picturejpg.setAttribute("fallback","");
picturejpg.setAttribute("src", src_jpg);
picturejpg.setAttribute("layout", "responsive");
await setSrcset(picturejpg, src, "jpeg");
picturejpg.setAttribute("width","1920");
picturejpg.setAttribute("height","900");
picture.appendChild(picturejpg);
// const avif = doc.createElement("source");
// const webp = doc.createElement("source");
// const jpeg = doc.createElement("source");
//
// if (ACTIVATE_AVIF) {
// await setSrcset(avif, src, "avif");
// }
//
// avif.setAttribute("type", "image/avif");
// await setSrcset(webp, src, "webp");
// webp.setAttribute("type", "image/webp");
// await setSrcset(jpeg, src, "jpeg");
// jpeg.setAttribute("type", "image/jpeg");
// if (ACTIVATE_AVIF) {
// picture.appendChild(avif);
// }
// picture.appendChild(webp);
// picture.appendChild(jpeg);
img.parentElement.replaceChild(picture, img);
//picture.appendChild(img);
} else if (!img.getAttribute("srcset")) {
await setSrcset(img, src, "jpeg");
}
};
async function setSrcset(img, src, format) {
img.setAttribute("srcset", await srcset(src, format));
img.setAttribute(
"sizes",
img.getAttribute("align")
? "(max-width: 608px) 50vw, 187px"
: "(max-width: 608px) 100vw, 608px"
);
}
const dimImages = async (rawContent, outputPath) => {
let content = rawContent;
if (outputPath && outputPath.endsWith(".html")) {
const dom = new JSDOM(content);
const images = [...dom.window.document.querySelectorAll("img,amp-img")];
if (images.length > 0) {
await Promise.all(images.map((i) => processImage(i, outputPath)));
content = dom.serialize();
}
}
return content;
};
module.exports = {
initArguments: {},
configFunction: async (eleventyConfig, pluginOptions = {}) => {
eleventyConfig.addTransform("imgDim", dimImages);
},
};
|
define([
"esri/layers/GraphicsLayer",
"esri/layers/FeatureLayer",
"esri/symbols/TextSymbol",
"esri/layers/support/LabelClass",
"esri/tasks/support/Query",
"esri/Graphic",
"esri/geometry/support/webMercatorUtils",
"esri/kernel",
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/_base/array",
"dojo/on",
"dojo/has",
"require"
], function(
GraphicsLayer,
FeatureLayer,
TextSymbol,
LabelClass,
Query,
Graphic,
webMercatorUtils,
esriNS,
declare,
lang,
array,
on,
has,
require
){
var esriVersion = parseFloat(esriNS.version);
var isWebGL = has('esri-featurelayer-webgl')==1;
var clusterRenderer = {
type: "simple",
symbol: {
type: "simple-marker",
style: "circle",
size: 10,
color: [255, 255, 255, 0.6],
outline: {
width: 1.5,
color: "red",
style: "solid"
}
},
visualVariables: [{
type: "size",
field: "point_count",
minDataValue: 3,
maxDataValue: 1000,
// minimum size to render minDataVal at specified view scales
minSize: {
type: "size",
valueExpression: "$view.scale",
stops: [
{ value: 1128, size: "20px" },
{ value: 591657528, size: "12px" }
]
},
// maximum size to render maxDataVal at specified view scales
maxSize: {
type: "size",
valueExpression: "$view.scale",
stops: [
{ value: 1128, size: "60px" },
{ value: 288895, size: "50px" },
{ value: 73957191, size: "40px" },
{ value: 591657528, size: "12px" }
]
}
}]
};
// Default cluster fields...these will always be added as attributes for the
// features generated by th supercluster module.
var clusterFields = [{
name: "objectid",
alias: "Cluster ID in Local Index",
type: "oid"
}, {
name: "cluster_id",
alias: "Cluster ID in Local Index",
type: "long"
}, {
name: "point_count",
alias: "Total Points in Cluster Recorded",
type: "long"
}, {
name: "point_count_abbreviated",
alias: "Total Points in Cluster (abbreviated)",
type: "string"
}];
// A default cluster popup template...
var clusterPopupTemplate = {
title: "Cluster Info",
content: [{
type: "fields",
fieldInfos: [{
fieldName: "cluster_id",
label: "Cluster ID in Local Index",
visible: true
}, {
fieldName: "point_count",
label: "Total Points in Cluster",
visible: true
}, {
fieldName: "point_count_abbreviated",
label: "Total Points in Cluster (abbreviated)",
visible: true
}]
}]
};
var clusterLabelSymbol = {
type: "text",
color: "black",
haloColor: "blue",
haloSize: "40px",
text: "",
xoffset: 0,
yoffset: "-4px",
font: {
size: "12px",
family: "sans-serif",
weight: "bolder"
}
}
var clusterLabelingInfo = [new LabelClass({
labelExpressionInfo: {
expression: "$feature.point_count_abbreviated"
},
labelPlacement: "center-center",
symbol: {
type: "text",
color: "black",
font: {
size: 9,
family: "sans-serif",
weight: "normal"
}
}
})]
return FeatureLayer.createSubclass({
properties: {
clusterIndexReady: {},
source_definitionExpression: {}
},
constructor: function(opts){
var $this = this;
$this.opts = opts;
$this.featureLayerOpts = {};
$this.worker = new Worker(require.toUrl("./ClusterWorker.js"));
$this.worker.onmessage = function(e) {
if (e.data.workerReady) {
// message received when the worker has loaded, but needs
// a url to a script with the supercluster module.
$this.worker.postMessage({
supercluster: require.toUrl("./") + "../node_modules/supercluster/dist/supercluster.js"
});
} else if (e.data.superclusterReady) {
// The supercluster module is now loaded in the worker.
$this.clusterWorkerReady = true;
// If the layer is already added to a map view, then
// call the initClusterLayer() method to get things started.
if ($this.view) $this.initClusterLayer();
} else if (e.data.indexReady) {
// When the supercluster index is finished being
// prepared by the worker, we can start drawing the
// clusters on the map.
$this.clusterIndexReady = true;
$this.requestClusters(true);
} else {
// This will be a message from the worker containing
// clusters for the current zoom & extent.
$this.displayClusters(e.data);
}
};
for (var prop in $this.opts)
{
var val = $this.opts[prop];
if (prop == "source_url")
$this.featureLayerOpts.url = val;
else if (prop == "source_definitionExpression")
$this.featureLayerOpts.definitionExpression = val;
else if (prop == "source_outFields")
$this.featureLayerOpts.outFields = val;
else if (prop != "supercluster" && prop != "source" && prop != "popupTemplate" && prop != "renderer")
$this.featureLayerOpts[prop] = val;
}
if (!$this.opts.supercluster)
$this.opts.supercluster = {};
// This will store client-side features from the source feature layer:
$this.currentFeatures = [];
// This will store the graphics currently displayed in the main map view:
$this.currentClusters = [];
// Keep track of views that the map is displayed in.
$this.view = null;
$this.allViews = [];
// For convenience later on, this will make it easy to distinguish
// between client-side cluster attributes, and attributes associated with
// the underlying feature service ...
$this.clusterFieldNames = array.map(clusterFields, function(field) {
return field.name;
});
// Any supercluster fields provided will be appended to the default
// clusterFields. They should be matched by any properties that are
// defined/calculated by the supercluster initialize/map/reduce methods:
var fields = $this.opts.supercluster.fields || [];
$this.opts.fields = clusterFields.concat(array.filter(
fields,
function(field){
return $this.clusterFieldNames.indexOf(field.name) == -1;
}
));
// If no supercluster popup template is provided, use a default template...
if (!$this.opts.popupTemplate) $this.opts.popupTemplate = clusterPopupTemplate;
if ($this.opts.labelsVisible && esriVersion >= 4.9 && !isWebGL) $this.opts.labelWithGraphics = true;
if ($this.opts.labelWithGraphics) $this.opts.labelsVisible = false;
if ($this.opts.labelsVisible && !$this.opts.labelingInfo)
$this.opts.labelingInfo = clusterLabelingInfo;
if ($this.opts.labelsVisible && !$this.opts.labelingInfo)
$this.opts.labelingInfo = clusterLabelingInfo;
if (($this.opts.labelsVisible || $this.opts.labelWithGraphics) && !$this.opts.labelSymbol)
$this.opts.labelSymbol = clusterLabelSymbol;
if (($this.opts.labelsVisible || $this.opts.labelWithGraphics) && !$this.opts.labelField)
$this.opts.labelField = "point_count_abbreviated";
// Renderer can be anything, but should define appropriate symbols based
// on point_count, or any other attribute calculated by the SuperCluster
// reduce() method. Must be part of the supercluster parameters...
if (!$this.opts.renderer) $this.opts.renderer = clusterRenderer;
$this.opts.geometryType = "point";
$this.opts.spatialReference = { wkid: 4326 };
$this.opts.objectIdField = "objectid";
// Stash local graphics if they are provided directly in the constructor options:
if ($this.opts.source) $this.opts.source_features = $this.opts.source;
$this.opts.source = [];
return $this.inherited(arguments);
},
// The zoom level and extent used to define clustering will be based on the
// first view that the layer is added to...
createLayerView: function(mapView) {
if (!this.view) this.view = mapView;
this.allViews.push(mapView);
if (this.opts.labelWithGraphics) {
this.enableLabelGraphics();
}
this.watchView(this.view);
if (this.clusterWorkerReady)
{
this.initClusterLayer();
}
return this.inherited(arguments);
},
// If the layer is removed from a view, switch to the next view (if the
// layer has been added to more than one), or set this.view = null
destroyLayerView: function(mapView) {
this.allViews.splice(this.allViews.indexOf(mapView), 1);
if (this.allViews.indexOf(this.view) == -1)
{
if (this.allViews.length > 0) this.view = this.allViews[0];
else this.view = null;
}
this.watchView(this.view);
return this.inherited(arguments);
},
enableLabelGraphics: function() {
this.labelWithGraphics = true;
this.labelGraphics = new GraphicsLayer({ graphics: [], popupTemplate: this.popupTemplate });
this.view.map.add(this.labelGraphics);
if (isWebGL) this.labelGraphics.opacity = 0;
},
watchView: function(mapView)
{
var $this = this;
if ($this.stationaryWatch) $this.stationaryWatch.remove();
if ($this.scaleWatch) $this.scaleWatch.remove();
if (!mapView) return;
$this.stationaryWatch = $this.view.watch("stationary", function(stationary){ $this.refreshClusters(stationary); });
$this.scaleWatch = $this.view.watch("scale", function(){
if ($this.labelGraphics && isWebGL) $this.labelGraphics.opacity = 0;
});
},
initClusterLayer: function(e){
var $this = this;
if ($this.featureLayerOpts.url && !$this.featureLayerOpts.direct_url)
{
$this.source_layer = new FeatureLayer($this.featureLayerOpts);
$this.source_layer.load().then(function(){
$this.source_definitionExpression = $this.source_layer.definitionExpression;
$this.watch("source_definitionExpression", function(newExp, oldExp) {
$this.source_layer.definitionExpression = newExp;
$this.loadFeatures();
});
$this.loadFeatures();
}, function(e) {
console.log("Error: ", e);
});
} else {
$this.loadFeatures();
}
},
loadFeatures: function(where, offset) {
var $this = this;
// Initialize the ClusterWorker if it hasn't been done yet...
// Copy the supercluster options, remove the fields property (in
// case these have been defined as actual objects instead of simple
// JSON data).
var workerOpts = lang.mixin({}, $this.opts.supercluster);
if (workerOpts.fields) delete workerOpts.fields;
if (!$this.clusterIndexReady) $this.worker.postMessage({opts: workerOpts});
// If $this was instantiated with client-side graphics, then just load
// the supercluster index once...
if ($this.opts.source_features)
{
if ($this.currentFeatures.length > 0) return;
$this.worker.postMessage({
features: $this.opts.source_features,
type: "esri",
load: true
});
return;
}
// If this was instantiated with url, and direct_url==true, then pass the URL to
// the ClusterWorker, and let it load the URL as a raw JSON source...
if ($this.opts.source_url && $this.featureLayerOpts.direct_url)
{
if ($this.currentFeatures.length > 0) return;
// The direct_type can specify "esri" for an Esri FeatureSet JSON
// representation, "coords" for an array of
// raw lon/lat pairs, or "geojson"...
$this.worker.postMessage({
url: $this.opts.source_url,
load: true,
type: $this.featureLayerOpts.direct_type || "geojson"
});
return;
}
// At this point, it is expected that a source_url parameter was provided which
// should point to a layer in a FeatureServer.
// Setup default parameters, and start querying the layer for features:
where = where || $this.source_layer.definitionExpression || "1=1";
offset = offset || 0;
// If this is a new query, then initialize a new geojson features object
if (offset == 0) $this.currentFeatures = [];
// Get appropriate outFields to ask for when querying the underlying
// feature layer...this must exclude the clusterFieldNames (which are
// generated locally by the supercluster module)...
var outFields = array.filter($this.source_layer.outFields, function(fieldname){
return $this.clusterFieldNames.indexOf(fieldname) == -1;
});
if (outFields.length == 0) outFields = [$this.source_layer.objectIdField];
// Define the query parameters...
var query = new Query({
num: $this.source_layer.maxRecordCount || 1000,
start: offset,
where: where,
outFields: outFields,
outSpatialReference: {wkid: 4326},
returnGeometry: true
});
// Define a method in scope that will handle the query response...
var handleQueryResponse = function(results){
// Pass features to the cluster worker (as plain JSON).
$this.worker.postMessage({
features: results.features.map(esriObjectToJSON),
type: "esri",
load: !results.exceededTransferLimit
});
// Keep querying for more...
if (results.exceededTransferLimit) {
query.start += results.features.length;
$this.source_layer.queryFeatures(query).then(handleQueryResponse);
}
};
// Start querying the underlying layer for features...
$this.source_layer.queryFeatures(query).then(handleQueryResponse);
},
requestClusters: function() {
var $this = this;
$this.requesting_clusters = true;
if ($this.clusterIndexReady && $this.view) {
var zoom = parseInt(Math.round($this.view.zoom));
var extent = webMercatorUtils.webMercatorToGeographic(
zoom < 5 ? $this.view.map.basemap.baseLayers.items[0].fullExtent : $this.view.extent
);
$this.worker.postMessage({bbox: [extent.xmin, extent.ymin, extent.xmax, extent.ymax], zoom: zoom});
}
},
refreshClusters: function(stationary) {
var $this = this;
// Close the popup if it's showing details for a feature in this layer (or the labelGraphics layer).
if ($this.view.popup.visible && $this.view.popup.selectedFeature)
{
if ($this.view.popup.selectedFeature.layer == $this || $this.view.popup.selectedFeature.layer == $this.labelGraphics)
{
$this.view.popup.visible = false;
}
}
if (!stationary) return;
// Only start refreshing the graphics if a request for clusters is not already in progress
if (!$this.requesting_clusters) $this.requestClusters();
},
displayClusters: function(clusters) {
var $this = this;
$this.currentClusters = array.map(clusters, function(clusterGeoJson) {
var cluster = graphicFromGeoJson(clusterGeoJson);
// Ensure that the point_count_abbreviated attribute is always a string value, or it won't be
// accepted when passed to the applyEdits method.
if (cluster.attributes.point_count_abbreviated)
cluster.attributes.point_count_abbreviated = cluster.attributes.point_count_abbreviated.toString();
if ($this.opts.labelFormatter)
cluster.attributes[$this.opts.labelField] = $this.opts.labelFormatter(
cluster.attributes[$this.opts.labelField]
) || cluster.attributes[$this.opts.labelField];
return cluster;
});
if (isWebGL && esriVersion >= 4.9) {
// As-of JSAPI 4.9, featurelayer-like object must have its graphics controlled
// via the applyEdits method, even if it is being drawn from client-side graphics:
$this.queryFeatures().then(function(result){
var delete_ids = array.map(result.features, function(f){
return {objectId: f.attributes.objectid};
});
var editFeatures = {};
if ($this.currentClusters.length > 0) editFeatures.addFeatures = $this.currentClusters;
if (delete_ids.length > 0) editFeatures.deleteFeatures = delete_ids;
$this.applyEdits(editFeatures).then(function(edits){
$this.addLabelGraphics();
if ($this.requesting_clusters) $this.requesting_clusters = false;
}, function(){
addToSource();
});
}, function(){
addToSource();
});
} else {
addToSource();
}
function addToSource() {
// JSAPI versions < 4.9 or 4.9 with WebGL disabled do not support
// queryFeatures/applyEdits on local graphics layers:
$this.source.removeAll();
$this.source.addMany($this.currentClusters);
$this.addLabelGraphics();
if ($this.requesting_clusters) $this.requesting_clusters = false;
}
},
addLabelGraphics: function() {
var $this = this;
// Add any label graphics if enabled:
if ($this.labelGraphics) {
$this.labelGraphics.removeAll();
$this.labelGraphics.addMany(array.map(
array.filter($this.currentClusters, function (cluster) {
return cluster.attributes.point_count > 0;
}), function(cluster) {
var c = new Graphic({
geometry: cluster.geometry,
attributes: cluster.attributes,
symbol: new TextSymbol(lang.mixin(
{},
$this.opts.labelSymbol,
{text: cluster.attributes[$this.opts.labelField]}
))
});
return c;
}
));
// Since 4.9's switch to using WebGL drawing by default, there is a bit of lag
// when the cluster icons updated using applyEdits() are displayed on the map
// relative to when label graphics appear after they are updated using the
// removeAll() and addMany() methods. This timeout is added as a bit of
// a hack to prevent the visual appearance of labels being drawn slightly before
// the symobols for the points they represent...instead, they (usually) will
// appear slightly after, which is somewhat less distracting.
if (isWebGL) setTimeout(function(){
$this.labelGraphics.opacity = 1;
}, $this.has_loaded?300:500);
$this.has_loaded = true;
}
}
});
function esriObjectToJSON(obj) {
return obj.toJSON();
}
// Convert GeoJSON point objects to Esri Graphic objects:
function graphicFromGeoJson(geoJson){
try
{
return new Graphic(
{
geometry: {
type: "point",
longitude: geoJson.geometry.coordinates[0],
latitude: geoJson.geometry.coordinates[1]
},
attributes: geoJson.properties
}
);
} catch (e) {
console.log('Error converting GeoJSON to Graphic:', e);
}
}
});
|
import React from 'react';
import ReactDOM from 'react-dom';
import App from './examples/App';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
|
var gulp = require('gulp');
var browserify = require('browserify');
var through2 = require('through2');
var rename = require('gulp-rename');
var config = require('../config').app;
gulp.task('browserify', function () {
return gulp.src([config.init])
.pipe(through2.obj(function (file, enc, next) {
browserify({entries: file.path, standalone: "sparks"})
.bundle(function(err, res){
file.contents = res;
next(null, file);
});
}))
.pipe(rename('sparks.js'))
.pipe(gulp.dest(config.dest));
});
|
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// WebKit Web Facing API
var console = {}
/** @param {...*} vararg */
console.warn = function(vararg) {}
/** @param {...*} vararg */
console.assert = function(vararg) {}
/** @param {...*} vararg */
console.error = function(vararg) {}
console.trace = function() {}
var JSON = {}
/** @param {string} str */
JSON.parse = function(str) {}
/**
* @param {*} obj
* @param {Function=} replacer
* @param {number=} space
* @return {string}
*/
JSON.stringify = function(obj, replacer, space) {}
/** @param {boolean=} param */
Element.prototype.scrollIntoViewIfNeeded = function(param) {}
/** @type {boolean} */
Event.prototype.isMetaOrCtrlForTest = false;
/** @param {...*} vararg */
Event.prototype.initWebKitWheelEvent = function(vararg) {}
Event.prototype.stopImmediatePropagation = function() {}
/** @param {Element} element */
window.getComputedStyle = function(element) {}
/** @param {*} message */
function postMessage(message) {}
/**
* @param {string} eventName
* @param {Function} listener
* @param {boolean=} capturing
*/
function addEventListener(eventName, listener, capturing) {}
/** @param {boolean=} onlyFirst */
Array.prototype.remove = function(obj, onlyFirst) {}
Array.prototype.keySet = function() {}
/** @return {number} */
Array.prototype.upperBound = function(anchor) {}
/** @return {number} */
Array.prototype.binaryIndexOf = function(anchor) {}
Array.prototype.sortRange = function(comparator, leftBound, rightBound, k) {}
/**
* @this {Array.<number>}
* @param {function(number,number):boolean} comparator
* @param {number} left
* @param {number} right
* @param {number} pivotIndex
* @return {number}
*/
Array.prototype.partition = function(comparator, left, right, pivotIndex) {}
/**
* @this {Array.<number>}
* @param {number} k
* @param {function(number,number):boolean=} comparator
* @return {number}
*/
Array.prototype.qselect = function(k, comparator) {}
DOMApplicationCache.prototype.UNCACHED = 0;
DOMApplicationCache.prototype.IDLE = 1;
DOMApplicationCache.prototype.CHECKING = 2;
DOMApplicationCache.prototype.DOWNLOADING = 3;
DOMApplicationCache.prototype.UPDATEREADY = 4;
DOMApplicationCache.prototype.OBSOLETE = 5;
// Inspector Backend
var InspectorBackend = {}
InspectorBackend.runAfterPendingDispatches = function(message) {}
// FIXME: remove everything below.
var WebInspector = {}
/**
* @param {NetworkAgent.RequestId} requestId
* @return {?WebInspector.NetworkRequest}
*/
WebInspector.networkRequestById = function(requestId)
{
}
WebInspector.panels = {};
/**
* @type {WebInspector.InspectorView}
*/
WebInspector.inspectorView;
/**
* @param {Element} element
* @param {WebInspector.View} view
* @param {function()=} onclose
*/
WebInspector.showViewInDrawer = function(element, view, onclose) {}
WebInspector.closeViewInDrawer = function() {}
/**
* @param {string=} messageLevel
* @param {boolean=} showConsole
*/
WebInspector.log = function(message, messageLevel, showConsole) {}
WebInspector.addMainEventListeners = function(doc) {}
WebInspector.openResource = function(url, external) {}
/**
* @param {string} expression
* @param {boolean=} showResultOnly
*/
WebInspector.evaluateInConsole = function(expression, showResultOnly) {}
var InjectedFakeWorker = function() {}
WebInspector.queryParamsObject = {}
WebInspector.Events = {
InspectorClosing: "InspectorClosing"
}
/** Extensions API */
/** @constructor */
function AuditCategory() {}
/** @constructor */
function AuditResult() {}
/** @constructor */
function EventSink() {}
/** @constructor */
function ExtensionSidebarPane() {}
/** @constructor */
function Panel() {}
/** @constructor */
function PanelWithSidebar() {}
/** @constructor */
function Request() {}
/** @constructor */
function Resource() {}
/** @constructor */
function Timeline() {}
/** @type {string} */
Location.prototype.origin = "";
/**
* @constructor
*/
function ExtensionDescriptor() {
this.startPage = "";
this.name = "";
}
/**
* @constructor
*/
function ExtensionReloadOptions() {
this.ignoreCache = false;
this.injectedScript = "";
this.userAgent = "";
}
/**
* @type {WebInspector.HandlerRegistry}
*/
WebInspector.openAnchorLocationRegistry = null;
/**
* @param {WebInspector.Panel} panel
*/
WebInspector.showPanelForAnchorNavigation = function(panel)
{
}
WebInspector.showPanel = function(panel)
{
}
/**
* @type {string}
*/
WebInspector.inspectedPageDomain;
WebInspector.isCompactMode = function() { return false; }
WebInspector.SourceJavaScriptTokenizer = {}
WebInspector.SourceJavaScriptTokenizer.Keywords = {}
var InspectorTest = {}
|
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
require("antd/es/result/style");
var _result = _interopRequireDefault(require("antd/es/result"));
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var ErrorBoundary = /*#__PURE__*/function (_React$Component) {
_inherits(ErrorBoundary, _React$Component);
var _super = _createSuper(ErrorBoundary);
function ErrorBoundary() {
var _this;
_classCallCheck(this, ErrorBoundary);
_this = _super.apply(this, arguments);
_this.state = {
hasError: false,
errorInfo: ''
};
return _this;
}
_createClass(ErrorBoundary, [{
key: "componentDidCatch",
value: function componentDidCatch(error, errorInfo) {
// You can also log the error to an error reporting service
// eslint-disable-next-line no-console
console.log(error, errorInfo);
}
}, {
key: "render",
value: function render() {
if (this.state.hasError) {
// You can render any custom fallback UI
return /*#__PURE__*/_react.default.createElement(_result.default, {
status: "error",
title: "Something went wrong.",
extra: this.state.errorInfo
});
}
return this.props.children;
}
}], [{
key: "getDerivedStateFromError",
value: function getDerivedStateFromError(error) {
return {
hasError: true,
errorInfo: error.message
};
}
}]);
return ErrorBoundary;
}(_react.default.Component);
var _default = ErrorBoundary;
exports.default = _default;
|
"use strict";
var gulp = require( "gulp" );
var watch = require( "gulp-watch" );
var server = require( "gulp-develop-server" );
var cukes = require( "gulp-cukes" );
var http = require( "http" );
var config = require( "./config" );
var browserify = require( "gulp-browserify" );
var literalify = require( "literalify" );
var reactify = require( "reactify" );
gulp.task( "cukes", function() {
return gulp.src( "specs/**/*.feature", { read: false } )
.pipe( cukes().format("pretty").withDiagnostics() );
} );
gulp.task( "cod:prep", function() {
return gulp.src( "./code-on-demand/widgets/*/browser.js")
.pipe( browserify( { transform: [
reactify,
literalify.configure( { "react": "window.React" } )
] } ) )
.pipe( gulp.dest( "./public/js/widgets" ) );
} );
gulp.task( "server:start", function() {
server.listen( { path: "./index.js" } );
} );
gulp.task( "test", [ "cod:prep", "server:start", "cukes" ] );
function pingServer( next, count ) {
if( count > 5 ) {
console.log( "FAILED TO PING SERVER" );
return;
}
var req = http.request( "http://localhost:" + config.port, next );
req.on( "error", function() {
console.log( "Delaying until server is up again..." );
setTimeout( pingServer.bind( this, next, ++count ), 250 );
} );
req.end();
}
gulp.task( "watch", [ "cod:prep", "server:start" ], function() {
watch( [ "code-on-demand/**/*", "lib/**/*", "specs/**/*" ], function() {
server.restart( function() {
pingServer( function() {
console.log( "Successfully verified that server is back up." );
gulp.start( [ "cod:prep", "cukes" ] );
} );
} );
} );
} );
|
"use strict";
function _openPreview() {
const data = _interopRequireDefault(require("../openPreview"));
_openPreview = function () {
return data;
};
return data;
}
function _fsPromise() {
const data = _interopRequireDefault(require("../../nuclide-commons/fsPromise"));
_fsPromise = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*
* @format
*/
function getActiveTextEditor() {
const activeTextEditor = atom.workspace.getActiveTextEditor();
if (!activeTextEditor) {
throw new Error("Invariant violation: \"activeTextEditor\"");
}
return activeTextEditor;
}
function getPendingItem() {
const pane = atom.workspace.paneForItem(getActiveTextEditor());
if (!pane) {
throw new Error("Invariant violation: \"pane\"");
}
return pane.getPendingItem();
}
describe('openPreview', () => {
// replace Jasmine's mocked setTimeout with another mock which immediately
// fires the callback. This is to mock the delay after requesting a preview.
let oldSetTimeout;
beforeEach(() => {
oldSetTimeout = window.setTimeout;
window.setTimeout = fn => fn();
});
afterEach(() => {
window.setTimeout = oldSetTimeout;
});
describe('previewing within the same file', () => {
let file;
let fileItem;
beforeEach(async () => {
file = await _fsPromise().default.tempfile();
await _fsPromise().default.writeFile(file, 'foobarbaz\n'.repeat(1000));
fileItem = await atom.workspace.open(file);
});
afterEach(() => {
_fsPromise().default.unlink(file);
});
it('does not change the cursor position', async () => {
expect(getActiveTextEditor().getURI()).toEqual(file);
expect(getActiveTextEditor().getCursorBufferPosition()).toEqual({
row: 0,
column: 0
});
await (0, _openPreview().default)(file, {
line: 700,
column: 3,
center: true
})._promise; // this case shouldn't open any new editors
expect(getActiveTextEditor()).toBe(fileItem); // Neither the file path nor the cursor position technically change as
// this preview is not yet confirmed
expect(getActiveTextEditor().getURI()).toEqual(file);
expect(getActiveTextEditor().getCursorBufferPosition()).toEqual({
row: 0,
column: 0
});
});
});
describe('opening a preview of a different file', () => {
let startingFile;
let previewingFile;
beforeEach(async () => {
[startingFile, previewingFile] = await Promise.all([_fsPromise().default.tempfile(), _fsPromise().default.tempfile()]);
await atom.workspace.open(startingFile);
});
afterEach(async () => {
await (() => Promise.all([_fsPromise().default.unlink(startingFile), _fsPromise().default.unlink(previewingFile)]))();
});
it('opens a preview pane editor pointed at the previewFile', async () => {
expect(getActiveTextEditor().getURI()).toEqual(startingFile);
expect(getActiveTextEditor().getCursorBufferPosition()).toEqual({
row: 0,
column: 0
});
await (0, _openPreview().default)(previewingFile)._promise;
expect(getActiveTextEditor().getURI()).toBe(previewingFile); // $FlowFixMe
expect(getPendingItem().getURI()).toBe(previewingFile);
});
it('leaves focus on the starting editor', async () => {
expect(getActiveTextEditor().getURI()).toEqual(startingFile);
expect(getActiveTextEditor().getCursorBufferPosition()).toEqual({
row: 0,
column: 0
});
await (0, _openPreview().default)(previewingFile)._promise;
expect(getActiveTextEditor().getURI()).toEqual(previewingFile);
});
});
describe('with multiple previews', () => {
let startingFile;
let firstPreviewingFile;
let secondPreviewingFile;
beforeEach(async () => {
[startingFile, firstPreviewingFile, secondPreviewingFile] = await Promise.all([_fsPromise().default.tempfile(), _fsPromise().default.tempfile(), _fsPromise().default.tempfile()]);
await atom.workspace.open(startingFile);
});
afterEach(async () => {
await (() => Promise.all([_fsPromise().default.unlink(startingFile), _fsPromise().default.unlink(firstPreviewingFile), _fsPromise().default.unlink(secondPreviewingFile)]))();
});
it('reuses the preview pane when openPreview is called multiple times', async () => {
await (0, _openPreview().default)(firstPreviewingFile)._promise;
const firstPendingItem = getPendingItem(); // $FlowFixMe
expect(getPendingItem().getURI()).toBe(firstPreviewingFile);
await (0, _openPreview().default)(secondPreviewingFile)._promise;
const secondPendingItem = getPendingItem(); // $FlowFixMe
expect(getPendingItem().getURI()).toBe(secondPreviewingFile); // $FlowFixMe
expect(firstPendingItem.isDestroyed()).toBe(true); // $FlowFixMe
expect(secondPendingItem.isDestroyed()).toBe(false);
expect(getPendingItem()).toBe(secondPendingItem);
expect(secondPendingItem).toBe(getActiveTextEditor());
});
it('destroys all previews once an openable is confirmed', async () => {
await (0, _openPreview().default)(firstPreviewingFile)._promise;
const firstPendingItem = getPendingItem();
const secondOpenable = (0, _openPreview().default)(secondPreviewingFile);
await secondOpenable._promise;
const secondPendingItem = getPendingItem();
await secondOpenable.confirm(); // $FlowFixMe
expect(firstPendingItem.isDestroyed()).toBe(true); // $FlowFixMe
expect(secondPendingItem.isDestroyed()).toBe(false);
expect(getPendingItem()).toBeNull();
expect(secondPendingItem).toBe(getActiveTextEditor());
});
});
it('never reuses a non-pending pane', async () => {
const [startingFile, file1, file2] = await Promise.all([_fsPromise().default.tempfile(), _fsPromise().default.tempfile(), _fsPromise().default.tempfile()]);
await atom.workspace.open(startingFile);
await (0, _openPreview().default)(file1)._promise; // Open a preview back in the originating file, which is not pending
await (0, _openPreview().default)(startingFile)._promise;
expect(getActiveTextEditor()).not.toBe(getPendingItem()); // ...and make sure requesting a new preview does *not* reuse the original
// file's pane item
await (0, _openPreview().default)(file2)._promise;
expect(getActiveTextEditor()).toBe(getPendingItem());
await Promise.all([_fsPromise().default.unlink(startingFile), _fsPromise().default.unlink(file1), _fsPromise().default.unlink(file2)]);
});
it('throws when trying to confirm a preview that is not the latest', async () => {
const [file1, file2] = await Promise.all([_fsPromise().default.tempfile(), _fsPromise().default.tempfile()]);
const preview1 = (0, _openPreview().default)(file1);
(0, _openPreview().default)(file2);
expect(() => preview1.confirm()).toThrow();
await Promise.all([_fsPromise().default.unlink(file1), _fsPromise().default.unlink(file2)]);
});
it('throws when calling confirm after cancel', async () => {
const file = await _fsPromise().default.tempfile();
const preview = (0, _openPreview().default)(file);
preview.cancel();
expect(() => preview.confirm()).toThrow();
await _fsPromise().default.unlink(file);
});
it('throws when calling cancel after confirm', async () => {
const file = await _fsPromise().default.tempfile();
const preview = (0, _openPreview().default)(file);
preview.confirm();
expect(() => preview.cancel()).toThrow();
await _fsPromise().default.unlink(file);
});
});
|
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
'use strict';
const { BaseGenerator } = require('@microsoft/generator-bot-adaptive');
module.exports = class extends BaseGenerator {
initializing() {
this.composeWith(
require.resolve('@microsoft/generator-bot-adaptive/generators/app'),
Object.assign(this.options, {
arguments: this.args,
applicationSettingsDirectory: 'settings',
packageReferences: [
{
isPlugin: true,
name: 'Microsoft.Bot.Components.Graph',
version: '1.0.0-preview.20210325.5bda44a',
},
],
modifyApplicationSettings: (appSettings) => {
Object.assign(appSettings, {
oauthConnectionName: '',
defaultValue: {
duration: 30,
},
});
appSettings.runtimeSettings.features.setSpeak = true;
},
})
);
}
writing() {
this._copyBotTemplateFiles();
}
};
|
import React, { useState,useEffect } from "react";
import JobtypeList from "./JobtypeList";
import SubjobList from "./SubjobList";
import TasktypeList from "./TasktypeList";
import SubtaskList from "./SubtaskList";
const EditRecordModal = ({apiUrl, apiKey, getTimesheets}) => {
// state vars
const [jobTypes, setJobtypes] = useState([]);
const [jobType, setJobtype] = useState();
const [subJobs, setSubjobs] = useState([]);
const [subJob, setSubjob] = useState();
const [taskTypes, setTasktypes] = useState([]);
const [taskType, setTasktype] = useState();
const [subTasks, setSubtasks] = useState([]);
const [subTask, setSubtask] = useState();
const [formValues, setFormValues] = useState({});
// use effect
useEffect(() => {
getJobTypes();
}, []);
const isArrayValid = (arr) => {
return (arr.length > 0);
};
const getJobTypes = () => {
// api connection and send request
fetch(apiUrl+"jobtypes", {
"method": "GET",
"headers": {
"Authorization": "Bearer "+apiKey,
"Content-Type": "application/json",
"Accept": "application/json",
"Referer": location.origin,
}
})
.then(response => response.json())
.then(response => {
setJobtypes(response);
})
.catch(err => {
console.log(err);
});
};
const handleJobtypeChange = (el) => {
setJobtype(el.target.value);
getSubjobs(el.target.value);
handleFormChange(el);
};
const getSubjobs = (jobType) => {
// api connection and send request
fetch(apiUrl+"jobtypes/"+jobType+"/subjobs", {
"method": "GET",
"headers": {
"Authorization": "Bearer "+apiKey,
"Content-Type": "application/json",
"Accept": "application/json",
"Referer": location.origin,
}
})
.then(response => response.json())
.then(response => {
setSubjobs(response);
})
.catch(err => {
console.log(err);
});
};
const handleSubjobChange = (el) => {
setSubjob(el.target.value);
getTasktypes(jobType, el.target.value);
handleFormChange(el);
};
const getTasktypes = (jobType, subJob) => {
// api connection and send request
fetch(apiUrl+"jobtypes/"+jobType+"/subjobs/"+subJob+"/tasktypes", {
"method": "GET",
"headers": {
"Authorization": "Bearer "+apiKey,
"Content-Type": "application/json",
"Accept": "application/json",
"Referer": location.origin,
}
})
.then(response => response.json())
.then(response => {
setTasktypes(response);
})
.catch(err => {
console.log(err);
});
};
const handleTasktypeChange = (el) => {
setTasktype(el.target.value);
getSubtasks(jobType, subJob, el.target.value);
handleFormChange(el);
};
const getSubtasks = (jobType, subJob, taskType) => {
// api connection and send request
fetch(apiUrl+"jobtypes/"+jobType+"/subjobs/"+subJob+"/tasktypes/"+taskType+"/subtasks", {
"method": "GET",
"headers": {
"Authorization": "Bearer "+apiKey,
"Content-Type": "application/json",
"Accept": "application/json",
"Referer": location.origin,
}
})
.then(response => response.json())
.then(response => {
setSubtasks(response);
})
.catch(err => {
console.log(err);
});
};
const handleSubtasksChange = (el) => {
setSubtask(el.target.value);
handleFormChange(el);
};
const handleFormChange = (el) => {
formValues[el.target.name] = el.target.value;
setFormValues(formValues);
};
const handleSubmitForm = (el) => {
console.log("formValues Submitted: ");
console.log(formValues);
let account = 1;
// make connection
fetch(apiUrl+"accounts/"+account+"/timesheets", {
"method": "POST",
"headers": {
"Authorization": "Bearer "+apiKey,
"Content-Type": "application/json",
"Accept": "application/json",
"Referer": location.origin,
},
"body": JSON.stringify(formValues),
})
.then(response => response.json())
.then(response => {
console.log("response from timesheet store: ");
console.log(response);
getTimesheets();
$('#addTimeModal').modal('hide');
})
.catch(err => {
console.log(err);
});
};
return (
<div className="container">
{ /*Button trigger modal*/ }
<button type="button" className="btn btn-outline-warning btn-sm" data-toggle="modal" data-target="#editTimeModal">
Add Timesheet
</button>
{ /*Modal*/ }
<div className="modal fade" id="editTimeModal" data-backdrop="static" data-keyboard="false" tabIndex="-1" aria-labelledby="addTimeModalLabel" aria-hidden="true">
<div className="modal-dialog">
<div className="modal-content">
<div className="modal-header">
<h5 className="modal-title" id="addTimeModalLabel">Add Record</h5>
<button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div className="modal-body">
<form id="timesheet_form">
<div hidden className="form-group col-md-3">
<label htmlFor="week_ending">Week Ending</label>
<input type="date" className="form-control form-control-sm" id="week_ending" name="week_ending" onChange={handleFormChange} placeholder="date" />
</div>
<div className="form-row">
<div className="form-group col-md-6">
<label htmlFor="building">Building</label>
<input type="email" className="form-control form-control-sm" id="building" name="building" onChange={handleFormChange} placeholder="bldg #" />
</div>
<div className="form-group col-md-6">
<label htmlFor="building">Date</label>
<input type="date" className="form-control form-control-sm" id="date" name="date" onChange={handleFormChange} placeholder="date" />
</div>
</div>
<div className="form-row">
<div className="form-group col-md-3">
{
!isArrayValid(jobTypes)
?
<div>no jobTypes.</div>
:
<JobtypeList jobTypes={jobTypes} handleJobtypeChange={handleJobtypeChange} />
}
</div>
<div className="form-group col-md-3">
{
!isArrayValid(subJobs)
?
<div>no subJobs.</div>
:
<SubjobList subJobs={subJobs} handleSubjobChange={handleSubjobChange} />
}
</div>
<div className="form-group col-md-3">
{
!isArrayValid(taskTypes)
?
<div>no taskTypes.</div>
:
<TasktypeList taskTypes={taskTypes} handleTasktypeChange={handleTasktypeChange} />
}
</div>
<div className="form-group col-md-3">
{
!isArrayValid(subTasks)
?
<div>no subTasks.</div>
:
<SubtaskList subTasks={subTasks} handleSubtasksChange={handleSubtasksChange} />
}
</div>
</div>
<div className="form-group">
<label htmlFor="hours">Hours</label>
<input type="text" className="form-control form-control-sm" id="hours" name="hours" onChange={handleFormChange} placeholder="hours worked" />
</div>
</form>
</div>
<div className="modal-footer">
<button type="button" className="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" className="btn btn-primary" onClick={handleSubmitForm}>Submit</button>
</div>
</div>
</div>
</div>
</div>
);
};
export default EditRecordModal;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.