code stringlengths 2 1.05M | repo_name stringlengths 5 114 | path stringlengths 4 991 | language stringclasses 1 value | license stringclasses 15 values | size int32 2 1.05M |
|---|---|---|---|---|---|
var test = require('tape')
var flatten = require('../lib/flattenCommandArgs')
function testFlatten (command, expectedArgs) {
test(command.type, function (t) {
var args = flatten(command)
t.same(args, expectedArgs)
t.end()
})
}
testFlatten(
{ type: 'M', relative: false, x: 10, y: 20 },
[10, 20])
testFlatten(
{ type: 'L', relative: false, x: 10, y: 20 },
[10, 20])
testFlatten(
{ type: 'C', relative: false, x1: 10, y1: 20, x2: 30, y2: 40, x: 50, y: 60 },
[10, 20, 30, 40, 50, 60])
testFlatten(
{ type: 'S', relative: false, x2: 30, y2: 40, x: 50, y: 60 },
[30, 40, 50, 60])
testFlatten(
{ type: 'Q', relative: false, x1: 10, y1: 20, x: 50, y: 60 },
[10, 20, 50, 60])
testFlatten(
{ type: 'T', relative: false, x: 10, y: 20 },
[10, 20])
testFlatten(
{ type: 'A', relative: false, rx: 10, ry: 20, x_axis_rotation: 30,
large_arc_flag: 0, sweep_flag: 0, x: 50, y: 60 },
[10, 20, 30, 0, 0, 50, 60])
| ppvg/svg-path | test/flattenCommandArgs.js | JavaScript | mit | 951 |
"use strict";
/**
* Renders pagination, accepts the following props:
* - totalPages : {int} The total number of available pages, integer greater
* than 0
*
* - currentPage : {int} To be greater than 0 and less than or equal to totalPages
*
* - goToPage : {function} Function that accepts single argument of page number
* will then go to that page number
*/
export class Pagination extends React.Component {
constructor(props) {
super(props);
if(this.props.currentPage === undefined || this.props.totalPages === undefined) {
throw new Error("props.currentPage and props.totalPages must be defined");
} else if(this.props.currentPage < 1 || this.props.currentPage > this.props.totalPages) {
throw new Error("Invalid value specified for props.currentPage, should be greater than 0 and less than or equal to props.totalPages");
}
this.goToPage = this.goToPage.bind(this);
this.getFirst = this.getFirst.bind(this);
this.getPreviousArrow = this.getPreviousArrow.bind(this);
this.getPageNumbers = this.getPageNumbers.bind(this);
this.getNextArrow = this.getNextArrow.bind(this);
this.getLast = this.getLast.bind(this);
}
/**
* Call goToPage on props if the selected page is not the current page, is
* greater than or equal to 1 and is less than or equal to the total number
* of pages.
*
* @param {int} pageNumber
* @return {void}
*/
goToPage(pageNumber) {
if(pageNumber !== this.props.currentPage && pageNumber <= this.props.totalPages && pageNumber >= 1) {
this.props.goToPage(pageNumber);
}
}
/**
* Get `first` pagination element
*
* @return {HTML component}
*/
getFirst() {
let classes = ["first"];
if(this.props.currentPage === 1) {
classes.push("disabled");
}
return <span
className={classes.join(" ")}
onClick={() => this.goToPage(1)}>
First
</span>;
}
/**
* Get previous page arrow
*
* @return {HTML component}
*/
getPreviousArrow() {
let classes = ["previous"],
entity = "\u25b2";
if(this.props.currentPage === 1) {
classes.push("disabled");
}
return <span
className={classes.join(" ")}
onClick={() => this.goToPage(this.props.currentPage - 1)}>{entity}</span>;
}
/**
* Renders page numbers, will render a maximum of 2 page numbers and ellipsis
* for forwards and backwards navigation
*
* @return {array} Array of HTML components
*/
getPageNumbers() {
// Initialise page numbers array with current page
let pageNumbers = [
{
label: this.props.currentPage,
value: this.props.currentPage
}
],
output = [];
if(this.props.currentPage < this.props.totalPages) {
// Add next page
pageNumbers.push({
label: this.props.currentPage + 1,
value: this.props.currentPage + 1
});
// Add ellipsis for next
if(this.props.currentPage + 1 < this.props.totalPages) {
pageNumbers.push({
label: "...",
value: this.props.currentPage + 2
});
}
// Add ellipsis for previous
if(this.props.currentPage - 1 >= 1) {
pageNumbers.unshift({
label: "...",
value: this.props.currentPage - 1
});
}
} else if(this.props.currentPage > 1) {
// Add previous page
pageNumbers.unshift({
label: this.props.currentPage - 1,
value: this.props.currentPage - 1
});
// Add ellipsis for previous
if(this.props.currentPage - 2 >= 1) {
pageNumbers.unshift({
label: "...",
value: this.props.currentPage - 2
});
}
}
while(pageNumbers.length > 0) {
let next = pageNumbers.shift(),
classes = ["page-number"];
if(next.value === this.props.currentPage) {
classes.push("active");
}
output.push(
<span
className={classes.join(" ")}
key={"page-number-" + next.value}
value={next.value}
onClick={() => this.goToPage(next.value)}>
{next.label}
</span>
);
}
return output;
}
/**
* Get next page arrow
*
* @return {HTML component}
*/
getNextArrow() {
let classes = ["next"],
entity = "\u25b2";
if(this.props.currentPage === this.props.totalPages) {
classes.push("disabled");
}
return <span
className={classes.join(" ")}
onClick={() => this.goToPage(this.props.currentPage + 1)}>{entity}</span>;
}
/**
* Get `last` pagination element
*
* @return {HTML component}
*/
getLast() {
let classes = ["last"];
if(this.props.currentPage === this.props.totalPages) {
classes.push("disabled");
}
return <span
className={classes.join(" ")}
onClick={() => this.goToPage(this.props.totalPages)}>
Last
</span>;
}
render() {
return (
<div className="pagination-component">
{this.getFirst()}
{this.getPreviousArrow()}
{this.getPageNumbers()}
{this.getNextArrow()}
{this.getLast()}
</div>
);
}
} | lewnelson/star-wars-planets-database | src/js/components/Pagination.js | JavaScript | mit | 5,342 |
import { combineReducers } from 'redux';
import { reducer as formReducer } from 'redux-form'
import user from './user';
import runtime from './runtime';
export default combineReducers({
user,
runtime,
form: formReducer
});
| zuban/edhunter | src/reducers/index.js | JavaScript | mit | 230 |
if(typeof define !== 'function') {
var define = require('amdefine')(module);
}
if(inServer) {
var file = require('../../../libraries/file');
var MessageFormat = require('../../../libraries/MessageFormat');
}
define(function(require) {
var Backbone = require('backbone')
, Model = inServer ? require('../../libraries/Model') : require('Model')
, Collection = inServer ? require('../../libraries/Collection') : require('Collection')
, _ = require('underscore');
if(inClient) {
var request = require('request')
}
else {
Backbone = require('backbone-relational');
}
var Constructor = Model.extend({
/**
* Parse raw data
*
* @param {JSON} json
* @return {void}
* @api private
*/
_parse: function(json) {
this.set(json);
},
/**
* Default values
*
* @type {Object}
*/
defaults: {
key: null,
variables: [],
timestamp: null,
new: false,
l10ns: {
message: 'Use <a href="http://l10ns.org/docs.html#messageformat" target="_blank">message format</a> to localize your string above. Click on the help buttons on the toolbar to get help on different formats.',
save: 'Save',
variables: 'VARIABLES:',
inDefaultLocale: 'IN DEFAULT LOCALE:'
}
},
/**
* Sync
*
* @delegate
*/
sync: function(method, model, options, requestData) {
if(method === 'read') {
if(inServer) {
this._handleReadRequestFromServer(model, options, requestData);
}
else {
this._handleReadRequestFromClient(model, options, requestData);
}
}
else if(method === 'update') {
if(inClient) {
this._handleUpdateRequestFromClient(model, options, requestData);
}
}
},
/**
* Handle update request from client
*
* @param {Model} model
* @param {Object} options
* @param {Request} requestData
* @return {void}
* @api private
*/
_handleUpdateRequestFromClient: function(model, options, requestData) {
var id = window.location.pathname.split('/')[3]
, json = this.toL10nsJSON();
request
.put('/api/' + app.language + '/l/' + id)
.send(json)
.end(function(error, response) {
if(!error && response.status === 200) {
var localizationInList = app.models.localizations.get(json.id);
if(localizationInList) {
localizationInList.set(json);
}
if(typeof options.success === 'function') {
options.success();
}
}
else {
options.error(response.text);
}
});
},
/**
* Handle read request from client
*
* @param {Model} model
* @param {Object} options
* @param {Request} requestData
* @return {void}
* @api private
*/
_handleReadRequestFromClient: function(model, options, requestData) {
var _this = this
, id = window.location.pathname.split('/')[3];
var $json = $('.js-json-localization');
if($json.length) {
this._parse(JSON.parse(_.unescape($json.html())));
$json.remove();
options.success();
return;
}
request
.get('/api/' + app.language + '/l/' + id)
.end(function(err, res) {
var localization = res.body;
_this._parse(localization);
app.document.set('title', app.language + ' | ' + localization.key);
app.document.set('description', 'Edit ' + localization.key + ' in locale ' + app.language);
options.success();
});
},
/**
* Handle read request from server
*
* @param {Model} model
* @param {Object} options
* @param {Request} requestData
* @return {void}
* @api private
*/
_handleReadRequestFromServer: function(model, options, requestData) {
var _this = this;
file.readLocalizations()
.then(function(localizations) {
var locale = requestData.param('locale')
, id = requestData.param('id')
, localizationsWithRequestedLocale = file.localizationMapToArray(localizations)[locale]
, localizationWithRequestedLocale = _.findWhere(localizationsWithRequestedLocale, { id : id });
if(localizationWithRequestedLocale) {
_this._parse(localizationWithRequestedLocale);
var messageFormat = new MessageFormat(locale);
_this.set('pluralRules', messageFormat.pluralRules);
_this.set('ordinalRules', messageFormat.ordinalRules);
if(locale !== project.defaultLanguage) {
var localizationsWithDefaultLocale = file.localizationMapToArray(localizations)[project.defaultLanguage]
, localizationWithDefaultLocale = _.findWhere(localizationsWithDefaultLocale, { id : id });
_this.set('message', 'In ' + project.defaultLanguage + ': ' + localizationWithDefaultLocale.value);
}
else {
_this.set('message', _this.get('l10ns').message);
}
_this.setPageTitle(locale + ' | ' + localizationWithRequestedLocale.key);
_this.setPageDescription('Edit ' + localizationWithRequestedLocale.key + ' in locale ' + locale);
options.success();
}
else {
options.error(new TypeError('localization with id:' + requestData.param('id') + ' not found'));
}
})
.fail(function(error) {
options.error(error);
});
},
/**
* On history push to `/`. We want to change the `revealed` property
* to true.
*
* @delegate
*/
onHistoryChange: function(path) {
if(/^[a-z]{2}\-[A-Z]{2}\/t\//.test(path)) {
this.setMeta('revealed', true);
this.setPageTitle('Localization')
this.setPageDescription('Edit localization');
}
else {
this.setMeta('revealed', false);
}
},
/**
* We will ovverride the default implementation of `toJSON` method
* because the relations is not mapped according to the server
* implementation. Relations `Conditions`, `Inputs`, `Else` need to
* under the property `values`
*
* @override
*/
toL10nsJSON: function() {
var json = Model.prototype.toJSON.call(this);
json = this._removeJSONLocalizedStrings(json);
return json;
},
/**
* Remove JSON localizaed strings
*
* @param {JSON} json
* @return {JSON}
* @api private
*/
_removeJSONLocalizedStrings: function(json) {
delete json.l10ns;
delete json.pluralRules;
delete json.ordinalRules;
delete json.message;
return json;
}
});
return Constructor;
});
| mAiNiNfEcTiOn/l10ns | interface/contents/localization/Localization.js | JavaScript | mit | 6,910 |
import React, { Component } from 'react';
import { observer } from 'mobx-react';
@observer
class SearchResults extends Component {
constructor(){
super();
}
renderList(items){
return items.map(
(item) => <li key={ item.id.videoId } onClick={ () =>{ this.props.clickHandler(item) } }>{ item.snippet.title }</li>
);
}
render() {
return (
<ul className="search-results">
{ this.renderList(this.props.results) }
</ul>
);
}
};
export default SearchResults;
| Zerchan/ytApp | src/js/components/searchResults.js | JavaScript | mit | 572 |
var assert= require("assert")
, DatesAndTimes= require("../../lib/utils/DatesAndTimes")
, moment = require("moment");
describe('DatesAndTimes.ParseTimeOffset', function(){
it("should parse negative as well as positive offsets", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1s"), 1 );
assert.equal( DatesAndTimes.parseTimeOffset("+1s"), 1 );
assert.equal( DatesAndTimes.parseTimeOffset("-1s"), -1 );
});
it("should parse seconds", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1s"), 1 );
assert.equal( DatesAndTimes.parseTimeOffset("-23seconds"), -23 );
});
it("should parse minutes", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1min"), 60 );
assert.equal( DatesAndTimes.parseTimeOffset("-2minutes"), -120 );
});
it("should parse hours", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1h"), 3600 );
assert.equal( DatesAndTimes.parseTimeOffset("-10hours"), -36000 );
});
it("should parse days", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1d"), 86400 );
assert.equal( DatesAndTimes.parseTimeOffset("-5days"), -432000 );
});
it("should parse weeks", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1w"), 604800 );
assert.equal( DatesAndTimes.parseTimeOffset("-5weeks"), -3024000 );
});
it("should parse months", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1mon"), 2592000 );
assert.equal( DatesAndTimes.parseTimeOffset("-2months"), -5184000 );
});
it("should parse years", function() {
assert.equal( DatesAndTimes.parseTimeOffset("1y"), 31536000 );
assert.equal( DatesAndTimes.parseTimeOffset("-2years"), -63072000 );
});
}); | ciaranj/chartled | test/ServerTests/ParseTimeOffsetTests.js | JavaScript | mit | 1,787 |
Meteor.publish('rules', ruleId => {
check(ruleId, String);
return Rules.find({
_id: ruleId,
});
});
Meteor.publish('allRules', () => {
return Rules.find({});
});
Meteor.publish('allTriggers', () => {
return Triggers.find({});
});
Meteor.publish('allActions', () => {
return Actions.find({});
});
| GhassenRjab/wekan | server/publications/rules.js | JavaScript | mit | 315 |
export const startGame = () => ({
type: 'START_GAME',
});
export const stopGame = () => ({
type: 'STOP_GAME',
});
| DavidIValencia/kanjeweled | src/actions/appActions.js | JavaScript | mit | 119 |
const Metalsmith = require('metalsmith');
const filter = require('metalsmith-filter');
const regex_derived = '**/derived-variables.sass';
const derived_plugin = require('./plugins/02-read-derived-variables');
Metalsmith(__dirname)
.source('../../sass')
.use(filter(regex_derived))
.use(derived_plugin())
.build(function(err) {
if (err) throw err;
});
| jgthms/bulma | docs/_scripts/02-derived.js | JavaScript | mit | 367 |
#!/usr/bin/env nodejs
var zerorpc = require('zerorpc');
var server = new zerorpc.Server({
sleep: function(seconds, reply) {
console.log('Sleeping for '+seconds+' seconds');
setTimeout(function() {
reply(null, 'Slept for '+seconds+' seconds');
}, seconds*1000);
}
});
server.bind('tcp://127.0.0.1:18181');
| siboulet/php-zerorpc | examples/server.js | JavaScript | mit | 330 |
var breadcrumbs=[['-1',"",""],['2',"SOLUTION-WIDE PROPERTIES Reference","topic_0000000000000C16.html"],['2977',"Tlece.Recruitment.Services.Company Namespace","topic_0000000000000A83.html"],['2978',"CompanyService Class","topic_0000000000000A84.html"],['2991',"Methods","topic_0000000000000A84_methods--.html"],['3015',"GetBadge Method","topic_0000000000000ABD.html"]]; | asiboro/asiboro.github.io | vsdoc/toc--/topic_0000000000000ABD.html.js | JavaScript | mit | 368 |
$.get('./map/json/world.json', function (worldJson) {
echarts.registerMap('world', worldJson);
var myChart = echarts.init(document.getElementById('map-wrap'));
var geoCoordMap = {
'AUS':[133.41701195,-26.1772288],
'AUT':[13.34573475,47.69646785],
'BEL':[4.47674425,50.50107895],
'BGR':[25.48330395,42.7253401],
'BRA':[-51.41064325,-14.23990025],
'CAN':[-96.0,56.0],
'CHE':[8.22421005,46.8131873],
'CHN':[104.1380606,35.86139005],
'CYP':[33.4369821,35.1697497],
'CZE':[15.47491255,49.80374335],
'DEU':[10.45416805,51.1641859],
'DNK':[10.4329654,56.15549105],
'ESP':[-3.713,40.2085],
'EST':[24.9866699,58.60480985],
'FIN':[26.06934375,64.916959],
'FRA':[2.20876775,46.2159704],
'GBR':[-3.44322615,55.3685909],
'GRC':[23.8097531,38.2753895],
'HRV':[16.46887605,44.47136115],
'HUN':[19.5057147,47.16116145],
'IDN':[118.01525315,-2.55000655],
'IND':[82.77893295,21.13110835],
'IRL':[-8.3288204,53.4275836],
'ITA':[12.5736123,41.2925164],
'JPN':[134.375054,34.78384835],
'KOR':[127.0964051,35.86151235],
'LTU':[23.89478705,55.1735983],
'LUX':[6.13332,49.8152995],
'LVA':[24.60573035,56.8801679],
'MEX':[-102.5391532,23.62609395],
'MLT':[14.3800256,35.9442317],
'NLD':[5.27937025,52.21299185],
'NOR':[17.82508785,64.57140285],
'POL':[19.13437865,51.9189046],
'PRT':[-7.85273349,39.55748523],
'ROU':[25.00941995,45.94428585],
'RUS':[103.0,55.0],
'SVK':[19.696058,48.67248205],
'SVN':[14.99301965,46.1492473],
'SWE':[17.56278825,62.1988839],
'TUR':[35.24148795,38.957489],
'TWN':[121.0173448,23.598913],
'USA':[-95.665,37.6]
};
var BJData = [
[{name:'CHN'},{name:'AUS',value:1}],
[{name:'CHN'},{name:'BGR',value:1}],
[{name:'CHN'},{name:'HUN',value:1}],
[{name:'CHN'},{name:'IDN',value:1}],
[{name:'CHN'},{name:'IND',value:1}],
[{name:'CHN'},{name:'JPN',value:1}],
[{name:'CHN'},{name:'KOR',value:1}],
[{name:'CHN'},{name:'LUX',value:1}],
[{name:'CHN'},{name:'TWN',value:1}],
[{name:'CHN'},{name:'USA',value:1}]
];
var SHData = [
[{name:'CHN'},{name:'AUS',value:1}],
[{name:'CHN'},{name:'BGR',value:1}],
[{name:'CHN'},{name:'BRA',value:1}],
[{name:'CHN'},{name:'CAN',value:1}],
[{name:'CHN'},{name:'CYP',value:1}],
[{name:'CHN'},{name:'CZE',value:1}],
[{name:'CHN'},{name:'DEU',value:1}],
[{name:'CHN'},{name:'DNK',value:1}],
[{name:'CHN'},{name:'EST',value:1}],
[{name:'CHN'},{name:'FIN',value:1}],
[{name:'CHN'},{name:'FRA',value:1}],
[{name:'CHN'},{name:'GBR',value:1}],
[{name:'CHN'},{name:'HUN',value:1}],
[{name:'CHN'},{name:'IDN',value:1}],
[{name:'CHN'},{name:'IND',value:1}],
[{name:'CHN'},{name:'ITA',value:1}],
[{name:'CHN'},{name:'JPN',value:1}],
[{name:'CHN'},{name:'KOR',value:1}],
[{name:'CHN'},{name:'LUX',value:1}],
[{name:'CHN'},{name:'MEX',value:1}],
[{name:'CHN'},{name:'NLD',value:1}],
[{name:'CHN'},{name:'ROU',value:1}],
[{name:'CHN'},{name:'TUR',value:1}],
[{name:'CHN'},{name:'TWN',value:1}],
[{name:'CHN'},{name:'USA',value:1}]
];
var GZData = [
[{name:'CHN'},{name:'AUS',value:1}],
[{name:'CHN'},{name:'BEL',value:1}],
[{name:'CHN'},{name:'BGR',value:1}],
[{name:'CHN'},{name:'BRA',value:1}],
[{name:'CHN'},{name:'CAN',value:1}],
[{name:'CHN'},{name:'CYP',value:1}],
[{name:'CHN'},{name:'CZE',value:1}],
[{name:'CHN'},{name:'DEU',value:1}],
[{name:'CHN'},{name:'DNK',value:1}],
[{name:'CHN'},{name:'ESP',value:1}],
[{name:'CHN'},{name:'EST',value:1}],
[{name:'CHN'},{name:'FIN',value:1}],
[{name:'CHN'},{name:'FRA',value:1}],
[{name:'CHN'},{name:'GBR',value:1}],
[{name:'CHN'},{name:'GRC',value:1}],
[{name:'CHN'},{name:'HRV',value:1}],
[{name:'CHN'},{name:'HUN',value:1}],
[{name:'CHN'},{name:'IDN',value:1}],
[{name:'CHN'},{name:'IND',value:1}],
[{name:'CHN'},{name:'ITA',value:1}],
[{name:'CHN'},{name:'JPN',value:1}],
[{name:'CHN'},{name:'KOR',value:1}],
[{name:'CHN'},{name:'LTU',value:1}],
[{name:'CHN'},{name:'LVA',value:1}],
[{name:'CHN'},{name:'MEX',value:1}],
[{name:'CHN'},{name:'MLT',value:1}],
[{name:'CHN'},{name:'NLD',value:1}],
[{name:'CHN'},{name:'NOR',value:1}],
[{name:'CHN'},{name:'POL',value:1}],
[{name:'CHN'},{name:'PRT',value:1}],
[{name:'CHN'},{name:'ROU',value:1}],
[{name:'CHN'},{name:'RUS',value:1}],
[{name:'CHN'},{name:'SVK',value:1}],
[{name:'CHN'},{name:'SVN',value:1}],
[{name:'CHN'},{name:'SWE',value:1}],
[{name:'CHN'},{name:'TUR',value:1}],
[{name:'CHN'},{name:'TWN',value:1}],
[{name:'CHN'},{name:'USA',value:1}]
];
var planePath = 'path://M1705.06,1318.313v-89.254l-319.9-221.799l0.073-208.063c0.521-84.662-26.629-121.796-63.961-121.491c-37.332-0.305-64.482,36.829-63.961,121.491l0.073,208.063l-319.9,221.799v89.254l330.343-157.288l12.238,241.308l-134.449,92.931l0.531,42.034l175.125-42.917l175.125,42.917l0.531-42.034l-134.449-92.931l12.238-241.308L1705.06,1318.313z';
var convertData = function (data) {
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var fromCoord = geoCoordMap[dataItem[0].name];
var toCoord = geoCoordMap[dataItem[1].name];
if (fromCoord && toCoord) {
res.push({
fromName: dataItem[0].name,
toName: dataItem[1].name,
coords: [fromCoord, toCoord]
});
}
}
return res;
};
var color = ['#a6c84c', '#ffa022', '#46bee9'];
var series = [];
[['CHN_2000', BJData], ['CHN_2004', SHData], ['CHN_2014', GZData]].forEach(function (item, i) {
series.push({
name: item[0] ,
type: 'lines',
zlevel: 1,
effect: {
show: true,
period: 6,
trailLength: 0.7,
color: '#fff',
symbolSize: 3
},
lineStyle: {
normal: {
color: color[i],
width: 0,
curveness: 0.2
}
},
data: convertData(item[1])
},
{
name: item[0] ,
type: 'lines',
zlevel: 2,
symbol: ['none', 'arrow'],
symbolSize: 10,
effect: {
show: true,
period: 6,
trailLength: 0,
symbol: planePath,
symbolSize: 15
},
lineStyle: {
normal: {
color: color[i],
width: 1,
opacity: 0.6,
curveness: 0.2
}
},
data: convertData(item[1])
},
{
name: item[0],
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 2,
rippleEffect: {
brushType: 'stroke'
},
label: {
normal: {
show: true,
position: 'right',
formatter: '{b}'
}
},
symbolSize: function (val) {
return val[2] / 8;
},
itemStyle: {
normal: {
color: color[i]
}
},
data: item[1].map(function (dataItem) {
return {
name: dataItem[1].name,
value: geoCoordMap[dataItem[1].name].concat([dataItem[1].value])
};
})
});
});
var option = {
backgroundColor: '#404a59',
title : {
text: 'Network',
subtext: 'CHN',
left: 'center',
textStyle : {
color: '#fff'
}
},
tooltip : {
trigger: 'item'
},
legend: {
orient: 'vertical',
top: 'bottom',
left: 'right',
data:['CHN_2000', 'CHN_2004', 'CHN_2014'],
textStyle: {
color: '#fff'
},
selectedMode: 'single' //或者multiple
},
// toolbox: {
// show: true,
// feature: {
// dataZoom: {
// yAxisIndex: 'none'
// },
// dataView: {readOnly: false},
// restore: {},
// saveAsImage: {}
// }
// },
geo: {
map: 'world',
label: {
emphasis: {
show: false
}
},
roam: true,
itemStyle: {
normal: {
areaColor: '#323c48',
borderColor: '#404a59'
},
emphasis: {
areaColor: '#2a333d'
}
}
},
series: series
};
myChart.setOption(option);
});
| DA092/ppt | map.js | JavaScript | mit | 10,980 |
/* *
*
* Exporting module
*
* (c) 2010-2021 Torstein Honsi
*
* License: www.highcharts.com/license
*
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
*
* */
'use strict';
import AST from '../../Core/Renderer/HTML/AST.js';
import Chart from '../../Core/Chart/Chart.js';
import ChartNavigationComposition from '../../Core/Chart/ChartNavigationComposition.js';
import D from '../../Core/DefaultOptions.js';
var defaultOptions = D.defaultOptions;
import ExportingDefaults from './ExportingDefaults.js';
import ExportingSymbols from './ExportingSymbols.js';
import G from '../../Core/Globals.js';
var doc = G.doc, win = G.win;
import HU from '../../Core/HttpUtilities.js';
import U from '../../Core/Utilities.js';
var addEvent = U.addEvent, css = U.css, createElement = U.createElement, discardElement = U.discardElement, extend = U.extend, find = U.find, fireEvent = U.fireEvent, isObject = U.isObject, merge = U.merge, objectEach = U.objectEach, pick = U.pick, removeEvent = U.removeEvent, uniqueKey = U.uniqueKey;
/* *
*
* Composition
*
* */
var Exporting;
(function (Exporting) {
/* *
*
* Declarations
*
* */
/* *
*
* Constants
*
* */
var composedClasses = [];
// These CSS properties are not inlined. Remember camelCase.
var inlineBlacklist = [
/-/,
/^(clipPath|cssText|d|height|width)$/,
/^font$/,
/[lL]ogical(Width|Height)$/,
/perspective/,
/TapHighlightColor/,
/^transition/,
/^length$/ // #7700
// /^text (border|color|cursor|height|webkitBorder)/
];
// These ones are translated to attributes rather than styles
var inlineToAttributes = [
'fill',
'stroke',
'strokeLinecap',
'strokeLinejoin',
'strokeWidth',
'textAnchor',
'x',
'y'
];
Exporting.inlineWhitelist = [];
var unstyledElements = [
'clipPath',
'defs',
'desc'
];
/* *
*
* Variables
*
* */
var printingChart;
/* *
*
* Functions
*
* */
/* eslint-disable valid-jsdoc */
/**
* Add the export button to the chart, with options.
*
* @private
* @function Highcharts.Chart#addButton
* @param {Highcharts.NavigationButtonOptions} options
* @return {void}
* @requires modules/exporting
*/
function addButton(options) {
var chart = this, renderer = chart.renderer, btnOptions = merge(chart.options.navigation.buttonOptions, options), onclick = btnOptions.onclick, menuItems = btnOptions.menuItems, symbolSize = btnOptions.symbolSize || 12;
var symbol;
if (!chart.btnCount) {
chart.btnCount = 0;
}
// Keeps references to the button elements
if (!chart.exportDivElements) {
chart.exportDivElements = [];
chart.exportSVGElements = [];
}
if (btnOptions.enabled === false || !btnOptions.theme) {
return;
}
var attr = btnOptions.theme, states = attr.states, hover = states && states.hover, select = states && states.select;
var callback;
if (!chart.styledMode) {
attr.fill = pick(attr.fill, "#ffffff" /* backgroundColor */);
attr.stroke = pick(attr.stroke, 'none');
}
delete attr.states;
if (onclick) {
callback = function (e) {
if (e) {
e.stopPropagation();
}
onclick.call(chart, e);
};
}
else if (menuItems) {
callback = function (e) {
// consistent with onclick call (#3495)
if (e) {
e.stopPropagation();
}
chart.contextMenu(button.menuClassName, menuItems, button.translateX, button.translateY, button.width, button.height, button);
button.setState(2);
};
}
if (btnOptions.text && btnOptions.symbol) {
attr.paddingLeft = pick(attr.paddingLeft, 30);
}
else if (!btnOptions.text) {
extend(attr, {
width: btnOptions.width,
height: btnOptions.height,
padding: 0
});
}
if (!chart.styledMode) {
attr['stroke-linecap'] = 'round';
attr.fill = pick(attr.fill, "#ffffff" /* backgroundColor */);
attr.stroke = pick(attr.stroke, 'none');
}
var button = renderer
.button(btnOptions.text, 0, 0, callback, attr, hover, select)
.addClass(options.className)
.attr({
title: pick(chart.options.lang[btnOptions._titleKey || btnOptions.titleKey], '')
});
button.menuClassName = (options.menuClassName ||
'highcharts-menu-' + chart.btnCount++);
if (btnOptions.symbol) {
symbol = renderer
.symbol(btnOptions.symbol, btnOptions.symbolX - (symbolSize / 2), btnOptions.symbolY - (symbolSize / 2), symbolSize, symbolSize
// If symbol is an image, scale it (#7957)
, {
width: symbolSize,
height: symbolSize
})
.addClass('highcharts-button-symbol')
.attr({
zIndex: 1
})
.add(button);
if (!chart.styledMode) {
symbol.attr({
stroke: btnOptions.symbolStroke,
fill: btnOptions.symbolFill,
'stroke-width': btnOptions.symbolStrokeWidth || 1
});
}
}
button
.add(chart.exportingGroup)
.align(extend(btnOptions, {
width: button.width,
x: pick(btnOptions.x, chart.buttonOffset) // #1654
}), true, 'spacingBox');
chart.buttonOffset += ((button.width + btnOptions.buttonSpacing) *
(btnOptions.align === 'right' ? -1 : 1));
chart.exportSVGElements.push(button, symbol);
}
/**
* Clena up after printing a chart.
*
* @function Highcharts#afterPrint
*
* @private
*
* @param {Highcharts.Chart} chart
* Chart that was (or suppose to be) printed
* @return {void}
*
* @fires Highcharts.Chart#event:afterPrint
*/
function afterPrint() {
var chart = this;
if (!chart.printReverseInfo) {
return void 0;
}
var _a = chart.printReverseInfo, childNodes = _a.childNodes, origDisplay = _a.origDisplay, resetParams = _a.resetParams;
// put the chart back in
chart.moveContainers(chart.renderTo);
// restore all body content
[].forEach.call(childNodes, function (node, i) {
if (node.nodeType === 1) {
node.style.display = (origDisplay[i] || '');
}
});
chart.isPrinting = false;
// Reset printMaxWidth
if (resetParams) {
chart.setSize.apply(chart, resetParams);
}
delete chart.printReverseInfo;
printingChart = void 0;
fireEvent(chart, 'afterPrint');
}
/**
* Prepare chart and document before printing a chart.
*
* @function Highcharts#beforePrint
*
* @private
*
* @return {void}
*
* @fires Highcharts.Chart#event:beforePrint
*/
function beforePrint() {
var chart = this, body = doc.body, printMaxWidth = chart.options.exporting.printMaxWidth, printReverseInfo = {
childNodes: body.childNodes,
origDisplay: [],
resetParams: void 0
};
chart.isPrinting = true;
chart.pointer.reset(null, 0);
fireEvent(chart, 'beforePrint');
// Handle printMaxWidth
var handleMaxWidth = printMaxWidth && chart.chartWidth > printMaxWidth;
if (handleMaxWidth) {
printReverseInfo.resetParams = [
chart.options.chart.width,
void 0,
false
];
chart.setSize(printMaxWidth, void 0, false);
}
// hide all body content
[].forEach.call(printReverseInfo.childNodes, function (node, i) {
if (node.nodeType === 1) {
printReverseInfo.origDisplay[i] = node.style.display;
node.style.display = 'none';
}
});
// pull out the chart
chart.moveContainers(body);
// Storage details for undo action after printing
chart.printReverseInfo = printReverseInfo;
}
/**
* @private
*/
function chartCallback(chart) {
var composition = chart;
composition.renderExporting();
addEvent(chart, 'redraw', composition.renderExporting);
// Destroy the export elements at chart destroy
addEvent(chart, 'destroy', composition.destroyExport);
// Uncomment this to see a button directly below the chart, for quick
// testing of export
/*
let button, viewImage, viewSource;
if (!chart.renderer.forExport) {
viewImage = function () {
let div = doc.createElement('div');
div.innerHTML = chart.getSVGForExport();
chart.renderTo.parentNode.appendChild(div);
};
viewSource = function () {
let pre = doc.createElement('pre');
pre.innerHTML = chart.getSVGForExport()
.replace(/</g, '\n<')
.replace(/>/g, '>');
chart.renderTo.parentNode.appendChild(pre);
};
viewImage();
// View SVG Image
button = doc.createElement('button');
button.innerHTML = 'View SVG Image';
chart.renderTo.parentNode.appendChild(button);
button.onclick = viewImage;
// View SVG Source
button = doc.createElement('button');
button.innerHTML = 'View SVG Source';
chart.renderTo.parentNode.appendChild(button);
button.onclick = viewSource;
}
//*/
}
/**
* @private
*/
function compose(ChartClass, SVGRendererClass) {
ExportingSymbols.compose(SVGRendererClass);
if (composedClasses.indexOf(ChartClass) === -1) {
composedClasses.push(ChartClass);
var chartProto = ChartClass.prototype;
chartProto.afterPrint = afterPrint;
chartProto.exportChart = exportChart;
chartProto.inlineStyles = inlineStyles;
chartProto.print = print;
chartProto.sanitizeSVG = sanitizeSVG;
chartProto.getChartHTML = getChartHTML;
chartProto.getSVG = getSVG;
chartProto.getSVGForExport = getSVGForExport;
chartProto.getFilename = getFilename;
chartProto.moveContainers = moveContainers;
chartProto.beforePrint = beforePrint;
chartProto.contextMenu = contextMenu;
chartProto.addButton = addButton;
chartProto.destroyExport = destroyExport;
chartProto.renderExporting = renderExporting;
chartProto.callbacks.push(chartCallback);
addEvent(ChartClass, 'init', onChartInit);
if (G.isSafari) {
G.win.matchMedia('print').addListener(function (mqlEvent) {
if (!printingChart) {
return void 0;
}
if (mqlEvent.matches) {
printingChart.beforePrint();
}
else {
printingChart.afterPrint();
}
});
}
}
}
Exporting.compose = compose;
/**
* Display a popup menu for choosing the export type.
*
* @private
* @function Highcharts.Chart#contextMenu
* @param {string} className
* An identifier for the menu.
* @param {Array<string|Highcharts.ExportingMenuObject>} items
* A collection with text and onclicks for the items.
* @param {number} x
* The x position of the opener button
* @param {number} y
* The y position of the opener button
* @param {number} width
* The width of the opener button
* @param {number} height
* The height of the opener button
* @return {void}
* @requires modules/exporting
*/
function contextMenu(className, items, x, y, width, height, button) {
var chart = this, navOptions = chart.options.navigation, chartWidth = chart.chartWidth, chartHeight = chart.chartHeight, cacheName = 'cache-' + className, menuPadding = Math.max(width, height); // for mouse leave detection
var innerMenu, menu = chart[cacheName];
// create the menu only the first time
if (!menu) {
// create a HTML element above the SVG
chart.exportContextMenu = chart[cacheName] = menu =
createElement('div', {
className: className
}, {
position: 'absolute',
zIndex: 1000,
padding: menuPadding + 'px',
pointerEvents: 'auto'
}, chart.fixedDiv || chart.container);
innerMenu = createElement('ul', { className: 'highcharts-menu' }, {
listStyle: 'none',
margin: 0,
padding: 0
}, menu);
// Presentational CSS
if (!chart.styledMode) {
css(innerMenu, extend({
MozBoxShadow: '3px 3px 10px #888',
WebkitBoxShadow: '3px 3px 10px #888',
boxShadow: '3px 3px 10px #888'
}, navOptions.menuStyle));
}
// hide on mouse out
menu.hideMenu = function () {
css(menu, { display: 'none' });
if (button) {
button.setState(0);
}
chart.openMenu = false;
// #10361, #9998
css(chart.renderTo, { overflow: 'hidden' });
css(chart.container, { overflow: 'hidden' });
U.clearTimeout(menu.hideTimer);
fireEvent(chart, 'exportMenuHidden');
};
// Hide the menu some time after mouse leave (#1357)
chart.exportEvents.push(addEvent(menu, 'mouseleave', function () {
menu.hideTimer = win.setTimeout(menu.hideMenu, 500);
}), addEvent(menu, 'mouseenter', function () {
U.clearTimeout(menu.hideTimer);
}),
// Hide it on clicking or touching outside the menu (#2258,
// #2335, #2407)
addEvent(doc, 'mouseup', function (e) {
if (!chart.pointer.inClass(e.target, className)) {
menu.hideMenu();
}
}), addEvent(menu, 'click', function () {
if (chart.openMenu) {
menu.hideMenu();
}
}));
// create the items
items.forEach(function (item) {
if (typeof item === 'string') {
item = chart.options.exporting
.menuItemDefinitions[item];
}
if (isObject(item, true)) {
var element = void 0;
if (item.separator) {
element = createElement('hr', void 0, void 0, innerMenu);
}
else {
// When chart initialized with the table,
// wrong button text displayed, #14352.
if (item.textKey === 'viewData' && chart.isDataTableVisible) {
item.textKey = 'hideData';
}
element = createElement('li', {
className: 'highcharts-menu-item',
onclick: function (e) {
if (e) { // IE7
e.stopPropagation();
}
menu.hideMenu();
if (item.onclick) {
item.onclick
.apply(chart, arguments);
}
}
}, void 0, innerMenu);
AST.setElementHTML(element, item.text ||
chart.options.lang[item.textKey]);
if (!chart.styledMode) {
element.onmouseover = function () {
css(this, navOptions.menuItemHoverStyle);
};
element.onmouseout = function () {
css(this, navOptions.menuItemStyle);
};
css(element, extend({
cursor: 'pointer'
}, navOptions.menuItemStyle));
}
}
// Keep references to menu divs to be able to destroy them
chart.exportDivElements.push(element);
}
});
// Keep references to menu and innerMenu div to be able to destroy
// them
chart.exportDivElements.push(innerMenu, menu);
chart.exportMenuWidth = menu.offsetWidth;
chart.exportMenuHeight = menu.offsetHeight;
}
var menuStyle = { display: 'block' };
// if outside right, right align it
if (x + chart.exportMenuWidth > chartWidth) {
menuStyle.right = (chartWidth - x - width - menuPadding) + 'px';
}
else {
menuStyle.left = (x - menuPadding) + 'px';
}
// if outside bottom, bottom align it
if (y + height + chart.exportMenuHeight > chartHeight &&
button.alignOptions.verticalAlign !== 'top') {
menuStyle.bottom = (chartHeight - y - menuPadding) + 'px';
}
else {
menuStyle.top = (y + height - menuPadding) + 'px';
}
css(menu, menuStyle);
// #10361, #9998
css(chart.renderTo, { overflow: '' });
css(chart.container, { overflow: '' });
chart.openMenu = true;
fireEvent(chart, 'exportMenuShown');
}
/**
* Destroy the export buttons.
* @private
* @function Highcharts.Chart#destroyExport
* @param {global.Event} [e]
* @return {void}
* @requires modules/exporting
*/
function destroyExport(e) {
var chart = e ? e.target : this, exportSVGElements = chart.exportSVGElements, exportDivElements = chart.exportDivElements, exportEvents = chart.exportEvents;
var cacheName;
// Destroy the extra buttons added
if (exportSVGElements) {
exportSVGElements.forEach(function (elem, i) {
// Destroy and null the svg elements
if (elem) { // #1822
elem.onclick = elem.ontouchstart = null;
cacheName = 'cache-' + elem.menuClassName;
if (chart[cacheName]) {
delete chart[cacheName];
}
exportSVGElements[i] = elem.destroy();
}
});
exportSVGElements.length = 0;
}
// Destroy the exporting group
if (chart.exportingGroup) {
chart.exportingGroup.destroy();
delete chart.exportingGroup;
}
// Destroy the divs for the menu
if (exportDivElements) {
exportDivElements.forEach(function (elem, i) {
if (elem) {
// Remove the event handler
U.clearTimeout(elem.hideTimer); // #5427
removeEvent(elem, 'mouseleave');
// Remove inline events
// (chart.exportDivElements as any)[i] =
exportDivElements[i] =
elem.onmouseout =
elem.onmouseover =
elem.ontouchstart =
elem.onclick = null;
// Destroy the div by moving to garbage bin
discardElement(elem);
}
});
exportDivElements.length = 0;
}
if (exportEvents) {
exportEvents.forEach(function (unbind) {
unbind();
});
exportEvents.length = 0;
}
}
/**
* Exporting module required. Submit an SVG version of the chart to a server
* along with some parameters for conversion.
*
* @sample highcharts/members/chart-exportchart/
* Export with no options
* @sample highcharts/members/chart-exportchart-filename/
* PDF type and custom filename
* @sample highcharts/members/chart-exportchart-custom-background/
* Different chart background in export
* @sample stock/members/chart-exportchart/
* Export with Highcharts Stock
*
* @function Highcharts.Chart#exportChart
*
* @param {Highcharts.ExportingOptions} exportingOptions
* Exporting options in addition to those defined in
* [exporting](https://api.highcharts.com/highcharts/exporting).
*
* @param {Highcharts.Options} chartOptions
* Additional chart options for the exported chart. For example a
* different background color can be added here, or `dataLabels` for
* export only.
*
* @requires modules/exporting
*/
function exportChart(exportingOptions, chartOptions) {
var svg = this.getSVGForExport(exportingOptions, chartOptions);
// merge the options
exportingOptions = merge(this.options.exporting, exportingOptions);
// do the post
HU.post(exportingOptions.url, {
filename: exportingOptions.filename ?
exportingOptions.filename.replace(/\//g, '-') :
this.getFilename(),
type: exportingOptions.type,
// IE8 fails to post undefined correctly, so use 0
width: exportingOptions.width || 0,
scale: exportingOptions.scale,
svg: svg
}, exportingOptions.formAttributes);
}
/**
* Return the unfiltered innerHTML of the chart container. Used as hook for
* plugins. In styled mode, it also takes care of inlining CSS style rules.
*
* @see Chart#getSVG
*
* @function Highcharts.Chart#getChartHTML
*
* @returns {string}
* The unfiltered SVG of the chart.
*
* @requires modules/exporting
*/
function getChartHTML() {
if (this.styledMode) {
this.inlineStyles();
}
return this.container.innerHTML;
}
/**
* Get the default file name used for exported charts. By default it creates
* a file name based on the chart title.
*
* @function Highcharts.Chart#getFilename
*
* @return {string} A file name without extension.
*
* @requires modules/exporting
*/
function getFilename() {
var s = this.userOptions.title && this.userOptions.title.text;
var filename = this.options.exporting.filename;
if (filename) {
return filename.replace(/\//g, '-');
}
if (typeof s === 'string') {
filename = s
.toLowerCase()
.replace(/<\/?[^>]+(>|$)/g, '') // strip HTML tags
.replace(/[\s_]+/g, '-')
.replace(/[^a-z0-9\-]/g, '') // preserve only latin
.replace(/^[\-]+/g, '') // dashes in the start
.replace(/[\-]+/g, '-') // dashes in a row
.substr(0, 24)
.replace(/[\-]+$/g, ''); // dashes in the end;
}
if (!filename || filename.length < 5) {
filename = 'chart';
}
return filename;
}
/**
* Return an SVG representation of the chart.
*
* @sample highcharts/members/chart-getsvg/
* View the SVG from a button
*
* @function Highcharts.Chart#getSVG
*
* @param {Highcharts.Options} [chartOptions]
* Additional chart options for the generated SVG representation. For
* collections like `xAxis`, `yAxis` or `series`, the additional
* options is either merged in to the original item of the same
* `id`, or to the first item if a common id is not found.
*
* @return {string}
* The SVG representation of the rendered chart.
*
* @fires Highcharts.Chart#event:getSVG
*
* @requires modules/exporting
*/
function getSVG(chartOptions) {
var chart = this;
var svg, seriesOptions,
// Copy the options and add extra options
options = merge(chart.options, chartOptions);
// Use userOptions to make the options chain in series right (#3881)
options.plotOptions = merge(chart.userOptions.plotOptions, chartOptions && chartOptions.plotOptions);
// ... and likewise with time, avoid that undefined time properties are
// merged over legacy global time options
options.time = merge(chart.userOptions.time, chartOptions && chartOptions.time);
// create a sandbox where a new chart will be generated
var sandbox = createElement('div', null, {
position: 'absolute',
top: '-9999em',
width: chart.chartWidth + 'px',
height: chart.chartHeight + 'px'
}, doc.body);
// get the source size
var cssWidth = chart.renderTo.style.width, cssHeight = chart.renderTo.style.height, sourceWidth = options.exporting.sourceWidth ||
options.chart.width ||
(/px$/.test(cssWidth) && parseInt(cssWidth, 10)) ||
(options.isGantt ? 800 : 600), sourceHeight = options.exporting.sourceHeight ||
options.chart.height ||
(/px$/.test(cssHeight) && parseInt(cssHeight, 10)) ||
400;
// override some options
extend(options.chart, {
animation: false,
renderTo: sandbox,
forExport: true,
renderer: 'SVGRenderer',
width: sourceWidth,
height: sourceHeight
});
options.exporting.enabled = false; // hide buttons in print
delete options.data; // #3004
// prepare for replicating the chart
options.series = [];
chart.series.forEach(function (serie) {
seriesOptions = merge(serie.userOptions, {
animation: false,
enableMouseTracking: false,
showCheckbox: false,
visible: serie.visible
});
// Used for the navigator series that has its own option set
if (!seriesOptions.isInternal) {
options.series.push(seriesOptions);
}
});
var colls = {};
chart.axes.forEach(function (axis) {
// Assign an internal key to ensure a one-to-one mapping (#5924)
if (!axis.userOptions.internalKey) { // #6444
axis.userOptions.internalKey = uniqueKey();
}
if (!axis.options.isInternal) {
if (!colls[axis.coll]) {
colls[axis.coll] = true;
options[axis.coll] = [];
}
options[axis.coll].push(merge(axis.userOptions, {
visible: axis.visible
}));
}
});
// generate the chart copy
var chartCopy = new Chart(options, chart.callback);
// Axis options and series options (#2022, #3900, #5982)
if (chartOptions) {
['xAxis', 'yAxis', 'series'].forEach(function (coll) {
var collOptions = {};
if (chartOptions[coll]) {
collOptions[coll] = chartOptions[coll];
chartCopy.update(collOptions);
}
});
}
// Reflect axis extremes in the export (#5924)
chart.axes.forEach(function (axis) {
var axisCopy = find(chartCopy.axes, function (copy) {
return copy.options.internalKey ===
axis.userOptions.internalKey;
}), extremes = axis.getExtremes(), userMin = extremes.userMin, userMax = extremes.userMax;
if (axisCopy &&
((typeof userMin !== 'undefined' &&
userMin !== axisCopy.min) || (typeof userMax !== 'undefined' &&
userMax !== axisCopy.max))) {
axisCopy.setExtremes(userMin, userMax, true, false);
}
});
// Get the SVG from the container's innerHTML
svg = chartCopy.getChartHTML();
fireEvent(this, 'getSVG', { chartCopy: chartCopy });
svg = chart.sanitizeSVG(svg, options);
// free up memory
options = null;
chartCopy.destroy();
discardElement(sandbox);
return svg;
}
/**
* @private
* @function Highcharts.Chart#getSVGForExport
* @param {Highcharts.ExportingOptions} options
* @param {Highcharts.Options} chartOptions
* @return {string}
* @requires modules/exporting
*/
function getSVGForExport(options, chartOptions) {
var chartExportingOptions = this.options.exporting;
return this.getSVG(merge({ chart: { borderRadius: 0 } }, chartExportingOptions.chartOptions, chartOptions, {
exporting: {
sourceWidth: ((options && options.sourceWidth) ||
chartExportingOptions.sourceWidth),
sourceHeight: ((options && options.sourceHeight) ||
chartExportingOptions.sourceHeight)
}
}));
}
/**
* Make hyphenated property names out of camelCase
* @private
* @param {string} prop
* Property name in camelCase
* @return {string}
* Hyphenated property name
*/
function hyphenate(prop) {
return prop.replace(/([A-Z])/g, function (a, b) {
return '-' + b.toLowerCase();
});
}
/**
* Analyze inherited styles from stylesheets and add them inline
*
* @private
* @function Highcharts.Chart#inlineStyles
* @return {void}
*
* @todo: What are the border styles for text about? In general, text has a
* lot of properties.
* @todo: Make it work with IE9 and IE10.
*
* @requires modules/exporting
*/
function inlineStyles() {
var blacklist = inlineBlacklist, whitelist = Exporting.inlineWhitelist, // For IE
defaultStyles = {};
var dummySVG;
// Create an iframe where we read default styles without pollution from
// this body
var iframe = doc.createElement('iframe');
css(iframe, {
width: '1px',
height: '1px',
visibility: 'hidden'
});
doc.body.appendChild(iframe);
var iframeDoc = iframe.contentWindow.document;
iframeDoc.open();
iframeDoc.write('<svg xmlns="http://www.w3.org/2000/svg"></svg>');
iframeDoc.close();
/**
* Call this on all elements and recurse to children
* @private
* @param {Highcharts.HTMLDOMElement} node
* Element child
* @return {void}
*/
function recurse(node) {
var styles, parentStyles, cssText = '', dummy, styleAttr, blacklisted, whitelisted, i;
/**
* Check computed styles and whether they are in the white/blacklist
* for styles or atttributes.
* @private
* @param {string} val
* Style value
* @param {string} prop
* Style property name
* @return {void}
*/
function filterStyles(val, prop) {
// Check against whitelist & blacklist
blacklisted = whitelisted = false;
if (whitelist.length) {
// Styled mode in IE has a whitelist instead.
// Exclude all props not in this list.
i = whitelist.length;
while (i-- && !whitelisted) {
whitelisted = whitelist[i].test(prop);
}
blacklisted = !whitelisted;
}
// Explicitly remove empty transforms
if (prop === 'transform' && val === 'none') {
blacklisted = true;
}
i = blacklist.length;
while (i-- && !blacklisted) {
blacklisted = (blacklist[i].test(prop) ||
typeof val === 'function');
}
if (!blacklisted) {
// If parent node has the same style, it gets inherited, no
// need to inline it. Top-level props should be diffed
// against parent (#7687).
if ((parentStyles[prop] !== val ||
node.nodeName === 'svg') &&
defaultStyles[node.nodeName][prop] !== val) {
// Attributes
if (!inlineToAttributes ||
inlineToAttributes.indexOf(prop) !== -1) {
if (val) {
node.setAttribute(hyphenate(prop), val);
}
// Styles
}
else {
cssText += hyphenate(prop) + ':' + val + ';';
}
}
}
}
if (node.nodeType === 1 &&
unstyledElements.indexOf(node.nodeName) === -1) {
styles = win.getComputedStyle(node, null);
parentStyles = node.nodeName === 'svg' ?
{} :
win.getComputedStyle(node.parentNode, null);
// Get default styles from the browser so that we don't have to
// add these
if (!defaultStyles[node.nodeName]) {
/*
if (!dummySVG) {
dummySVG = doc.createElementNS(H.SVG_NS, 'svg');
dummySVG.setAttribute('version', '1.1');
doc.body.appendChild(dummySVG);
}
*/
dummySVG = iframeDoc.getElementsByTagName('svg')[0];
dummy = iframeDoc.createElementNS(node.namespaceURI, node.nodeName);
dummySVG.appendChild(dummy);
// Copy, so we can remove the node
defaultStyles[node.nodeName] = merge(win.getComputedStyle(dummy, null));
// Remove default fill, otherwise text disappears when
// exported
if (node.nodeName === 'text') {
delete defaultStyles.text.fill;
}
dummySVG.removeChild(dummy);
}
// Loop through all styles and add them inline if they are ok
if (G.isFirefox || G.isMS) {
// Some browsers put lots of styles on the prototype
for (var p in styles) { // eslint-disable-line guard-for-in
filterStyles(styles[p], p);
}
}
else {
objectEach(styles, filterStyles);
}
// Apply styles
if (cssText) {
styleAttr = node.getAttribute('style');
node.setAttribute('style', (styleAttr ? styleAttr + ';' : '') + cssText);
}
// Set default stroke width (needed at least for IE)
if (node.nodeName === 'svg') {
node.setAttribute('stroke-width', '1px');
}
if (node.nodeName === 'text') {
return;
}
// Recurse
[].forEach.call(node.children || node.childNodes, recurse);
}
}
/**
* Remove the dummy objects used to get defaults
* @private
* @return {void}
*/
function tearDown() {
dummySVG.parentNode.removeChild(dummySVG);
// Remove trash from DOM that stayed after each exporting
iframe.parentNode.removeChild(iframe);
}
recurse(this.container.querySelector('svg'));
tearDown();
}
/**
* Move the chart container(s) to another div.
*
* @function Highcharts#moveContainers
*
* @private
*
* @param {Highcharts.HTMLDOMElement} moveTo
* Move target
* @return {void}
*/
function moveContainers(moveTo) {
var chart = this;
(chart.fixedDiv ? // When scrollablePlotArea is active (#9533)
[chart.fixedDiv, chart.scrollingContainer] :
[chart.container]).forEach(function (div) {
moveTo.appendChild(div);
});
}
/**
* Add update methods to handle chart.update and chart.exporting.update and
* chart.navigation.update. These must be added to the chart instance rather
* than the Chart prototype in order to use the chart instance inside the
* update function.
* @private
*/
function onChartInit() {
var chart = this,
/**
* @private
* @param {"exporting"|"navigation"} prop
* Property name in option root
* @param {Highcharts.ExportingOptions|Highcharts.NavigationOptions} options
* Options to update
* @param {boolean} [redraw=true]
* Whether to redraw
* @return {void}
*/
update = function (prop, options, redraw) {
chart.isDirtyExporting = true;
merge(true, chart.options[prop], options);
if (pick(redraw, true)) {
chart.redraw();
}
};
chart.exporting = {
update: function (options, redraw) {
update('exporting', options, redraw);
}
};
// Register update() method for navigation. Can not be set the same way
// as for exporting, because navigation options are shared with bindings
// which has separate update() logic.
ChartNavigationComposition
.compose(chart).navigation
.addUpdate(function (options, redraw) {
update('navigation', options, redraw);
});
}
/**
* Exporting module required. Clears away other elements in the page and
* prints the chart as it is displayed. By default, when the exporting
* module is enabled, a context button with a drop down menu in the upper
* right corner accesses this function.
*
* @sample highcharts/members/chart-print/
* Print from a HTML button
*
* @function Highcharts.Chart#print
*
* @return {void}
*
* @fires Highcharts.Chart#event:beforePrint
* @fires Highcharts.Chart#event:afterPrint
*
* @requires modules/exporting
*/
function print() {
var chart = this;
if (chart.isPrinting) { // block the button while in printing mode
return;
}
printingChart = chart;
if (!G.isSafari) {
chart.beforePrint();
}
// Give the browser time to draw WebGL content, an issue that randomly
// appears (at least) in Chrome ~67 on the Mac (#8708).
setTimeout(function () {
win.focus(); // #1510
win.print();
// allow the browser to prepare before reverting
if (!G.isSafari) {
setTimeout(function () {
chart.afterPrint();
}, 1000);
}
}, 1);
}
/**
* Add the buttons on chart load
* @private
* @function Highcharts.Chart#renderExporting
* @return {void}
* @requires modules/exporting
*/
function renderExporting() {
var chart = this, exportingOptions = chart.options.exporting, buttons = exportingOptions.buttons, isDirty = chart.isDirtyExporting || !chart.exportSVGElements;
chart.buttonOffset = 0;
if (chart.isDirtyExporting) {
chart.destroyExport();
}
if (isDirty && exportingOptions.enabled !== false) {
chart.exportEvents = [];
chart.exportingGroup = chart.exportingGroup ||
chart.renderer.g('exporting-group').attr({
zIndex: 3 // #4955, // #8392
}).add();
objectEach(buttons, function (button) {
chart.addButton(button);
});
chart.isDirtyExporting = false;
}
}
/**
* Exporting module only. A collection of fixes on the produced SVG to
* account for expando properties, browser bugs, VML problems and other.
* Returns a cleaned SVG.
*
* @private
* @function Highcharts.Chart#sanitizeSVG
* @param {string} svg
* SVG code to sanitize
* @param {Highcharts.Options} options
* Chart options to apply
* @return {string}
* Sanitized SVG code
* @requires modules/exporting
*/
function sanitizeSVG(svg, options) {
var split = svg.indexOf('</svg>') + 6;
var html = svg.substr(split);
// Remove any HTML added to the container after the SVG (#894, #9087)
svg = svg.substr(0, split);
// Move HTML into a foreignObject
if (options && options.exporting && options.exporting.allowHTML) {
if (html) {
html = '<foreignObject x="0" y="0" ' +
'width="' + options.chart.width + '" ' +
'height="' + options.chart.height + '">' +
'<body xmlns="http://www.w3.org/1999/xhtml">' +
// Some tags needs to be closed in xhtml (#13726)
html.replace(/(<(?:img|br).*?(?=\>))>/g, '$1 />') +
'</body>' +
'</foreignObject>';
svg = svg.replace('</svg>', html + '</svg>');
}
}
svg = svg
.replace(/zIndex="[^"]+"/g, '')
.replace(/symbolName="[^"]+"/g, '')
.replace(/jQuery[0-9]+="[^"]+"/g, '')
.replace(/url\(("|")(.*?)("|")\;?\)/g, 'url($2)')
.replace(/url\([^#]+#/g, 'url(#')
.replace(/<svg /, '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ')
.replace(/ (|NS[0-9]+\:)href=/g, ' xlink:href=') // #3567
.replace(/\n/, ' ')
// Batik doesn't support rgba fills and strokes (#3095)
.replace(/(fill|stroke)="rgba\(([ 0-9]+,[ 0-9]+,[ 0-9]+),([ 0-9\.]+)\)"/g, // eslint-disable-line max-len
'$1="rgb($2)" $1-opacity="$3"')
// Replace HTML entities, issue #347
.replace(/ /g, '\u00A0') // no-break space
.replace(/­/g, '\u00AD'); // soft hyphen
// Further sanitize for oldIE
if (this.ieSanitizeSVG) {
svg = this.ieSanitizeSVG(svg);
}
return svg;
}
})(Exporting || (Exporting = {}));
/* *
*
* Registry
*
* */
defaultOptions.exporting = merge(ExportingDefaults.exporting, defaultOptions.exporting);
defaultOptions.lang = merge(ExportingDefaults.lang, defaultOptions.lang);
// Buttons and menus are collected in a separate config option set called
// 'navigation'. This can be extended later to add control buttons like
// zoom and pan right click menus.
/**
* A collection of options for buttons and menus appearing in the exporting
* module or in Stock Tools.
*
* @requires modules/exporting
* @optionparent navigation
*/
defaultOptions.navigation = merge(ExportingDefaults.navigation, defaultOptions.navigation);
/* *
*
* Default Export
*
* */
export default Exporting;
/* *
*
* API Declarations
*
* */
/**
* Gets fired after a chart is printed through the context menu item or the
* Chart.print method.
*
* @callback Highcharts.ExportingAfterPrintCallbackFunction
*
* @param {Highcharts.Chart} chart
* The chart on which the event occured.
*
* @param {global.Event} event
* The event that occured.
*/
/**
* Gets fired before a chart is printed through the context menu item or the
* Chart.print method.
*
* @callback Highcharts.ExportingBeforePrintCallbackFunction
*
* @param {Highcharts.Chart} chart
* The chart on which the event occured.
*
* @param {global.Event} event
* The event that occured.
*/
/**
* Function to call if the offline-exporting module fails to export a chart on
* the client side.
*
* @callback Highcharts.ExportingErrorCallbackFunction
*
* @param {Highcharts.ExportingOptions} options
* The exporting options.
*
* @param {global.Error} err
* The error from the module.
*/
/**
* Definition for a menu item in the context menu.
*
* @interface Highcharts.ExportingMenuObject
*/ /**
* The text for the menu item.
*
* @name Highcharts.ExportingMenuObject#text
* @type {string|undefined}
*/ /**
* If internationalization is required, the key to a language string.
*
* @name Highcharts.ExportingMenuObject#textKey
* @type {string|undefined}
*/ /**
* The click handler for the menu item.
*
* @name Highcharts.ExportingMenuObject#onclick
* @type {Highcharts.EventCallbackFunction<Highcharts.Chart>|undefined}
*/ /**
* Indicates a separator line instead of an item.
*
* @name Highcharts.ExportingMenuObject#separator
* @type {boolean|undefined}
*/
/**
* Possible MIME types for exporting.
*
* @typedef {"image/png"|"image/jpeg"|"application/pdf"|"image/svg+xml"} Highcharts.ExportingMimeTypeValue
*/
(''); // keeps doclets above in transpiled file
/* *
*
* API Options
*
* */
/**
* Fires after a chart is printed through the context menu item or the
* `Chart.print` method.
*
* @sample highcharts/chart/events-beforeprint-afterprint/
* Rescale the chart to print
*
* @type {Highcharts.ExportingAfterPrintCallbackFunction}
* @since 4.1.0
* @context Highcharts.Chart
* @requires modules/exporting
* @apioption chart.events.afterPrint
*/
/**
* Fires before a chart is printed through the context menu item or
* the `Chart.print` method.
*
* @sample highcharts/chart/events-beforeprint-afterprint/
* Rescale the chart to print
*
* @type {Highcharts.ExportingBeforePrintCallbackFunction}
* @since 4.1.0
* @context Highcharts.Chart
* @requires modules/exporting
* @apioption chart.events.beforePrint
*/
(''); // keeps doclets above in transpiled file
| cdnjs/cdnjs | ajax/libs/highcharts/9.3.0/es-modules/Extensions/Exporting/Exporting.js | JavaScript | mit | 47,830 |
Components.utils.import('resource:///modules/CustomizableUI.jsm')
function E (id, context) {
var element = context.getElementById(id)
return element
}
function hide (element) {
if (element) {
element.setAttribute('hidden', 'true')
}
}
function disable (element) {
if (element) {
element.disabled = true
element.setAttribute('disabled', 'true')
}
}
function removeDeveloperTools (doc) {
var win = doc.defaultView
// Need to delay this because devtools is created dynamically
win.setTimeout(function () {
CustomizableUI.destroyWidget('developer-button')
hide(E('webDeveloperMenu', doc))
var devtoolsKeyset = doc.getElementById('devtoolsKeyset')
if (devtoolsKeyset) {
for (var i = 0; i < devtoolsKeyset.childNodes.length; i++) {
devtoolsKeyset.childNodes[i].removeAttribute('oncommand')
devtoolsKeyset.childNodes[i].removeAttribute('command')
}
}
}, 500)
try {
doc.getElementById('Tools:ResponsiveUI').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:Scratchpad').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:BrowserConsole').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:BrowserToolbox').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:DevAppsMgr').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:DevToolbar').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:DevToolbox').removeAttribute('oncommand')
} catch (e) {}
try {
doc.getElementById('Tools:DevToolbarFocus').removeAttribute('oncommand')
} catch (e) {}
CustomizableUI.destroyWidget('developer-button')
}
var webc = {
init: function (event) {
// Following https://github.com/mkaply/cck2wizard/blob/9968f143386dfaa2afe519ee48aa2ae730a12055/cck2/modules/CCK2BrowserOverlay.jsm#L24
var doc = event.target
removeDeveloperTools(doc)
if (gBrowser) {
gBrowser.tabContainer.addEventListener('TabClose', webc.tabRemoved, false)
}
gBrowser.getStatusPanel().setAttribute('hidden', 'true')
},
tabRemoved: function (event) {
var closeWindowWithLastTab = true
try {
closeWindowWithLastTab = Services.prefs.getBoolPref('browser.tabs.closeWindowWithLastTab')
} catch (e) {}
// Get number of tabs
var num = gBrowser.browsers.length
// If there are two tabs, the second tab has no title and the closed tab
// does have a title (ie is not the same tab) then close the browser
if ((num === 2) && (!gBrowser.getBrowserAtIndex(1).contentTitle) && event.target.linkedBrowser.contentTitle) {
if (closeWindowWithLastTab) {
goQuitApplication()
}
}
if ((num === 2) && (!gBrowser.getBrowserAtIndex(0).contentTitle)) {
if (closeWindowWithLastTab) {
goQuitApplication()
}
}
}
}
window.addEventListener('load', function load (event) {
window.removeEventListener('load', load, false) // remove listener, no longer needed
webc.init(event)
},
false)
function BrowserLoadURL (aTriggeringEvent, aPostData) { // override browser.js
var url = gURLBar.value
if (url.match(/^file:/) || url.match(/^\//) || url.match(/^resource:/) || url.match(/^about:/)) {
alert('Access to this protocol has been disabled!')
return
}
if (aTriggeringEvent instanceof MouseEvent) {
if (aTriggeringEvent.button === 2) {
return // Do nothing for right clicks
}
// We have a mouse event (from the go button), so use the standard UI link behaviors
openUILink(url, aTriggeringEvent, false, false, true, aPostData)
return
}
if (aTriggeringEvent && aTriggeringEvent.altKey) {
handleURLBarRevert()
content.focus()
gBrowser.loadOneTab(url, null, null, aPostData, false, true
/* allow third party fixup */
)
aTriggeringEvent.preventDefault()
aTriggeringEvent.stopPropagation()
} else {
loadURI(url, null, aPostData, true
/* allow third party fixup */
)
}
focusElement(content)
}
(function () {
function onPageLoad (event) {
var doc = event.target
var win = doc.defaultView
// ignore frame loads
if (win !== win.top) {
return
}
var uri = doc.documentURIObject
// If we get a neterror, try again in 10 seconds
if (uri.spec.match('about:neterror')) {
window.setTimeout(function (win) {
win.location.reload()
}, 10000, win)
}
}
function startup () {
var navigatorToolbox = document.getElementById('navigator-toolbox')
navigatorToolbox.iconsize = 'small'
navigatorToolbox.setAttribute('iconsize', 'small')
var showPrintButton = false
try {
showPrintButton = Services.prefs.getBoolPref('extensions.webconverger.showprintbutton')
} catch (e) {}
if (showPrintButton) {
CustomizableUI.addWidgetToArea('print-button', 'nav-bar')
} else {
CustomizableUI.removeWidgetFromArea('print-button')
}
window.removeEventListener('load', startup, false)
var nobrand = false
try {
nobrand = Services.prefs.getBoolPref('extensions.webconverger.nobrand')
} catch (e) {}
if (!nobrand) {
var insertAfter = document.getElementById('alltabs-button')
document.getElementById('alltabs-button')
var allTabsButton = document.getElementById('alltabs-button')
var spacer = document.createElement('spacer')
spacer.setAttribute('flex', '1')
insertAfter.parentNode.appendChild(spacer)
var box = document.createElement('box')
box.setAttribute('pack', 'center')
box.setAttribute('align', 'center')
var image = document.createElement('image')
image.setAttribute('src', 'chrome://webconverger/content/webclogo.svg')
image.setAttribute('tooltiptext', 'Webconverger')
box.appendChild(image)
insertAfter.parentNode.appendChild(box)
}
document.getElementById('appcontent').addEventListener('DOMContentLoaded', onPageLoad, false)
// Remove social API
SocialActivationListener = {
init: function () {}
}
CustomizableUI.destroyWidget('social-share-button')
CustomizableUI.destroyWidget('pocket-button')
try {
themeURL = Services.prefs.getCharPref('extensions.webconverger.themeURL')
if (themeURL) {
fetch(themeURL, { method: 'GET' })
.then(function (response) {
return response.json()
}).then(function (json) {
console.log('parsed json', json)
var temp = {}
Components.utils.import('resource://gre/modules/LightweightThemeManager.jsm', temp)
temp.LightweightThemeManager.currentTheme = json
}).catch(function (ex) {
console.log('parsing failed', ex)
})
}
} catch (e) { console.log('Issue setting the theme', e) }
}
function shutdown () {
window.removeEventListener('unload', shutdown, false)
document.getElementById('appcontent').removeEventListener('DOMContentLoaded', onPageLoad, false)
}
window.addEventListener('load', startup, false)
window.addEventListener('unload', shutdown, false)
})()
// Disable shift click from opening window
// Fixes https://github.com/Webconverger/webconverger-addon/issues/18
var ffWhereToOpenLink = whereToOpenLink
whereToOpenLink = function (e, ignoreButton, ignoreAlt) {
var where = ffWhereToOpenLink(e, ignoreButton, ignoreAlt)
if (where === 'window') {
where = 'tab'
}
return where
}
| Webconverger/webconverger-addon | src/webconverger.js | JavaScript | mit | 7,623 |
search_result['278']=["topic_0000000000000088.html","ChatService.GetMembers Method",""]; | asiboro/asiboro.github.io | vsdoc/search--/s_278.js | JavaScript | mit | 88 |
// Helper definitions for validation of webgl parameters
/* eslint-disable no-inline-comments, max-len */
// Errors - Constants returned from getError().
const GL_NO_ERROR = 0; // Returned from getError.
const GL_INVALID_ENUM = 0x0500; // Returned from getError.
const GL_INVALID_VALUE = 0x0501; // Returned from getError.
const GL_INVALID_OPERATION = 0x0502; // Returned from getError.
const GL_OUT_OF_MEMORY = 0x0505; // Returned from getError.
const GL_CONTEXT_LOST_WEBGL = 0x9242; // Returned from getError.
const GL_INVALID_FRAMEBUFFER_OPERATION = 0x0506;
// GL errors
const GL_ERROR_MESSAGES = {
// If the WebGL context is lost, this error is returned on the
// first call to getError. Afterwards and until the context has been
// restored, it returns gl.NO_ERROR.
[GL_CONTEXT_LOST_WEBGL]: 'WebGL context lost',
// An unacceptable value has been specified for an enumerated argument.
[GL_INVALID_ENUM]: 'WebGL invalid enumerated argument',
// A numeric argument is out of range.
[GL_INVALID_VALUE]: 'WebGL invalid value',
// The specified command is not allowed for the current state.
[GL_INVALID_OPERATION]: 'WebGL invalid operation',
// The currently bound framebuffer is not framebuffer complete
// when trying to render to or to read from it.
[GL_INVALID_FRAMEBUFFER_OPERATION]: 'WebGL invalid framebuffer operation',
// Not enough memory is left to execute the command.
[GL_OUT_OF_MEMORY]: 'WebGL out of memory'
};
function glGetErrorMessage(gl, glError) {
return GL_ERROR_MESSAGES[glError] || `WebGL unknown error ${glError}`;
}
// Returns an Error representing the Latest webGl error or null
export function glGetError(gl) {
// Loop to ensure all errors are cleared
const errorStack = [];
let glError = gl.getError();
while (glError !== GL_NO_ERROR) {
errorStack.push(glGetErrorMessage(gl, glError));
glError = gl.getError();
}
return errorStack.length ? new Error(errorStack.join('\n')) : null;
}
export function glCheckError(gl) {
if (gl.debug) {
const error = glGetError(gl);
if (error) {
throw error;
}
}
}
| uber-common/luma.gl | modules/webgl/src/webgl-utils/get-error.js | JavaScript | mit | 2,110 |
var args = require("minimist")(process.argv.slice(2));
var default_port = 7654;
/* Start server if listen parameter is specified */
if (args.l || args.listen) {
var server = require("./server")({
port: args.l || args.listen || default_port,
keepalive: args.k || args.keepalive
});
}
/* Connect to remote server if host specified */
if (args._.length > 0) {
var client = require("./client")({
host: args._[0],
port: args.p || args.port || default_port,
keepalive: args.k || args.keepalive
});
} | travissinnott/nodejs-socket-keepalive | index.js | JavaScript | mit | 510 |
import {expect} from 'chai'
import wait from 'ember-test-helpers/wait'
import {beforeEach, describe, it} from 'mocha'
import {
expectCollapsibleHandles,
expectOnValidationState
} from 'dummy/tests/helpers/ember-frost-bunsen'
import {
expectButtonWithState,
expectTextInputWithState,
fillIn,
findTextInputs
} from 'dummy/tests/helpers/ember-frost-core'
import selectors from 'dummy/tests/helpers/selectors'
import {setupFormComponentTest} from 'dummy/tests/helpers/utils'
describe('Integration: Component / frost-bunsen-form / array of objects', function () {
describe('without initial value', function () {
const ctx = setupFormComponentTest({
bunsenModel: {
properties: {
foo: {
items: {
properties: {
bar: {
type: 'string'
},
baz: {
type: 'number'
}
},
type: 'object'
},
type: 'array'
}
},
type: 'object'
}
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'does not render any bunsen text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.renderer.number),
'does not render any bunsen number inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'text'}),
'does not render any text inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'number'}),
'does not render any number inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render any sort handles'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
describe('when form explicitly enabled', function () {
beforeEach(function () {
this.set('disabled', false)
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'does not render any bunsen text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.renderer.number),
'does not render any bunsen number inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'text'}),
'does not render any text inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'number'}),
'does not render any number inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render any sort handles'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
})
describe('when form disabled', function () {
beforeEach(function () {
this.set('disabled', true)
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'does not render any bunsen text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.renderer.number),
'does not render any bunsen number inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'text'}),
'does not render any text inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'number'}),
'does not render any number inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render any sort handles'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.disabled)
expectButtonWithState($button, {
disabled: true,
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
})
describe('when autoAdd enabled', function () {
beforeEach(function () {
this.set('bunsenView', {
cellDefinitions: {
foo: {
children: [
{
model: 'bar'
},
{
model: 'baz'
}
]
}
},
cells: [
{
arrayOptions: {
autoAdd: true,
itemCell: {
extends: 'foo'
}
},
model: 'foo'
}
],
type: 'form',
version: '2.0'
})
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for auto added item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for auto added item'
)
.to.have.length(1)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for auto added item'
)
.to.have.length(1)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for auto added item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for auto added array item'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
text: 'Remove'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
describe('when user inputs value', function () {
beforeEach(function () {
fillIn('bunsenForm-foo.0.bar-input', 'bar')
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for item plus one'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for item plus one'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for item plus one'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for item plus one'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for auto added array item'
)
.to.have.length(0)
const $buttons = this.$(selectors.frost.button.input.enabled)
expect(
$buttons,
'has an enabled button for removing item plus one'
)
.to.have.length(2)
expectButtonWithState($buttons.eq(0), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
text: 'Remove'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 2})
})
describe('when user clears input', function () {
beforeEach(function () {
fillIn('bunsenForm-foo.0.bar-input', '')
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for auto added item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for auto added item'
)
.to.have.length(1)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for auto added item'
)
.to.have.length(1)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for auto added item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for auto added array item'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
text: 'Remove'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
const validationResult = ctx.props.onValidation.lastCall.args[0]
/* FIXME: getting the following error when we expect no errors (MRD - 2016-07-24)
*
* {
* "code": "INVALID_TYPE",
* "message": "Expected type string but found type null",
* "params": ["string", "null"],
* "path": "#/foo/0",
* "schemaId": undefined
* }
*
expect(
validationResult.errors.length,
'informs consumer there are no errors'
)
.to.equal(0)
*/
expect(
validationResult.warnings.length,
'informs consumer there are no warnings'
)
.to.equal(0)
})
})
})
})
describe('when maxItems', function () {
beforeEach(function () {
ctx.props.onValidation.reset()
this.set('bunsenModel', {
properties: {
foo: {
items: {
properties: {
bar: {
type: 'string'
},
baz: {
type: 'number'
}
},
type: 'object'
},
maxItems: 1,
type: 'array'
}
},
type: 'object'
})
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'does not render any bunsen text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.renderer.number),
'does not render any bunsen number inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'text'}),
'does not render any text inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'number'}),
'does not render any number inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render any sort handles'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
describe('when user adds item (maxItems reached)', function () {
beforeEach(function () {
this.$(selectors.frost.button.input.enabled).trigger('click')
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for item'
)
.to.have.length(1)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for item'
)
.to.have.length(1)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for auto added array item'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
text: 'Remove'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 2})
})
})
})
})
describe('with initial value', function () {
const ctx = setupFormComponentTest({
bunsenModel: {
properties: {
foo: {
items: {
properties: {
bar: {
type: 'string'
},
baz: {
type: 'number'
}
},
type: 'object'
},
type: 'array'
}
},
type: 'object'
},
value: {
foo: [
{
bar: 'bar'
},
{
baz: 1
}
]
}
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for array items'
)
.to.have.length(0)
const $buttons = this.$(selectors.frost.button.input.enabled)
expect(
$buttons,
'has three enabled buttons (1 for adding and 2 for removing)'
)
.to.have.length(3)
expectButtonWithState($buttons.eq(0), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(2), {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
describe('when form explicitly enabled', function () {
beforeEach(function () {
this.set('disabled', false)
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for array items'
)
.to.have.length(0)
const $buttons = this.$(selectors.frost.button.input.enabled)
expect(
$buttons,
'has three enabled buttons (1 for adding and 2 for removing)'
)
.to.have.length(3)
expectButtonWithState($buttons.eq(0), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(2), {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
})
describe('when form disabled', function () {
beforeEach(function () {
this.set('disabled', true)
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: true,
type: 'text'
}),
'renders a disabled text input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: true,
type: 'number'
}),
'renders a disabled number input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for array items'
)
.to.have.length(0)
const $buttons = this.$(selectors.frost.button.input.disabled)
expect(
$buttons,
'has three disabled buttons (1 for adding and 2 for removing)'
)
.to.have.length(3)
expectButtonWithState($buttons.eq(0), {
disabled: true,
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
disabled: true,
text: 'Remove'
})
expectButtonWithState($buttons.eq(2), {
disabled: true,
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
describe('when sortable enabled', function () {
beforeEach(function () {
this.set('bunsenView', {
cellDefinitions: {
foo: {
children: [
{
model: 'bar'
},
{
model: 'baz'
}
]
}
},
cells: [
{
arrayOptions: {
sortable: true,
itemCell: {
extends: 'foo'
}
},
model: 'foo'
}
],
type: 'form',
version: '2.0'
})
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: true,
type: 'text'
}),
'renders a disabled text input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: true,
type: 'number'
}),
'renders a disabled number input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.array.sort.handle),
'renders a sort handle for each array item'
)
.to.have.length(2)
// TODO: add test that ensures sort handles appear disabled
const $buttons = this.$(selectors.frost.button.input.disabled)
expect(
$buttons,
'has three disabled buttons (1 for adding and 2 for removing)'
)
.to.have.length(3)
expectButtonWithState($buttons.eq(0), {
disabled: true,
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
disabled: true,
text: 'Remove'
})
expectButtonWithState($buttons.eq(2), {
disabled: true,
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
})
})
describe('when autoAdd enabled', function () {
beforeEach(function () {
this.set('bunsenView', {
cellDefinitions: {
foo: {
children: [
{
model: 'bar'
},
{
model: 'baz'
}
]
}
},
cells: [
{
arrayOptions: {
autoAdd: true,
itemCell: {
extends: 'foo'
}
},
model: 'foo'
}
],
type: 'form',
version: '2.0'
})
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for each array item plus one'
)
.to.have.length(3)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for each array item plus one'
)
.to.have.length(3)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for each array item plus one'
)
.to.have.length(3)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for each array item plus one'
)
.to.have.length(3)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for array items'
)
.to.have.length(0)
const $buttons = this.$(selectors.frost.button.input.enabled)
expect(
$buttons,
'has three enabled buttons for removing items'
)
.to.have.length(3)
expectButtonWithState($buttons.eq(0), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(2), {
text: 'Remove'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
})
describe('when sortable enabled', function () {
beforeEach(function () {
this.set('bunsenView', {
cellDefinitions: {
foo: {
children: [
{
model: 'bar'
},
{
model: 'baz'
}
]
}
},
cells: [
{
arrayOptions: {
sortable: true,
itemCell: {
extends: 'foo'
}
},
model: 'foo'
}
],
type: 'form',
version: '2.0'
})
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'text'
}),
'renders an enabled text input for each array item'
)
.to.have.length(2)
expect(
findTextInputs({
disabled: false,
type: 'number'
}),
'renders an enabled number input for each array item'
)
.to.have.length(2)
expect(
this.$(selectors.bunsen.array.sort.handle),
'renders a sort handle for each array item'
)
.to.have.length(2)
const $buttons = this.$(selectors.frost.button.input.enabled)
expect(
$buttons,
'has three enabled buttons (1 for adding and 2 for removing)'
)
.to.have.length(3)
expectButtonWithState($buttons.eq(0), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(2), {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
})
})
describe('with defaults', function () {
const ctx = setupFormComponentTest({
bunsenModel: {
properties: {
foo: {
items: {
properties: {
bar: {
default: 'test',
type: 'string'
},
baz: {
default: 1.5,
type: 'number'
}
},
type: 'object'
},
type: 'array'
}
},
type: 'object'
}
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'does not render any bunsen text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.renderer.number),
'does not render any bunsen number inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'text'}),
'does not render any text inputs'
)
.to.have.length(0)
expect(
findTextInputs({type: 'number'}),
'does not render any number inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render any sort handles'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 1})
})
describe('when user adds item', function () {
beforeEach(function () {
this.$(selectors.frost.button.input.enabled).click()
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'renders a bunsen text input for item'
)
.to.have.length(1)
expect(
this.$(selectors.bunsen.renderer.number),
'renders a bunsen number input for item'
)
.to.have.length(1)
expect(
findTextInputs({type: 'text'}),
'renders one text input'
)
.to.have.length(1)
expectTextInputWithState('bunsenForm-foo.0.bar-input', {
value: 'test'
})
const $numberInput = this.$(selectors.frost.number.input.enabled)
expect(
findTextInputs({type: 'number'}),
'renders an enabled number input for item'
)
.to.have.length(1)
expect(
$numberInput.val(),
'renders default value for number input'
)
.to.equal('1.5')
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for auto added array item'
)
.to.have.length(0)
const $buttons = this.$(selectors.frost.button.input.enabled)
expect(
$buttons,
'has an enabled button for removing item plus one'
)
.to.have.length(2)
expectButtonWithState($buttons.eq(0), {
text: 'Remove'
})
expectButtonWithState($buttons.eq(1), {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
expectOnValidationState(ctx, {count: 2})
})
describe('when user clears input', function () {
beforeEach(function () {
this.$(selectors.frost.button.input.enabled).first().click()
return wait()
})
it('renders as expected', function () {
expectCollapsibleHandles(0)
expect(
this.$(selectors.bunsen.renderer.text),
'does not render any bunsen text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.renderer.number),
'does not render any bunsen number inputs'
)
.to.have.length(0)
expect(
findTextInputs(),
'does not render any text inputs'
)
.to.have.length(0)
expect(
this.$(selectors.frost.number.input.enabled),
'does not render any number inputs'
)
.to.have.length(0)
expect(
this.$(selectors.bunsen.array.sort.handle),
'does not render sort handle for auto added array item'
)
.to.have.length(0)
const $button = this.$(selectors.frost.button.input.enabled)
expectButtonWithState($button, {
icon: 'round-add',
text: 'Add foo'
})
expect(
this.$(selectors.error),
'does not have any validation errors'
)
.to.have.length(0)
const validationResult = ctx.props.onValidation.lastCall.args[0]
/* FIXME: getting the following error when we expect no errors (MRD - 2016-07-24)
*
* {
* "code": "INVALID_TYPE",
* "message": "Expected type string but found type null",
* "params": ["string", "null"],
* "path": "#/foo/0",
* "schemaId": undefined
* }
*
expect(
validationResult.errors.length,
'informs consumer there are no errors'
)
.to.equal(0)
*/
expect(
validationResult.warnings.length,
'informs consumer there are no warnings'
)
.to.equal(0)
})
})
})
})
})
| sandersky/ember-frost-bunsen | tests/integration/components/frost-bunsen-form/arrays/array-of-objects-test.js | JavaScript | mit | 34,570 |
THREE.OrbitControls = function ( object, domElement ) {
this.object = object;
this.domElement = ( domElement !== undefined ) ? domElement : document;
// API
this.enabled = true;
this.center = new THREE.Vector3();
this.userZoom = true;
this.userZoomSpeed = 1.0;
this.userRotate = true;
this.userRotateSpeed = 1.0;
this.userPan = false;
this.userPanSpeed = 2.0;
this.autoRotate = false;
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
this.minPolarAngle = 0; // radians
this.maxPolarAngle = Math.PI; // radians
this.minDistance = 0;
this.maxDistance = Infinity;
this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
// internals
var scope = this;
var eventDispatcher = new THREE.EventDispatcher();
var EPS = 0.000001;
var PIXELS_PER_ROUND = 1800;
var rotateStart = new THREE.Vector2();
var rotateEnd = new THREE.Vector2();
var rotateDelta = new THREE.Vector2();
var zoomStart = new THREE.Vector2();
var zoomEnd = new THREE.Vector2();
var zoomDelta = new THREE.Vector2();
var phiDelta = 0;
var thetaDelta = 0;
var scale = 1;
var lastPosition = new THREE.Vector3();
var STATE = { NONE: -1, ROTATE: 0, ZOOM: 1, PAN: 2 };
var state = STATE.NONE;
// events
var changeEvent = { type: 'change' };
this.rotateLeft = function ( angle ) {
if ( angle === undefined ) {
angle = getAutoRotationAngle();
}
thetaDelta -= angle;
};
this.rotateRight = function ( angle ) {
if ( angle === undefined ) {
angle = getAutoRotationAngle();
}
thetaDelta += angle;
};
this.rotateUp = function ( angle ) {
if ( angle === undefined ) {
angle = getAutoRotationAngle();
}
phiDelta -= angle;
};
this.rotateDown = function ( angle ) {
if ( angle === undefined ) {
angle = getAutoRotationAngle();
}
phiDelta += angle;
};
this.zoomIn = function ( zoomScale ) {
if ( zoomScale === undefined ) {
zoomScale = getZoomScale();
}
scale /= zoomScale;
};
this.zoomOut = function ( zoomScale ) {
if ( zoomScale === undefined ) {
zoomScale = getZoomScale();
}
scale *= zoomScale;
};
this.pan = function ( distance ) {
distance.transformDirection( this.object.matrix );
distance.multiplyScalar( scope.userPanSpeed );
this.object.position.add( distance );
this.center.add( distance );
};
this.update = function () {
var position = this.object.position;
var offset = position.clone().sub( this.center );
// angle from z-axis around y-axis
var theta = Math.atan2( offset.x, offset.z );
// angle from y-axis
var phi = Math.atan2( Math.sqrt( offset.x * offset.x + offset.z * offset.z ), offset.y );
if ( this.autoRotate ) {
this.rotateLeft( getAutoRotationAngle() );
}
theta += thetaDelta;
phi += phiDelta;
// restrict phi to be between desired limits
phi = Math.max( this.minPolarAngle, Math.min( this.maxPolarAngle, phi ) );
// restrict phi to be betwee EPS and PI-EPS
phi = Math.max( EPS, Math.min( Math.PI - EPS, phi ) );
var radius = offset.length() * scale;
// restrict radius to be between desired limits
radius = Math.max( this.minDistance, Math.min( this.maxDistance, radius ) );
offset.x = radius * Math.sin( phi ) * Math.sin( theta );
offset.y = radius * Math.cos( phi );
offset.z = radius * Math.sin( phi ) * Math.cos( theta );
position.copy( this.center ).add( offset );
this.object.lookAt( this.center );
thetaDelta = 0;
phiDelta = 0;
scale = 1;
if ( lastPosition.distanceTo( this.object.position ) > 0 ) {
eventDispatcher.dispatchEvent( changeEvent );
lastPosition.copy( this.object.position );
}
};
function getAutoRotationAngle() {
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
}
function getZoomScale() {
return Math.pow( 0.95, scope.userZoomSpeed );
}
function onMouseDown( event ) {
if ( scope.enabled === false ) return;
if ( scope.userRotate === false ) return;
event.preventDefault();
if ( event.button === 0 ) {
state = STATE.ROTATE;
rotateStart.set( event.clientX, event.clientY );
} else if ( event.button === 1 ) {
state = STATE.ZOOM;
zoomStart.set( event.clientX, event.clientY );
} else if ( event.button === 2 ) {
state = STATE.PAN;
}
document.addEventListener( 'mousemove', onMouseMove, false );
document.addEventListener( 'mouseup', onMouseUp, false );
}
function onMouseMove( event ) {
if ( scope.enabled === false ) return;
event.preventDefault();
if ( state === STATE.ROTATE ) {
rotateEnd.set( event.clientX, event.clientY );
rotateDelta.subVectors( rotateEnd, rotateStart );
scope.rotateLeft( 2 * Math.PI * rotateDelta.x / PIXELS_PER_ROUND * scope.userRotateSpeed );
scope.rotateUp( 2 * Math.PI * rotateDelta.y / PIXELS_PER_ROUND * scope.userRotateSpeed );
rotateStart.copy( rotateEnd );
} else if ( state === STATE.ZOOM ) {
zoomEnd.set( event.clientX, event.clientY );
zoomDelta.subVectors( zoomEnd, zoomStart );
if ( zoomDelta.y > 0 ) {
scope.zoomIn();
} else {
scope.zoomOut();
}
zoomStart.copy( zoomEnd );
} else if ( state === STATE.PAN ) {
var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
scope.pan( new THREE.Vector3( - movementX, movementY, 0 ) );
}
}
function onMouseUp( event ) {
if ( scope.enabled === false ) return;
if ( scope.userRotate === false ) return;
document.removeEventListener( 'mousemove', onMouseMove, false );
document.removeEventListener( 'mouseup', onMouseUp, false );
state = STATE.NONE;
}
function onMouseWheel( event ) {
if ( scope.enabled === false ) return;
if ( scope.userZoom === false ) return;
var delta = 0;
if ( event.wheelDelta ) { // WebKit / Opera / Explorer 9
delta = event.wheelDelta;
} else if ( event.detail ) { // Firefox
delta = - event.detail;
}
if ( delta > 0 ) {
scope.zoomOut();
} else {
scope.zoomIn();
}
}
function onKeyDown( event ) {
if ( scope.enabled === false ) return;
if ( scope.userPan === false ) return;
switch ( event.keyCode ) {
case scope.keys.UP:
scope.pan( new THREE.Vector3( 0, 1, 0 ) );
break;
case scope.keys.BOTTOM:
scope.pan( new THREE.Vector3( 0, - 1, 0 ) );
break;
case scope.keys.LEFT:
scope.pan( new THREE.Vector3( - 1, 0, 0 ) );
break;
case scope.keys.RIGHT:
scope.pan( new THREE.Vector3( 1, 0, 0 ) );
break;
}
}
this.domElement.addEventListener( 'contextmenu', function ( event ) { event.preventDefault(); }, false );
this.domElement.addEventListener( 'mousedown', onMouseDown, false );
this.domElement.addEventListener( 'mousewheel', onMouseWheel, false );
this.domElement.addEventListener( 'DOMMouseScroll', onMouseWheel, false ); // firefox
this.domElement.addEventListener( 'keydown', onKeyDown, false );
};
THREE.OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
| MemoryLeakers/show-time | visualization/cube_matrix/js/OrbitControls.js | JavaScript | mit | 7,051 |
/**
* Extends caja-sanitizer to include additional sanitizers from validator.js
*/
var sanitize = require('sanitizer')
, validate = require('validator');
/**
* Extend replace function to return empty strings when passed an undefined parameter
*
* @param {string} str - string to sanitize
* @param {boolean} alt - if set to true, validator.js escape method will be used instead of caja
* @return {string} - sanitized string
*/
sanitize.escape = function (str, alt) {
if (!str) return ''; // return empty string
return alt ? validate.escape(str) : sanitize.escapeAttrib(str);
}
sanitize.toString = function (str) { return validate.toString(str); }
sanitize.toDate = function (str) { return validate.toDate(str); }
sanitize.toFloat = function (str) { return validate.toFloat(str); }
sanitize.toInt = function (str, radix) { return validate.toInt(str, radix); }
sanitize.toBoolean = function (str, strict) { return validate.toBoolean(str, strict); }
sanitize.trim = function (str, chars) { return validate.trim(str, chars); }
sanitize.ltrim = function (str, chars) { return validate.ltrim(str, chars); }
sanitize.rtrim = function (str, chars) { return validate.rtrim(str, chars); }
sanitize.whitelist = function (str, chars) { return validate.whitelist(str, chars); }
sanitize.blacklist = function (str, chars) { return validate.blacklist(str, chars); }
module.exports = sanitize;
| mjbondra/brewGet | server/assets/lib/sanitizer-extended.js | JavaScript | mit | 1,395 |
module.exports = function (knex) {
return {
getAll: function() {
return knex.select().table('images')
},
// add: function(/*user_id*/, url, tagsArr, callback) {
// var tagsObjArr = tagsArr.map(function(tag) {
// return {'name': tag}
// })
// knex('tags')
// .insert(tagsObjArr)
// .then(knex('images')
// .insert({'url': url}))
// // .then(knex('users')
// // .insert({'id': user_id}))
// .then(function(resp) {callback(null, resp)})
// },
// getAllImagesWithTag: function(tag, callback) {
// knex('images')
// .join('idIndex', 'images.id', 'idIndex.img_id' )
// .join('tags', 'tags.id', 'idIndex.tag_id')
// .select('images.id', 'images.descript', 'images.url')
// .where({'tags.name': tag})
// .then(function(resp) {callback(null, resp)})
// },
getAllImagesWithTag: function(tag) {
return knex('images')
.join('idIndex', 'images.id', 'idIndex.img_id' )
.join('tags', 'tags.id', 'idIndex.tag_id')
.select('images.id', 'images.descript', 'images.url')
.where({'tags.name': tag})
},
getAllTagsForImg: function(image_id) {
return knex('tags')
.join('idIndex', 'tags.id', 'idIndex.tag_id')
.select('tags.name')
.where({'idIndex.img_id': image_id})
},
saveImageToImagesTable: function (tagStr, urlStr, descriptStr){
var currImgId
var currentTagId
return knex('images')
.insert({url:urlStr, descript:descriptStr})
.into('images')
.select('id', 'url', 'descript').from('images')
.then(function (id) {
// console.log('we are assigning id to know variable')
currImgId = id[0]
return currImgId
})
.then (function (currImgId) {
knex('tags').select('id', 'name')
.then(function (arrOfTagsRowObjs){
return arrOfTagsRowObjs.filter(function(obj){
return (obj.name === tagStr)
})
})
.then(function(arr){
if(arr.length > 0){
currentTagId = arr[0].id
return currentTagId
} else {
return knex('tags')
.insert({name: tagStr})
.into('tags')
.select('id')
.from('tags')
.where('name', tagStr)
.then(function(id){
currentTagId = id[0]
})
}
})
.then(function(){
console.log('so we have imgid:', currImgId, 'and tagid:', currentTagId)
return knex('idIndex')
.insert({img_id: currImgId, tag_id:currentTagId })
.into('idIndex')
})
})
},
// getAllTagsForImg: function(image_id, callback) {
// knex('tags')
// .join('idIndex', 'tags.id', 'idIndex.tag_id')
// .select('tags.name')
// .where({'idIndex.img_id': image_id})
// .then(function(resp) {callback(null, resp)})
// },
//For future use when user table is implemented
// getUsersImages: function(user_id, calback) {
// knex('images')
// .join('idIndex', 'images.id', 'idIndex.img_id')
// .join('users', 'users.id', 'idIndex.user_id')
// .select('images.id', 'images.descript', 'images.url')
// .where({'users.id': user_id})
// }
}
}
| broc-harcourt/gif-meme-my-image | db.js | JavaScript | mit | 3,651 |
define("test/fixtures/three",[],function(){}),define("test/fixtures/one",["./three"],function(){}),define("test/fixtures/two",[],function(){}),require(["./one","./two"],function(){}),define("test/fixtures/main",function(){});
| jlouns/gulp-requirejs-optimize | test/expected/main-windows.js | JavaScript | mit | 226 |
'use strict';
describe('Service: alert', function () {
// load the service's module
beforeEach(module('client'));
// instantiate service
var alert;
beforeEach(inject(function (_alert_) {
alert = _alert_;
}));
it('should do something', function () {
expect(!!alert).toBe(true);
});
});
| gatortim50/ViaWest | client/test/spec/services/alert.js | JavaScript | mit | 314 |
/**
* @author mrdoob / http://mrdoob.com/
*/
import { BackSide, FrontSide } from '../../constants.js';
import { BoxBufferGeometry } from '../../geometries/BoxGeometry.js';
import { PlaneBufferGeometry } from '../../geometries/PlaneGeometry.js';
import { ShaderMaterial } from '../../materials/ShaderMaterial.js';
import { Color } from '../../math/Color.js';
import { Mesh } from '../../objects/Mesh.js';
import { ShaderLib } from '../shaders/ShaderLib.js';
import { UniformsUtils } from '../shaders/UniformsUtils.js';
function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
var clearColor = new Color( 0x000000 );
var clearAlpha = 0;
var planeMesh;
var boxMesh;
function render( renderList, scene, camera, forceClear ) {
var background = scene.background;
if ( background === null ) {
setClear( clearColor, clearAlpha );
} else if ( background && background.isColor ) {
setClear( background, 1 );
forceClear = true;
}
if ( renderer.autoClear || forceClear ) {
renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
}
if ( background && background.isCubeTexture ) {
if ( boxMesh === undefined ) {
boxMesh = new Mesh(
new BoxBufferGeometry( 1, 1, 1 ),
new ShaderMaterial( {
uniforms: UniformsUtils.clone( ShaderLib.cube.uniforms ),
vertexShader: ShaderLib.cube.vertexShader,
fragmentShader: ShaderLib.cube.fragmentShader,
side: BackSide,
depthTest: true,
depthWrite: false,
fog: false
} )
);
boxMesh.geometry.removeAttribute( 'normal' );
boxMesh.geometry.removeAttribute( 'uv' );
boxMesh.onBeforeRender = function ( renderer, scene, camera ) {
this.matrixWorld.copyPosition( camera.matrixWorld );
};
objects.update( boxMesh );
}
boxMesh.material.uniforms.tCube.value = background;
renderList.push( boxMesh, boxMesh.geometry, boxMesh.material, 0, null );
} else if ( background && background.isTexture ) {
if ( planeMesh === undefined ) {
planeMesh = new Mesh(
new PlaneBufferGeometry( 2, 2 ),
new ShaderMaterial( {
uniforms: UniformsUtils.clone( ShaderLib.background.uniforms ),
vertexShader: ShaderLib.background.vertexShader,
fragmentShader: ShaderLib.background.fragmentShader,
side: FrontSide,
depthTest: true,
depthWrite: false,
fog: false
} )
);
planeMesh.geometry.removeAttribute( 'normal' );
objects.update( planeMesh );
}
planeMesh.material.uniforms.t2D.value = background;
renderList.push( planeMesh, planeMesh.geometry, planeMesh.material, 0, null );
}
}
function setClear( color, alpha ) {
state.buffers.color.setClear( color.r, color.g, color.b, alpha, premultipliedAlpha );
}
return {
getClearColor: function () {
return clearColor;
},
setClearColor: function ( color, alpha ) {
clearColor.set( color );
clearAlpha = alpha !== undefined ? alpha : 1;
setClear( clearColor, clearAlpha );
},
getClearAlpha: function () {
return clearAlpha;
},
setClearAlpha: function ( alpha ) {
clearAlpha = alpha;
setClear( clearColor, clearAlpha );
},
render: render
};
}
export { WebGLBackground };
| Mugen87/three.js | src/renderers/webgl/WebGLBackground.js | JavaScript | mit | 3,276 |
/* global describe, it, require */
'use strict';
// MODULES //
var // Expectation library:
chai = require( 'chai' ),
// Module to be tested:
mean = require( './../lib/deepset.js' );
// VARIABLES //
var expect = chai.expect,
assert = chai.assert;
// TESTS //
describe( 'deepset mean', function tests() {
it( 'should export a function', function test() {
expect( mean ).to.be.a( 'function' );
});
it( 'should compute the distribution mean and deep set', function test() {
var data, expected;
data = [
{'x':1},
{'x':5},
{'x':10},
{'x':20}
];
data = mean( data, 'x' );
expected = [
{'x':1},
{'x':0.2},
{'x':0.1},
{'x':0.05}
];
assert.deepEqual( data, expected );
// Custom separator...
data = [
{'x':[9,1]},
{'x':[9,5]},
{'x':[9,10]},
{'x':[9,20]}
];
data = mean( data, 'x/1', '/' );
expected = [
{'x':[9,1]},
{'x':[9,0.2]},
{'x':[9,0.1]},
{'x':[9,0.05]}
];
assert.deepEqual( data, expected, 'custom separator' );
});
it( 'should return an empty array if provided an empty array', function test() {
assert.deepEqual( mean( [], 'x' ), [] );
assert.deepEqual( mean( [], 'x', '/' ), [] );
});
it( 'should handle non-numeric values by setting the element to NaN', function test() {
var data, actual, expected;
data = [
{'x':true},
{'x':null},
{'x':[]},
{'x':{}}
];
actual = mean( data, 'x' );
expected = [
{'x':NaN},
{'x':NaN},
{'x':NaN},
{'x':NaN}
];
assert.deepEqual( data, expected );
});
});
| distributions-io/exponential-mean | test/test.deepset.js | JavaScript | mit | 1,543 |
var class_robot =
[
[ "Robot", "class_robot.html#a4fc7c70ae20623f05e06f2ecb388b6c4", null ],
[ "Robot", "class_robot.html#a0e6819bf54f9cb47a4147ce6e883ff06", null ],
[ "~Robot", "class_robot.html#a924320124b09c2f2ac1621aa210d5f38", null ],
[ "getDiagnostic", "class_robot.html#aba4678da963cd350bc81934182f49262", null ],
[ "run", "class_robot.html#a68db0807318b24bf97b590217687f14a", null ]
]; | karanvivekbhargava/robot-butler-enpm808x | doc/html/class_robot.js | JavaScript | mit | 413 |
import { map, isEmpty } from 'lodash'
import React from 'react'
const buildEducation = (education = {}) => {
if (isEmpty(education)) return null
return (
<ul className="verboseList" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginTop': '0', 'marginBottom': '10px', 'listStyle': 'none', 'fontSize': '17px', 'paddingBottom': '10px'}}>
{
map(education, ({value: {school, attended, degree, major}}) => (
<li style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '15px'}}>
<h4 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '10px', 'marginBottom': '10px', 'fontSize': '18px'}}>{degree}: {major}</h4>
<p style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'margin': '0 0 10px'}}>{school}, {attended}</p>
</li>
))
}
</ul>
)
}
const buildProjects = (projects = []) => {
if (!projects.length) return null
return (
<ul style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginTop': '0', 'marginBottom': '0', 'listStyle': 'none', 'fontSize': '14px', 'paddingBottom': '10px'}}>
{projects.map(({type, url, title}) => (
<li style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '15px'}}>
<b style={{'fontWeight': 'bold', 'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box'}}>{type}: </b><a href="{url}" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'color': '#428bca', 'text-decoration': 'none'}}>{title}</a>
</li>
))}
</ul>
)
}
const mapEmployment = ({value: {position, duration, projects, employer, description}}) => {
// const projectHtml = buildProjects(projects)
return (
<li style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '15px'}}>
<h3 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px', 'fontSize': '24px'}}>{position} <small style={{'fontSize': '14px', 'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontWeight': 'normal', 'lineHeight': '1', 'color': '#999999'}}>{duration}</small></h3>
<h4 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '10px', 'marginBottom': '10px', 'fontSize': '18px'}}>{employer}</h4>
<p style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'margin': '0 0 10px'}}>{description}</p>
</li>
)
}
const buildEmployment = (employment = {}) => {
if (isEmpty(employment)) return null
return (
<ul className="verboseList" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginTop': '0', 'marginBottom': '10px', 'listStyle': 'none', 'fontSize': '17px', 'paddingBottom': '10px'}}>
{
map(employment, mapEmployment)
}
</ul>
)
}
const buildInterests = (interests = {}) => {
if (isEmpty(interests)) return null
return (
<ul style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginTop': '0', 'marginBottom': '10px', 'fontSize': '17px', 'paddingBottom': '10px'}}>
{map(interests, ({value: {interest}}) => (
<li style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '3px'}}>{interest}</li>
))}
</ul>
)
}
const buildSkills = (skills = {}) => {
if (isEmpty(skills)) return null
return (
<ul style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginTop': '0', 'marginBottom': '10px', 'fontSize': '17px', 'paddingBottom': '10px'}}>
{map(skills, ({value: {skill}}) => (
<li style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '3px'}}>{skill}</li>
))}
</ul>
)
}
const buildProfiles = (profiles = {}) => {
if (isEmpty(profiles)) return null
return (
<ul className="profileList" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginTop': '0', 'marginBottom': '10px', 'fontSize': '17px', 'paddingBottom': '10px'}}>
{map(profiles, ({value: {url, title}}) => (
<li style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '3px'}}><a href="{url}" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'color': '#428bca', 'text-decoration': 'none'}}>{title}</a></li>
))}
</ul>
)
}
const fullResume = ({resume}) => {
return (
<div className="container" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'marginRight': 'auto', 'marginLeft': 'auto', 'paddingLeft': '15px', 'paddingRight': '15px'}}>
<div className="page-header" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'paddingBottom': '9px', 'margin': '40px 0 20px', 'borderBottom': '1px solid #eeeeee'}}>
<h1 style={{'fontSize': '36px', 'margin': '0.67em 0', 'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px'}}>{resume.name.value} <small style={{'fontSize': '24px', 'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontWeight': 'normal', 'lineHeight': '1', 'color': '#999999'}}>{resume.email.value}</small></h1>
</div>
<div className="span10" style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box'}}>
{
isEmpty(resume.education)
? null
: <h2 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px', 'fontSize': '30px'}}>Education</h2>
}
{buildEducation(resume.education)}
{
isEmpty(resume.employment)
? null
: <h2 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px', 'fontSize': '30px'}}>Employment</h2>
}
{buildEmployment(resume.employment)}
{
isEmpty(resume.interests)
? null
: <h2 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px', 'fontSize': '30px'}}>Interests</h2>
}
{buildInterests(resume.interests)}
{
isEmpty(resume.skill)
? null
: <h2 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px', 'fontSize': '30px'}}>Skills</h2>
}
{buildSkills(resume.skill)}
{
isEmpty(resume.profile)
? null
: <h2 style={{'WebkitBoxSizing': 'border-box', 'MozBoxSizing': 'border-box', 'boxSizing': 'border-box', 'fontFamily': 'Helvetica Neue, Helvetica, Arial, sans-serif', 'fontWeight': '500', 'lineHeight': '1.1', 'marginTop': '20px', 'marginBottom': '10px', 'fontSize': '30px'}}>Profiles</h2>
}
{buildProfiles(resume.profile)}
</div>
</div>
)
}
export default fullResume | maxmechanic/resumaker | app/js/views/html.js | JavaScript | mit | 8,759 |
import expect from 'expect';
import postReducer from '../redux/reducers/reducer';
import deepFreeze from 'deep-freeze';
import * as ActionTypes from '../redux/constants/constants';
describe('reducer tests', () => {
it('action ADD_POST is working', () => {
const stateBefore = { posts: [], post: null };
const stateAfter = { posts: [{
name: 'prank',
title: 'first post',
content: 'Hello world!',
_id: null,
cuid: null,
slug: 'first-post',
}], post: null };
const action = {
type: ActionTypes.ADD_POST,
name: 'prank',
title: 'first post',
content: 'Hello world!',
_id: null,
cuid: null,
slug: 'first-post',
};
deepFreeze(stateBefore);
deepFreeze(action);
expect(stateAfter).toEqual(postReducer(stateBefore, action));
});
it('action ADD_SELECTED_POST is working', () => {
const stateBefore = {
posts: [{
name: 'prank',
title: 'first post',
content: 'Hello world!',
_id: null,
slug: 'first-post',
}],
selectedPost: null,
};
const stateAfter = {
posts: [{
name: 'prank',
title: 'first post',
content: 'Hello world!',
_id: null,
slug: 'first-post',
}],
post: {
name: 'prank',
title: 'first post',
content: 'Hello world!',
_id: null,
slug: 'first-post',
},
};
const action = {
type: ActionTypes.ADD_SELECTED_POST,
post: {
name: 'prank',
title: 'first post',
content: 'Hello world!',
_id: null,
slug: 'first-post',
},
};
deepFreeze(stateBefore);
deepFreeze(action);
expect(stateAfter).toEqual(postReducer(stateBefore, action));
});
});
| raksonibs/kook | shared/tests/reducer_test.spec.js | JavaScript | mit | 1,809 |
import React from "react";
import Todo from "../components/Todo";
import * as TodoActions from "../actions/TodoActions";
import TodoStore from "../stores/TodoStore";
let creating = false;
export default class Todos extends React.Component {
constructor() {
super();
this.getTodos = this.getTodos.bind(this);
this.state = {
todos: TodoStore.getAll(),
};
}
componentWillMount() {
console.log('mounting');
TodoStore.on("change", this.getTodos);
console.log('mounted');
}
componentWillUnmount() {
console.log('unmounted');
TodoStore.removeListener("change", this.getTodos);
}
getTodos() {
this.setState({
todos: TodoStore.getAll()
});
console.log('got Todos');
}
reloadTodos() {
TodoActions.reloadTodos();
console.log('todos reloaded');
}
createTodo(val, date){
TodoActions.createTodo(val, date);
}
editTodo(id, text){
TodoActions.editTodo(id, text);
}
deleteTodo(id){
TodoActions.deleteTodo(id);
console.log(this.id)
}
handleChange(e){
const activity = e.target.value;
const inp = document.getElementById('todo-inp');
//don't forget to add the prop in the change method --duhhh
//this.props.changeTitle(title);
console.log(creating, " init", activity, inp);
if(creating == false){
let creating = true;
console.log(activity, " length");
if(creating == true || activity.length != null){
console.log(creating);
console.log(activity);
inp.onkeypress = function(e){
if(!e) e = window.event;
var kCode = e.keyCode || e.which;
if (kCode == '13' && activity.length > 2){
TodoStore.createTodo(activity);
creating = false;
}
}
// this.createTodo(activity);
}
}
}
render() {
const { todos } = this.state;
const TodoComponents = todos.map((todo) => {
return <Todo key={todo.id} {...todo}/>;
});
const inpval = document.getElementById('todo-inp');
// const typingSty = this.inpval > 1 ? {color: "red"} : {color: "black"};
//const typingSty = {color: "red"};
return (
<div>
<button onClick={this.editTodo.bind(this)}>edit</button>
<button onClick={this.reloadTodos.bind(this)}>Reload!</button>
<h1>Todos Poos</h1>
<p style={this.typingSty}> ::Typing::</p>
<input id="todo-inp" onChange={this.handleChange.bind(this)}/>
<ul onClick={this.deleteTodo.bind(this)}>{TodoComponents}</ul>
</div>
);
}
}
| qtOS/react-todo | src/js/pages/Todos.js | JavaScript | mit | 2,604 |
search_result['223']=["topic_000000000000006C_methods--.html","AnswerVideoDto Methods",""]; | asiboro/asiboro.github.io | vsdoc/search--/s_223.js | JavaScript | mit | 91 |
import {ToAnnotation} from './ToAnnotation.js';
class NgAnnotation {
constructor(...dependencies) {
this.dependencies = dependencies;
}
}
class NgNamedAnnotation {
constructor(token, dependencies = []) {
this.dependencies = dependencies;
this.token = token;
}
}
class ConfigAnnotation extends NgAnnotation {
}
export const Config = ToAnnotation(ConfigAnnotation);
class RunAnnotation extends NgAnnotation {
}
export const Run = ToAnnotation(RunAnnotation);
class ControllerAnnotation extends NgNamedAnnotation {
}
export const Controller = ToAnnotation(ControllerAnnotation);
class DirectiveAnnotation extends NgNamedAnnotation {
}
export const Directive = ToAnnotation(DirectiveAnnotation);
class ServiceAnnotation extends NgNamedAnnotation {
}
export const Service = ToAnnotation(ServiceAnnotation);
class FactoryAnnotation extends NgNamedAnnotation {
}
export const Factory = ToAnnotation(FactoryAnnotation);
class ProviderAnnotation extends NgNamedAnnotation {
}
export const Provider = ToAnnotation(ProviderAnnotation);
class ValueAnnotation extends NgNamedAnnotation {
}
export const Value = ToAnnotation(ValueAnnotation);
class ConstantAnnotation extends NgNamedAnnotation {
}
export const Constant = ToAnnotation(ConstantAnnotation);
class FilterAnnotation extends NgNamedAnnotation {
}
export const Filter = ToAnnotation(FilterAnnotation);
class AnimationAnnotation extends NgNamedAnnotation {
}
export const Animation = ToAnnotation(AnimationAnnotation);
export class Module extends NgNamedAnnotation {
}
export const AsModule = ToAnnotation(Module);
| hannahhoward/a1atscript | src/a1atscript/annotations.js | JavaScript | mit | 1,619 |
/**
** @author: Mostafa Samir
** @email: mostafa.3210@gmail.com
** @liscence: MIT
**
** @NOTE: the plugin requires the fontawesome library and bootstrap-native 2.0.2
**/
'use strict';
/**
* uses info from hidden sidenote elements to create popovers for the additional info
* @param {HTMLElement} note: the hidden sidenote element
*/
function processSideNoteElement(note) {
let noteIconElement = document.createElement('i');
noteIconElement.className = 'fa fa-info-circle';
let noteAElement = document.createElement('a');
noteAElement.href = '#';
noteAElement.className = 'sidenote-super';
noteAElement.appendChild(noteIconElement);
let insertedNoteAElement = note.parentNode.insertBefore(noteAElement, note);
let contentP = document.createElement('p');
note.className = '';
contentP.appendChild(note);
let containerDiv = document.createElement('div');
containerDiv.addEventListener('click', function(e) {e.stopPropagation()});
containerDiv.className = 'sidenote-container';
containerDiv.appendChild(contentP);
let appendedContainerDiv = document.querySelector('article').appendChild(containerDiv)
insertedNoteAElement.addEventListener('click', function(e) {
e.preventDefault();
e.stopPropagation();
// mark the note marker as the current viewed note
insertedNoteAElement.className = 'sidenote-super sidenote-viewed';
// hide any other opened side note if any
let visibleNote = document.querySelector('.sidenote-visible');
if(visibleNote) {
visibleNote.className = "sidenote-container";
visibleNote.style.display = "none";
}
let pos = {
x: insertedNoteAElement.offsetLeft,
y: insertedNoteAElement.offsetTop
};
// show the note and bring it to the top-left corner to assume its
// full possible width
appendedContainerDiv.style.top = "0px";
appendedContainerDiv.style.left = "0px";
appendedContainerDiv.style.display = 'block';
appendedContainerDiv.className = "sidenote-container sidenote-visible"
let screenWidth = screen.width;
let noteWidth = appendedContainerDiv.clientWidth;
appendedContainerDiv.style.top = (pos.y + 20) + "px";
if (pos.x + noteWidth < screenWidth - 50) {
appendedContainerDiv.style.left = pos.x + "px";
}
else {
console.log(screenWidth)
let diff = (pos.x + noteWidth) - (screenWidth - 50);
console.log(diff)
appendedContainerDiv.style.left = (pos.x - diff) + "px";
}
});
}
/**
* repositions a visible side note to a new screen size
* @param {HTMLElement} visibleNote: the note element to position
*/
function repositionNote(visibleNote) {
// hide and bring the node to top left corner and show it again
// to assume its full width in the new screen size
visibleNote.style.display = "none";
visibleNote.style.top = "0px";
visibleNote.style.left = "0px";
visibleNote.style.display = "block";
let viewdNoteMark = document.querySelector('.sidenote-viewed');
let pos = {
x: viewdNoteMark.offsetLeft,
y: viewdNoteMark.offsetTop
}
let screenWidth = screen.width;
let noteWidth = visibleNote.clientWidth;
visibleNote.style.top = (pos.y + 20) + "px";
if (pos.x + noteWidth < screenWidth - 50) {
visibleNote.style.left = pos.x + "px";
}
else {
let diff = (pos.x + noteWidth) - (screenWidth - 50);
visibleNote.style.left = (pos.x - diff) + "px";
}
}
| Mostafa-Samir/Mostafa-Samir.github.io | assets/js/side-notes.js | JavaScript | mit | 3,657 |
const assert = require('assert');
const MockServer = require('../../../../lib/mockserver.js');
const CommandGlobals = require('../../../../lib/globals/commands.js');
describe('getValue', function() {
before(function(done) {
CommandGlobals.beforeEach.call(this, done);
});
after(function(done) {
CommandGlobals.afterEach.call(this, done);
});
it('client.getValue()', function(done) {
MockServer.addMock({
url: '/wd/hub/session/1352110219202/element/0/property/value',
method: 'GET',
response: JSON.stringify({
sessionId: '1352110219202',
status: 0,
value: 'test value'
})
});
this.client.api.getValue('css selector', '#weblogin', function callback(result) {
assert.strictEqual(result.value, 'test value');
}).getValue('#weblogin', function callback(result) {
assert.strictEqual(result.value, 'test value');
});
this.client.start(done);
});
});
| nightwatchjs/nightwatch | test/src/api/commands/element/testGetValue.js | JavaScript | mit | 953 |
/**
* Tom Select v1.4.1
* Licensed under the Apache License, Version 2.0 (the "License");
*/
import TomSelect from '../../tom-select.js';
import { KEY_LEFT, KEY_RIGHT } from '../../constants.js';
import { parentMatch, nodeIndex } from '../../vanilla.js';
/**
* Plugin: "optgroup_columns" (Tom Select.js)
* Copyright (c) contributors
*
* 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.
*
*/
TomSelect.define('optgroup_columns', function () {
var self = this;
var orig_keydown = self.onKeyDown;
self.hook('instead', 'onKeyDown', function (evt) {
var index, option, options, optgroup;
if (!self.isOpen || !(evt.keyCode === KEY_LEFT || evt.keyCode === KEY_RIGHT)) {
return orig_keydown.apply(self, arguments);
}
optgroup = parentMatch(self.activeOption, '[data-group]');
index = nodeIndex(self.activeOption, '[data-selectable]');
if (evt.keyCode === KEY_LEFT) {
optgroup = optgroup.previousSibling;
} else {
optgroup = optgroup.nextSibling;
}
if (!optgroup) {
return;
}
options = optgroup.querySelectorAll('[data-selectable]');
option = options[Math.min(options.length - 1, index)];
if (option) {
self.setActiveOption(option);
}
});
});
//# sourceMappingURL=plugin.js.map
| cdnjs/cdnjs | ajax/libs/tom-select/1.4.1/esm/plugins/optgroup_columns/plugin.js | JavaScript | mit | 1,768 |
// Importing node modules
import express from 'express';
// Importing source files
const router = express.Router();
import bodyParser from 'body-parser';
import cors from 'cors';
// consts
const app = express();
app.use(cors());
const posts = [
{
title: 'Oakley, Fife',
text: 'Oakley is a village in Fife, Scotland located at the mutual border of Carnock and Culross parishes, Fife, about 5 miles (8.0 km) W by N of Dunfermline on the A907.'
},
{
title: 'Vinai',
text: 'VINAI is an electronic music group formed in 2011 by Italian producers Alessandro Vinai and Andrea Vinai. As a duo, they produce electronic dance music.'
},
{
title: 'Danny Groves',
text: 'Daniel Charles "Danny" Groves (born 10 December 1990) is an English footballer currently playing for Spennymoor Town F.C.. He is a midfielder or right back.'
},
{
title: 'Zoram Nationalist Party',
text: 'Zoram Nationalist Party is recognized as the state political party in Mizoram, India.The party known as formerly Mizo National Front (Nationalist) . It is led by former MP Lalduhoma. MNF(N) was formed in 1997 through a split in the Mizo National Front.'
}
];
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
router.get('/', (req, res) => {
res.send({message: 'Hello World!!'});
});
router.get('/posts', (req, res) => {
res.send(posts);
});
app.use('/', router);
// arrow functions
const server = app.listen(3000, () => {
// destructuring
const {address, port} = server.address();
// string interpolation:
console.log(`Example app listening at http://${address}:${port}`);
}); | shotaK/expressjs-es6-rest-starter | server.js | JavaScript | mit | 1,692 |
'use strict';
/**
* @author luckyadam
* @date 2015-11-9
* @desc
*/
| luckyadam/xgames | games/widget/page_btn/page_btn.js | JavaScript | mit | 73 |
/**
* Tom Select v1.6.0
* Licensed under the Apache License, Version 2.0 (the "License");
*/
import TomSelect from '../../tom-select.js';
/**
* Plugin: "input_autogrow" (Tom Select)
*
* 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.
*
*/
TomSelect.define('no_active_items', function (options) {
this.hook('instead', 'setActiveItem', () => {});
this.hook('instead', 'selectAll', () => {});
});
//# sourceMappingURL=plugin.js.map
| cdnjs/cdnjs | ajax/libs/tom-select/1.6.0/esm/plugins/no_active_items/plugin.js | JavaScript | mit | 932 |
/*!
* dependencyLibs/inputmask.dependencyLib.jquery.js
* https://github.com/RobinHerbots/Inputmask
* Copyright (c) 2010 - 2018 Robin Herbots
* Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
* Version: 4.0.1-beta.6
*/
!function(factory) {
"function" == typeof define && define.amd ? define([ "jquery" ], factory) : "object" == typeof exports ? module.exports = factory(require("jquery")) : window.dependencyLib = factory(jQuery);
}(function($) {
return $;
}); | cdnjs/cdnjs | ajax/libs/jquery.inputmask/4.0.1-beta.6/inputmask/dependencyLibs/inputmask.dependencyLib.jquery.js | JavaScript | mit | 504 |
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
* Version: 5.10.1 (2021-11-03)
*/
(function () {
'use strict';
var Cell = function (initial) {
var value = initial;
var get = function () {
return value;
};
var set = function (v) {
value = v;
};
return {
get: get,
set: set
};
};
var global$3 = tinymce.util.Tools.resolve('tinymce.PluginManager');
var get$5 = function (fullscreenState) {
return {
isFullscreen: function () {
return fullscreenState.get() !== null;
}
};
};
var typeOf = function (x) {
var t = typeof x;
if (x === null) {
return 'null';
} else if (t === 'object' && (Array.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'Array')) {
return 'array';
} else if (t === 'object' && (String.prototype.isPrototypeOf(x) || x.constructor && x.constructor.name === 'String')) {
return 'string';
} else {
return t;
}
};
var isType$1 = function (type) {
return function (value) {
return typeOf(value) === type;
};
};
var isSimpleType = function (type) {
return function (value) {
return typeof value === type;
};
};
var isString = isType$1('string');
var isArray = isType$1('array');
var isBoolean = isSimpleType('boolean');
var isNullable = function (a) {
return a === null || a === undefined;
};
var isNonNullable = function (a) {
return !isNullable(a);
};
var isFunction = isSimpleType('function');
var isNumber = isSimpleType('number');
var noop = function () {
};
var compose = function (fa, fb) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return fa(fb.apply(null, args));
};
};
var compose1 = function (fbc, fab) {
return function (a) {
return fbc(fab(a));
};
};
var constant = function (value) {
return function () {
return value;
};
};
var identity = function (x) {
return x;
};
function curry(fn) {
var initialArgs = [];
for (var _i = 1; _i < arguments.length; _i++) {
initialArgs[_i - 1] = arguments[_i];
}
return function () {
var restArgs = [];
for (var _i = 0; _i < arguments.length; _i++) {
restArgs[_i] = arguments[_i];
}
var all = initialArgs.concat(restArgs);
return fn.apply(null, all);
};
}
var never = constant(false);
var always = constant(true);
var none = function () {
return NONE;
};
var NONE = function () {
var call = function (thunk) {
return thunk();
};
var id = identity;
var me = {
fold: function (n, _s) {
return n();
},
isSome: never,
isNone: always,
getOr: id,
getOrThunk: call,
getOrDie: function (msg) {
throw new Error(msg || 'error: getOrDie called on none.');
},
getOrNull: constant(null),
getOrUndefined: constant(undefined),
or: id,
orThunk: call,
map: none,
each: noop,
bind: none,
exists: never,
forall: always,
filter: function () {
return none();
},
toArray: function () {
return [];
},
toString: constant('none()')
};
return me;
}();
var some = function (a) {
var constant_a = constant(a);
var self = function () {
return me;
};
var bind = function (f) {
return f(a);
};
var me = {
fold: function (n, s) {
return s(a);
},
isSome: always,
isNone: never,
getOr: constant_a,
getOrThunk: constant_a,
getOrDie: constant_a,
getOrNull: constant_a,
getOrUndefined: constant_a,
or: self,
orThunk: self,
map: function (f) {
return some(f(a));
},
each: function (f) {
f(a);
},
bind: bind,
exists: bind,
forall: bind,
filter: function (f) {
return f(a) ? me : NONE;
},
toArray: function () {
return [a];
},
toString: function () {
return 'some(' + a + ')';
}
};
return me;
};
var from = function (value) {
return value === null || value === undefined ? NONE : some(value);
};
var Optional = {
some: some,
none: none,
from: from
};
var __assign = function () {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s)
if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var singleton = function (doRevoke) {
var subject = Cell(Optional.none());
var revoke = function () {
return subject.get().each(doRevoke);
};
var clear = function () {
revoke();
subject.set(Optional.none());
};
var isSet = function () {
return subject.get().isSome();
};
var get = function () {
return subject.get();
};
var set = function (s) {
revoke();
subject.set(Optional.some(s));
};
return {
clear: clear,
isSet: isSet,
get: get,
set: set
};
};
var unbindable = function () {
return singleton(function (s) {
return s.unbind();
});
};
var value = function () {
var subject = singleton(noop);
var on = function (f) {
return subject.get().each(f);
};
return __assign(__assign({}, subject), { on: on });
};
var nativePush = Array.prototype.push;
var map = function (xs, f) {
var len = xs.length;
var r = new Array(len);
for (var i = 0; i < len; i++) {
var x = xs[i];
r[i] = f(x, i);
}
return r;
};
var each$1 = function (xs, f) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
f(x, i);
}
};
var filter$1 = function (xs, pred) {
var r = [];
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i)) {
r.push(x);
}
}
return r;
};
var findUntil = function (xs, pred, until) {
for (var i = 0, len = xs.length; i < len; i++) {
var x = xs[i];
if (pred(x, i)) {
return Optional.some(x);
} else if (until(x, i)) {
break;
}
}
return Optional.none();
};
var find$1 = function (xs, pred) {
return findUntil(xs, pred, never);
};
var flatten = function (xs) {
var r = [];
for (var i = 0, len = xs.length; i < len; ++i) {
if (!isArray(xs[i])) {
throw new Error('Arr.flatten item ' + i + ' was not an array, input: ' + xs);
}
nativePush.apply(r, xs[i]);
}
return r;
};
var bind$3 = function (xs, f) {
return flatten(map(xs, f));
};
var get$4 = function (xs, i) {
return i >= 0 && i < xs.length ? Optional.some(xs[i]) : Optional.none();
};
var head = function (xs) {
return get$4(xs, 0);
};
var findMap = function (arr, f) {
for (var i = 0; i < arr.length; i++) {
var r = f(arr[i], i);
if (r.isSome()) {
return r;
}
}
return Optional.none();
};
var keys = Object.keys;
var each = function (obj, f) {
var props = keys(obj);
for (var k = 0, len = props.length; k < len; k++) {
var i = props[k];
var x = obj[i];
f(x, i);
}
};
var contains = function (str, substr) {
return str.indexOf(substr) !== -1;
};
var isSupported$1 = function (dom) {
return dom.style !== undefined && isFunction(dom.style.getPropertyValue);
};
var fromHtml = function (html, scope) {
var doc = scope || document;
var div = doc.createElement('div');
div.innerHTML = html;
if (!div.hasChildNodes() || div.childNodes.length > 1) {
console.error('HTML does not have a single root node', html);
throw new Error('HTML must have a single root node');
}
return fromDom(div.childNodes[0]);
};
var fromTag = function (tag, scope) {
var doc = scope || document;
var node = doc.createElement(tag);
return fromDom(node);
};
var fromText = function (text, scope) {
var doc = scope || document;
var node = doc.createTextNode(text);
return fromDom(node);
};
var fromDom = function (node) {
if (node === null || node === undefined) {
throw new Error('Node cannot be null or undefined');
}
return { dom: node };
};
var fromPoint = function (docElm, x, y) {
return Optional.from(docElm.dom.elementFromPoint(x, y)).map(fromDom);
};
var SugarElement = {
fromHtml: fromHtml,
fromTag: fromTag,
fromText: fromText,
fromDom: fromDom,
fromPoint: fromPoint
};
typeof window !== 'undefined' ? window : Function('return this;')();
var DOCUMENT = 9;
var DOCUMENT_FRAGMENT = 11;
var ELEMENT = 1;
var TEXT = 3;
var type = function (element) {
return element.dom.nodeType;
};
var isType = function (t) {
return function (element) {
return type(element) === t;
};
};
var isElement = isType(ELEMENT);
var isText = isType(TEXT);
var isDocument = isType(DOCUMENT);
var isDocumentFragment = isType(DOCUMENT_FRAGMENT);
var cached = function (f) {
var called = false;
var r;
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
if (!called) {
called = true;
r = f.apply(null, args);
}
return r;
};
};
var DeviceType = function (os, browser, userAgent, mediaMatch) {
var isiPad = os.isiOS() && /ipad/i.test(userAgent) === true;
var isiPhone = os.isiOS() && !isiPad;
var isMobile = os.isiOS() || os.isAndroid();
var isTouch = isMobile || mediaMatch('(pointer:coarse)');
var isTablet = isiPad || !isiPhone && isMobile && mediaMatch('(min-device-width:768px)');
var isPhone = isiPhone || isMobile && !isTablet;
var iOSwebview = browser.isSafari() && os.isiOS() && /safari/i.test(userAgent) === false;
var isDesktop = !isPhone && !isTablet && !iOSwebview;
return {
isiPad: constant(isiPad),
isiPhone: constant(isiPhone),
isTablet: constant(isTablet),
isPhone: constant(isPhone),
isTouch: constant(isTouch),
isAndroid: os.isAndroid,
isiOS: os.isiOS,
isWebView: constant(iOSwebview),
isDesktop: constant(isDesktop)
};
};
var firstMatch = function (regexes, s) {
for (var i = 0; i < regexes.length; i++) {
var x = regexes[i];
if (x.test(s)) {
return x;
}
}
return undefined;
};
var find = function (regexes, agent) {
var r = firstMatch(regexes, agent);
if (!r) {
return {
major: 0,
minor: 0
};
}
var group = function (i) {
return Number(agent.replace(r, '$' + i));
};
return nu$2(group(1), group(2));
};
var detect$3 = function (versionRegexes, agent) {
var cleanedAgent = String(agent).toLowerCase();
if (versionRegexes.length === 0) {
return unknown$2();
}
return find(versionRegexes, cleanedAgent);
};
var unknown$2 = function () {
return nu$2(0, 0);
};
var nu$2 = function (major, minor) {
return {
major: major,
minor: minor
};
};
var Version = {
nu: nu$2,
detect: detect$3,
unknown: unknown$2
};
var detectBrowser$1 = function (browsers, userAgentData) {
return findMap(userAgentData.brands, function (uaBrand) {
var lcBrand = uaBrand.brand.toLowerCase();
return find$1(browsers, function (browser) {
var _a;
return lcBrand === ((_a = browser.brand) === null || _a === void 0 ? void 0 : _a.toLowerCase());
}).map(function (info) {
return {
current: info.name,
version: Version.nu(parseInt(uaBrand.version, 10), 0)
};
});
});
};
var detect$2 = function (candidates, userAgent) {
var agent = String(userAgent).toLowerCase();
return find$1(candidates, function (candidate) {
return candidate.search(agent);
});
};
var detectBrowser = function (browsers, userAgent) {
return detect$2(browsers, userAgent).map(function (browser) {
var version = Version.detect(browser.versionRegexes, userAgent);
return {
current: browser.name,
version: version
};
});
};
var detectOs = function (oses, userAgent) {
return detect$2(oses, userAgent).map(function (os) {
var version = Version.detect(os.versionRegexes, userAgent);
return {
current: os.name,
version: version
};
});
};
var normalVersionRegex = /.*?version\/\ ?([0-9]+)\.([0-9]+).*/;
var checkContains = function (target) {
return function (uastring) {
return contains(uastring, target);
};
};
var browsers = [
{
name: 'Edge',
versionRegexes: [/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],
search: function (uastring) {
return contains(uastring, 'edge/') && contains(uastring, 'chrome') && contains(uastring, 'safari') && contains(uastring, 'applewebkit');
}
},
{
name: 'Chrome',
brand: 'Chromium',
versionRegexes: [
/.*?chrome\/([0-9]+)\.([0-9]+).*/,
normalVersionRegex
],
search: function (uastring) {
return contains(uastring, 'chrome') && !contains(uastring, 'chromeframe');
}
},
{
name: 'IE',
versionRegexes: [
/.*?msie\ ?([0-9]+)\.([0-9]+).*/,
/.*?rv:([0-9]+)\.([0-9]+).*/
],
search: function (uastring) {
return contains(uastring, 'msie') || contains(uastring, 'trident');
}
},
{
name: 'Opera',
versionRegexes: [
normalVersionRegex,
/.*?opera\/([0-9]+)\.([0-9]+).*/
],
search: checkContains('opera')
},
{
name: 'Firefox',
versionRegexes: [/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],
search: checkContains('firefox')
},
{
name: 'Safari',
versionRegexes: [
normalVersionRegex,
/.*?cpu os ([0-9]+)_([0-9]+).*/
],
search: function (uastring) {
return (contains(uastring, 'safari') || contains(uastring, 'mobile/')) && contains(uastring, 'applewebkit');
}
}
];
var oses = [
{
name: 'Windows',
search: checkContains('win'),
versionRegexes: [/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]
},
{
name: 'iOS',
search: function (uastring) {
return contains(uastring, 'iphone') || contains(uastring, 'ipad');
},
versionRegexes: [
/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,
/.*cpu os ([0-9]+)_([0-9]+).*/,
/.*cpu iphone os ([0-9]+)_([0-9]+).*/
]
},
{
name: 'Android',
search: checkContains('android'),
versionRegexes: [/.*?android\ ?([0-9]+)\.([0-9]+).*/]
},
{
name: 'OSX',
search: checkContains('mac os x'),
versionRegexes: [/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]
},
{
name: 'Linux',
search: checkContains('linux'),
versionRegexes: []
},
{
name: 'Solaris',
search: checkContains('sunos'),
versionRegexes: []
},
{
name: 'FreeBSD',
search: checkContains('freebsd'),
versionRegexes: []
},
{
name: 'ChromeOS',
search: checkContains('cros'),
versionRegexes: [/.*?chrome\/([0-9]+)\.([0-9]+).*/]
}
];
var PlatformInfo = {
browsers: constant(browsers),
oses: constant(oses)
};
var edge = 'Edge';
var chrome = 'Chrome';
var ie = 'IE';
var opera = 'Opera';
var firefox = 'Firefox';
var safari = 'Safari';
var unknown$1 = function () {
return nu$1({
current: undefined,
version: Version.unknown()
});
};
var nu$1 = function (info) {
var current = info.current;
var version = info.version;
var isBrowser = function (name) {
return function () {
return current === name;
};
};
return {
current: current,
version: version,
isEdge: isBrowser(edge),
isChrome: isBrowser(chrome),
isIE: isBrowser(ie),
isOpera: isBrowser(opera),
isFirefox: isBrowser(firefox),
isSafari: isBrowser(safari)
};
};
var Browser = {
unknown: unknown$1,
nu: nu$1,
edge: constant(edge),
chrome: constant(chrome),
ie: constant(ie),
opera: constant(opera),
firefox: constant(firefox),
safari: constant(safari)
};
var windows = 'Windows';
var ios = 'iOS';
var android = 'Android';
var linux = 'Linux';
var osx = 'OSX';
var solaris = 'Solaris';
var freebsd = 'FreeBSD';
var chromeos = 'ChromeOS';
var unknown = function () {
return nu({
current: undefined,
version: Version.unknown()
});
};
var nu = function (info) {
var current = info.current;
var version = info.version;
var isOS = function (name) {
return function () {
return current === name;
};
};
return {
current: current,
version: version,
isWindows: isOS(windows),
isiOS: isOS(ios),
isAndroid: isOS(android),
isOSX: isOS(osx),
isLinux: isOS(linux),
isSolaris: isOS(solaris),
isFreeBSD: isOS(freebsd),
isChromeOS: isOS(chromeos)
};
};
var OperatingSystem = {
unknown: unknown,
nu: nu,
windows: constant(windows),
ios: constant(ios),
android: constant(android),
linux: constant(linux),
osx: constant(osx),
solaris: constant(solaris),
freebsd: constant(freebsd),
chromeos: constant(chromeos)
};
var detect$1 = function (userAgent, userAgentDataOpt, mediaMatch) {
var browsers = PlatformInfo.browsers();
var oses = PlatformInfo.oses();
var browser = userAgentDataOpt.bind(function (userAgentData) {
return detectBrowser$1(browsers, userAgentData);
}).orThunk(function () {
return detectBrowser(browsers, userAgent);
}).fold(Browser.unknown, Browser.nu);
var os = detectOs(oses, userAgent).fold(OperatingSystem.unknown, OperatingSystem.nu);
var deviceType = DeviceType(os, browser, userAgent, mediaMatch);
return {
browser: browser,
os: os,
deviceType: deviceType
};
};
var PlatformDetection = { detect: detect$1 };
var mediaMatch = function (query) {
return window.matchMedia(query).matches;
};
var platform = cached(function () {
return PlatformDetection.detect(navigator.userAgent, Optional.from(navigator.userAgentData), mediaMatch);
});
var detect = function () {
return platform();
};
var is = function (element, selector) {
var dom = element.dom;
if (dom.nodeType !== ELEMENT) {
return false;
} else {
var elem = dom;
if (elem.matches !== undefined) {
return elem.matches(selector);
} else if (elem.msMatchesSelector !== undefined) {
return elem.msMatchesSelector(selector);
} else if (elem.webkitMatchesSelector !== undefined) {
return elem.webkitMatchesSelector(selector);
} else if (elem.mozMatchesSelector !== undefined) {
return elem.mozMatchesSelector(selector);
} else {
throw new Error('Browser lacks native selectors');
}
}
};
var bypassSelector = function (dom) {
return dom.nodeType !== ELEMENT && dom.nodeType !== DOCUMENT && dom.nodeType !== DOCUMENT_FRAGMENT || dom.childElementCount === 0;
};
var all$1 = function (selector, scope) {
var base = scope === undefined ? document : scope.dom;
return bypassSelector(base) ? [] : map(base.querySelectorAll(selector), SugarElement.fromDom);
};
var eq = function (e1, e2) {
return e1.dom === e2.dom;
};
var owner = function (element) {
return SugarElement.fromDom(element.dom.ownerDocument);
};
var documentOrOwner = function (dos) {
return isDocument(dos) ? dos : owner(dos);
};
var parent = function (element) {
return Optional.from(element.dom.parentNode).map(SugarElement.fromDom);
};
var parents = function (element, isRoot) {
var stop = isFunction(isRoot) ? isRoot : never;
var dom = element.dom;
var ret = [];
while (dom.parentNode !== null && dom.parentNode !== undefined) {
var rawParent = dom.parentNode;
var p = SugarElement.fromDom(rawParent);
ret.push(p);
if (stop(p) === true) {
break;
} else {
dom = rawParent;
}
}
return ret;
};
var siblings$2 = function (element) {
var filterSelf = function (elements) {
return filter$1(elements, function (x) {
return !eq(element, x);
});
};
return parent(element).map(children).map(filterSelf).getOr([]);
};
var children = function (element) {
return map(element.dom.childNodes, SugarElement.fromDom);
};
var isShadowRoot = function (dos) {
return isDocumentFragment(dos) && isNonNullable(dos.dom.host);
};
var supported = isFunction(Element.prototype.attachShadow) && isFunction(Node.prototype.getRootNode);
var isSupported = constant(supported);
var getRootNode = supported ? function (e) {
return SugarElement.fromDom(e.dom.getRootNode());
} : documentOrOwner;
var getShadowRoot = function (e) {
var r = getRootNode(e);
return isShadowRoot(r) ? Optional.some(r) : Optional.none();
};
var getShadowHost = function (e) {
return SugarElement.fromDom(e.dom.host);
};
var getOriginalEventTarget = function (event) {
if (isSupported() && isNonNullable(event.target)) {
var el = SugarElement.fromDom(event.target);
if (isElement(el) && isOpenShadowHost(el)) {
if (event.composed && event.composedPath) {
var composedPath = event.composedPath();
if (composedPath) {
return head(composedPath);
}
}
}
}
return Optional.from(event.target);
};
var isOpenShadowHost = function (element) {
return isNonNullable(element.dom.shadowRoot);
};
var inBody = function (element) {
var dom = isText(element) ? element.dom.parentNode : element.dom;
if (dom === undefined || dom === null || dom.ownerDocument === null) {
return false;
}
var doc = dom.ownerDocument;
return getShadowRoot(SugarElement.fromDom(dom)).fold(function () {
return doc.body.contains(dom);
}, compose1(inBody, getShadowHost));
};
var getBody = function (doc) {
var b = doc.dom.body;
if (b === null || b === undefined) {
throw new Error('Body is not available yet');
}
return SugarElement.fromDom(b);
};
var rawSet = function (dom, key, value) {
if (isString(value) || isBoolean(value) || isNumber(value)) {
dom.setAttribute(key, value + '');
} else {
console.error('Invalid call to Attribute.set. Key ', key, ':: Value ', value, ':: Element ', dom);
throw new Error('Attribute value was not simple');
}
};
var set = function (element, key, value) {
rawSet(element.dom, key, value);
};
var get$3 = function (element, key) {
var v = element.dom.getAttribute(key);
return v === null ? undefined : v;
};
var remove = function (element, key) {
element.dom.removeAttribute(key);
};
var internalSet = function (dom, property, value) {
if (!isString(value)) {
console.error('Invalid call to CSS.set. Property ', property, ':: Value ', value, ':: Element ', dom);
throw new Error('CSS value must be a string: ' + value);
}
if (isSupported$1(dom)) {
dom.style.setProperty(property, value);
}
};
var setAll = function (element, css) {
var dom = element.dom;
each(css, function (v, k) {
internalSet(dom, k, v);
});
};
var get$2 = function (element, property) {
var dom = element.dom;
var styles = window.getComputedStyle(dom);
var r = styles.getPropertyValue(property);
return r === '' && !inBody(element) ? getUnsafeProperty(dom, property) : r;
};
var getUnsafeProperty = function (dom, property) {
return isSupported$1(dom) ? dom.style.getPropertyValue(property) : '';
};
var mkEvent = function (target, x, y, stop, prevent, kill, raw) {
return {
target: target,
x: x,
y: y,
stop: stop,
prevent: prevent,
kill: kill,
raw: raw
};
};
var fromRawEvent = function (rawEvent) {
var target = SugarElement.fromDom(getOriginalEventTarget(rawEvent).getOr(rawEvent.target));
var stop = function () {
return rawEvent.stopPropagation();
};
var prevent = function () {
return rawEvent.preventDefault();
};
var kill = compose(prevent, stop);
return mkEvent(target, rawEvent.clientX, rawEvent.clientY, stop, prevent, kill, rawEvent);
};
var handle = function (filter, handler) {
return function (rawEvent) {
if (filter(rawEvent)) {
handler(fromRawEvent(rawEvent));
}
};
};
var binder = function (element, event, filter, handler, useCapture) {
var wrapped = handle(filter, handler);
element.dom.addEventListener(event, wrapped, useCapture);
return { unbind: curry(unbind, element, event, wrapped, useCapture) };
};
var bind$2 = function (element, event, filter, handler) {
return binder(element, event, filter, handler, false);
};
var unbind = function (element, event, handler, useCapture) {
element.dom.removeEventListener(event, handler, useCapture);
};
var filter = always;
var bind$1 = function (element, event, handler) {
return bind$2(element, event, filter, handler);
};
var r = function (left, top) {
var translate = function (x, y) {
return r(left + x, top + y);
};
return {
left: left,
top: top,
translate: translate
};
};
var SugarPosition = r;
var get$1 = function (_DOC) {
var doc = _DOC !== undefined ? _DOC.dom : document;
var x = doc.body.scrollLeft || doc.documentElement.scrollLeft;
var y = doc.body.scrollTop || doc.documentElement.scrollTop;
return SugarPosition(x, y);
};
var get = function (_win) {
var win = _win === undefined ? window : _win;
if (detect().browser.isFirefox()) {
return Optional.none();
} else {
return Optional.from(win['visualViewport']);
}
};
var bounds = function (x, y, width, height) {
return {
x: x,
y: y,
width: width,
height: height,
right: x + width,
bottom: y + height
};
};
var getBounds = function (_win) {
var win = _win === undefined ? window : _win;
var doc = win.document;
var scroll = get$1(SugarElement.fromDom(doc));
return get(win).fold(function () {
var html = win.document.documentElement;
var width = html.clientWidth;
var height = html.clientHeight;
return bounds(scroll.left, scroll.top, width, height);
}, function (visualViewport) {
return bounds(Math.max(visualViewport.pageLeft, scroll.left), Math.max(visualViewport.pageTop, scroll.top), visualViewport.width, visualViewport.height);
});
};
var bind = function (name, callback, _win) {
return get(_win).map(function (visualViewport) {
var handler = function (e) {
return callback(fromRawEvent(e));
};
visualViewport.addEventListener(name, handler);
return {
unbind: function () {
return visualViewport.removeEventListener(name, handler);
}
};
}).getOrThunk(function () {
return { unbind: noop };
});
};
var global$2 = tinymce.util.Tools.resolve('tinymce.dom.DOMUtils');
var global$1 = tinymce.util.Tools.resolve('tinymce.Env');
var global = tinymce.util.Tools.resolve('tinymce.util.Delay');
var fireFullscreenStateChanged = function (editor, state) {
editor.fire('FullscreenStateChanged', { state: state });
};
var getFullscreenNative = function (editor) {
return editor.getParam('fullscreen_native', false, 'boolean');
};
var getFullscreenRoot = function (editor) {
var elem = SugarElement.fromDom(editor.getElement());
return getShadowRoot(elem).map(getShadowHost).getOrThunk(function () {
return getBody(owner(elem));
});
};
var getFullscreenElement = function (root) {
if (root.fullscreenElement !== undefined) {
return root.fullscreenElement;
} else if (root.msFullscreenElement !== undefined) {
return root.msFullscreenElement;
} else if (root.webkitFullscreenElement !== undefined) {
return root.webkitFullscreenElement;
} else {
return null;
}
};
var getFullscreenchangeEventName = function () {
if (document.fullscreenElement !== undefined) {
return 'fullscreenchange';
} else if (document.msFullscreenElement !== undefined) {
return 'MSFullscreenChange';
} else if (document.webkitFullscreenElement !== undefined) {
return 'webkitfullscreenchange';
} else {
return 'fullscreenchange';
}
};
var requestFullscreen = function (sugarElem) {
var elem = sugarElem.dom;
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.msRequestFullscreen) {
elem.msRequestFullscreen();
} else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
}
};
var exitFullscreen = function (sugarDoc) {
var doc = sugarDoc.dom;
if (doc.exitFullscreen) {
doc.exitFullscreen();
} else if (doc.msExitFullscreen) {
doc.msExitFullscreen();
} else if (doc.webkitCancelFullScreen) {
doc.webkitCancelFullScreen();
}
};
var isFullscreenElement = function (elem) {
return elem.dom === getFullscreenElement(owner(elem).dom);
};
var ancestors$1 = function (scope, predicate, isRoot) {
return filter$1(parents(scope, isRoot), predicate);
};
var siblings$1 = function (scope, predicate) {
return filter$1(siblings$2(scope), predicate);
};
var all = function (selector) {
return all$1(selector);
};
var ancestors = function (scope, selector, isRoot) {
return ancestors$1(scope, function (e) {
return is(e, selector);
}, isRoot);
};
var siblings = function (scope, selector) {
return siblings$1(scope, function (e) {
return is(e, selector);
});
};
var attr = 'data-ephox-mobile-fullscreen-style';
var siblingStyles = 'display:none!important;';
var ancestorPosition = 'position:absolute!important;';
var ancestorStyles = 'top:0!important;left:0!important;margin:0!important;padding:0!important;width:100%!important;height:100%!important;overflow:visible!important;';
var bgFallback = 'background-color:rgb(255,255,255)!important;';
var isAndroid = global$1.os.isAndroid();
var matchColor = function (editorBody) {
var color = get$2(editorBody, 'background-color');
return color !== undefined && color !== '' ? 'background-color:' + color + '!important' : bgFallback;
};
var clobberStyles = function (dom, container, editorBody) {
var gatherSiblings = function (element) {
return siblings(element, '*:not(.tox-silver-sink)');
};
var clobber = function (clobberStyle) {
return function (element) {
var styles = get$3(element, 'style');
var backup = styles === undefined ? 'no-styles' : styles.trim();
if (backup === clobberStyle) {
return;
} else {
set(element, attr, backup);
setAll(element, dom.parseStyle(clobberStyle));
}
};
};
var ancestors$1 = ancestors(container, '*');
var siblings$1 = bind$3(ancestors$1, gatherSiblings);
var bgColor = matchColor(editorBody);
each$1(siblings$1, clobber(siblingStyles));
each$1(ancestors$1, clobber(ancestorPosition + ancestorStyles + bgColor));
var containerStyles = isAndroid === true ? '' : ancestorPosition;
clobber(containerStyles + ancestorStyles + bgColor)(container);
};
var restoreStyles = function (dom) {
var clobberedEls = all('[' + attr + ']');
each$1(clobberedEls, function (element) {
var restore = get$3(element, attr);
if (restore !== 'no-styles') {
setAll(element, dom.parseStyle(restore));
} else {
remove(element, 'style');
}
remove(element, attr);
});
};
var DOM = global$2.DOM;
var getScrollPos = function () {
return getBounds(window);
};
var setScrollPos = function (pos) {
return window.scrollTo(pos.x, pos.y);
};
var viewportUpdate = get().fold(function () {
return {
bind: noop,
unbind: noop
};
}, function (visualViewport) {
var editorContainer = value();
var resizeBinder = unbindable();
var scrollBinder = unbindable();
var refreshScroll = function () {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
};
var refreshVisualViewport = function () {
window.requestAnimationFrame(function () {
editorContainer.on(function (container) {
return setAll(container, {
top: visualViewport.offsetTop + 'px',
left: visualViewport.offsetLeft + 'px',
height: visualViewport.height + 'px',
width: visualViewport.width + 'px'
});
});
});
};
var update = global.throttle(function () {
refreshScroll();
refreshVisualViewport();
}, 50);
var bind$1 = function (element) {
editorContainer.set(element);
update();
resizeBinder.set(bind('resize', update));
scrollBinder.set(bind('scroll', update));
};
var unbind = function () {
editorContainer.on(function () {
resizeBinder.clear();
scrollBinder.clear();
});
editorContainer.clear();
};
return {
bind: bind$1,
unbind: unbind
};
});
var toggleFullscreen = function (editor, fullscreenState) {
var body = document.body;
var documentElement = document.documentElement;
var editorContainer = editor.getContainer();
var editorContainerS = SugarElement.fromDom(editorContainer);
var fullscreenRoot = getFullscreenRoot(editor);
var fullscreenInfo = fullscreenState.get();
var editorBody = SugarElement.fromDom(editor.getBody());
var isTouch = global$1.deviceType.isTouch();
var editorContainerStyle = editorContainer.style;
var iframe = editor.iframeElement;
var iframeStyle = iframe.style;
var handleClasses = function (handler) {
handler(body, 'tox-fullscreen');
handler(documentElement, 'tox-fullscreen');
handler(editorContainer, 'tox-fullscreen');
getShadowRoot(editorContainerS).map(function (root) {
return getShadowHost(root).dom;
}).each(function (host) {
handler(host, 'tox-fullscreen');
handler(host, 'tox-shadowhost');
});
};
var cleanup = function () {
if (isTouch) {
restoreStyles(editor.dom);
}
handleClasses(DOM.removeClass);
viewportUpdate.unbind();
Optional.from(fullscreenState.get()).each(function (info) {
return info.fullscreenChangeHandler.unbind();
});
};
if (!fullscreenInfo) {
var fullscreenChangeHandler = bind$1(owner(fullscreenRoot), getFullscreenchangeEventName(), function (_evt) {
if (getFullscreenNative(editor)) {
if (!isFullscreenElement(fullscreenRoot) && fullscreenState.get() !== null) {
toggleFullscreen(editor, fullscreenState);
}
}
});
var newFullScreenInfo = {
scrollPos: getScrollPos(),
containerWidth: editorContainerStyle.width,
containerHeight: editorContainerStyle.height,
containerTop: editorContainerStyle.top,
containerLeft: editorContainerStyle.left,
iframeWidth: iframeStyle.width,
iframeHeight: iframeStyle.height,
fullscreenChangeHandler: fullscreenChangeHandler
};
if (isTouch) {
clobberStyles(editor.dom, editorContainerS, editorBody);
}
iframeStyle.width = iframeStyle.height = '100%';
editorContainerStyle.width = editorContainerStyle.height = '';
handleClasses(DOM.addClass);
viewportUpdate.bind(editorContainerS);
editor.on('remove', cleanup);
fullscreenState.set(newFullScreenInfo);
if (getFullscreenNative(editor)) {
requestFullscreen(fullscreenRoot);
}
fireFullscreenStateChanged(editor, true);
} else {
fullscreenInfo.fullscreenChangeHandler.unbind();
if (getFullscreenNative(editor) && isFullscreenElement(fullscreenRoot)) {
exitFullscreen(owner(fullscreenRoot));
}
iframeStyle.width = fullscreenInfo.iframeWidth;
iframeStyle.height = fullscreenInfo.iframeHeight;
editorContainerStyle.width = fullscreenInfo.containerWidth;
editorContainerStyle.height = fullscreenInfo.containerHeight;
editorContainerStyle.top = fullscreenInfo.containerTop;
editorContainerStyle.left = fullscreenInfo.containerLeft;
setScrollPos(fullscreenInfo.scrollPos);
fullscreenState.set(null);
fireFullscreenStateChanged(editor, false);
cleanup();
editor.off('remove', cleanup);
}
};
var register$1 = function (editor, fullscreenState) {
editor.addCommand('mceFullScreen', function () {
toggleFullscreen(editor, fullscreenState);
});
};
var makeSetupHandler = function (editor, fullscreenState) {
return function (api) {
api.setActive(fullscreenState.get() !== null);
var editorEventCallback = function (e) {
return api.setActive(e.state);
};
editor.on('FullscreenStateChanged', editorEventCallback);
return function () {
return editor.off('FullscreenStateChanged', editorEventCallback);
};
};
};
var register = function (editor, fullscreenState) {
var onAction = function () {
return editor.execCommand('mceFullScreen');
};
editor.ui.registry.addToggleMenuItem('fullscreen', {
text: 'Fullscreen',
icon: 'fullscreen',
shortcut: 'Meta+Shift+F',
onAction: onAction,
onSetup: makeSetupHandler(editor, fullscreenState)
});
editor.ui.registry.addToggleButton('fullscreen', {
tooltip: 'Fullscreen',
icon: 'fullscreen',
onAction: onAction,
onSetup: makeSetupHandler(editor, fullscreenState)
});
};
function Plugin () {
global$3.add('fullscreen', function (editor) {
var fullscreenState = Cell(null);
if (editor.inline) {
return get$5(fullscreenState);
}
register$1(editor, fullscreenState);
register(editor, fullscreenState);
editor.addShortcut('Meta+Shift+F', '', 'mceFullScreen');
return get$5(fullscreenState);
});
}
Plugin();
}());
| cdnjs/cdnjs | ajax/libs/tinymce/5.10.1/plugins/fullscreen/plugin.js | JavaScript | mit | 41,683 |
/*! UIkit 3.7.5 | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) :
typeof define === 'function' && define.amd ? define('uikitslider', ['uikit-util'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitSlider = factory(global.UIkit.util));
})(this, (function (uikitUtil) { 'use strict';
var Class = {
connected: function() {
!uikitUtil.hasClass(this.$el, this.$name) && uikitUtil.addClass(this.$el, this.$name);
}
};
var SliderAutoplay = {
props: {
autoplay: Boolean,
autoplayInterval: Number,
pauseOnHover: Boolean
},
data: {
autoplay: false,
autoplayInterval: 7000,
pauseOnHover: true
},
connected: function() {
this.autoplay && this.startAutoplay();
},
disconnected: function() {
this.stopAutoplay();
},
update: function() {
uikitUtil.attr(this.slides, 'tabindex', '-1');
},
events: [
{
name: 'visibilitychange',
el: function() {
return document;
},
filter: function() {
return this.autoplay;
},
handler: function() {
if (document.hidden) {
this.stopAutoplay();
} else {
this.startAutoplay();
}
}
}
],
methods: {
startAutoplay: function() {
var this$1$1 = this;
this.stopAutoplay();
this.interval = setInterval(
function () { return (!this$1$1.draggable || !uikitUtil.$(':focus', this$1$1.$el))
&& (!this$1$1.pauseOnHover || !uikitUtil.matches(this$1$1.$el, ':hover'))
&& !this$1$1.stack.length
&& this$1$1.show('next'); },
this.autoplayInterval
);
},
stopAutoplay: function() {
this.interval && clearInterval(this.interval);
}
}
};
var SliderDrag = {
props: {
draggable: Boolean
},
data: {
draggable: true,
threshold: 10
},
created: function() {
var this$1$1 = this;
['start', 'move', 'end'].forEach(function (key) {
var fn = this$1$1[key];
this$1$1[key] = function (e) {
var pos = uikitUtil.getEventPos(e).x * (uikitUtil.isRtl ? -1 : 1);
this$1$1.prevPos = pos !== this$1$1.pos ? this$1$1.pos : this$1$1.prevPos;
this$1$1.pos = pos;
fn(e);
};
});
},
events: [
{
name: uikitUtil.pointerDown,
delegate: function() {
return this.selSlides;
},
handler: function(e) {
if (!this.draggable
|| !uikitUtil.isTouch(e) && hasTextNodesOnly(e.target)
|| uikitUtil.closest(e.target, uikitUtil.selInput)
|| e.button > 0
|| this.length < 2
) {
return;
}
this.start(e);
}
},
{
name: 'dragstart',
handler: function(e) {
e.preventDefault();
}
}
],
methods: {
start: function() {
this.drag = this.pos;
if (this._transitioner) {
this.percent = this._transitioner.percent();
this.drag += this._transitioner.getDistance() * this.percent * this.dir;
this._transitioner.cancel();
this._transitioner.translate(this.percent);
this.dragging = true;
this.stack = [];
} else {
this.prevIndex = this.index;
}
uikitUtil.on(document, uikitUtil.pointerMove, this.move, {passive: false});
// 'input' event is triggered by video controls
uikitUtil.on(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input"), this.end, true);
uikitUtil.css(this.list, 'userSelect', 'none');
},
move: function(e) {
var this$1$1 = this;
var distance = this.pos - this.drag;
if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) {
return;
}
// prevent click event
uikitUtil.css(this.list, 'pointerEvents', 'none');
e.cancelable && e.preventDefault();
this.dragging = true;
this.dir = (distance < 0 ? 1 : -1);
var ref = this;
var slides = ref.slides;
var ref$1 = this;
var prevIndex = ref$1.prevIndex;
var dis = Math.abs(distance);
var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
while (nextIndex !== prevIndex && dis > width) {
this.drag -= width * this.dir;
prevIndex = nextIndex;
dis -= width;
nextIndex = this.getIndex(prevIndex + this.dir, prevIndex);
width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth;
}
this.percent = dis / width;
var prev = slides[prevIndex];
var next = slides[nextIndex];
var changed = this.index !== nextIndex;
var edge = prevIndex === nextIndex;
var itemShown;
[this.index, this.prevIndex].filter(function (i) { return !uikitUtil.includes([nextIndex, prevIndex], i); }).forEach(function (i) {
uikitUtil.trigger(slides[i], 'itemhidden', [this$1$1]);
if (edge) {
itemShown = true;
this$1$1.prevIndex = prevIndex;
}
});
if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) {
uikitUtil.trigger(slides[this.index], 'itemshown', [this]);
}
if (changed) {
this.prevIndex = prevIndex;
this.index = nextIndex;
!edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]);
uikitUtil.trigger(next, 'beforeitemshow', [this]);
}
this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next);
if (changed) {
!edge && uikitUtil.trigger(prev, 'itemhide', [this]);
uikitUtil.trigger(next, 'itemshow', [this]);
}
},
end: function() {
uikitUtil.off(document, uikitUtil.pointerMove, this.move, {passive: false});
uikitUtil.off(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " input"), this.end, true);
if (this.dragging) {
this.dragging = null;
if (this.index === this.prevIndex) {
this.percent = 1 - this.percent;
this.dir *= -1;
this._show(false, this.index, true);
this._transitioner = null;
} else {
var dirChange = (uikitUtil.isRtl ? this.dir * (uikitUtil.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos;
this.index = dirChange ? this.index : this.prevIndex;
if (dirChange) {
this.percent = 1 - this.percent;
}
this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true);
}
}
uikitUtil.css(this.list, {userSelect: '', pointerEvents: ''});
this.drag
= this.percent
= null;
}
}
};
function hasTextNodesOnly(el) {
return !el.children.length && el.childNodes.length;
}
var SliderNav = {
data: {
selNav: false
},
computed: {
nav: function(ref, $el) {
var selNav = ref.selNav;
return uikitUtil.$(selNav, $el);
},
selNavItem: function(ref) {
var attrItem = ref.attrItem;
return ("[" + attrItem + "],[data-" + attrItem + "]");
},
navItems: function(_, $el) {
return uikitUtil.$$(this.selNavItem, $el);
}
},
update: {
write: function() {
var this$1$1 = this;
if (this.nav && this.length !== this.nav.children.length) {
uikitUtil.html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1$1.attrItem) + "=\"" + i + "\"><a href></a></li>"); }).join(''));
}
this.navItems.concat(this.nav).forEach(function (el) { return el && (el.hidden = !this$1$1.maxIndex); });
this.updateNav();
},
events: ['resize']
},
events: [
{
name: 'click',
delegate: function() {
return this.selNavItem;
},
handler: function(e) {
e.preventDefault();
this.show(uikitUtil.data(e.current, this.attrItem));
}
},
{
name: 'itemshow',
handler: 'updateNav'
}
],
methods: {
updateNav: function() {
var this$1$1 = this;
var i = this.getValidIndex();
this.navItems.forEach(function (el) {
var cmd = uikitUtil.data(el, this$1$1.attrItem);
uikitUtil.toggleClass(el, this$1$1.clsActive, uikitUtil.toNumber(cmd) === i);
uikitUtil.toggleClass(el, 'uk-invisible', this$1$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1$1.maxIndex));
});
}
}
};
var Slider = {
mixins: [SliderAutoplay, SliderDrag, SliderNav],
props: {
clsActivated: Boolean,
easing: String,
index: Number,
finite: Boolean,
velocity: Number,
selSlides: String
},
data: function () { return ({
easing: 'ease',
finite: false,
velocity: 1,
index: 0,
prevIndex: -1,
stack: [],
percent: 0,
clsActive: 'uk-active',
clsActivated: false,
Transitioner: false,
transitionOptions: {}
}); },
connected: function() {
this.prevIndex = -1;
this.index = this.getValidIndex(this.$props.index);
this.stack = [];
},
disconnected: function() {
uikitUtil.removeClass(this.slides, this.clsActive);
},
computed: {
duration: function(ref, $el) {
var velocity = ref.velocity;
return speedUp($el.offsetWidth / velocity);
},
list: function(ref, $el) {
var selList = ref.selList;
return uikitUtil.$(selList, $el);
},
maxIndex: function() {
return this.length - 1;
},
selSlides: function(ref) {
var selList = ref.selList;
var selSlides = ref.selSlides;
return (selList + " " + (selSlides || '> *'));
},
slides: {
get: function() {
return uikitUtil.$$(this.selSlides, this.$el);
},
watch: function() {
this.$reset();
}
},
length: function() {
return this.slides.length;
}
},
events: {
itemshown: function() {
this.$update(this.list);
}
},
methods: {
show: function(index, force) {
var this$1$1 = this;
if ( force === void 0 ) force = false;
if (this.dragging || !this.length) {
return;
}
var ref = this;
var stack = ref.stack;
var queueIndex = force ? 0 : stack.length;
var reset = function () {
stack.splice(queueIndex, 1);
if (stack.length) {
this$1$1.show(stack.shift(), true);
}
};
stack[force ? 'unshift' : 'push'](index);
if (!force && stack.length > 1) {
if (stack.length === 2) {
this._transitioner.forward(Math.min(this.duration, 200));
}
return;
}
var prevIndex = this.getIndex(this.index);
var prev = uikitUtil.hasClass(this.slides, this.clsActive) && this.slides[prevIndex];
var nextIndex = this.getIndex(index, this.index);
var next = this.slides[nextIndex];
if (prev === next) {
reset();
return;
}
this.dir = getDirection(index, prevIndex);
this.prevIndex = prevIndex;
this.index = nextIndex;
if (prev && !uikitUtil.trigger(prev, 'beforeitemhide', [this])
|| !uikitUtil.trigger(next, 'beforeitemshow', [this, prev])
) {
this.index = this.prevIndex;
reset();
return;
}
var promise = this._show(prev, next, force).then(function () {
prev && uikitUtil.trigger(prev, 'itemhidden', [this$1$1]);
uikitUtil.trigger(next, 'itemshown', [this$1$1]);
return new uikitUtil.Promise(function (resolve) {
uikitUtil.fastdom.write(function () {
stack.shift();
if (stack.length) {
this$1$1.show(stack.shift(), true);
} else {
this$1$1._transitioner = null;
}
resolve();
});
});
});
prev && uikitUtil.trigger(prev, 'itemhide', [this]);
uikitUtil.trigger(next, 'itemshow', [this]);
return promise;
},
getIndex: function(index, prev) {
if ( index === void 0 ) index = this.index;
if ( prev === void 0 ) prev = this.index;
return uikitUtil.clamp(uikitUtil.getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex);
},
getValidIndex: function(index, prevIndex) {
if ( index === void 0 ) index = this.index;
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
return this.getIndex(index, prevIndex);
},
_show: function(prev, next, force) {
this._transitioner = this._getTransitioner(
prev,
next,
this.dir,
uikitUtil.assign({
easing: force
? next.offsetWidth < 600
? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */
: 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */
: this.easing
}, this.transitionOptions)
);
if (!force && !prev) {
this._translate(1);
return uikitUtil.Promise.resolve();
}
var ref = this.stack;
var length = ref.length;
return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent);
},
_getDistance: function(prev, next) {
return this._getTransitioner(prev, prev !== next && next).getDistance();
},
_translate: function(percent, prev, next) {
if ( prev === void 0 ) prev = this.prevIndex;
if ( next === void 0 ) next = this.index;
var transitioner = this._getTransitioner(prev !== next ? prev : false, next);
transitioner.translate(percent);
return transitioner;
},
_getTransitioner: function(prev, next, dir, options) {
if ( prev === void 0 ) prev = this.prevIndex;
if ( next === void 0 ) next = this.index;
if ( dir === void 0 ) dir = this.dir || 1;
if ( options === void 0 ) options = this.transitionOptions;
return new this.Transitioner(
uikitUtil.isNumber(prev) ? this.slides[prev] : prev,
uikitUtil.isNumber(next) ? this.slides[next] : next,
dir * (uikitUtil.isRtl ? -1 : 1),
options
);
}
}
};
function getDirection(index, prevIndex) {
return index === 'next'
? 1
: index === 'previous'
? -1
: index < prevIndex
? -1
: 1;
}
function speedUp(x) {
return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200)
}
var SliderReactive = {
update: {
write: function() {
if (this.stack.length || this.dragging) {
return;
}
var index = this.getValidIndex(this.index);
if (!~this.prevIndex || this.index !== index) {
this.show(index);
}
},
events: ['resize']
}
};
function translate(value, unit) {
if ( value === void 0 ) value = 0;
if ( unit === void 0 ) unit = '%';
value += value ? unit : '';
return uikitUtil.isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently not translate3d in IE, translate3d within translate3d does not work while transitioning
}
function Transitioner (prev, next, dir, ref) {
var center = ref.center;
var easing = ref.easing;
var list = ref.list;
var deferred = new uikitUtil.Deferred();
var from = prev
? getLeft(prev, list, center)
: getLeft(next, list, center) + uikitUtil.dimensions(next).width * dir;
var to = next
? getLeft(next, list, center)
: from + uikitUtil.dimensions(prev).width * dir * (uikitUtil.isRtl ? -1 : 1);
return {
dir: dir,
show: function(duration, percent, linear) {
if ( percent === void 0 ) percent = 0;
var timing = linear ? 'linear' : easing;
duration -= Math.round(duration * uikitUtil.clamp(percent, -1, 1));
this.translate(percent);
percent = prev ? percent : uikitUtil.clamp(percent, 0, 1);
triggerUpdate(this.getItemIn(), 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir});
prev && triggerUpdate(this.getItemIn(true), 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir});
uikitUtil.Transition
.start(list, {transform: translate(-to * (uikitUtil.isRtl ? -1 : 1), 'px')}, duration, timing)
.then(deferred.resolve, uikitUtil.noop);
return deferred.promise;
},
cancel: function() {
uikitUtil.Transition.cancel(list);
},
reset: function() {
uikitUtil.css(list, 'transform', '');
},
forward: function(duration, percent) {
if ( percent === void 0 ) percent = this.percent();
uikitUtil.Transition.cancel(list);
return this.show(duration, percent, true);
},
translate: function(percent) {
var distance = this.getDistance() * dir * (uikitUtil.isRtl ? -1 : 1);
uikitUtil.css(list, 'transform', translate(uikitUtil.clamp(
-to + (distance - distance * percent),
-getWidth(list),
uikitUtil.dimensions(list).width
) * (uikitUtil.isRtl ? -1 : 1), 'px'));
var actives = this.getActives();
var itemIn = this.getItemIn();
var itemOut = this.getItemIn(true);
percent = prev ? uikitUtil.clamp(percent, -1, 1) : 0;
uikitUtil.children(list).forEach(function (slide) {
var isActive = uikitUtil.includes(actives, slide);
var isIn = slide === itemIn;
var isOut = slide === itemOut;
var translateIn = isIn || !isOut && (isActive || dir * (uikitUtil.isRtl ? -1 : 1) === -1 ^ getElLeft(slide, list) > getElLeft(prev || next));
triggerUpdate(slide, ("itemtranslate" + (translateIn ? 'in' : 'out')), {
dir: dir,
percent: isOut
? 1 - percent
: isIn
? percent
: isActive
? 1
: 0
});
});
},
percent: function() {
return Math.abs((uikitUtil.css(list, 'transform').split(',')[4] * (uikitUtil.isRtl ? -1 : 1) + from) / (to - from));
},
getDistance: function() {
return Math.abs(to - from);
},
getItemIn: function(out) {
if ( out === void 0 ) out = false;
var actives = this.getActives();
var nextActives = inView(list, getLeft(next || prev, list, center));
if (out) {
var temp = actives;
actives = nextActives;
nextActives = temp;
}
return nextActives[uikitUtil.findIndex(nextActives, function (el) { return !uikitUtil.includes(actives, el); })];
},
getActives: function() {
return inView(list, getLeft(prev || next, list, center));
}
};
}
function getLeft(el, list, center) {
var left = getElLeft(el, list);
return center
? left - centerEl(el, list)
: Math.min(left, getMax(list));
}
function getMax(list) {
return Math.max(0, getWidth(list) - uikitUtil.dimensions(list).width);
}
function getWidth(list) {
return uikitUtil.children(list).reduce(function (right, el) { return uikitUtil.dimensions(el).width + right; }, 0);
}
function centerEl(el, list) {
return uikitUtil.dimensions(list).width / 2 - uikitUtil.dimensions(el).width / 2;
}
function getElLeft(el, list) {
return el && (uikitUtil.position(el).left + (uikitUtil.isRtl ? uikitUtil.dimensions(el).width - uikitUtil.dimensions(list).width : 0)) * (uikitUtil.isRtl ? -1 : 1) || 0;
}
function inView(list, listLeft) {
listLeft -= 1;
var listRight = listLeft + uikitUtil.dimensions(list).width + 2;
return uikitUtil.children(list).filter(function (slide) {
var slideLeft = getElLeft(slide, list);
var slideRight = slideLeft + uikitUtil.dimensions(slide).width;
return slideLeft >= listLeft && slideRight <= listRight;
});
}
function triggerUpdate(el, type, data) {
uikitUtil.trigger(el, uikitUtil.createEvent(type, false, false, data));
}
var Component = {
mixins: [Class, Slider, SliderReactive],
props: {
center: Boolean,
sets: Boolean
},
data: {
center: false,
sets: false,
attrItem: 'uk-slider-item',
selList: '.uk-slider-items',
selNav: '.uk-slider-nav',
clsContainer: 'uk-slider-container',
Transitioner: Transitioner
},
computed: {
avgWidth: function() {
return getWidth(this.list) / this.length;
},
finite: function(ref) {
var finite = ref.finite;
return finite || Math.ceil(getWidth(this.list)) < uikitUtil.dimensions(this.list).width + getMaxElWidth(this.list) + this.center;
},
maxIndex: function() {
if (!this.finite || this.center && !this.sets) {
return this.length - 1;
}
if (this.center) {
return uikitUtil.last(this.sets);
}
var lft = 0;
var max = getMax(this.list);
var index = uikitUtil.findIndex(this.slides, function (el) {
if (lft >= max) {
return true;
}
lft += uikitUtil.dimensions(el).width;
});
return ~index ? index : this.length - 1;
},
sets: function(ref) {
var this$1$1 = this;
var sets = ref.sets;
if (!sets) {
return;
}
var width = uikitUtil.dimensions(this.list).width / (this.center ? 2 : 1);
var left = 0;
var leftCenter = width;
var slideLeft = 0;
sets = uikitUtil.sortBy(this.slides, 'offsetLeft').reduce(function (sets, slide, i) {
var slideWidth = uikitUtil.dimensions(slide).width;
var slideRight = slideLeft + slideWidth;
if (slideRight > left) {
if (!this$1$1.center && i > this$1$1.maxIndex) {
i = this$1$1.maxIndex;
}
if (!uikitUtil.includes(sets, i)) {
var cmp = this$1$1.slides[i + 1];
if (this$1$1.center && cmp && slideWidth < leftCenter - uikitUtil.dimensions(cmp).width / 2) {
leftCenter -= slideWidth;
} else {
leftCenter = width;
sets.push(i);
left = slideLeft + width + (this$1$1.center ? slideWidth / 2 : 0);
}
}
}
slideLeft += slideWidth;
return sets;
}, []);
return !uikitUtil.isEmpty(sets) && sets;
},
transitionOptions: function() {
return {
center: this.center,
list: this.list
};
}
},
connected: function() {
uikitUtil.toggleClass(this.$el, this.clsContainer, !uikitUtil.$(("." + (this.clsContainer)), this.$el));
},
update: {
write: function() {
var this$1$1 = this;
this.navItems.forEach(function (el) {
var index = uikitUtil.toNumber(uikitUtil.data(el, this$1$1.attrItem));
if (index !== false) {
el.hidden = !this$1$1.maxIndex || index > this$1$1.maxIndex || this$1$1.sets && !uikitUtil.includes(this$1$1.sets, index);
}
});
if (this.length && !this.dragging && !this.stack.length) {
this.reorder();
this._translate(1);
}
var actives = this._getTransitioner(this.index).getActives();
this.slides.forEach(function (slide) { return uikitUtil.toggleClass(slide, this$1$1.clsActive, uikitUtil.includes(actives, slide)); });
if (this.clsActivated && (!this.sets || uikitUtil.includes(this.sets, uikitUtil.toFloat(this.index)))) {
this.slides.forEach(function (slide) { return uikitUtil.toggleClass(slide, this$1$1.clsActivated || '', uikitUtil.includes(actives, slide)); });
}
},
events: ['resize']
},
events: {
beforeitemshow: function(e) {
if (!this.dragging && this.sets && this.stack.length < 2 && !uikitUtil.includes(this.sets, this.index)) {
this.index = this.getValidIndex();
}
var diff = Math.abs(
this.index
- this.prevIndex
+ (this.dir > 0 && this.index < this.prevIndex || this.dir < 0 && this.index > this.prevIndex ? (this.maxIndex + 1) * this.dir : 0)
);
if (!this.dragging && diff > 1) {
for (var i = 0; i < diff; i++) {
this.stack.splice(1, 0, this.dir > 0 ? 'next' : 'previous');
}
e.preventDefault();
return;
}
var index = this.dir < 0 || !this.slides[this.prevIndex] ? this.index : this.prevIndex;
this.duration = speedUp(this.avgWidth / this.velocity) * (uikitUtil.dimensions(this.slides[index]).width / this.avgWidth);
this.reorder();
},
itemshow: function() {
if (~this.prevIndex) {
uikitUtil.addClass(this._getTransitioner().getItemIn(), this.clsActive);
}
}
},
methods: {
reorder: function() {
var this$1$1 = this;
if (this.finite) {
uikitUtil.css(this.slides, 'order', '');
return;
}
var index = this.dir > 0 && this.slides[this.prevIndex] ? this.prevIndex : this.index;
this.slides.forEach(function (slide, i) { return uikitUtil.css(slide, 'order', this$1$1.dir > 0 && i < index
? 1
: this$1$1.dir < 0 && i >= this$1$1.index
? -1
: ''
); }
);
if (!this.center) {
return;
}
var next = this.slides[index];
var width = uikitUtil.dimensions(this.list).width / 2 - uikitUtil.dimensions(next).width / 2;
var j = 0;
while (width > 0) {
var slideIndex = this.getIndex(--j + index, index);
var slide = this.slides[slideIndex];
uikitUtil.css(slide, 'order', slideIndex > index ? -2 : -1);
width -= uikitUtil.dimensions(slide).width;
}
},
getValidIndex: function(index, prevIndex) {
if ( index === void 0 ) index = this.index;
if ( prevIndex === void 0 ) prevIndex = this.prevIndex;
index = this.getIndex(index, prevIndex);
if (!this.sets) {
return index;
}
var prev;
do {
if (uikitUtil.includes(this.sets, index)) {
return index;
}
prev = index;
index = this.getIndex(index + this.dir, prevIndex);
} while (index !== prev);
return index;
}
}
};
function getMaxElWidth(list) {
return Math.max.apply(Math, [ 0 ].concat( uikitUtil.children(list).map(function (el) { return uikitUtil.dimensions(el).width; }) ));
}
if (typeof window !== 'undefined' && window.UIkit) {
window.UIkit.component('slider', Component);
}
return Component;
}));
| cdnjs/cdnjs | ajax/libs/uikit/3.7.5/js/components/slider.js | JavaScript | mit | 34,123 |
/*!
* froala_editor v4.0.2 (https://www.froala.com/wysiwyg-editor)
* License https://froala.com/wysiwyg-editor/terms/
* Copyright 2014-2021 Froala Labs
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) :
typeof define === 'function' && define.amd ? define(['froala-editor'], factory) :
(factory(global.FroalaEditor));
}(this, (function (FE) { 'use strict';
FE = FE && FE.hasOwnProperty('default') ? FE['default'] : FE;
/**
* Arabic
*/
FE.LANGUAGE['ar'] = {
translation: {
// Place holder
'Type something': "\u0627\u0643\u062A\u0628 \u0634\u064A\u0626\u0627",
// Basic formatting
'Bold': "\u063A\u0627\u0645\u0642",
'Italic': "\u0645\u0627\u0626\u0644",
'Underline': "\u062A\u0633\u0637\u064A\u0631",
'Strikethrough': "\u064A\u062A\u0648\u0633\u0637 \u062E\u0637",
// Main buttons
'Insert': "\u0625\u062F\u0631\u0627\u062C",
'Delete': "\u062D\u0630\u0641",
'Cancel': "\u0625\u0644\u063A\u0627\u0621",
'OK': "\u0645\u0648\u0627\u0641\u0642",
'Back': "\u0638\u0647\u0631",
'Remove': "\u0625\u0632\u0627\u0644\u0629",
'More': "\u0623\u0643\u062B\u0631",
'Update': "\u0627\u0644\u062A\u062D\u062F\u064A\u062B",
'Style': "\u0623\u0633\u0644\u0648\u0628",
// Font
'Font Family': "\u0639\u0627\u0626\u0644\u0629 \u0627\u0644\u062E\u0637",
'Font Size': "\u062D\u062C\u0645 \u0627\u0644\u062E\u0637",
// Colors
'Colors': "\u0627\u0644\u0623\u0644\u0648\u0627\u0646",
'Background': "\u0627\u0644\u062E\u0644\u0641\u064A\u0629",
'Text': "\u0627\u0644\u0646\u0635",
'HEX Color': 'عرافة اللون',
// Paragraphs
'Paragraph Format': "\u062A\u0646\u0633\u064A\u0642 \u0627\u0644\u0641\u0642\u0631\u0629",
'Normal': "\u0637\u0628\u064A\u0639\u064A",
'Code': "\u0643\u0648\u062F",
'Heading 1': "\u0627\u0644\u0639\u0646\u0627\u0648\u064A\u0646 1",
'Heading 2': "\u0627\u0644\u0639\u0646\u0627\u0648\u064A\u0646 2",
'Heading 3': "\u0627\u0644\u0639\u0646\u0627\u0648\u064A\u0646 3",
'Heading 4': "\u0627\u0644\u0639\u0646\u0627\u0648\u064A\u0646 4",
// Style
'Paragraph Style': "\u0646\u0645\u0637 \u0627\u0644\u0641\u0642\u0631\u0629",
'Inline Style': "\u0627\u0644\u0646\u0645\u0637 \u0627\u0644\u0645\u0636\u0645\u0646",
// Alignment
'Align': "\u0645\u062D\u0627\u0630\u0627\u0629",
'Align Left': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0646\u0635 \u0644\u0644\u064A\u0633\u0627\u0631",
'Align Center': "\u062A\u0648\u0633\u064A\u0637",
'Align Right': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0646\u0635 \u0644\u0644\u064A\u0645\u064A\u0646",
'Align Justify': "\u0636\u0628\u0637",
'None': "\u0644\u0627 \u0634\u064A\u0621",
// Lists
'Ordered List': "\u0642\u0627\u0626\u0645\u0629 \u0645\u0631\u062A\u0628\u0629",
'Default': 'الافتراضي',
'Lower Alpha': 'أقل ألفا',
'Lower Greek': 'أقل اليونانية',
'Lower Roman': 'انخفاض الروماني',
'Upper Alpha': 'العلوي ألفا',
'Upper Roman': 'الروماني العلوي',
'Unordered List': "\u0642\u0627\u0626\u0645\u0629 \u063A\u064A\u0631 \u0645\u0631\u062A\u0628\u0629",
'Circle': 'دائرة',
'Disc': 'القرص',
'Square': 'ميدان',
// Line height
'Line Height': 'ارتفاع خط',
'Single': 'غير مرتبطة',
'Double': 'مزدوج',
// Indent
'Decrease Indent': "\u0627\u0646\u062E\u0641\u0627\u0636 \u0627\u0644\u0645\u0633\u0627\u0641\u0629 \u0627\u0644\u0628\u0627\u062F\u0626\u0629",
'Increase Indent': "\u0632\u064A\u0627\u062F\u0629 \u0627\u0644\u0645\u0633\u0627\u0641\u0629 \u0627\u0644\u0628\u0627\u062F\u0626\u0629",
// Links
'Insert Link': "\u0625\u062F\u0631\u0627\u062C \u0631\u0627\u0628\u0637",
'Open in new tab': "\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\u0629",
'Open Link': "\u0627\u0641\u062A\u062D \u0627\u0644\u0631\u0627\u0628\u0637",
'Edit Link': "\u0627\u0631\u062A\u0628\u0627\u0637 \u062A\u062D\u0631\u064A\u0631",
'Unlink': "\u062D\u0630\u0641 \u0627\u0644\u0631\u0627\u0628\u0637",
'Choose Link': "\u0627\u062E\u062A\u064A\u0627\u0631 \u0635\u0644\u0629",
// Images
'Insert Image': "\u0625\u062F\u0631\u0627\u062C \u0635\u0648\u0631\u0629",
'Upload Image': "\u062A\u062D\u0645\u064A\u0644 \u0635\u0648\u0631\u0629",
'By URL': "\u0628\u0648\u0627\u0633\u0637\u0629 URL",
'Browse': "\u062A\u0635\u0641\u062D",
'Drop image': "\u0625\u0633\u0642\u0627\u0637 \u0635\u0648\u0631\u0629",
'or click': "\u0623\u0648 \u0627\u0646\u0642\u0631 \u0641\u0648\u0642",
'Manage Images': "\u0625\u062F\u0627\u0631\u0629 \u0627\u0644\u0635\u0648\u0631",
'Loading': "\u062A\u062D\u0645\u064A\u0644",
'Deleting': "\u062D\u0630\u0641",
'Tags': "\u0627\u0644\u0643\u0644\u0645\u0627\u062A",
'Are you sure? Image will be deleted.': "\u0647\u0644 \u0623\u0646\u062A \u0645\u062A\u0623\u0643\u062F\u061F \u0633\u064A\u062A\u0645 \u062D\u0630\u0641 \u0627\u0644\u0635\u0648\u0631\u0629.",
'Replace': "\u0627\u0633\u062A\u0628\u062F\u0627\u0644",
'Uploading': "\u062A\u062D\u0645\u064A\u0644",
'Loading image': "\u0635\u0648\u0631\u0629 \u062A\u062D\u0645\u064A\u0644",
'Display': "\u0639\u0631\u0636",
'Inline': "\u0641\u064A \u062E\u0637",
'Break Text': "\u0646\u0635 \u0627\u0633\u062A\u0631\u0627\u062D\u0629",
'Alternative Text': "\u0646\u0635 \u0628\u062F\u064A\u0644",
'Change Size': "\u062A\u063A\u064A\u064A\u0631 \u062D\u062C\u0645",
'Width': "\u0639\u0631\u0636",
'Height': "\u0627\u0631\u062A\u0641\u0627\u0639",
'Something went wrong. Please try again.': ".\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0627\u062E\u0631\u0649",
'Image Caption': 'تعليق على الصورة',
'Advanced Edit': 'تعديل متقدم',
// Video
'Insert Video': "\u0625\u062F\u0631\u0627\u062C \u0641\u064A\u062F\u064A\u0648",
'Embedded Code': "\u0627\u0644\u062A\u0639\u0644\u064A\u0645\u0627\u062A \u0627\u0644\u0628\u0631\u0645\u062C\u064A\u0629 \u0627\u0644\u0645\u0636\u0645\u0646\u0629",
'Paste in a video URL': 'لصق في عنوان ورل للفيديو',
'Drop video': 'انخفاض الفيديو',
'Your browser does not support HTML5 video.': 'متصفحك لا يدعم فيديو HTML5.',
'Upload Video': 'رفع فيديو',
// Tables
'Insert Table': "\u0625\u062F\u0631\u0627\u062C \u062C\u062F\u0648\u0644",
'Table Header': "\u0631\u0623\u0633 \u0627\u0644\u062C\u062F\u0648\u0644",
'Remove Table': "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u062C\u062F\u0648\u0644",
'Table Style': "\u0646\u0645\u0637 \u0627\u0644\u062C\u062F\u0648\u0644",
'Horizontal Align': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0623\u0641\u0642\u064A\u0629",
'Row': "\u0635\u0641",
'Insert row above': "\u0625\u062F\u0631\u0627\u062C \u0635\u0641 \u0644\u0644\u0623\u0639\u0644\u0649",
'Insert row below': "\u0625\u062F\u0631\u0627\u062C \u0635\u0641 \u0644\u0644\u0623\u0633\u0641\u0644",
'Delete row': "\u062D\u0630\u0641 \u0635\u0641",
'Column': "\u0639\u0645\u0648\u062F",
'Insert column before': "\u0625\u062F\u0631\u0627\u062C \u0639\u0645\u0648\u062F \u0644\u0644\u064A\u0633\u0627\u0631",
'Insert column after': "\u0625\u062F\u0631\u0627\u062C \u0639\u0645\u0648\u062F \u0644\u0644\u064A\u0645\u064A\u0646",
'Delete column': "\u062D\u0630\u0641 \u0639\u0645\u0648\u062F",
'Cell': "\u062E\u0644\u064A\u0629",
'Merge cells': "\u062F\u0645\u062C \u062E\u0644\u0627\u064A\u0627",
'Horizontal split': "\u0627\u0646\u0642\u0633\u0627\u0645 \u0623\u0641\u0642\u064A",
'Vertical split': "\u0627\u0644\u0627\u0646\u0642\u0633\u0627\u0645 \u0627\u0644\u0639\u0645\u0648\u062F\u064A",
'Cell Background': "\u062E\u0644\u0641\u064A\u0629 \u0627\u0644\u062E\u0644\u064A\u0629",
'Vertical Align': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0639\u0645\u0648\u062F\u064A\u0629",
'Top': "\u0623\u0639\u0644\u0649",
'Middle': "\u0648\u0633\u0637",
'Bottom': "\u0623\u0633\u0641\u0644",
'Align Top': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0623\u0639\u0644\u0649",
'Align Middle': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0648\u0633\u0637",
'Align Bottom': "\u0645\u062D\u0627\u0630\u0627\u0629 \u0627\u0644\u0623\u0633\u0641\u0644",
'Cell Style': "\u0646\u0645\u0637 \u0627\u0644\u062E\u0644\u064A\u0629",
// Files
'Upload File': "\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0644\u0641",
'Drop file': "\u0627\u0646\u062E\u0641\u0627\u0636 \u0627\u0644\u0645\u0644\u0641",
// Emoticons
'Emoticons': "\u0627\u0644\u0645\u0634\u0627\u0639\u0631",
'Grinning face': "\u064A\u0643\u0634\u0631 \u0648\u062C\u0647\u0647",
'Grinning face with smiling eyes': "\u0645\u0628\u062A\u0633\u0645\u0627 \u0648\u062C\u0647 \u0645\u0639 \u064A\u0628\u062A\u0633\u0645 \u0627\u0644\u0639\u064A\u0646",
'Face with tears of joy': "\u0648\u062C\u0647 \u0645\u0639 \u062F\u0645\u0648\u0639 \u0627\u0644\u0641\u0631\u062D",
'Smiling face with open mouth': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645",
'Smiling face with open mouth and smiling eyes': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645 \u0648\u0627\u0644\u0639\u064A\u0646\u064A\u0646 \u064A\u0628\u062A\u0633\u0645",
'Smiling face with open mouth and cold sweat': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645 \u0648\u0627\u0644\u0639\u0631\u0642 \u0627\u0644\u0628\u0627\u0631\u062F",
'Smiling face with open mouth and tightly-closed eyes': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645 \u0648\u0627\u0644\u0639\u064A\u0646\u064A\u0646 \u0645\u063A\u0644\u0642\u0629 \u0628\u0625\u062D\u0643\u0627\u0645",
'Smiling face with halo': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0645\u0639 \u0647\u0627\u0644\u0629",
'Smiling face with horns': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0628\u0642\u0631\u0648\u0646",
'Winking face': "\u0627\u0644\u063A\u0645\u0632 \u0648\u062C\u0647",
'Smiling face with smiling eyes': "\u064A\u0628\u062A\u0633\u0645 \u0648\u062C\u0647 \u0645\u0639 \u0639\u064A\u0648\u0646 \u062A\u0628\u062A\u0633\u0645",
'Face savoring delicious food': "\u064A\u0648\u0627\u062C\u0647 \u0644\u0630\u064A\u0630 \u0627\u0644\u0645\u0630\u0627\u0642 \u0644\u0630\u064A\u0630 \u0627\u0644\u0637\u0639\u0627\u0645",
'Relieved face': "\u0648\u062C\u0647 \u0628\u0627\u0644\u0627\u0631\u062A\u064A\u0627\u062D",
'Smiling face with heart-shaped eyes': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0628\u0639\u064A\u0646\u064A\u0646 \u0639\u0644\u0649 \u0634\u0643\u0644 \u0642\u0644\u0628",
'Smiling face with sunglasses': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0628\u062A\u0633\u0645 \u0645\u0639 \u0627\u0644\u0646\u0638\u0627\u0631\u0627\u062A \u0627\u0644\u0634\u0645\u0633\u064A\u0629",
'Smirking face': "\u0633\u0645\u064A\u0631\u0643\u064A\u0646\u062C \u0627\u0644\u0648\u062C\u0647",
'Neutral face': "\u0645\u062D\u0627\u064A\u062F \u0627\u0644\u0648\u062C\u0647",
'Expressionless face': "\u0648\u062C\u0647 \u0627\u0644\u062A\u0639\u0627\u0628\u064A\u0631",
'Unamused face': "\u0644\u0627 \u0645\u0633\u0644\u064A\u0627 \u0627\u0644\u0648\u062C\u0647",
'Face with cold sweat': "\u0648\u062C\u0647 \u0645\u0639 \u0639\u0631\u0642 \u0628\u0627\u0631\u062F",
'Pensive face': "\u0648\u062C\u0647 \u0645\u062A\u0623\u0645\u0644",
'Confused face': "\u0648\u062C\u0647 \u0627\u0644\u062E\u0644\u0637",
'Confounded face': "\u0648\u062C\u0647 \u0645\u0631\u062A\u0628\u0643",
'Kissing face': "\u062A\u0642\u0628\u064A\u0644 \u0627\u0644\u0648\u062C\u0647",
'Face throwing a kiss': "\u0645\u0648\u0627\u062C\u0647\u0629 \u0631\u0645\u064A \u0642\u0628\u0644\u0629",
'Kissing face with smiling eyes': "\u062A\u0642\u0628\u064A\u0644 \u0648\u062C\u0647 \u0645\u0639 \u0639\u064A\u0648\u0646 \u062A\u0628\u062A\u0633\u0645",
'Kissing face with closed eyes': "\u062A\u0642\u0628\u064A\u0644 \u0648\u062C\u0647 \u0645\u0639 \u0639\u064A\u0648\u0646 \u0645\u063A\u0644\u0642\u0629",
'Face with stuck out tongue': "\u0627\u0644\u0648\u062C\u0647 \u0645\u0639 \u062A\u0645\u0633\u0643 \u0628\u0647\u0627 \u0627\u0644\u0644\u0633\u0627\u0646",
'Face with stuck out tongue and winking eye': "\u0627\u0644\u0648\u062C\u0647 \u0645\u0639 \u062A\u0645\u0633\u0643 \u0628\u0647\u0627 \u0627\u0644\u0644\u0633\u0627\u0646 \u0648\u0627\u0644\u0639\u064A\u0646 \u0627\u0644\u062A\u063A\u0627\u0636\u064A",
'Face with stuck out tongue and tightly-closed eyes': "\u0627\u0644\u0648\u062C\u0647 \u0645\u0639 \u062A\u0645\u0633\u0643 \u0628\u0647\u0627 \u0627\u0644\u0644\u0633\u0627\u0646 \u0648\u0627\u0644\u0639\u064A\u0648\u0646 \u0645\u063A\u0644\u0642\u0629 \u0628\u0623\u062D\u0643\u0627\u0645-",
'Disappointed face': "\u0648\u062C\u0647\u0627 \u062E\u064A\u0628\u0629 \u0623\u0645\u0644",
'Worried face': "\u0648\u062C\u0647\u0627 \u0627\u0644\u0642\u0644\u0642\u0648\u0646",
'Angry face': "\u0648\u062C\u0647 \u063A\u0627\u0636\u0628",
'Pouting face': "\u0627\u0644\u0639\u0628\u0648\u0633 \u0648\u062C\u0647",
'Crying face': "\u0627\u0644\u0628\u0643\u0627\u0621 \u0627\u0644\u0648\u062C\u0647",
'Persevering face': "\u0627\u0644\u0645\u062B\u0627\u0628\u0631\u0629 \u0648\u062C\u0647\u0647",
'Face with look of triumph': "\u0648\u0627\u062C\u0647 \u0645\u0639 \u0646\u0638\u0631\u0629 \u0627\u0646\u062A\u0635\u0627\u0631",
'Disappointed but relieved face': "\u0628\u062E\u064A\u0628\u0629 \u0623\u0645\u0644 \u0648\u0644\u0643\u0646 \u064A\u0639\u0641\u0649 \u0648\u062C\u0647",
'Frowning face with open mouth': "\u0645\u0642\u0637\u0628 \u0627\u0644\u0648\u062C\u0647 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645",
'Anguished face': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u0624\u0644\u0645",
'Fearful face': "\u0627\u0644\u0648\u062C\u0647 \u0627\u0644\u0645\u062E\u064A\u0641",
'Weary face': "\u0648\u062C\u0647\u0627 \u0628\u0627\u0644\u0636\u062C\u0631",
'Sleepy face': "\u0648\u062C\u0647 \u0646\u0639\u0633\u0627\u0646",
'Tired face': "\u0648\u062C\u0647 \u0645\u062A\u0639\u0628",
'Grimacing face': "\u0648\u062E\u0631\u062C \u0633\u064A\u0633 \u0627\u0644\u0648\u062C\u0647",
'Loudly crying face': "\u0627\u0644\u0628\u0643\u0627\u0621 \u0628\u0635\u0648\u062A \u0639\u0627\u0644 \u0648\u062C\u0647\u0647",
'Face with open mouth': "\u0648\u0627\u062C\u0647 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645",
'Hushed face': "\u0648\u062C\u0647\u0627 \u0627\u0644\u062A\u0643\u062A\u0645",
'Face with open mouth and cold sweat': "\u0648\u0627\u062C\u0647 \u0645\u0639 \u0641\u062A\u062D \u0627\u0644\u0641\u0645 \u0648\u0627\u0644\u0639\u0631\u0642 \u0627\u0644\u0628\u0627\u0631\u062F",
'Face screaming in fear': "\u0648\u0627\u062C\u0647 \u064A\u0635\u0631\u062E \u0641\u064A \u062E\u0648\u0641",
'Astonished face': "\u0648\u062C\u0647\u0627 \u062F\u0647\u0634",
'Flushed face': "\u0627\u062D\u0645\u0631\u0627\u0631 \u0627\u0644\u0648\u062C\u0647",
'Sleeping face': "\u0627\u0644\u0646\u0648\u0645 \u0627\u0644\u0648\u062C\u0647",
'Dizzy face': "\u0648\u062C\u0647\u0627 \u0628\u0627\u0644\u062F\u0648\u0627\u0631",
'Face without mouth': "\u0648\u0627\u062C\u0647 \u062F\u0648\u0646 \u0627\u0644\u0641\u0645",
'Face with medical mask': "\u0648\u0627\u062C\u0647 \u0645\u0639 \u0642\u0646\u0627\u0639 \u0627\u0644\u0637\u0628\u064A\u0629",
// Line breaker
'Break': "\u0627\u0644\u0627\u0646\u0642\u0633\u0627\u0645",
// Math
'Subscript': "\u0645\u0646\u062E\u0641\u0636",
'Superscript': "\u062D\u0631\u0641 \u0641\u0648\u0642\u064A",
// Full screen
'Fullscreen': "\u0643\u0627\u0645\u0644 \u0627\u0644\u0634\u0627\u0634\u0629",
// Horizontal line
'Insert Horizontal Line': "\u0625\u062F\u0631\u0627\u062C \u062E\u0637 \u0623\u0641\u0642\u064A",
// Clear formatting
'Clear Formatting': "\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u062A\u0646\u0633\u064A\u0642",
// Save
'Save': "\u062D\u0641\u0638",
// Undo, redo
'Undo': "\u062A\u0631\u0627\u062C\u0639",
'Redo': "\u0625\u0639\u0627\u062F\u0629",
// Select all
'Select All': "\u062A\u062D\u062F\u064A\u062F \u0627\u0644\u0643\u0644",
// Code view
'Code View': "\u0639\u0631\u0636 \u0627\u0644\u062A\u0639\u0644\u064A\u0645\u0627\u062A \u0627\u0644\u0628\u0631\u0645\u062C\u064A\u0629",
// Quote
'Quote': "\u0627\u0642\u062A\u0628\u0633",
'Increase': "\u0632\u064A\u0627\u062F\u0629",
'Decrease': "\u0627\u0646\u062E\u0641\u0627\u0636",
// Quick Insert
'Quick Insert': "\u0625\u062F\u0631\u0627\u062C \u0633\u0631\u064A\u0639",
// Spcial Characters
'Special Characters': 'أحرف خاصة',
'Latin': 'لاتينية',
'Greek': 'الإغريقي',
'Cyrillic': 'السيريلية',
'Punctuation': 'علامات ترقيم',
'Currency': 'دقة',
'Arrows': 'السهام',
'Math': 'الرياضيات',
'Misc': 'متفرقات',
// Print.
'Print': 'طباعة',
// Spell Checker.
'Spell Checker': 'مدقق املائي',
// Help
'Help': 'مساعدة',
'Shortcuts': 'اختصارات',
'Inline Editor': 'محرر مضمنة',
'Show the editor': 'عرض المحرر',
'Common actions': 'الإجراءات المشتركة',
'Copy': 'نسخ',
'Cut': 'يقطع',
'Paste': 'معجون',
'Basic Formatting': 'التنسيق الأساسي',
'Increase quote level': 'زيادة مستوى الاقتباس',
'Decrease quote level': 'انخفاض مستوى الاقتباس',
'Image / Video': 'صورة / فيديو',
'Resize larger': 'تغيير حجم أكبر',
'Resize smaller': 'تغيير حجم أصغر',
'Table': 'الطاولة',
'Select table cell': 'حدد خلية الجدول',
'Extend selection one cell': 'توسيع اختيار خلية واحدة',
'Extend selection one row': 'تمديد اختيار صف واحد',
'Navigation': 'التنقل',
'Focus popup / toolbar': 'التركيز المنبثقة / شريط الأدوات',
'Return focus to previous position': 'عودة التركيز إلى الموقف السابق',
// Embed.ly
'Embed URL': 'تضمين عنوان ورل',
'Paste in a URL to embed': 'الصق في عنوان ورل لتضمينه',
// Word Paste.
'The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?': 'المحتوى الذي تم لصقه قادم من وثيقة كلمة ميكروسوفت. هل تريد الاحتفاظ بالتنسيق أو تنظيفه؟',
'Keep': 'احتفظ',
'Clean': 'نظيف',
'Word Paste Detected': 'تم اكتشاف معجون الكلمات',
// Character Counter
'Characters': 'الشخصيات',
// More Buttons
'More Text': 'المزيد من النص',
'More Paragraph': ' المزيد من الفقرة',
'More Rich': ' أكثر ثراء',
'More Misc': ' أكثر متفرقات'
},
direction: 'rtl'
};
})));
//# sourceMappingURL=ar.js.map
| cdnjs/cdnjs | ajax/libs/froala-editor/4.0.2/js/languages/ar.js | JavaScript | mit | 20,426 |
/*! `sml` grammar compiled for Highlight.js 11.4.0 */
(()=>{var e=(()=>{"use strict";return e=>({name:"SML (Standard ML)",
aliases:["ml"],keywords:{$pattern:"[a-z_]\\w*!?",
keyword:"abstype and andalso as case datatype do else end eqtype exception fn fun functor handle if in include infix infixr let local nonfix of op open orelse raise rec sharing sig signature struct structure then type val with withtype where while",
built_in:"array bool char exn int list option order real ref string substring vector unit word",
literal:"true false NONE SOME LESS EQUAL GREATER nil"},illegal:/\/\/|>>/,
contains:[{className:"literal",begin:/\[(\|\|)?\]|\(\)/,relevance:0
},e.COMMENT("\\(\\*","\\*\\)",{contains:["self"]}),{className:"symbol",
begin:"'[A-Za-z_](?!')[\\w']*"},{className:"type",begin:"`[A-Z][\\w']*"},{
className:"type",begin:"\\b[A-Z][\\w']*",relevance:0},{
begin:"[a-z_]\\w*'[\\w']*"},e.inherit(e.APOS_STRING_MODE,{className:"string",
relevance:0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number",
begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",
relevance:0},{begin:/[-=]>/}]})})();hljs.registerLanguage("sml",e)})(); | cdnjs/cdnjs | ajax/libs/highlight.js/11.4.0/languages/sml.min.js | JavaScript | mit | 1,225 |
import BaseSeries from"../../Core/Series/Series.js";BaseSeries.seriesType("zigzag","sma",{params:{lowIndex:2,highIndex:1,deviation:1}},{nameComponents:["deviation"],nameSuffixes:["%"],nameBase:"Zig Zag",getValues:function(e,s){var a,i,n,h,o,t,u,p=s.lowIndex,r=s.highIndex,g=s.deviation/100,d=1+g,m=1-g,f=e.xData,l=e.yData,v=l?l.length:0,x=[],S=[],D=[],I=!1,y=!1;if(!(!f||f.length<=1||v&&(void 0===l[0][p]||void 0===l[0][r]))){for(h=l[0][p],o=l[0][r],a=1;a<v;a++)l[a][p]<=o*m?(x.push([f[0],o]),n=[f[a],l[a][p]],t=!0,I=!0):l[a][r]>=h*d&&(x.push([f[0],h]),n=[f[a],l[a][r]],t=!1,I=!0),I&&(S.push(x[0][0]),D.push(x[0][1]),i=a++,a=v);for(a=i;a<v;a++)t?(l[a][p]<=n[1]&&(n=[f[a],l[a][p]]),l[a][r]>=n[1]*d&&(y=r)):(l[a][r]>=n[1]&&(n=[f[a],l[a][r]]),l[a][p]<=n[1]*m&&(y=p)),!1!==y&&(x.push(n),S.push(n[0]),D.push(n[1]),n=[f[a],l[a][y]],t=!t,y=!1);return 0!==(u=x.length)&&x[u-1][0]<f[v-1]&&(x.push(n),S.push(n[0]),D.push(n[1])),{values:x,xData:S,yData:D}}}}); | cdnjs/cdnjs | ajax/libs/highcharts/8.2.2/es-modules/Stock/Indicators/ZigzagIndicator.min.js | JavaScript | mit | 949 |
/*!
* bootstrap-fileinput v5.2.1
* http://plugins.krajee.com/file-input
*
* Font Awesome icon theme configuration for bootstrap-fileinput. Requires font awesome assets to be loaded.
*
* Author: Kartik Visweswaran
* Copyright: 2014 - 2021, Kartik Visweswaran, Krajee.com
*
* Licensed under the BSD-3-Clause
* https://github.com/kartik-v/bootstrap-fileinput/blob/master/LICENSE.md
*/
(function ($) {
"use strict";
$.fn.fileinputThemes.fa = {
fileActionSettings: {
removeIcon: '<i class="fa fa-trash"></i>',
uploadIcon: '<i class="fa fa-upload"></i>',
uploadRetryIcon: '<i class="fa fa-repeat"></i>',
downloadIcon: '<i class="fa fa-download"></i>',
zoomIcon: '<i class="fa fa-search-plus"></i>',
dragIcon: '<i class="fa fa-arrows"></i>',
indicatorNew: '<i class="fa fa-plus-circle text-warning"></i>',
indicatorSuccess: '<i class="fa fa-check-circle text-success"></i>',
indicatorError: '<i class="fa fa-exclamation-circle text-danger"></i>',
indicatorLoading: '<i class="fa fa-hourglass text-muted"></i>',
indicatorPaused: '<i class="fa fa-pause text-info"></i>'
},
layoutTemplates: {
fileIcon: '<i class="fa fa-file kv-caption-icon"></i> '
},
previewZoomButtonIcons: {
prev: '<i class="fa fa-caret-left fa-lg"></i>',
next: '<i class="fa fa-caret-right fa-lg"></i>',
toggleheader: '<i class="fa fa-fw fa-arrows-v"></i>',
fullscreen: '<i class="fa fa-fw fa-arrows-alt"></i>',
borderless: '<i class="fa fa-fw fa-external-link"></i>',
close: '<i class="fa fa-fw fa-remove"></i>'
},
previewFileIcon: '<i class="fa fa-file"></i>',
browseIcon: '<i class="fa fa-folder-open"></i>',
removeIcon: '<i class="fa fa-trash"></i>',
cancelIcon: '<i class="fa fa-ban"></i>',
pauseIcon: '<i class="fa fa-pause"></i>',
uploadIcon: '<i class="fa fa-upload"></i>',
msgValidationErrorIcon: '<i class="fa fa-exclamation-circle"></i> '
};
})(window.jQuery);
| cdnjs/cdnjs | ajax/libs/bootstrap-fileinput/5.2.1/themes/fa/theme.js | JavaScript | mit | 2,177 |
jsonp({"cep":"52091364","logradouro":"Rua Pirajui","bairro":"Nova Descoberta","cidade":"Recife","uf":"PE","estado":"Pernambuco"});
| lfreneda/cepdb | api/v1/52091364.jsonp.js | JavaScript | cc0-1.0 | 131 |
jsonp({"cep":"13273268","logradouro":"Rua Beja","bairro":"Jardim Portugal","cidade":"Valinhos","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/13273268.jsonp.js | JavaScript | cc0-1.0 | 134 |
jsonp({"cep":"08370220","logradouro":"Rua Lup\u00e9rcio de Souza Cortez","bairro":"Jardim S\u00e3o Jo\u00e3o (S\u00e3o Rafael)","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/08370220.jsonp.js | JavaScript | cc0-1.0 | 193 |
jsonp({"cep":"13144560","logradouro":"Rua Gildo Quaiatti","bairro":"Parque da Represa","cidade":"Paul\u00ednia","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/13144560.jsonp.js | JavaScript | cc0-1.0 | 151 |
jsonp({"cep":"73751119","logradouro":"Quadra 8 AE","bairro":"Setor Norte","cidade":"Planaltina de Goi\u00e1s","uf":"GO","estado":"Goi\u00e1s"});
| lfreneda/cepdb | api/v1/73751119.jsonp.js | JavaScript | cc0-1.0 | 145 |
jsonp({"cep":"45012596","logradouro":"Rua Quarenta e Tr\u00eas","bairro":"Primavera","cidade":"Vit\u00f3ria da Conquista","uf":"BA","estado":"Bahia"});
| lfreneda/cepdb | api/v1/45012596.jsonp.js | JavaScript | cc0-1.0 | 152 |
$('.main-heading').sticky();
$('.main-heading').on('sticky-start', function () {
$(this).css({
fontSize: '2rem',
background: '#ffa949',
marginTop: '0',
borderBottom: '3px solid black'
});
});
$('.main-heading').on('sticky-end', function () {
$(this).css({
fontSize: '5.625rem',
background: 'transparent',
border: 'none'
});
});
console.log("I am the new main.js file and also your father."); | margaretgodowns/gulp-practice | js/main.js | JavaScript | cc0-1.0 | 433 |
jsonp({"cep":"72669675","logradouro":"Condom\u00ednio Residencial Nova Bet\u00e2nia Quadra 16","bairro":"Recanto das Emas","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
| lfreneda/cepdb | api/v1/72669675.jsonp.js | JavaScript | cc0-1.0 | 189 |
jsonp({"cep":"78048228","logradouro":"Rua Seistan","bairro":"Jardim Bom Clima","cidade":"Cuiab\u00e1","uf":"MT","estado":"Mato Grosso"});
| lfreneda/cepdb | api/v1/78048228.jsonp.js | JavaScript | cc0-1.0 | 138 |
jsonp({"cep":"73802469","logradouro":"Via 3","bairro":"Setor Sul","cidade":"Formosa","uf":"GO","estado":"Goi\u00e1s"});
| lfreneda/cepdb | api/v1/73802469.jsonp.js | JavaScript | cc0-1.0 | 120 |
jsonp({"cep":"03646070","logradouro":"Pra\u00e7a S\u00e3o Gerv\u00e1sio","bairro":"Vila Esperan\u00e7a","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/03646070.jsonp.js | JavaScript | cc0-1.0 | 169 |
jsonp({"cep":"60120360","logradouro":"Vila Azal\u00e9ia","bairro":"S\u00e3o Jo\u00e3o do Tauape","cidade":"Fortaleza","uf":"CE","estado":"Cear\u00e1"});
| lfreneda/cepdb | api/v1/60120360.jsonp.js | JavaScript | cc0-1.0 | 153 |
jsonp({"cep":"08070150","logradouro":"Rua Robespierre de Melo","bairro":"Parque Cruzeiro do Sul","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/08070150.jsonp.js | JavaScript | cc0-1.0 | 162 |
jsonp({"cep":"80010110","logradouro":"Rua Desembargador Westphalen","bairro":"Centro","cidade":"Curitiba","uf":"PR","estado":"Paran\u00e1"});
| lfreneda/cepdb | api/v1/80010110.jsonp.js | JavaScript | cc0-1.0 | 142 |
jsonp({"cep":"09080500","logradouro":"Avenida Industrial","bairro":"Jardim","cidade":"Santo Andr\u00e9","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/09080500.jsonp.js | JavaScript | cc0-1.0 | 143 |
jsonp({"cep":"58059118","logradouro":"Rua Elisio Pereira de Paiva","bairro":"Mangabeira","cidade":"Jo\u00e3o Pessoa","uf":"PB","estado":"Para\u00edba"});
| lfreneda/cepdb | api/v1/58059118.jsonp.js | JavaScript | cc0-1.0 | 154 |
jsonp({"cep":"38181179","logradouro":"Avenida Doutor Pedro de Paula Lemos","bairro":"Micro Distrito Santa Rita","cidade":"Arax\u00e1","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/38181179.jsonp.js | JavaScript | cc0-1.0 | 171 |
jsonp({"cep":"88818345","logradouro":"Rua Ant\u00f4nio Marcello Gomes","bairro":"Catarinense","cidade":"Crici\u00fama","uf":"SC","estado":"Santa Catarina"});
| lfreneda/cepdb | api/v1/88818345.jsonp.js | JavaScript | cc0-1.0 | 158 |
jsonp({"cep":"29667000","cidade":"S\u00e3o Jacinto","uf":"ES","estado":"Esp\u00edrito Santo"});
| lfreneda/cepdb | api/v1/29667000.jsonp.js | JavaScript | cc0-1.0 | 96 |
jsonp({"cep":"74684275","logradouro":"Travessa Get\u00falio Cardoso dos Passos","bairro":"Residencial Vale dos Sonhos","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
| lfreneda/cepdb | api/v1/74684275.jsonp.js | JavaScript | cc0-1.0 | 178 |
jsonp({"cep":"27320030","logradouro":"Rua Sebasti\u00e3o Bonif\u00e1cio de Queiroz","bairro":"Vista Alegre","cidade":"Barra Mansa","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/27320030.jsonp.js | JavaScript | cc0-1.0 | 170 |
jsonp({"cep":"39803225","logradouro":"Rua das Violetas","bairro":"Solidariedade","cidade":"Te\u00f3filo Otoni","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/39803225.jsonp.js | JavaScript | cc0-1.0 | 148 |
jsonp({"cep":"03437060","logradouro":"Rua Maria In\u00e1cia da Concei\u00e7\u00e3o","bairro":"Vila Carr\u00e3o","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/03437060.jsonp.js | JavaScript | cc0-1.0 | 177 |
jsonp({"cep":"11495063","logradouro":"Travessa Manoel Quinto de Souza","bairro":"Morrinhos","cidade":"Guaruj\u00e1","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/11495063.jsonp.js | JavaScript | cc0-1.0 | 155 |
jsonp({"cep":"02762100","logradouro":"Rua Monsenhor Paulo Fernandes de Barros","bairro":"Jardim Cachoeira","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/02762100.jsonp.js | JavaScript | cc0-1.0 | 172 |
jsonp({"cep":"04506010","logradouro":"Rua Caracas","bairro":"Vila Nova Concei\u00e7\u00e3o","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/04506010.jsonp.js | JavaScript | cc0-1.0 | 157 |
jsonp({"cep":"64007340","logradouro":"Rua Y","bairro":"\u00c1gua Mineral","cidade":"Teresina","uf":"PI","estado":"Piau\u00ed"});
| lfreneda/cepdb | api/v1/64007340.jsonp.js | JavaScript | cc0-1.0 | 129 |
jsonp({"cep":"55299420","logradouro":"Rua das Telecomunica\u00e7\u00f5es","bairro":"Severiano Moraes Filho","cidade":"Garanhuns","uf":"PE","estado":"Pernambuco"});
| lfreneda/cepdb | api/v1/55299420.jsonp.js | JavaScript | cc0-1.0 | 164 |
jsonp({"cep":"72280650","logradouro":"Rua Rua 12","bairro":"Condom\u00ednio Priv\u00ea Lucena Roriz (Ceil\u00e2ndia)","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
| lfreneda/cepdb | api/v1/72280650.jsonp.js | JavaScript | cc0-1.0 | 184 |
jsonp({"cep":"06154210","logradouro":"Rua Marginal Esquerda","bairro":"Padroeira","cidade":"Osasco","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/06154210.jsonp.js | JavaScript | cc0-1.0 | 139 |
jsonp({"cep":"26587010","logradouro":"Travessa L\u00eddia","bairro":"Chatuba","cidade":"Mesquita","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/26587010.jsonp.js | JavaScript | cc0-1.0 | 137 |
jsonp({"cep":"79064040","logradouro":"Avenida Serra da Canastra","bairro":"Vila Cidade Morena","cidade":"Campo Grande","uf":"MS","estado":"Mato Grosso do Sul"});
| lfreneda/cepdb | api/v1/79064040.jsonp.js | JavaScript | cc0-1.0 | 162 |
jsonp({"cep":"68513753","logradouro":"Rua do Contorno","bairro":"S\u00e3o F\u00e9lix II","cidade":"Marab\u00e1","uf":"PA","estado":"Par\u00e1"});
| lfreneda/cepdb | api/v1/68513753.jsonp.js | JavaScript | cc0-1.0 | 146 |
jsonp({"cep":"08190030","logradouro":"Rua Api\u00fa-Quirib\u00f3","bairro":"Vila Aimor\u00e9","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/08190030.jsonp.js | JavaScript | cc0-1.0 | 159 |
jsonp({"cep":"22773516","logradouro":"Travessa Purim","bairro":"Cidade de Deus","cidade":"Rio de Janeiro","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/22773516.jsonp.js | JavaScript | cc0-1.0 | 145 |
jsonp({"cep":"05133080","logradouro":"Rua Raymundo Trajano de Vasconcelos","bairro":"Vila Mangalot","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/05133080.jsonp.js | JavaScript | cc0-1.0 | 165 |
jsonp({"cep":"65080390","logradouro":"Travessa da Saudade","bairro":"S\u00e1 Viana","cidade":"S\u00e3o Lu\u00eds","uf":"MA","estado":"Maranh\u00e3o"});
| lfreneda/cepdb | api/v1/65080390.jsonp.js | JavaScript | cc0-1.0 | 152 |
jsonp({"cep":"25651210","logradouro":"Rua L\u00edbano","bairro":"Quitandinha","cidade":"Petr\u00f3polis","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/25651210.jsonp.js | JavaScript | cc0-1.0 | 144 |
jsonp({"cep":"64605460","logradouro":"Quadra 04","bairro":"Parque Industrial","cidade":"Picos","uf":"PI","estado":"Piau\u00ed"});
| lfreneda/cepdb | api/v1/64605460.jsonp.js | JavaScript | cc0-1.0 | 130 |
jsonp({"cep":"17021620","logradouro":"Rua Dez","bairro":"Jardim Estrela D'Alva","cidade":"Bauru","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/17021620.jsonp.js | JavaScript | cc0-1.0 | 136 |
jsonp({"cep":"34545320","logradouro":"Rua S\u00e3o Braz","bairro":"Santo Ant\u00f4nio (Ro\u00e7a Grande)","cidade":"Sabar\u00e1","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/34545320.jsonp.js | JavaScript | cc0-1.0 | 166 |
jsonp({"cep":"14784099","logradouro":"Rua Rui Rocha","bairro":"Jardim Nova Barretos","cidade":"Barretos","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/14784099.jsonp.js | JavaScript | cc0-1.0 | 144 |
jsonp({"cep":"35300027","logradouro":"Vila Maria do Carmo Ribeiro","bairro":"Centro","cidade":"Caratinga","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/35300027.jsonp.js | JavaScript | cc0-1.0 | 143 |
jsonp({"cep":"29102680","logradouro":"Rua \u00c9rico Ver\u00edssimo","bairro":"Boa Vista I","cidade":"Vila Velha","uf":"ES","estado":"Esp\u00edrito Santo"});
| lfreneda/cepdb | api/v1/29102680.jsonp.js | JavaScript | cc0-1.0 | 158 |
jsonp({"cep":"73391103","logradouro":"Conjunto Conjunto A","bairro":"Condom\u00ednio Nosso Lar (Planaltina)","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
| lfreneda/cepdb | api/v1/73391103.jsonp.js | JavaScript | cc0-1.0 | 175 |
jsonp({"cep":"76908314","logradouro":"Rua Acre","bairro":"Jot\u00e3o","cidade":"Ji-Paran\u00e1","uf":"RO","estado":"Rond\u00f4nia"});
| lfreneda/cepdb | api/v1/76908314.jsonp.js | JavaScript | cc0-1.0 | 134 |
jsonp({"cep":"59621392","logradouro":"Rua Pastor Othoniel Marques Guedes","bairro":"Santo Ant\u00f4nio","cidade":"Mossor\u00f3","uf":"RN","estado":"Rio Grande do Norte"});
| lfreneda/cepdb | api/v1/59621392.jsonp.js | JavaScript | cc0-1.0 | 172 |
jsonp({"cep":"64075605","logradouro":"Rua Barrol\u00e2ndia","bairro":"Beira Rio","cidade":"Teresina","uf":"PI","estado":"Piau\u00ed"});
| lfreneda/cepdb | api/v1/64075605.jsonp.js | JavaScript | cc0-1.0 | 136 |
jsonp({"cep":"15502102","logradouro":"Rua Peru","bairro":"Vila Am\u00e9rica","cidade":"Votuporanga","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/15502102.jsonp.js | JavaScript | cc0-1.0 | 139 |
jsonp({"cep":"05187180","logradouro":"Rua Estev\u00e3o Gascon","bairro":"Jardim Ipanema (Zona Oeste)","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/05187180.jsonp.js | JavaScript | cc0-1.0 | 167 |
jsonp({"cep":"41205036","logradouro":"Travessa Diogo","bairro":"Tancredo Neves","cidade":"Salvador","uf":"BA","estado":"Bahia"});
| lfreneda/cepdb | api/v1/41205036.jsonp.js | JavaScript | cc0-1.0 | 130 |
jsonp({"cep":"26298354","logradouro":"Rua Pessegueiros","bairro":"Jardim Guandu","cidade":"Nova Igua\u00e7u","uf":"RJ","estado":"Rio de Janeiro"});
| lfreneda/cepdb | api/v1/26298354.jsonp.js | JavaScript | cc0-1.0 | 148 |
jsonp({"cep":"58703384","logradouro":"Rua An\u00e1lia Carvalho","bairro":"Morada do Sol","cidade":"Patos","uf":"PB","estado":"Para\u00edba"});
| lfreneda/cepdb | api/v1/58703384.jsonp.js | JavaScript | cc0-1.0 | 143 |
jsonp({"cep":"04411060","logradouro":"Rua Doutor Mulquem","bairro":"American\u00f3polis","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
| lfreneda/cepdb | api/v1/04411060.jsonp.js | JavaScript | cc0-1.0 | 154 |
jsonp({"cep":"38400400","logradouro":"Pra\u00e7a Elisa de Freitas Borges","bairro":"Oswaldo Rezende","cidade":"Uberl\u00e2ndia","uf":"MG","estado":"Minas Gerais"});
| lfreneda/cepdb | api/v1/38400400.jsonp.js | JavaScript | cc0-1.0 | 165 |
jsonp({"cep":"91160120","logradouro":"Rua G","bairro":"Rubem Berta","cidade":"Porto Alegre","uf":"RS","estado":"Rio Grande do Sul"});
| lfreneda/cepdb | api/v1/91160120.jsonp.js | JavaScript | cc0-1.0 | 134 |