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
|
---|---|---|---|---|---|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (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.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Ajax.org Code Editor (ACE).
*
* The Initial Developer of the Original Code is
* Ajax.org B.V.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Fabian Jakobs <fabian AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) {
var lang = require("pilot/lang");
var oop = require("pilot/oop");
var Range = require("ace/range").Range;
var Search = function() {
this.$options = {
needle: "",
backwards: false,
wrap: false,
caseSensitive: false,
wholeWord: false,
scope: Search.ALL,
regExp: false
};
};
Search.ALL = 1;
Search.SELECTION = 2;
(function() {
this.set = function(options) {
oop.mixin(this.$options, options);
return this;
};
this.getOptions = function() {
return lang.copyObject(this.$options);
};
this.find = function(session) {
if (!this.$options.needle)
return null;
if (this.$options.backwards) {
var iterator = this.$backwardMatchIterator(session);
} else {
iterator = this.$forwardMatchIterator(session);
}
var firstRange = null;
iterator.forEach(function(range) {
firstRange = range;
return true;
});
return firstRange;
};
this.findAll = function(session) {
if (!this.$options.needle)
return [];
if (this.$options.backwards) {
var iterator = this.$backwardMatchIterator(session);
} else {
iterator = this.$forwardMatchIterator(session);
}
var ranges = [];
iterator.forEach(function(range) {
ranges.push(range);
});
return ranges;
};
this.replace = function(input, replacement) {
var re = this.$assembleRegExp();
var match = re.exec(input);
if (match && match[0].length == input.length) {
if (this.$options.regExp) {
return input.replace(re, replacement);
} else {
return replacement;
}
} else {
return null;
}
};
this.$forwardMatchIterator = function(session) {
var re = this.$assembleRegExp();
var self = this;
return {
forEach: function(callback) {
self.$forwardLineIterator(session).forEach(function(line, startIndex, row) {
if (startIndex) {
line = line.substring(startIndex);
}
var matches = [];
line.replace(re, function(str) {
var offset = arguments[arguments.length-2];
matches.push({
str: str,
offset: startIndex + offset
});
return str;
});
for (var i=0; i<matches.length; i++) {
var match = matches[i];
var range = self.$rangeFromMatch(row, match.offset, match.str.length);
if (callback(range))
return true;
}
});
}
};
};
this.$backwardMatchIterator = function(session) {
var re = this.$assembleRegExp();
var self = this;
return {
forEach: function(callback) {
self.$backwardLineIterator(session).forEach(function(line, startIndex, row) {
if (startIndex) {
line = line.substring(startIndex);
}
var matches = [];
line.replace(re, function(str, offset) {
matches.push({
str: str,
offset: startIndex + offset
});
return str;
});
for (var i=matches.length-1; i>= 0; i--) {
var match = matches[i];
var range = self.$rangeFromMatch(row, match.offset, match.str.length);
if (callback(range))
return true;
}
});
}
};
};
this.$rangeFromMatch = function(row, column, length) {
return new Range(row, column, row, column+length);
};
this.$assembleRegExp = function() {
if (this.$options.regExp) {
var needle = this.$options.needle;
} else {
needle = lang.escapeRegExp(this.$options.needle);
}
if (this.$options.wholeWord) {
needle = "\\b" + needle + "\\b";
}
var modifier = "g";
if (!this.$options.caseSensitive) {
modifier += "i";
}
var re = new RegExp(needle, modifier);
return re;
};
this.$forwardLineIterator = function(session) {
var searchSelection = this.$options.scope == Search.SELECTION;
var range = session.getSelection().getRange();
var start = session.getSelection().getCursor();
var firstRow = searchSelection ? range.start.row : 0;
var firstColumn = searchSelection ? range.start.column : 0;
var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
var wrap = this.$options.wrap;
function getLine(row) {
var line = session.getLine(row);
if (searchSelection && row == range.end.row) {
line = line.substring(0, range.end.column);
}
return line;
}
return {
forEach: function(callback) {
var row = start.row;
var line = getLine(row);
var startIndex = start.column;
var stop = false;
while (!callback(line, startIndex, row)) {
if (stop) {
return;
}
row++;
startIndex = 0;
if (row > lastRow) {
if (wrap) {
row = firstRow;
startIndex = firstColumn;
} else {
return;
}
}
if (row == start.row)
stop = true;
line = getLine(row);
}
}
};
};
this.$backwardLineIterator = function(session) {
var searchSelection = this.$options.scope == Search.SELECTION;
var range = session.getSelection().getRange();
var start = searchSelection ? range.end : range.start;
var firstRow = searchSelection ? range.start.row : 0;
var firstColumn = searchSelection ? range.start.column : 0;
var lastRow = searchSelection ? range.end.row : session.getLength() - 1;
var wrap = this.$options.wrap;
return {
forEach : function(callback) {
var row = start.row;
var line = session.getLine(row).substring(0, start.column);
var startIndex = 0;
var stop = false;
while (!callback(line, startIndex, row)) {
if (stop)
return;
row--;
startIndex = 0;
if (row < firstRow) {
if (wrap) {
row = lastRow;
} else {
return;
}
}
if (row == start.row)
stop = true;
line = session.getLine(row);
if (searchSelection) {
if (row == firstRow)
startIndex = firstColumn;
else if (row == lastRow)
line = line.substring(0, range.end.column);
}
}
}
};
};
}).call(Search.prototype);
exports.Search = Search;
});
| reidab/icecondor-server-rails | public/javascripts/ace/ace/search.js | JavaScript | agpl-3.0 | 9,844 |
/**
* Based conceptually on the _.extend() function in underscore.js ( see http://documentcloud.github.com/underscore/#extend for more details )
* Copyright (C) 2012 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
**/
var _ = require('underscore');
deepExtend = function(obj) {
var parentRE = /#{\s*?_\s*?}/,
slice = Array.prototype.slice,
hasOwnProperty = Object.prototype.hasOwnProperty;
_.each(slice.call(arguments, 1), function(source) {
for (var prop in source) {
if (hasOwnProperty.call(source, prop)) {
if (_.isUndefined(obj[prop]) || _.isFunction(obj[prop]) || _.isNull(source[prop])) {
obj[prop] = source[prop];
}
else if (_.isString(source[prop]) && parentRE.test(source[prop])) {
if (_.isString(obj[prop])) {
obj[prop] = source[prop].replace(parentRE, obj[prop]);
}
}
else if (_.isArray(obj[prop]) || _.isArray(source[prop])){
if (!_.isArray(obj[prop]) || !_.isArray(source[prop])){
throw 'Error: Trying to combine an array with a non-array (' + prop + ')';
} else {
obj[prop] = _.reject(_.deepExtend(obj[prop], source[prop]), function (item) { return _.isNull(item);});
}
}
else if (_.isObject(obj[prop]) || _.isObject(source[prop])){
if (!_.isObject(obj[prop]) || !_.isObject(source[prop])){
throw 'Error: Trying to combine an object with a non-object (' + prop + ')';
} else {
obj[prop] = _.deepExtend(obj[prop], source[prop]);
}
} else {
obj[prop] = source[prop];
}
}
}
});
return obj;
};
exports.deepExtend = deepExtend;
| 4poc/anpaste | app/lib/deep_extend_underscore_mixin.js | JavaScript | agpl-3.0 | 2,385 |
import CodeClipboard from './CodeClipboard';
export default CodeClipboard; | StarterInc/Ignite | src/docs/src/components/CodeClipboard/index.js | JavaScript | agpl-3.0 | 75 |
const { Array } = require.main.require('./Tag/Classes');
class GetTag extends Array {
constructor(client) {
super(client, {
name: 'get',
args: [
{
name: 'array'
}, {
name: 'index'
}
],
minArgs: 2, maxArgs: 2
});
}
async execute(ctx, args) {
const res = await super.execute(ctx, args, true);
args = args.parsedArgs;
let arr = await this.loadArray(ctx, args.array);
let index = this.parseInt(args.index, 'index');
return res.setContent(arr[index]);
}
get implicit() { return false; }
}
module.exports = GetTag; | Ratismal/blargbot | Production/Tags/Array/Get.js | JavaScript | agpl-3.0 | 619 |
/*
This file is part of the Juju GUI, which lets users view and manage Juju
environments within a graphical interface (https://launchpad.net/juju-gui).
Copyright (C) 2012-2013 Canonical Ltd.
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU Affero General Public License version 3, as published by
the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
General Public License for more details.
You should have received a copy of the GNU Affero General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
'use strict';
(function() {
describe('Browser charm view', function() {
var container, CharmView, cleanIconHelper, factory, models, node, utils,
view, views, Y, testContainer;
before(function(done) {
Y = YUI(GlobalConfig).use(
'datatype-date',
'datatype-date-format',
'charmstore-api',
'json-stringify',
'juju-charm-models',
'juju-tests-utils',
'juju-tests-factory',
'node',
'node-event-simulate',
'subapp-browser-charmview',
function(Y) {
views = Y.namespace('juju.browser.views');
models = Y.namespace('juju.models');
utils = Y.namespace('juju-tests.utils');
factory = Y.namespace('juju-tests.factory');
CharmView = views.BrowserCharmView;
cleanIconHelper = utils.stubCharmIconPath();
done();
});
});
beforeEach(function() {
window.flags = {};
container = utils.makeContainer(this, 'container');
var testcontent = [
'<div id=testcontent><div class="bws-view-data">',
'</div></div>'
].join();
Y.Node.create(testcontent).appendTo(container);
// Mock out a dummy location for the Store used in view instances.
window.juju_config = {
charmworldURL: 'http://localhost'
};
node = Y.one('#testcontent');
});
afterEach(function() {
window.flags = {};
if (view) {
view.destroy();
}
if (testContainer) {
testContainer.remove(true);
}
node.remove(true);
delete window.juju_config;
container.remove(true);
});
after(function() {
cleanIconHelper();
});
it('renders for inspector mode correctly', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
entity: new models.Charm(data),
container: utils.makeContainer(this),
forInspector: true
});
view.render();
assert.isNull(view.get('container').one('.heading'));
// There is no 'related charms' tab to display.
assert.equal(view.get('container').all('.related-charms').size(), 0);
});
// Return the charm heading node included in the charm detail view.
var makeHeading = function(context, is_subordinate) {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
data.is_subordinate = is_subordinate;
utils.makeContainer(context);
view = new CharmView({
entity: new models.Charm(data),
container: utils.makeContainer(context)
});
view.render();
var heading = view.get('container').one('.header');
assert.isNotNull(heading);
return heading;
};
it('avoids showing the subordinate message for non-subordinate charms',
function() {
var heading = makeHeading(this, false);
assert.notInclude(heading.getContent(), 'Subordinate charm');
});
it('shows the subordinate message if the charm is a subordinate',
function() {
var heading = makeHeading(this, true);
assert.include(heading.getContent(), 'Subordinate charm');
});
it('renders local charms for inspector mode correctly', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
data.url = 'local:precise/apache2-10';
var charm = new models.Charm(data);
charm.set('scheme', 'local');
view = new CharmView({
entity: charm,
container: utils.makeContainer(this),
forInspector: true
});
view.render();
assert.isNull(view.get('container').one('.heading'));
assert.isNull(view.get('container').one('#readme'));
assert.isNull(view.get('container').one('#configuration'));
assert.isNull(view.get('container').one('#code'));
assert.isNull(view.get('container').one('#features'));
});
it('has sharing links', function() {
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install',
'readme.rst'
],
id: 'precise/wordpress',
code_source: { location: 'lp:~foo'}
}),
container: utils.makeContainer(this),
charmstore: factory.makeFakeCharmstore()
});
view.render();
var links = container.all('#sharing a');
assert.equal(links.size(), 3);
});
it('should be able to locate a readme file', function() {
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install',
'readme.rst'
],
id: 'precise/ceph-9',
code_source: { location: 'lp:~foo' }
})
});
view._locateReadme().should.eql('readme.rst');
// Matches for caps as well.
view.get('entity').set('files', [
'hooks/install',
'README.md'
]);
view._locateReadme().should.eql('README.md');
});
it('can generate source, bug, and revno links from its charm', function() {
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install',
'readme.rst'
],
id: 'precise/ceph-9',
name: 'ceph',
code_source: { location: 'lp:~foo'}
})
});
var url = view._getSourceLink(
view.get('entity').get('code_source').location);
assert.equal('http://bazaar.launchpad.net/~foo/files', url);
assert.equal(
'http://bazaar.launchpad.net/~foo/revision/1',
view._getRevnoLink(url, 1));
assert.equal(
'https://bugs.launchpad.net/charms/+source/ceph',
view._getBugLink(view.get('entity').get('name')));
});
it('excludes source svg files from the source tab', function() {
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install',
'icon.svg',
'readme.rst'
],
id: 'precise/ceph-9',
code_source: { location: 'lp:~foo'}
}),
container: utils.makeContainer(this)
});
view.render();
var options = Y.one('#code').all('select option');
assert.equal(options.size(), 3);
assert.deepEqual(
options.get('text'),
['Select --', 'readme.rst', 'hooks/install']);
});
it('can generate useful display data for commits', function() {
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install',
'readme.rst'
],
id: 'precise/ceph-9',
code_source: {
location: 'lp:~foo'
}
})
});
var revisions = [
{
authors: [{
email: '[email protected]',
name: 'John Doe'
}],
date: '2013-05-02T10:05:32Z',
message: 'The fnord had too much fleem.',
revno: 1
},
{
authors: [{
email: '[email protected]',
name: 'John Doe'
}],
date: '2013-05-02T10:05:45Z',
message: 'Fnord needed more fleem.',
revno: 2
}
];
var url = view._getSourceLink(
view.get('entity').get('code_source').location);
var commits = view._formatCommitsForHtml(revisions, url);
assert.equal(
'http://bazaar.launchpad.net/~foo/revision/1',
commits.first.revnoLink);
assert.equal(
'http://bazaar.launchpad.net/~foo/revision/2',
commits.remaining[0].revnoLink);
});
it('should be able to display the readme content', function() {
view = new CharmView({
activeTab: '#readme',
entity: new models.Charm({
files: [
'hooks/install',
'readme.rst'
],
id: 'precise/ceph-9',
code_source: { location: 'lp:~foo'}
}),
container: utils.makeContainer(this),
charmstore: {
getFile: function(url, filename, success, failure) {
success({
target: {
responseText: 'README content.'
}
});
}
}
});
view.render();
Y.one('#readme').get('text').should.eql('README content.');
});
// EVENTS
it('should catch when the add control is clicked', function(done) {
view = new CharmView({
activeTab: '#readme',
entity: new models.Charm({
files: [
'hooks/install'
],
id: 'precise/ceph-9',
code_source: { location: 'lp:~foo' }
}),
container: utils.makeContainer(this)
});
// Hook up to the callback for the click event.
view._addCharmEnvironment = function(ev) {
ev.halt();
Y.one('#readme h3').get('text').should.eql('Charm has no README');
done();
};
view.render();
node.one('.charm .add').simulate('click');
});
it('_addCharmEnvironment displays the config panel', function(done) {
var fakeStore = new Y.juju.charmstore.APIv4({
charmstoreURL: 'localhost/'
});
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install'
],
id: 'precise/ceph-9',
url: 'cs:precise/ceph-9',
code_source: { location: 'lp:~foo' },
options: {
configName: 'test'
}
}),
container: utils.makeContainer(this),
charmstore: fakeStore
});
var fireStub = utils.makeStubMethod(view, 'fire');
this._cleanups.push(fireStub.reset);
view.set('deployService', function(charm, serviceAttrs) {
var serviceCharm = view.get('entity');
assert.deepEqual(charm, serviceCharm);
assert.equal(charm.get('id'), 'cs:precise/ceph-9');
assert.equal(serviceAttrs.icon, 'localhost/v4/precise/ceph-9/icon.svg');
assert.equal(fireStub.calledOnce(), true);
var fireArgs = fireStub.lastArguments();
assert.equal(fireArgs[0], 'changeState');
assert.deepEqual(fireArgs[1], {
sectionA: {
component: 'charmbrowser',
metadata: {
id: null }}});
done();
});
view._addCharmEnvironment({halt: function() {}});
});
it('should load a file when a hook is selected', function() {
view = new CharmView({
entity: new models.Charm({
files: [
'hooks/install',
'readme.rst'
],
id: 'precise/ceph-9',
code_source: { location: 'lp:~foo' }
}),
container: utils.makeContainer(this),
charmstore: {
getFile: function(url, filename, success, failure) {
success({
target: {
responseText: '<install hook content>'
}
});
}
}
});
view.render();
Y.one('#code').all('select option').size().should.equal(3);
// Select the hooks install and the content should update.
Y.one('#code').all('select option').item(2).set(
'selected', 'selected');
Y.one('#code').one('select').simulate('change');
var content = Y.one('#code').one('div.filecontent');
// Content is escaped, so we read it out as text, not tags.
content.get('text').should.eql('<install hook content>');
});
it('should be able to render markdown as html', function() {
view = new CharmView({
activeTab: '#readme',
entity: new models.Charm({
files: [
'readme.md'
],
id: 'precise/wordpress-9',
code_source: { location: 'lp:~foo' }
}),
container: utils.makeContainer(this),
charmstore: {
getFile: function(url, filename, success, failure) {
success({
target: {
responseText: 'README Header\n============='
}
});
}
}
});
view.render();
Y.one('#readme').get('innerHTML').should.eql(
'<h1>README Header</h1>');
});
it('should display the config data in the config tab', function() {
view = new CharmView({
entity: new models.Charm({
files: [],
id: 'precise/ceph-9',
code_source: { location: 'lp:~foo' },
options: {
'client-port': {
'default': 9160,
'description': 'Port for client communcation',
'type': 'int'
}
}
}),
container: utils.makeContainer(this)
});
view.render();
Y.one('#configuration dd div').get('text').should.eql(
'Default: 9160');
Y.one('#configuration dd p').get('text').should.eql(
'Port for client communcation');
});
it('should catch when the open log is clicked', function(done) {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
entity: new models.Charm(data),
container: utils.makeContainer(this)
});
// Hook up to the callback for the click event.
view._toggleLog = function(ev) {
ev.halt();
done();
};
view.render();
node.one('.changelog .expand').simulate('click');
});
it('changelog is reformatted and displayed', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
entity: new models.Charm(data),
container: utils.makeContainer(this)
});
view.render();
// Basics that we have the right number of nodes.
node.all('.remaining li').size().should.eql(9);
node.all('.first p').size().should.eql(1);
// The reminaing starts out hidden.
assert(node.one('.changelog .remaining').hasClass('hidden'));
});
it('_getInterfaceIntroFlag sets the flag for no requires, no provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
},
'requires': {
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'noRequiresNoProvides'));
});
it('_getInterfaceIntroFlag sets the flag for no requires, 1 provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
'foo': {}
},
'requires': {
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'noRequiresOneProvides'));
});
it('_getInterfaceIntroFlag sets the flag for no requires, many provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
'foo': {},
'two': {}
},
'requires': {
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'noRequiresManyProvides'));
});
it('_getInterfaceIntroFlag sets the flag for 1 requires, no provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
},
'requires': {
'foo': {}
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'oneRequiresNoProvides'));
});
it('_getInterfaceIntroFlag sets the flag for 1 requires, 1 provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
'foo': {}
},
'requires': {
'foo': {}
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'oneRequiresOneProvides'));
});
it('_getInterfaceIntroFlag sets the flag for 1 requires, many provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
'foo': {},
'two': {}
},
'requires': {
'foo': {}
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'oneRequiresManyProvides'));
});
it('_getInterfaceIntroFlag sets the flag for many requires, no provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
},
'requires': {
'foo': {},
'two': {}
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'manyRequiresNoProvides'));
});
it('_getInterfaceIntroFlag sets the flag for many requires, 1 provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
'foo': {}
},
'requires': {
'foo': {},
'two': {}
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'manyRequiresOneProvides'));
});
it('_getInterfaceIntroFlag sets the flag for many requires, many provides',
function() {
var charm = new models.Charm({
files: [],
id: 'precise/ceph-9',
relations: {
'provides': {
'foo': {},
'two': {}
},
'requires': {
'foo': {},
'two': {}
}
}
});
view = new CharmView({
entity: charm
});
var interfaceIntro = view._getInterfaceIntroFlag(
charm.get('requires'), charm.get('provides'));
assert(Y.Object.hasKey(interfaceIntro, 'manyRequiresManyProvides'));
});
it('shows and hides an indicator', function(done) {
var hit = 0;
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
entity: new models.Charm(data),
container: utils.makeContainer(this)
});
view.showIndicator = function() {
hit += 1;
};
view.hideIndicator = function() {
hit += 1;
hit.should.equal(2);
done();
};
view.render();
});
it('selects the proper tab when given one', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
activeTab: '#configuration',
entity: new models.Charm(data),
container: utils.makeContainer(this)
});
view.render();
// We've selected the activeTab specified.
var selected = view.get('container').one('nav .active');
assert.equal(selected.getAttribute('href'), '#configuration');
});
it('sets the proper change request when closed', function(done) {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
activeTab: '#configuration',
entity: new models.Charm(data),
container: utils.makeContainer(this)
});
view.on('changeState', function(ev) {
assert.equal(ev.details[0].sectionA.metadata.id, null,
'The charm id is not set to null.');
assert.equal(ev.details[0].sectionA.metadata.hash, null,
'The charm details hash is not set to null.');
done();
});
view.render();
view.get('container').one('.charm .back').simulate('click');
});
it('renders related charms when interface tab selected', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
testContainer = utils.makeContainer(this);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
activeTab: '#related-charms',
entity: new models.Charm(data),
renderTo: testContainer
});
view.render();
assert.equal(
testContainer.all('#related-charms .token').size(),
18);
assert.equal(view.get('entity').get('id'), 'cs:precise/apache2-27');
assert.isTrue(view.loadedRelatedInterfaceCharms);
});
it('ignore invalid tab selections', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
testContainer = utils.makeContainer(this);
// We don't want any files so we don't have to mock/load them.
data.files = [];
var fakeStore = factory.makeFakeCharmstore();
view = new CharmView({
activeTab: '#bws-does-not-exist',
entity: new models.Charm(data),
renderTo: testContainer,
charmstore: fakeStore
});
view.render();
assert.equal(
testContainer.one('nav .active').getAttribute('href'),
'#summary');
});
it('should open header links in a new tab', function() {
var data = utils.loadFixture('data/browsercharm.json', true);
// We don't want any files so we don't have to mock/load them.
data.files = [];
view = new CharmView({
entity: new models.Charm(data),
container: utils.makeContainer(this)
});
view.render();
var links = view.get('container').all('.header .details li a');
// Check that we've found the links, otherwise the assert in .each will
// succeed when there are no links.
assert.equal(links.size() > 0, true);
links.each(function(link) {
assert.equal(link.getAttribute('target'), '_blank');
});
});
});
})();
| jrwren/juju-gui | test/test_browser_charm_details.js | JavaScript | agpl-3.0 | 25,436 |
/**
* BLOCK: blocks
*
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
*/
import "./editor.scss";
import "./style.scss";
import React from "react";
import Select from "react-select";
const {
PanelBody,
PanelRow,
ServerSideRender,
TextControl,
SelectControl
} = wp.components;
var el = wp.element.createElement;
const { InspectorControls } = wp.editor;
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
/**
* Register: aa Gutenberg Block.
*
* Registers a new block provided a unique name and an object defining its
* behavior. Once registered, the block is made editor as an option to any
* editor interface where blocks are implemented.
*
* @link https://wordpress.org/gutenberg/handbook/block-api/
* @param {string} name Block name.
* @param {Object} settings Block settings.
* @return {?WPBlock} The block, if it has been successfully
* registered; otherwise `undefined`.
*/
registerBlockType("bos/badgeos-evidence-block", {
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
title: __("Evidence - block"), // Block title.
icon: "shield", // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
category: "badgeos-blocks", // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
keywords: [
__("Evidence - block"),
__("block"),
__("Evidence")
],
supports: {
// Turn off ability to edit HTML of block content
html: false,
// Turn off reusable block feature
reusable: false,
// Add alignwide and alignfull options
align: false
},
attributes: {
achievement: {
type: "string",
default: ""
},
user_id: {
type: "string",
default: ""
},
award_id: {
type: "string",
default: ""
},
},
/**
* The edit function describes the structure of your block in the context of the editor.
* This represents what the editor will render when the block is used.
*
* The "edit" property must be a valid function.
*
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
*
* @param {Object} props Props.
* @returns {Mixed} JSX Component.
*/
edit: props => {
const {
attributes: {
achievement,
user_id,
award_id,
},
setAttributes
} = props;
let achievements_list = [];
let entries = [];
let user_lists = [];
wp.apiFetch({ path: `badgeos/block-achievements-award-list/0/0`, method: 'GET' }).then(posts =>
posts.map(function (post) {
console.log(post);
entries.push(post);
})
);
wp.apiFetch({ path: "badgeos/achievements" }).then(posts =>
posts.map(function (post) {
achievements_list.push(post);
})
);
wp.apiFetch({ path: "badgeos/user-lists" }).then(posts =>
posts.map(function (post) {
user_lists.push(post);
})
);
let selectedAwardId = [];
if (null !== award_id && award_id != "") {
selectedAwardId = JSON.parse(award_id);
}
function handleAwardChange(award_id) {
props.setAttributes({ award_id: JSON.stringify(award_id) });
}
function loadawardids() {
entries = [];
var achievement_val = 0;
if (achievement) {
var achievement_array = JSON.parse(achievement)
achievement_val = achievement_array.value;
}
var user_id_val = 0;
if (user_id) {
var user_array = JSON.parse(user_id);
user_id_val = user_array.value;
}
wp.apiFetch({ path: "badgeos/block-achievements-award-list/" + achievement_val + "/" + user_id_val + "", method: 'GET' }).then(posts =>
posts.map(function (post) {
entries.push(post);
})
);
}
let selectedUser = [];
if (null !== user_id && user_id != "") {
selectedUser = JSON.parse(user_id);
}
function handleUserChange(user_id) {
props.setAttributes({ user_id: JSON.stringify(user_id) });
loadawardids();
}
let selectedAchievement = [];
if (null !== achievement && achievement != "") {
selectedAchievement = JSON.parse(achievement);
}
function handleAchievementChange(achievement_val) {
props.setAttributes({
achievement: JSON.stringify(achievement_val)
});
loadawardids();
}
// Creates a <p class='wp-block-bos-block-blocks'></p>.
return [
el("div", {
className: "badgeos-editor-container",
style: { textAlign: "center" }
},
el(ServerSideRender, {
block: 'bos/badgeos-evidence-block',
attributes: props.attributes
})
),
<InspectorControls>
<PanelBody
title={__("Achievement", "badgeos")}
className="bos-block-inspector"
>
<PanelRow>
<label
htmlFor="bos-block-roles"
className="bos-block-inspector__label"
>
{__("Achievement", "badgeos")}
</label>
</PanelRow>
<PanelRow>
<Select
className="bos-block-inspector__control"
name="bos-achievement-types"
value={selectedAchievement}
onChange={handleAchievementChange}
options={achievements_list}
menuPlacement="auto"
/>
</PanelRow>
<PanelRow>
<label
htmlFor="bos-block-roles"
className="bos-block-inspector__label"
>
{__("User", "badgeos")}
</label>
</PanelRow>
<PanelRow>
<Select
className="bos-block-inspector__control"
name="bos-achievement-types"
value={selectedUser}
onChange={handleUserChange}
options={user_lists}
menuPlacement="auto"
/>
</PanelRow>
<PanelRow>
<label
htmlFor="bos-block-roles"
className="bos-block-inspector__label"
>
{__("Award Id", "badgeos")}
</label>
</PanelRow>
<PanelRow>
<Select
className="bos-block-inspector__control"
name="bos-achievement-types"
value={selectedAwardId}
onChange={handleAwardChange}
options={entries}
menuPlacement="auto"
/>
</PanelRow>
</PanelBody>
</InspectorControls>
];
},
/**
* The save function defines the way in which the different attributes should be combined
* into the final markup, which is then serialized by Gutenberg into post_content.
*
* The "save" property must be specified and must be a valid function.
*
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
*
* @param {Object} props Props.
* @returns {Mixed} JSX Frontend HTML.
*/
save: props => {
return <div>Content</div>;
}
});
| opencredit/badgeos | includes/blocks/src/evidence-block/block.js | JavaScript | agpl-3.0 | 6,640 |
/**
* @ngdoc service
* @name ftepApp.SubscriptionService
* @description
* # SubscriptionService
* Service for subscriptions.
*/
'use strict';
define(['../ftepmodules', 'traversonHal'], function (ftepmodules, TraversonJsonHalAdapter) {
ftepmodules.service('SubscriptionService', [ 'ftepProperties', '$q', 'traverson', function (ftepProperties, $q, traverson) {
var self = this;
traverson.registerMediaType(TraversonJsonHalAdapter.mediaType, TraversonJsonHalAdapter);
var rootUri = ftepProperties.URLv2;
var halAPI = traverson.from(rootUri).jsonHal().useAngularHttp();
var deleteAPI = traverson.from(rootUri).useAngularHttp();
this.getUserSubscriptions = function(user) {
var deferred = $q.defer();
halAPI.from(rootUri + '/subscriptions/search/findByOwner?owner=' + user._links.self.href)
.newRequest()
.getResource()
.result
.then(
function(document) {
deferred.resolve(document);
}, function(error) {
MessageService.addError('Failed to get subscriptions for user ' + user.name, error);
deferred.reject();
});
return deferred.promise;
};
this.updateSubscription = function(subscription) {
var patchedSubscription = {
packageName: subscription.packageName,
storageQuota: subscription.storageQuota,
processingQuota: subscription.processingQuota,
subscriptionStart: subscription.subscriptionStart,
subscriptionEnd: subscription.subscriptionEnd,
commentText: subscription.commentText
};
var deferred = $q.defer();
halAPI.from(rootUri + '/subscriptions/' + subscription.id)
.newRequest()
.patch(patchedSubscription)
.result
.then(
function(document) {
deferred.resolve(document);
}, function(error) {
MessageService.addError('Failed to update subscription ' + subscription.id, error);
deferred.reject();
});
return deferred.promise;
};
this.createSubscription = function(subscription, subscriptionOwner, subscriptionCreator) {
var newSubscription = {
owner: subscriptionOwner._links.self.href,
packageName: subscription.packageName,
storageQuota: subscription.storageQuota,
processingQuota: subscription.processingQuota,
subscriptionStart: subscription.subscriptionStart,
subscriptionEnd: subscription.subscriptionEnd,
commentText: subscription.commentText,
creator: subscriptionCreator._links.self.href
};
var deferred = $q.defer();
halAPI.from(rootUri + '/subscriptions')
.newRequest()
.post(newSubscription)
.result
.then(
function(document) {
deferred.resolve(document);
}, function(error) {
MessageService.addError('Failed to update subscription ' + subscription.id, error);
deferred.reject();
});
return deferred.promise;
};
this.deleteSubscription = function(subscription) {
var deferred = $q.defer();
deleteAPI.from(rootUri + '/subscriptions/' + subscription.id)
.newRequest()
.delete()
.result
.then(
function(document) {
if (200 <= document.status && document.status < 300) {
deferred.resolve(document);
} else {
MessageService.addError('Failed to delete subscription ' + subscription.id, error);
deferred.reject();
}
}, function(error) {
MessageService.addError('Failed to delete subscription ' + subscription.id, error);
deferred.reject();
});
return deferred.promise;
};
this.cancelSubscription = function(subscription) {
var deferred = $q.defer();
halAPI.from(rootUri + '/subscriptions/' + subscription.id + "/cancel")
.newRequest()
.post()
.result
.then(
function(document) {
deferred.resolve(document);
}, function(error) {
MessageService.addError('Failed to cancel subscription ' + subscription.id, error);
deferred.reject();
});
return deferred.promise;
};
return this;
}]);
});
| cgi-eoss/ftep | f-tep-portal/src/main/resources/app/scripts/services/subscriptionservice.js | JavaScript | agpl-3.0 | 4,930 |
var request = require("request");
var yaml = require("js-yaml");
var jsonfile = require("jsonfile");
request("https://raw.githubusercontent.com/unitedstates/congress-legislators/master/legislators-current.yaml", function(error, response, body) {
if (!error && response.statusCode == 200) {
var legislators = yaml.safeLoad(body);
legislators = legislators.map(function(legislator) {
var term = legislator.terms[legislator.terms.length-1];
return {
firstName: legislator.name.first,
lastName: legislator.name.last,
bioguideId: legislator.id.bioguide,
chamber: term.type == "rep" ? "house" : "senate",
title: term.type == "rep" ? "Rep" : "Sen",
state: term.state,
district: typeof term.district == "undefined" ? null : term.district.toString()
};
});
jsonfile.writeFileSync("congress.json", legislators, { spaces: 2 });
} else if (error) {
console.error("Failed to fetch legislators-current.yaml", error);
} else {
console.error("Failed to fetch legislators-current.yaml",
"("+response.statusCode+" "+response.statusMessage+")");
}
});
| EdenSG/democracy.io | bin/update-congress.js | JavaScript | agpl-3.0 | 1,161 |
/**
* Nooku Framework - http://www.nooku.org
*
* @copyright Copyright (C) 2011 - 2017 Johan Janssens and Timble CVBA. (http://www.timble.net)
* @license GNU AGPLv3 <https://www.gnu.org/licenses/agpl.html>
* @link https://github.com/timble/openpolice-platform
*/
if(!Ckeditor) var Ckeditor = {};
Ckeditor.Files = new Class({
Extends: Files.App,
Implements: [Events, Options],
options: {
types: ['file', 'image'],
editor: null,
preview: 'files-preview',
grid: {
cookie: false,
layout: 'compact',
batch_delete: false
},
history: {
enabled: false
}
},
initialize: function(options) {
this.parent(options);
this.editor = this.options.editor;
this.preview = document.id(this.options.preview);
},
setPaginator: function() {
},
setPathway: function() {
},
setState: function() {
// TODO: Implement pagination into the view
this.fireEvent('beforeSetState');
var opts = this.options.state;
this.state = new Files.State(opts);
this.fireEvent('afterSetState');
},
setGrid: function() {
var opts = this.options.grid;
var that = this;
$extend(opts, {
'onClickImage': function(e) {
that.setPreview(document.id(e.target), 'image');
},
'onClickFile': function(e) {
that.setPreview(document.id(e.target), 'file');
}
});
this.grid = new Files.Grid(this.options.grid.element, opts);
},
setPreview: function(target, type) {
var node = target.getParent('.files-node-shadow') || target.getParent('.files-node');
var row = node.retrieve('row');
var copy = $extend({}, row);
var path = row.baseurl+"/"+row.filepath;
var url = path.replace(Files.sitebase+'/', '').replace(/files\/[^\/]+\//, '');
// Update active row
node.getParent().getChildren().removeClass('active');
node.addClass('active');
// Load preview template
copy.template = 'details_'+type;
this.preview.empty();
copy.render('compact').inject(this.preview);
// Inject preview image
if (type == 'image') {
this.preview.getElement('img').set('src', copy.image);
}
// When no text is selected use the file name
if (type == 'file') {
if(document.id('image-text').get('value') == ""){
document.id('image-text').set('value', row.name);
}
}
document.id('image-url').set('value', url);
document.id('image-type').set('value',row.metadata.mimetype);
}
});
| timble/openpolice-platform | component/ckeditor/resources/assets/js/ckeditor.files.js | JavaScript | agpl-3.0 | 2,785 |
var articles = null;
function restore_all_articles_view() {
$("#allbtn").button('toggle');
$('#articleslist').empty();
$('#articleslist').append(articles);
$('#filterwarning').hide();
}
function switch_category(category) {
if (typeof category != "undefined") {
$("#articleslist").empty();
var filtered = articles.filter('.'.concat(category));
$("#articleslist").append(filtered);
} else {
restore_all_articles_view();
}
timeandtips("#articleslist");
}
$(document).ready(function() {
timeandtips();
articles = $('#articleslist article');
$('#searchfield').removeAttr("disabled");
});
$("#searchfield").keyup(function(event) {
var text = $('#searchfield').val();
if (text.length >= 3) {
$("#allbtn").button('toggle');
var found = articles.filter('article:containsi("'.concat(text, '")'));
$('#filterwarning').show();
$('#articleslist').empty();
$('#articleslist').append(found);
} else if (text.length == 0) {
restore_all_articles_view();
}
});
| gfidente/opinoid | webapp/static/js/country.js | JavaScript | agpl-3.0 | 1,017 |
OC.L10N.register(
"templateeditor",
{
"Could not load template" : "امکان بارگذاری قالب وجود ندارد",
"Saved" : "ذخیره شد",
"Reset" : "تنظیم مجدد",
"An error occurred" : "یک خطا رخ داده است",
"Sharing email - public link shares (HTML)" : "ایمیل اشتراک گذاری-لینک عمومی اشتراک گذاری(HTML)",
"Sharing email - public link shares (plain text fallback)" : "ایمیل اشتراک گذاری-لینک عمومی اشتراک گذاری(plain text fallback)",
"Sharing email (HTML)" : "اشتراکگذاری ایمیل (HTML)",
"Sharing email (plain text fallback)" : "ایمیل اشتراک گذاری (plain text fallback)",
"Lost password mail" : "ایمیل فراموش کردن رمز عبور",
"New user email (HTML)" : "ایمیل کاربری جدید (HTML)",
"New user email (plain text fallback)" : "ایمیل کاربر جدید (plain text fallback)",
"Activity notification mail" : "ایمیل هشدار فعالیت",
"Mail Templates" : "قالبهای ایمیل",
"Theme" : "تم",
"Template" : "قالب",
"Please choose a template" : "لطفا یک قالب انتخاب کنید",
"Save" : "ذخیره"
},
"nplurals=1; plural=0;");
| jacklicn/owncloud | apps/templateeditor/l10n/fa.js | JavaScript | agpl-3.0 | 1,324 |
/*
Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/
CKEDITOR.plugins.setLang( 'specialchar', 'cs', {
options: 'Nastavení speciálních znaků',
title: 'Výběr speciálního znaku',
toolbar: 'Vložit speciální znaky'
} );
| astrobin/astrobin | astrobin/static/astrobin/ckeditor/plugins/specialchar/lang/cs.js | JavaScript | agpl-3.0 | 339 |
(function() {
'use strict';
angular.module('columbyApp')
.controller('SearchCtrl', function($log,$rootScope, $scope, SearchSrv) {
/* ---------- SETUP ----------------------------------------------------------------------------- */
$scope.contentLoading = true;
$scope.search = {};
$rootScope.title = 'columby.com | search';
$scope.pagination = {
itemsPerPage: 20,
datasets:{
currentPage: 1
},
accounts:{
currentPage: 1
},
tags:{
currentPage: 1
}
};
/* ---------- SCOPE FUNCTIONS ------------------------------------------------------------------- */
$scope.doSearch = function(){
$scope.search.hits = null;
if ($scope.search.searchTerm.length>2){
$scope.search.message = 'Searching for: ' + $scope.search.searchTerm;
SearchSrv.query({
text: $scope.search.searchTerm,
limit: $scope.pagination.itemsPerPage
}).then(function (response) {
$scope.search.hits = response;
$scope.search.message = null;
$scope.pagination.datasets.numPages = response.datasets.count / $scope.pagination.itemsPerPage;
$scope.pagination.accounts.numPages = response.accounts.count / $scope.pagination.itemsPerPage;
$scope.pagination.tags.numPages = response.tags.count / $scope.pagination.itemsPerPage;
}, function(err){
$scope.search.message = 'Error: ' + err.data.message;
});
} else {
$scope.search.message = 'Type at least 3 characters.';
}
};
/* ---------- INIT ---------------------------------------------------------------------------- */
if ($rootScope.searchTerm){
$scope.search.searchTerm = $rootScope.searchTerm;
$log.debug($scope.search.searchTerm);
delete $rootScope.searchTerm;
$log.debug($scope.search.searchTerm);
$scope.doSearch();
}
});
})();
| columby/www.columby.com | src/www/app/controllers/search/search.controller.js | JavaScript | agpl-3.0 | 1,953 |
/**
* ISARI Import Scripts File Definitions
* ======================================
*
* Defining the various files to import as well as their line consumers.
*/
module.exports = {
organizations: require('./organizations.js'),
people: require('./people.js'),
activities: require('./activities.js'),
postProcessing: require('./post-processing.js')
};
| SciencesPo/isari | scripts/import/files/index.js | JavaScript | agpl-3.0 | 363 |
define(['sylvester', 'sha1', 'PrairieGeom'], function (Sylvester, Sha1, PrairieGeom) {
var $V = Sylvester.Vector.create;
var Vector = Sylvester.Vector;
var Matrix = Sylvester.Matrix;
/*****************************************************************************/
/** Creates a PrairieDraw object.
@constructor
@this {PrairieDraw}
@param {HTMLCanvasElement or string} canvas The canvas element to draw on or the ID of the canvas elemnt.
@param {Function} drawfcn An optional function that draws on the canvas.
*/
function PrairieDraw(canvas, drawFcn) {
if (canvas) {
if (canvas instanceof HTMLCanvasElement) {
this._canvas = canvas;
} else if (canvas instanceof String || typeof canvas === 'string') {
this._canvas = document.getElementById(canvas);
} else {
//throw new Error("PrairieDraw: unknown object type for constructor")
this._canvas = undefined;
}
if (this._canvas) {
this._canvas.prairieDraw = this;
this._ctx = this._canvas.getContext('2d');
if (this._ctx.setLineDash === undefined) {
this._ctx.setLineDash = function () {};
}
this._width = this._canvas.width;
this._height = this._canvas.height;
this._trans = Matrix.I(3);
this._transStack = [];
this._initViewAngleX3D = (-Math.PI / 2) * 0.75;
this._initViewAngleY3D = 0;
this._initViewAngleZ3D = (-Math.PI / 2) * 1.25;
this._viewAngleX3D = this._initViewAngleX3D;
this._viewAngleY3D = this._initViewAngleY3D;
this._viewAngleZ3D = this._initViewAngleZ3D;
this._trans3D = PrairieGeom.rotateTransform3D(
Matrix.I(4),
this._initViewAngleX3D,
this._initViewAngleY3D,
this._initViewAngleZ3D
);
this._trans3DStack = [];
this._props = {};
this._initProps();
this._propStack = [];
this._options = {};
this._history = {};
this._images = {};
this._redrawCallbacks = [];
if (drawFcn) {
this.draw = drawFcn.bind(this);
}
this.save();
this.draw();
this.restoreAll();
}
}
}
/** Creates a new PrairieDraw from a canvas ID.
@param {string} id The ID of the canvas element to draw on.
@return {PrairieDraw} The new PrairieDraw object.
*/
PrairieDraw.fromCanvasId = function (id) {
var canvas = document.getElementById(id);
if (!canvas) {
throw new Error('PrairieDraw: unable to find canvas ID: ' + id);
}
return new PrairieDraw(canvas);
};
/** Prototype function to draw on the canvas, should be implemented by children.
*/
PrairieDraw.prototype.draw = function () {};
/** Redraw the drawing.
*/
PrairieDraw.prototype.redraw = function () {
this.save();
this.draw();
this.restoreAll();
for (var i = 0; i < this._redrawCallbacks.length; i++) {
this._redrawCallbacks[i]();
}
};
/** Add a callback on redraw() calls.
*/
PrairieDraw.prototype.registerRedrawCallback = function (callback) {
this._redrawCallbacks.push(callback.bind(this));
};
/** @private Initialize properties.
*/
PrairieDraw.prototype._initProps = function () {
this._props.viewAngleXMin = -Math.PI / 2 + 1e-6;
this._props.viewAngleXMax = -1e-6;
this._props.viewAngleYMin = -Infinity;
this._props.viewAngleYMax = Infinity;
this._props.viewAngleZMin = -Infinity;
this._props.viewAngleZMax = Infinity;
this._props.arrowLineWidthPx = 2;
this._props.arrowLinePattern = 'solid';
this._props.arrowheadLengthRatio = 7; // arrowheadLength / arrowLineWidth
this._props.arrowheadWidthRatio = 0.3; // arrowheadWidth / arrowheadLength
this._props.arrowheadOffsetRatio = 0.3; // arrowheadOffset / arrowheadLength
this._props.circleArrowWrapOffsetRatio = 1.5;
this._props.arrowOutOfPageRadiusPx = 5;
this._props.textOffsetPx = 4;
this._props.textFontSize = 14;
this._props.pointRadiusPx = 2;
this._props.shapeStrokeWidthPx = 2;
this._props.shapeStrokePattern = 'solid';
this._props.shapeOutlineColor = 'rgb(0, 0, 0)';
this._props.shapeInsideColor = 'rgb(255, 255, 255)';
this._props.hiddenLineDraw = true;
this._props.hiddenLineWidthPx = 2;
this._props.hiddenLinePattern = 'dashed';
this._props.hiddenLineColor = 'rgb(0, 0, 0)';
this._props.centerOfMassStrokeWidthPx = 2;
this._props.centerOfMassColor = 'rgb(180, 49, 4)';
this._props.centerOfMassRadiusPx = 5;
this._props.rightAngleSizePx = 10;
this._props.rightAngleStrokeWidthPx = 1;
this._props.rightAngleColor = 'rgb(0, 0, 0)';
this._props.measurementStrokeWidthPx = 1;
this._props.measurementStrokePattern = 'solid';
this._props.measurementEndLengthPx = 10;
this._props.measurementOffsetPx = 3;
this._props.measurementColor = 'rgb(0, 0, 0)';
this._props.groundDepthPx = 10;
this._props.groundWidthPx = 10;
this._props.groundSpacingPx = 10;
this._props.groundOutlineColor = 'rgb(0, 0, 0)';
this._props.groundInsideColor = 'rgb(220, 220, 220)';
this._props.gridColor = 'rgb(200, 200, 200)';
this._props.positionColor = 'rgb(0, 0, 255)';
this._props.angleColor = 'rgb(0, 100, 180)';
this._props.velocityColor = 'rgb(0, 200, 0)';
this._props.angVelColor = 'rgb(100, 180, 0)';
this._props.accelerationColor = 'rgb(255, 0, 255)';
this._props.rotationColor = 'rgb(150, 0, 150)';
this._props.angAccColor = 'rgb(100, 0, 180)';
this._props.angMomColor = 'rgb(255, 0, 0)';
this._props.forceColor = 'rgb(210, 105, 30)';
this._props.momentColor = 'rgb(255, 102, 80)';
};
/*****************************************************************************/
/** The golden ratio.
*/
PrairieDraw.prototype.goldenRatio = (1 + Math.sqrt(5)) / 2;
/** Get the canvas width.
@return {number} The canvas width in Px.
*/
PrairieDraw.prototype.widthPx = function () {
return this._width;
};
/** Get the canvas height.
@return {number} The canvas height in Px.
*/
PrairieDraw.prototype.heightPx = function () {
return this._height;
};
/*****************************************************************************/
/** Conversion constants.
*/
PrairieDraw.prototype.milesPerKilometer = 0.621371;
/*****************************************************************************/
/** Scale the coordinate system.
@param {Vector} factor Scale factors.
*/
PrairieDraw.prototype.scale = function (factor) {
this._trans = PrairieGeom.scaleTransform(this._trans, factor);
};
/** Translate the coordinate system.
@param {Vector} offset Translation offset (drawing coords).
*/
PrairieDraw.prototype.translate = function (offset) {
this._trans = PrairieGeom.translateTransform(this._trans, offset);
};
/** Rotate the coordinate system.
@param {number} angle Angle to rotate by (radians).
*/
PrairieDraw.prototype.rotate = function (angle) {
this._trans = PrairieGeom.rotateTransform(this._trans, angle);
};
/** Transform the coordinate system (scale, translate, rotate) to
match old points to new. Drawing at the old locations will result
in points at the new locations.
@param {Vector} old1 The old location of point 1.
@param {Vector} old2 The old location of point 2.
@param {Vector} new1 The new location of point 1.
@param {Vector} new2 The new location of point 2.
*/
PrairieDraw.prototype.transformByPoints = function (old1, old2, new1, new2) {
this._trans = PrairieGeom.transformByPointsTransform(this._trans, old1, old2, new1, new2);
};
/*****************************************************************************/
/** Transform a vector from drawing to pixel coords.
@param {Vector} vDw Vector in drawing coords.
@return {Vector} Vector in pixel coords.
*/
PrairieDraw.prototype.vec2Px = function (vDw) {
return PrairieGeom.transformVec(this._trans, vDw);
};
/** Transform a position from drawing to pixel coords.
@param {Vector} pDw Position in drawing coords.
@return {Vector} Position in pixel coords.
*/
PrairieDraw.prototype.pos2Px = function (pDw) {
return PrairieGeom.transformPos(this._trans, pDw);
};
/** Transform a vector from pixel to drawing coords.
@param {Vector} vPx Vector in pixel coords.
@return {Vector} Vector in drawing coords.
*/
PrairieDraw.prototype.vec2Dw = function (vPx) {
return PrairieGeom.transformVec(this._trans.inverse(), vPx);
};
/** Transform a position from pixel to drawing coords.
@param {Vector} pPx Position in pixel coords.
@return {Vector} Position in drawing coords.
*/
PrairieDraw.prototype.pos2Dw = function (pPx) {
return PrairieGeom.transformPos(this._trans.inverse(), pPx);
};
/** @private Returns true if the current transformation is a reflection.
@return {bool} Whether the current transformation is a reflection.
*/
PrairieDraw.prototype._transIsReflection = function () {
var det = this._trans.e(1, 1) * this._trans.e(2, 2) - this._trans.e(1, 2) * this._trans.e(2, 1);
if (det < 0) {
return true;
} else {
return false;
}
};
/** Transform a position from normalized viewport [0,1] to drawing coords.
@param {Vector} pNm Position in normalized viewport coordinates.
@return {Vector} Position in drawing coordinates.
*/
PrairieDraw.prototype.posNm2Dw = function (pNm) {
var pPx = this.posNm2Px(pNm);
return this.pos2Dw(pPx);
};
/** Transform a position from normalized viewport [0,1] to pixel coords.
@param {Vector} pNm Position in normalized viewport coords.
@return {Vector} Position in pixel coords.
*/
PrairieDraw.prototype.posNm2Px = function (pNm) {
return $V([pNm.e(1) * this._width, (1 - pNm.e(2)) * this._height]);
};
/*****************************************************************************/
/** Set the 3D view to the given angles.
@param {number} angleX The rotation angle about the X axis.
@param {number} angleY The rotation angle about the Y axis.
@param {number} angleZ The rotation angle about the Z axis.
@param {bool} clip (Optional) Whether to clip to max/min range (default: true).
@param {bool} redraw (Optional) Whether to redraw (default: true).
*/
PrairieDraw.prototype.setView3D = function (angleX, angleY, angleZ, clip, redraw) {
clip = clip === undefined ? true : clip;
redraw = redraw === undefined ? true : redraw;
this._viewAngleX3D = angleX;
this._viewAngleY3D = angleY;
this._viewAngleZ3D = angleZ;
if (clip) {
this._viewAngleX3D = PrairieGeom.clip(
this._viewAngleX3D,
this._props.viewAngleXMin,
this._props.viewAngleXMax
);
this._viewAngleY3D = PrairieGeom.clip(
this._viewAngleY3D,
this._props.viewAngleYMin,
this._props.viewAngleYMax
);
this._viewAngleZ3D = PrairieGeom.clip(
this._viewAngleZ3D,
this._props.viewAngleZMin,
this._props.viewAngleZMax
);
}
this._trans3D = PrairieGeom.rotateTransform3D(
Matrix.I(4),
this._viewAngleX3D,
this._viewAngleY3D,
this._viewAngleZ3D
);
if (redraw) {
this.redraw();
}
};
/** Reset the 3D view to default.
@param {bool} redraw (Optional) Whether to redraw (default: true).
*/
PrairieDraw.prototype.resetView3D = function (redraw) {
this.setView3D(
this._initViewAngleX3D,
this._initViewAngleY3D,
this._initViewAngleZ3D,
undefined,
redraw
);
};
/** Increment the 3D view by the given angles.
@param {number} deltaAngleX The incremental rotation angle about the X axis.
@param {number} deltaAngleY The incremental rotation angle about the Y axis.
@param {number} deltaAngleZ The incremental rotation angle about the Z axis.
@param {bool} clip (Optional) Whether to clip to max/min range (default: true).
*/
PrairieDraw.prototype.incrementView3D = function (deltaAngleX, deltaAngleY, deltaAngleZ, clip) {
this.setView3D(
this._viewAngleX3D + deltaAngleX,
this._viewAngleY3D + deltaAngleY,
this._viewAngleZ3D + deltaAngleZ,
clip
);
};
/*****************************************************************************/
/** Scale the 3D coordinate system.
@param {Vector} factor Scale factor.
*/
PrairieDraw.prototype.scale3D = function (factor) {
this._trans3D = PrairieGeom.scaleTransform3D(this._trans3D, factor);
};
/** Translate the 3D coordinate system.
@param {Vector} offset Translation offset.
*/
PrairieDraw.prototype.translate3D = function (offset) {
this._trans3D = PrairieGeom.translateTransform3D(this._trans3D, offset);
};
/** Rotate the 3D coordinate system.
@param {number} angleX Angle to rotate by around the X axis (radians).
@param {number} angleY Angle to rotate by around the Y axis (radians).
@param {number} angleZ Angle to rotate by around the Z axis (radians).
*/
PrairieDraw.prototype.rotate3D = function (angleX, angleY, angleZ) {
this._trans3D = PrairieGeom.rotateTransform3D(this._trans3D, angleX, angleY, angleZ);
};
/*****************************************************************************/
/** Transform a position to the view coordinates in 3D.
@param {Vector} pDw Position in 3D drawing coords.
@return {Vector} Position in 3D viewing coords.
*/
PrairieDraw.prototype.posDwToVw = function (pDw) {
var pVw = PrairieGeom.transformPos3D(this._trans3D, pDw);
return pVw;
};
/** Transform a position from the view coordinates in 3D.
@param {Vector} pVw Position in 3D viewing coords.
@return {Vector} Position in 3D drawing coords.
*/
PrairieDraw.prototype.posVwToDw = function (pVw) {
var pDw = PrairieGeom.transformPos3D(this._trans3D.inverse(), pVw);
return pDw;
};
/** Transform a vector to the view coordinates in 3D.
@param {Vector} vDw Vector in 3D drawing coords.
@return {Vector} Vector in 3D viewing coords.
*/
PrairieDraw.prototype.vecDwToVw = function (vDw) {
var vVw = PrairieGeom.transformVec3D(this._trans3D, vDw);
return vVw;
};
/** Transform a vector from the view coordinates in 3D.
@param {Vector} vVw Vector in 3D viewing coords.
@return {Vector} Vector in 3D drawing coords.
*/
PrairieDraw.prototype.vecVwToDw = function (vVw) {
var vDw = PrairieGeom.transformVec3D(this._trans3D.inverse(), vVw);
return vDw;
};
/** Transform a position from 3D to 2D drawing coords if necessary.
@param {Vector} pDw Position in 2D or 3D drawing coords.
@return {Vector} Position in 2D drawing coords.
*/
PrairieDraw.prototype.pos3To2 = function (pDw) {
if (pDw.elements.length === 3) {
return PrairieGeom.orthProjPos3D(this.posDwToVw(pDw));
} else {
return pDw;
}
};
/** Transform a vector from 3D to 2D drawing coords if necessary.
@param {Vector} vDw Vector in 2D or 3D drawing coords.
@param {Vector} pDw Base point of vector (if in 3D).
@return {Vector} Vector in 2D drawing coords.
*/
PrairieDraw.prototype.vec3To2 = function (vDw, pDw) {
if (vDw.elements.length === 3) {
var qDw = pDw.add(vDw);
var p2Dw = this.pos3To2(pDw);
var q2Dw = this.pos3To2(qDw);
var v2Dw = q2Dw.subtract(p2Dw);
return v2Dw;
} else {
return vDw;
}
};
/** Transform a position from 2D to 3D drawing coords if necessary (adding z = 0).
@param {Vector} pDw Position in 2D or 3D drawing coords.
@return {Vector} Position in 3D drawing coords.
*/
PrairieDraw.prototype.pos2To3 = function (pDw) {
if (pDw.elements.length === 2) {
return $V([pDw.e(1), pDw.e(2), 0]);
} else {
return pDw;
}
};
/** Transform a vector from 2D to 3D drawing coords if necessary (adding z = 0).
@param {Vector} vDw Vector in 2D or 3D drawing coords.
@return {Vector} Vector in 3D drawing coords.
*/
PrairieDraw.prototype.vec2To3 = function (vDw) {
if (vDw.elements.length === 2) {
return $V([vDw.e(1), vDw.e(2), 0]);
} else {
return vDw;
}
};
/*****************************************************************************/
/** Set a property.
@param {string} name The name of the property.
@param {number} value The value to set the property to.
*/
PrairieDraw.prototype.setProp = function (name, value) {
if (!(name in this._props)) {
throw new Error('PrairieDraw: unknown property name: ' + name);
}
this._props[name] = value;
};
/** Get a property.
@param {string} name The name of the property.
@return {number} The current value of the property.
*/
PrairieDraw.prototype.getProp = function (name) {
if (!(name in this._props)) {
throw new Error('PrairieDraw: unknown property name: ' + name);
}
return this._props[name];
};
/** @private Colors.
*/
PrairieDraw._colors = {
black: 'rgb(0, 0, 0)',
white: 'rgb(255, 255, 255)',
red: 'rgb(255, 0, 0)',
green: 'rgb(0, 255, 0)',
blue: 'rgb(0, 0, 255)',
cyan: 'rgb(0, 255, 255)',
magenta: 'rgb(255, 0, 255)',
yellow: 'rgb(255, 255, 0)',
};
/** @private Get a color property for a given type.
@param {string} type Optional type to find the color for.
*/
PrairieDraw.prototype._getColorProp = function (type) {
if (type === undefined) {
return this._props.shapeOutlineColor;
}
var col = type + 'Color';
if (col in this._props) {
var c = this._props[col];
if (c in PrairieDraw._colors) {
return PrairieDraw._colors[c];
} else {
return c;
}
} else if (type in PrairieDraw._colors) {
return PrairieDraw._colors[type];
} else {
return type;
}
};
/** @private Set shape drawing properties for drawing hidden lines.
*/
PrairieDraw.prototype.setShapeDrawHidden = function () {
this._props.shapeStrokeWidthPx = this._props.hiddenLineWidthPx;
this._props.shapeStrokePattern = this._props.hiddenLinePattern;
this._props.shapeOutlineColor = this._props.hiddenLineColor;
};
/*****************************************************************************/
/** Add an external option for this drawing.
@param {string} name The option name.
@param {object} value The default initial value.
*/
PrairieDraw.prototype.addOption = function (name, value, triggerRedraw) {
if (!(name in this._options)) {
this._options[name] = {
value: value,
resetValue: value,
callbacks: {},
triggerRedraw: triggerRedraw === undefined ? true : triggerRedraw,
};
} else if (!('value' in this._options[name])) {
var option = this._options[name];
option.value = value;
option.resetValue = value;
for (var p in option.callbacks) {
option.callbacks[p](option.value);
}
}
};
/** Set an option to a given value.
@param {string} name The option name.
@param {object} value The new value for the option.
@param {bool} redraw (Optional) Whether to trigger a redraw() (default: true).
@param {Object} trigger (Optional) The object that triggered the change.
@param {bool} setReset (Optional) Also set this value to be the new reset value (default: false).
*/
PrairieDraw.prototype.setOption = function (name, value, redraw, trigger, setReset) {
redraw = redraw === undefined ? true : redraw;
setReset = setReset === undefined ? false : setReset;
if (!(name in this._options)) {
throw new Error('PrairieDraw: unknown option: ' + name);
}
var option = this._options[name];
option.value = value;
if (setReset) {
option.resetValue = value;
}
for (var p in option.callbacks) {
option.callbacks[p](option.value, trigger);
}
if (redraw) {
this.redraw();
}
};
/** Get the value of an option.
@param {string} name The option name.
@return {object} The current value for the option.
*/
PrairieDraw.prototype.getOption = function (name) {
if (!(name in this._options)) {
throw new Error('PrairieDraw: unknown option: ' + name);
}
if (!('value' in this._options[name])) {
throw new Error('PrairieDraw: option has no value: ' + name);
}
return this._options[name].value;
};
/** Set an option to the logical negation of its current value.
@param {string} name The option name.
*/
PrairieDraw.prototype.toggleOption = function (name) {
if (!(name in this._options)) {
throw new Error('PrairieDraw: unknown option: ' + name);
}
if (!('value' in this._options[name])) {
throw new Error('PrairieDraw: option has no value: ' + name);
}
var option = this._options[name];
option.value = !option.value;
for (var p in option.callbacks) {
option.callbacks[p](option.value);
}
this.redraw();
};
/** Register a callback on option changes.
@param {string} name The option to register on.
@param {Function} callback The callback(value) function.
@param {string} callbackID (Optional) The ID of the callback. If omitted, a new unique ID will be generated.
*/
PrairieDraw.prototype.registerOptionCallback = function (name, callback, callbackID) {
if (!(name in this._options)) {
throw new Error('PrairieDraw: unknown option: ' + name);
}
var option = this._options[name];
var useID;
if (callbackID === undefined) {
var nextIDNumber = 0,
curIDNumber;
for (var p in option.callbacks) {
curIDNumber = parseInt(p, 10);
if (isFinite(curIDNumber)) {
nextIDNumber = Math.max(nextIDNumber, curIDNumber + 1);
}
}
useID = nextIDNumber.toString();
} else {
useID = callbackID;
}
option.callbacks[useID] = callback.bind(this);
option.callbacks[useID](option.value);
};
/** Clear the value for the given option.
@param {string} name The option to clear.
*/
PrairieDraw.prototype.clearOptionValue = function (name) {
if (!(name in this._options)) {
throw new Error('PrairieDraw: unknown option: ' + name);
}
if ('value' in this._options[name]) {
delete this._options[name].value;
}
this.redraw();
};
/** Reset the value for the given option.
@param {string} name The option to reset.
*/
PrairieDraw.prototype.resetOptionValue = function (name) {
if (!(name in this._options)) {
throw new Error('PrairieDraw: unknown option: ' + name);
}
var option = this._options[name];
if (!('resetValue' in option)) {
throw new Error('PrairieDraw: option has no resetValue: ' + name);
}
option.value = option.resetValue;
for (var p in option.callbacks) {
option.callbacks[p](option.value);
}
};
/*****************************************************************************/
/** Save the graphics state (properties, options, and transformations).
@see restore().
*/
PrairieDraw.prototype.save = function () {
this._ctx.save();
var oldProps = {};
for (var p in this._props) {
oldProps[p] = this._props[p];
}
this._propStack.push(oldProps);
this._transStack.push(this._trans.dup());
this._trans3DStack.push(this._trans3D.dup());
};
/** Restore the graphics state (properties, options, and transformations).
@see save().
*/
PrairieDraw.prototype.restore = function () {
this._ctx.restore();
if (this._propStack.length === 0) {
throw new Error('PrairieDraw: tried to restore() without corresponding save()');
}
if (this._propStack.length !== this._transStack.length) {
throw new Error('PrairieDraw: incompatible save stack lengths');
}
if (this._propStack.length !== this._trans3DStack.length) {
throw new Error('PrairieDraw: incompatible save stack lengths');
}
this._props = this._propStack.pop();
this._trans = this._transStack.pop();
this._trans3D = this._trans3DStack.pop();
};
/** Restore all outstanding saves.
*/
PrairieDraw.prototype.restoreAll = function () {
while (this._propStack.length > 0) {
this.restore();
}
if (this._saveTrans !== undefined) {
this._trans = this._saveTrans;
}
};
/*****************************************************************************/
/** Reset the canvas image and drawing context.
*/
PrairieDraw.prototype.clearDrawing = function () {
this._ctx.clearRect(0, 0, this._width, this._height);
};
/** Reset everything to the intial state.
*/
PrairieDraw.prototype.reset = function () {
for (var optionName in this._options) {
this.resetOptionValue(optionName);
}
this.resetView3D(false);
this.redraw();
};
/** Stop all action and computation.
*/
PrairieDraw.prototype.stop = function () {};
/*****************************************************************************/
/** Set the visable coordinate sizes.
@param {number} xSize The horizontal size of the drawing area in coordinate units.
@param {number} ySize The vertical size of the drawing area in coordinate units.
@param {number} canvasWidth (Optional) The width of the canvas in px.
@param {bool} preserveCanvasSize (Optional) If true, do not resize the canvas to match the coordinate ratio.
*/
PrairieDraw.prototype.setUnits = function (xSize, ySize, canvasWidth, preserveCanvasSize) {
this.clearDrawing();
this._trans = Matrix.I(3);
if (canvasWidth !== undefined) {
var canvasHeight = Math.floor((ySize / xSize) * canvasWidth);
if (this._width !== canvasWidth || this._height !== canvasHeight) {
this._canvas.width = canvasWidth;
this._canvas.height = canvasHeight;
this._width = canvasWidth;
this._height = canvasHeight;
}
preserveCanvasSize = true;
}
var xScale = this._width / xSize;
var yScale = this._height / ySize;
if (xScale < yScale) {
this._scale = xScale;
if (!preserveCanvasSize && xScale !== yScale) {
var newHeight = xScale * ySize;
this._canvas.height = newHeight;
this._height = newHeight;
}
this.translate($V([this._width / 2, this._height / 2]));
this.scale($V([1, -1]));
this.scale($V([xScale, xScale]));
} else {
this._scale = yScale;
if (!preserveCanvasSize && xScale !== yScale) {
var newWidth = yScale * xSize;
this._canvas.width = newWidth;
this._width = newWidth;
}
this.translate($V([this._width / 2, this._height / 2]));
this.scale($V([1, -1]));
this.scale($V([yScale, yScale]));
}
this._saveTrans = this._trans;
};
/*****************************************************************************/
/** Draw a point.
@param {Vector} posDw Position of the point (drawing coords).
*/
PrairieDraw.prototype.point = function (posDw) {
posDw = this.pos3To2(posDw);
var posPx = this.pos2Px(posDw);
this._ctx.beginPath();
this._ctx.arc(posPx.e(1), posPx.e(2), this._props.pointRadiusPx, 0, 2 * Math.PI);
this._ctx.fillStyle = this._props.shapeOutlineColor;
this._ctx.fill();
};
/*****************************************************************************/
/** @private Set the stroke/fill styles for drawing lines.
@param {string} type The type of line being drawn.
*/
PrairieDraw.prototype._setLineStyles = function (type) {
var col = this._getColorProp(type);
this._ctx.strokeStyle = col;
this._ctx.fillStyle = col;
};
/** Return the dash array for the given line pattern.
@param {string} type The type of the dash pattern ('solid', 'dashed', 'dotted').
@return {Array} The numerical array of dash segment lengths.
*/
PrairieDraw.prototype._dashPattern = function (type) {
if (type === 'solid') {
return [];
} else if (type === 'dashed') {
return [6, 6];
} else if (type === 'dotted') {
return [2, 2];
} else {
throw new Error('PrairieDraw: unknown dash pattern: ' + type);
}
};
/** Draw a single line given start and end positions.
@param {Vector} startDw Initial point of the line (drawing coords).
@param {Vector} endDw Final point of the line (drawing coords).
@param {string} type Optional type of line being drawn.
*/
PrairieDraw.prototype.line = function (startDw, endDw, type) {
startDw = this.pos3To2(startDw);
endDw = this.pos3To2(endDw);
var startPx = this.pos2Px(startDw);
var endPx = this.pos2Px(endDw);
this._ctx.save();
this._setLineStyles(type);
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.beginPath();
this._ctx.moveTo(startPx.e(1), startPx.e(2));
this._ctx.lineTo(endPx.e(1), endPx.e(2));
this._ctx.stroke();
this._ctx.restore();
};
/*****************************************************************************/
/** Draw a cubic Bezier segment.
@param {Vector} p0Dw The starting point.
@param {Vector} p1Dw The first control point.
@param {Vector} p2Dw The second control point.
@param {Vector} p3Dw The ending point.
@param {string} type (Optional) type of line being drawn.
*/
PrairieDraw.prototype.cubicBezier = function (p0Dw, p1Dw, p2Dw, p3Dw, type) {
var p0Px = this.pos2Px(this.pos3To2(p0Dw));
var p1Px = this.pos2Px(this.pos3To2(p1Dw));
var p2Px = this.pos2Px(this.pos3To2(p2Dw));
var p3Px = this.pos2Px(this.pos3To2(p3Dw));
this._ctx.save();
this._setLineStyles(type);
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.beginPath();
this._ctx.moveTo(p0Px.e(1), p0Px.e(2));
this._ctx.bezierCurveTo(p1Px.e(1), p1Px.e(2), p2Px.e(1), p2Px.e(2), p3Px.e(1), p3Px.e(2));
this._ctx.stroke();
this._ctx.restore();
};
/*****************************************************************************/
/** @private Draw an arrowhead in pixel coords.
@param {Vector} posPx Position of the tip.
@param {Vector} dirPx Direction vector that the arrowhead points in.
@param {number} lenPx Length of the arrowhead.
*/
PrairieDraw.prototype._arrowheadPx = function (posPx, dirPx, lenPx) {
var dxPx = -(1 - this._props.arrowheadOffsetRatio) * lenPx;
var dyPx = this._props.arrowheadWidthRatio * lenPx;
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(dirPx));
this._ctx.beginPath();
this._ctx.moveTo(0, 0);
this._ctx.lineTo(-lenPx, dyPx);
this._ctx.lineTo(dxPx, 0);
this._ctx.lineTo(-lenPx, -dyPx);
this._ctx.closePath();
this._ctx.fill();
this._ctx.restore();
};
/** @private Draw an arrowhead.
@param {Vector} posDw Position of the tip (drawing coords).
@param {Vector} dirDw Direction vector that the arrowhead point in (drawing coords).
@param {number} lenPx Length of the arrowhead (pixel coords).
*/
PrairieDraw.prototype._arrowhead = function (posDw, dirDw, lenPx) {
var posPx = this.pos2Px(posDw);
var dirPx = this.vec2Px(dirDw);
this._arrowheadPx(posPx, dirPx, lenPx);
};
/** Draw an arrow given start and end positions.
@param {Vector} startDw Initial point of the arrow (drawing coords).
@param {Vector} endDw Final point of the arrow (drawing coords).
@param {string} type Optional type of vector being drawn.
*/
PrairieDraw.prototype.arrow = function (startDw, endDw, type) {
startDw = this.pos3To2(startDw);
endDw = this.pos3To2(endDw);
var offsetDw = endDw.subtract(startDw);
var offsetPx = this.vec2Px(offsetDw);
var arrowLengthPx = offsetPx.modulus();
var lineEndDw, drawArrowHead, arrowheadLengthPx;
if (arrowLengthPx < 1) {
// if too short, just draw a simple line
lineEndDw = endDw;
drawArrowHead = false;
} else {
var arrowheadMaxLengthPx = this._props.arrowheadLengthRatio * this._props.arrowLineWidthPx;
arrowheadLengthPx = Math.min(arrowheadMaxLengthPx, arrowLengthPx / 2);
var arrowheadCenterLengthPx = (1 - this._props.arrowheadOffsetRatio) * arrowheadLengthPx;
var lineLengthPx = arrowLengthPx - arrowheadCenterLengthPx;
lineEndDw = startDw.add(offsetDw.x(lineLengthPx / arrowLengthPx));
drawArrowHead = true;
}
var startPx = this.pos2Px(startDw);
var lineEndPx = this.pos2Px(lineEndDw);
this.save();
this._ctx.lineWidth = this._props.arrowLineWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.arrowLinePattern));
this._setLineStyles(type);
this._ctx.beginPath();
this._ctx.moveTo(startPx.e(1), startPx.e(2));
this._ctx.lineTo(lineEndPx.e(1), lineEndPx.e(2));
this._ctx.stroke();
if (drawArrowHead) {
this._arrowhead(endDw, offsetDw, arrowheadLengthPx);
}
this.restore();
};
/** Draw an arrow given the start position and offset.
@param {Vector} startDw Initial point of the arrow (drawing coords).
@param {Vector} offsetDw Offset vector of the arrow (drawing coords).
@param {string} type Optional type of vector being drawn.
*/
PrairieDraw.prototype.arrowFrom = function (startDw, offsetDw, type) {
var endDw = startDw.add(offsetDw);
this.arrow(startDw, endDw, type);
};
/** Draw an arrow given the end position and offset.
@param {Vector} endDw Final point of the arrow (drawing coords).
@param {Vector} offsetDw Offset vector of the arrow (drawing coords).
@param {string} type Optional type of vector being drawn.
*/
PrairieDraw.prototype.arrowTo = function (endDw, offsetDw, type) {
var startDw = endDw.subtract(offsetDw);
this.arrow(startDw, endDw, type);
};
/** Draw an arrow out of the page (circle with centered dot).
@param {Vector} posDw The position of the arrow.
@param {string} type Optional type of vector being drawn.
*/
PrairieDraw.prototype.arrowOutOfPage = function (posDw, type) {
var posPx = this.pos2Px(posDw);
var r = this._props.arrowOutOfPageRadiusPx;
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.beginPath();
this._ctx.arc(0, 0, r, 0, 2 * Math.PI);
this._ctx.fillStyle = 'rgb(255, 255, 255)';
this._ctx.fill();
this._ctx.lineWidth = this._props.arrowLineWidthPx;
this._setLineStyles(type);
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.arc(0, 0, this._props.arrowLineWidthPx * 0.7, 0, 2 * Math.PI);
this._ctx.fill();
this._ctx.restore();
};
/** Draw an arrow into the page (circle with times).
@param {Vector} posDw The position of the arrow.
@param {string} type Optional type of vector being drawn.
*/
PrairieDraw.prototype.arrowIntoPage = function (posDw, type) {
var posPx = this.pos2Px(posDw);
var r = this._props.arrowOutOfPageRadiusPx;
var rs = r / Math.sqrt(2);
this._ctx.save();
this._ctx.lineWidth = this._props.arrowLineWidthPx;
this._setLineStyles(type);
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.beginPath();
this._ctx.arc(0, 0, r, 0, 2 * Math.PI);
this._ctx.fillStyle = 'rgb(255, 255, 255)';
this._ctx.fill();
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.moveTo(-rs, -rs);
this._ctx.lineTo(rs, rs);
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.moveTo(rs, -rs);
this._ctx.lineTo(-rs, rs);
this._ctx.stroke();
this._ctx.restore();
};
/*****************************************************************************/
/** Draw a circle arrow by specifying the center and extent.
@param {Vector} posDw The center of the circle arrow.
@param {number} radDw The radius at the mid-angle.
@param {number} centerAngleDw The center angle (counterclockwise from x axis, in radians).
@param {number} extentAngleDw The extent of the arrow (counterclockwise, in radians).
@param {string} type (Optional) The type of the arrow.
@param {bool} fixedRad (Optional) Whether to use a fixed radius (default: false).
*/
PrairieDraw.prototype.circleArrowCentered = function (
posDw,
radDw,
centerAngleDw,
extentAngleDw,
type,
fixedRad
) {
var startAngleDw = centerAngleDw - extentAngleDw / 2;
var endAngleDw = centerAngleDw + extentAngleDw / 2;
this.circleArrow(posDw, radDw, startAngleDw, endAngleDw, type, fixedRad);
};
/** Draw a circle arrow.
@param {Vector} posDw The center of the circle arrow.
@param {number} radDw The radius at the mid-angle.
@param {number} startAngleDw The starting angle (counterclockwise from x axis, in radians).
@param {number} endAngleDw The ending angle (counterclockwise from x axis, in radians).
@param {string} type (Optional) The type of the arrow.
@param {bool} fixedRad (Optional) Whether to use a fixed radius (default: false).
@param {number} idealSegmentSize (Optional) The ideal linear segment size to use (radians).
*/
PrairieDraw.prototype.circleArrow = function (
posDw,
radDw,
startAngleDw,
endAngleDw,
type,
fixedRad,
idealSegmentSize
) {
this.save();
this._ctx.lineWidth = this._props.arrowLineWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.arrowLinePattern));
this._setLineStyles(type);
// convert to Px coordinates
var startOffsetDw = PrairieGeom.vector2DAtAngle(startAngleDw).x(radDw);
var posPx = this.pos2Px(posDw);
var startOffsetPx = this.vec2Px(startOffsetDw);
var radiusPx = startOffsetPx.modulus();
var startAnglePx = PrairieGeom.angleOf(startOffsetPx);
var deltaAngleDw = endAngleDw - startAngleDw;
// assume a possibly reflected/rotated but equally scaled Dw/Px transformation
var deltaAnglePx = this._transIsReflection() ? -deltaAngleDw : deltaAngleDw;
var endAnglePx = startAnglePx + deltaAnglePx;
// compute arrowhead properties
var startRadiusPx = this._circleArrowRadius(
radiusPx,
startAnglePx,
startAnglePx,
endAnglePx,
fixedRad
);
var endRadiusPx = this._circleArrowRadius(
radiusPx,
endAnglePx,
startAnglePx,
endAnglePx,
fixedRad
);
var arrowLengthPx = radiusPx * Math.abs(endAnglePx - startAnglePx);
var arrowheadMaxLengthPx = this._props.arrowheadLengthRatio * this._props.arrowLineWidthPx;
var arrowheadLengthPx = Math.min(arrowheadMaxLengthPx, arrowLengthPx / 2);
var arrowheadCenterLengthPx = (1 - this._props.arrowheadOffsetRatio) * arrowheadLengthPx;
var arrowheadExtraCenterLengthPx =
(1 - this._props.arrowheadOffsetRatio / 3) * arrowheadLengthPx;
var arrowheadAnglePx = arrowheadCenterLengthPx / endRadiusPx;
var arrowheadExtraAnglePx = arrowheadExtraCenterLengthPx / endRadiusPx;
var preEndAnglePx = endAnglePx - PrairieGeom.sign(endAnglePx - startAnglePx) * arrowheadAnglePx;
var arrowBaseAnglePx =
endAnglePx - PrairieGeom.sign(endAnglePx - startAnglePx) * arrowheadExtraAnglePx;
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
idealSegmentSize = idealSegmentSize === undefined ? 0.2 : idealSegmentSize; // radians
var numSegments = Math.ceil(Math.abs(preEndAnglePx - startAnglePx) / idealSegmentSize);
var i, anglePx, rPx;
var offsetPx = PrairieGeom.vector2DAtAngle(startAnglePx).x(startRadiusPx);
this._ctx.beginPath();
this._ctx.moveTo(offsetPx.e(1), offsetPx.e(2));
for (i = 1; i <= numSegments; i++) {
anglePx = PrairieGeom.linearInterp(startAnglePx, preEndAnglePx, i / numSegments);
rPx = this._circleArrowRadius(radiusPx, anglePx, startAnglePx, endAnglePx, fixedRad);
offsetPx = PrairieGeom.vector2DAtAngle(anglePx).x(rPx);
this._ctx.lineTo(offsetPx.e(1), offsetPx.e(2));
}
this._ctx.stroke();
this._ctx.restore();
var arrowBaseRadiusPx = this._circleArrowRadius(
radiusPx,
arrowBaseAnglePx,
startAnglePx,
endAnglePx,
fixedRad
);
var arrowPosPx = posPx.add(PrairieGeom.vector2DAtAngle(endAnglePx).x(endRadiusPx));
var arrowBasePosPx = posPx.add(
PrairieGeom.vector2DAtAngle(arrowBaseAnglePx).x(arrowBaseRadiusPx)
);
var arrowDirPx = arrowPosPx.subtract(arrowBasePosPx);
var arrowPosDw = this.pos2Dw(arrowPosPx);
var arrowDirDw = this.vec2Dw(arrowDirPx);
this._arrowhead(arrowPosDw, arrowDirDw, arrowheadLengthPx);
this.restore();
};
/** @private Compute the radius at a certain angle within a circle arrow.
@param {number} midRadPx The radius at the midpoint of the circle arrow.
@param {number} anglePx The angle at which to find the radius.
@param {number} startAnglePx The starting angle (counterclockwise from x axis, in radians).
@param {number} endAnglePx The ending angle (counterclockwise from x axis, in radians).
@return {number} The radius at the given angle (pixel coords).
@param {bool} fixedRad (Optional) Whether to use a fixed radius (default: false).
*/
PrairieDraw.prototype._circleArrowRadius = function (
midRadPx,
anglePx,
startAnglePx,
endAnglePx,
fixedRad
) {
if (fixedRad !== undefined && fixedRad === true) {
return midRadPx;
}
if (Math.abs(endAnglePx - startAnglePx) < 1e-4) {
return midRadPx;
}
var arrowheadMaxLengthPx = this._props.arrowheadLengthRatio * this._props.arrowLineWidthPx;
/* jshint laxbreak: true */
var spacingPx =
arrowheadMaxLengthPx *
this._props.arrowheadWidthRatio *
this._props.circleArrowWrapOffsetRatio;
var circleArrowWrapDensity = (midRadPx * Math.PI * 2) / spacingPx;
var midAnglePx = (startAnglePx + endAnglePx) / 2;
var offsetAnglePx = (anglePx - midAnglePx) * PrairieGeom.sign(endAnglePx - startAnglePx);
if (offsetAnglePx > 0) {
return midRadPx * (1 + offsetAnglePx / circleArrowWrapDensity);
} else {
return midRadPx * Math.exp(offsetAnglePx / circleArrowWrapDensity);
}
};
/*****************************************************************************/
/** Draw an arc in 3D.
@param {Vector} posDw The center of the arc.
@param {number} radDw The radius of the arc.
@param {Vector} normDw (Optional) The normal vector to the plane containing the arc (default: z axis).
@param {Vector} refDw (Optional) The reference vector to measure angles from (default: an orthogonal vector to normDw).
@param {number} startAngleDw (Optional) The starting angle (counterclockwise from refDw about normDw, in radians, default: 0).
@param {number} endAngleDw (Optional) The ending angle (counterclockwise from refDw about normDw, in radians, default: 2 pi).
@param {string} type (Optional) The type of the line.
@param {Object} options (Optional) Various options.
*/
PrairieDraw.prototype.arc3D = function (
posDw,
radDw,
normDw,
refDw,
startAngleDw,
endAngleDw,
options
) {
posDw = this.pos2To3(posDw);
normDw = normDw === undefined ? Vector.k : normDw;
refDw = refDw === undefined ? PrairieGeom.chooseNormVec(normDw) : refDw;
var fullCircle = startAngleDw === undefined && endAngleDw === undefined;
startAngleDw = startAngleDw === undefined ? 0 : startAngleDw;
endAngleDw = endAngleDw === undefined ? 2 * Math.PI : endAngleDw;
options = options === undefined ? {} : options;
var idealSegmentSize =
options.idealSegmentSize === undefined ? (2 * Math.PI) / 40 : options.idealSegmentSize;
var uDw = PrairieGeom.orthComp(refDw, normDw).toUnitVector();
var vDw = normDw.toUnitVector().cross(uDw);
var numSegments = Math.ceil(Math.abs(endAngleDw - startAngleDw) / idealSegmentSize);
var points = [];
var theta, p;
for (var i = 0; i <= numSegments; i++) {
theta = PrairieGeom.linearInterp(startAngleDw, endAngleDw, i / numSegments);
p = posDw.add(uDw.x(radDw * Math.cos(theta))).add(vDw.x(radDw * Math.sin(theta)));
points.push(this.pos3To2(p));
}
if (fullCircle) {
points.pop();
this.polyLine(points, true, false);
} else {
this.polyLine(points);
}
};
/*****************************************************************************/
/** Draw a circle arrow in 3D.
@param {Vector} posDw The center of the arc.
@param {number} radDw The radius of the arc.
@param {Vector} normDw (Optional) The normal vector to the plane containing the arc (default: z axis).
@param {Vector} refDw (Optional) The reference vector to measure angles from (default: x axis).
@param {number} startAngleDw (Optional) The starting angle (counterclockwise from refDw about normDw, in radians, default: 0).
@param {number} endAngleDw (Optional) The ending angle (counterclockwise from refDw about normDw, in radians, default: 2 pi).
@param {string} type (Optional) The type of the line.
@param {Object} options (Optional) Various options.
*/
PrairieDraw.prototype.circleArrow3D = function (
posDw,
radDw,
normDw,
refDw,
startAngleDw,
endAngleDw,
type,
options
) {
posDw = this.pos2To3(posDw);
normDw = normDw || Vector.k;
refDw = refDw || Vector.i;
startAngleDw = startAngleDw === undefined ? 0 : startAngleDw;
endAngleDw = endAngleDw === undefined ? 2 * Math.PI : endAngleDw;
options = options === undefined ? {} : options;
var idealSegmentSize =
options.idealSegmentSize === undefined ? (2 * Math.PI) / 40 : options.idealSegmentSize;
var uDw = PrairieGeom.orthComp(refDw, normDw).toUnitVector();
var vDw = normDw.toUnitVector().cross(uDw);
var numSegments = Math.ceil(Math.abs(endAngleDw - startAngleDw) / idealSegmentSize);
var points = [];
var theta, p;
for (var i = 0; i <= numSegments; i++) {
theta = PrairieGeom.linearInterp(startAngleDw, endAngleDw, i / numSegments);
p = posDw.add(uDw.x(radDw * Math.cos(theta))).add(vDw.x(radDw * Math.sin(theta)));
points.push(this.pos3To2(p));
}
this.polyLineArrow(points, type);
};
/** Label a circle line in 3D.
@param {string} labelText The label text.
@param {Vector} labelAnchor The label anchor (first coord -1 to 1 along the line, second -1 to 1 transverse).
@param {Vector} posDw The center of the arc.
@param {number} radDw The radius of the arc.
@param {Vector} normDw (Optional) The normal vector to the plane containing the arc (default: z axis).
@param {Vector} refDw (Optional) The reference vector to measure angles from (default: x axis).
@param {number} startAngleDw (Optional) The starting angle (counterclockwise from refDw about normDw, in radians, default: 0).
@param {number} endAngleDw (Optional) The ending angle (counterclockwise from refDw about normDw, in radians, default: 2 pi).
*/
PrairieDraw.prototype.labelCircleLine3D = function (
labelText,
labelAnchor,
posDw,
radDw,
normDw,
refDw,
startAngleDw,
endAngleDw
) {
if (labelText === undefined) {
return;
}
posDw = this.pos2To3(posDw);
normDw = normDw || Vector.k;
refDw = refDw || Vector.i;
startAngleDw = startAngleDw === undefined ? 0 : startAngleDw;
endAngleDw = endAngleDw === undefined ? 2 * Math.PI : endAngleDw;
var uDw = PrairieGeom.orthComp(refDw, normDw).toUnitVector();
var vDw = normDw.toUnitVector().cross(uDw);
var theta = PrairieGeom.linearInterp(startAngleDw, endAngleDw, (labelAnchor.e(1) + 1) / 2);
var p = posDw.add(uDw.x(radDw * Math.cos(theta))).add(vDw.x(radDw * Math.sin(theta)));
var p2Dw = this.pos3To2(p);
var t3Dw = uDw.x(-Math.sin(theta)).add(vDw.x(Math.cos(theta)));
var n3Dw = uDw.x(Math.cos(theta)).add(vDw.x(Math.sin(theta)));
var t2Px = this.vec2Px(this.vec3To2(t3Dw, p));
var n2Px = this.vec2Px(this.vec3To2(n3Dw, p));
n2Px = PrairieGeom.orthComp(n2Px, t2Px);
t2Px = t2Px.toUnitVector();
n2Px = n2Px.toUnitVector();
var oPx = t2Px.x(labelAnchor.e(1)).add(n2Px.x(labelAnchor.e(2)));
var oDw = this.vec2Dw(oPx);
var aDw = oDw.x(-1).toUnitVector();
var anchor = aDw.x(1.0 / Math.abs(aDw.max())).x(Math.abs(labelAnchor.max()));
this.text(p2Dw, anchor, labelText);
};
/*****************************************************************************/
/** Draw a sphere.
@param {Vector} posDw Position of the sphere center.
@param {number} radDw Radius of the sphere.
@param {bool} filled (Optional) Whether to fill the sphere (default: false).
*/
PrairieDraw.prototype.sphere = function (posDw, radDw, filled) {
filled = filled === undefined ? false : filled;
var posVw = this.posDwToVw(posDw);
var edgeDw = posDw.add($V([radDw, 0, 0]));
var edgeVw = this.posDwToVw(edgeDw);
var radVw = edgeVw.subtract(posVw).modulus();
var posDw2 = PrairieGeom.orthProjPos3D(posVw);
this.circle(posDw2, radVw, filled);
};
/** Draw a circular slice on a sphere.
@param {Vector} posDw Position of the sphere center.
@param {number} radDw Radius of the sphere.
@param {Vector} normDw Normal vector to the circle.
@param {number} distDw Distance from sphere center to circle center along normDw.
@param {string} drawBack (Optional) Whether to draw the back line (default: true).
@param {string} drawFront (Optional) Whether to draw the front line (default: true).
@param {Vector} refDw (Optional) The reference vector to measure angles from (default: an orthogonal vector to normDw).
@param {number} startAngleDw (Optional) The starting angle (counterclockwise from refDw about normDw, in radians, default: 0).
@param {number} endAngleDw (Optional) The ending angle (counterclockwise from refDw about normDw, in radians, default: 2 pi).
*/
PrairieDraw.prototype.sphereSlice = function (
posDw,
radDw,
normDw,
distDw,
drawBack,
drawFront,
refDw,
startAngleDw,
endAngleDw
) {
var cRDwSq = radDw * radDw - distDw * distDw;
if (cRDwSq <= 0) {
return;
}
var cRDw = Math.sqrt(cRDwSq);
var circlePosDw = posDw.add(normDw.toUnitVector().x(distDw));
drawBack = drawBack === undefined ? true : drawBack;
drawFront = drawFront === undefined ? true : drawFront;
var normVw = this.vecDwToVw(normDw);
if (PrairieGeom.orthComp(Vector.k, normVw).modulus() < 1e-10) {
// looking straight down on the circle
if (distDw > 0) {
// front side, completely visible
this.arc3D(circlePosDw, cRDw, normDw, refDw, startAngleDw, endAngleDw);
} else if (distDw < 0) {
// back side, completely invisible
this.save();
this.setShapeDrawHidden();
this.arc3D(circlePosDw, cRDw, normDw, refDw, startAngleDw, endAngleDw);
this.restore();
}
// if distDw == 0 then it's a great circle, don't draw it
return;
}
var refVw;
if (refDw === undefined) {
refVw = PrairieGeom.orthComp(Vector.k, normVw);
refDw = this.vecVwToDw(refVw);
}
refVw = this.vecDwToVw(refDw);
var uVw = refVw.toUnitVector();
var vVw = normVw.toUnitVector().cross(uVw);
var dVw = this.vecDwToVw(normDw.toUnitVector().x(distDw));
var cRVw = this.vecDwToVw(refDw.toUnitVector().x(cRDw)).modulus();
var A = -dVw.e(3);
var B = uVw.e(3) * cRVw;
var C = vVw.e(3) * cRVw;
var BCMag = Math.sqrt(B * B + C * C);
var AN = A / BCMag;
var phi = Math.atan2(C, B);
if (AN <= -1) {
// only front
if (drawFront) {
this.arc3D(circlePosDw, cRDw, normDw, refDw, startAngleDw, endAngleDw);
}
} else if (AN >= 1) {
// only back
if (drawBack && this._props.hiddenLineDraw) {
this.save();
this.setShapeDrawHidden();
this.arc3D(circlePosDw, cRDw, normDw, refDw, startAngleDw, endAngleDw);
this.restore();
}
} else {
// front and back
var acosAN = Math.acos(AN);
var theta1 = phi + acosAN;
var theta2 = phi + 2 * Math.PI - acosAN;
var i, intersections, range;
if (drawBack && this._props.hiddenLineDraw) {
this.save();
this.setShapeDrawHidden();
if (theta2 > theta1) {
if (startAngleDw === undefined || endAngleDw === undefined) {
this.arc3D(circlePosDw, cRDw, normDw, refDw, theta1, theta2);
} else {
intersections = PrairieGeom.intersectAngleRanges(
[theta1, theta2],
[startAngleDw, endAngleDw]
);
for (i = 0; i < intersections.length; i++) {
range = intersections[i];
this.arc3D(circlePosDw, cRDw, normDw, refDw, range[0], range[1]);
}
}
}
this.restore();
}
if (drawFront) {
if (startAngleDw === undefined || endAngleDw === undefined) {
this.arc3D(circlePosDw, cRDw, normDw, refDw, theta2, theta1 + 2 * Math.PI);
} else {
intersections = PrairieGeom.intersectAngleRanges(
[theta2, theta1 + 2 * Math.PI],
[startAngleDw, endAngleDw]
);
for (i = 0; i < intersections.length; i++) {
range = intersections[i];
this.arc3D(circlePosDw, cRDw, normDw, refDw, range[0], range[1]);
}
}
}
}
};
/*****************************************************************************/
/** Label an angle with an inset label.
@param {Vector} pos The corner position.
@param {Vector} p1 Position of first other point.
@param {Vector} p2 Position of second other point.
@param {string} label The label text.
*/
PrairieDraw.prototype.labelAngle = function (pos, p1, p2, label) {
pos = this.pos3To2(pos);
p1 = this.pos3To2(p1);
p2 = this.pos3To2(p2);
var v1 = p1.subtract(pos);
var v2 = p2.subtract(pos);
var vMid = v1.add(v2).x(0.5);
var anchor = vMid.x(-1.8 / PrairieGeom.supNorm(vMid));
this.text(pos, anchor, label);
};
/*****************************************************************************/
/** Draw an arc.
@param {Vector} centerDw The center of the circle.
@param {Vector} radiusDw The radius of the circle (or major axis for ellipses).
@param {number} startAngle (Optional) The start angle of the arc (radians, default: 0).
@param {number} endAngle (Optional) The end angle of the arc (radians, default: 2 pi).
@param {bool} filled (Optional) Whether to fill the arc (default: false).
@param {Number} aspect (Optional) The aspect ratio (major / minor) (default: 1).
*/
PrairieDraw.prototype.arc = function (centerDw, radiusDw, startAngle, endAngle, filled, aspect) {
startAngle = startAngle === undefined ? 0 : startAngle;
endAngle = endAngle === undefined ? 2 * Math.PI : endAngle;
filled = filled === undefined ? false : filled;
aspect = aspect === undefined ? 1 : aspect;
var centerPx = this.pos2Px(centerDw);
var offsetDw = $V([radiusDw, 0]);
var offsetPx = this.vec2Px(offsetDw);
var radiusPx = offsetPx.modulus();
var anglePx = PrairieGeom.angleOf(offsetPx);
this._ctx.save();
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.save();
this._ctx.translate(centerPx.e(1), centerPx.e(2));
this._ctx.rotate(anglePx);
this._ctx.scale(1, 1 / aspect);
this._ctx.beginPath();
this._ctx.arc(0, 0, radiusPx, -endAngle, -startAngle);
this._ctx.restore();
if (filled) {
this._ctx.fill();
}
this._ctx.stroke();
this._ctx.restore();
};
/*****************************************************************************/
/** Draw a polyLine (closed or open).
@param {Array} pointsDw A list of drawing coordinates that form the polyLine.
@param {bool} closed (Optional) Whether the shape should be closed (default: false).
@param {bool} filled (Optional) Whether the shape should be filled (default: true).
*/
PrairieDraw.prototype.polyLine = function (pointsDw, closed, filled) {
if (pointsDw.length < 2) {
return;
}
this._ctx.save();
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.beginPath();
var pDw = this.pos3To2(pointsDw[0]);
var pPx = this.pos2Px(pDw);
this._ctx.moveTo(pPx.e(1), pPx.e(2));
for (var i = 1; i < pointsDw.length; i++) {
pDw = this.pos3To2(pointsDw[i]);
pPx = this.pos2Px(pDw);
this._ctx.lineTo(pPx.e(1), pPx.e(2));
}
if (closed !== undefined && closed === true) {
this._ctx.closePath();
if (filled === undefined || filled === true) {
this._ctx.fill();
}
}
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a polyLine arrow.
@param {Array} pointsDw A list of drawing coordinates that form the polyLine.
*/
PrairieDraw.prototype.polyLineArrow = function (pointsDw, type) {
if (pointsDw.length < 2) {
return;
}
// convert the line to pixel coords and find its length
var pointsPx = [];
var i;
var polyLineLengthPx = 0;
for (i = 0; i < pointsDw.length; i++) {
pointsPx.push(this.pos2Px(this.pos3To2(pointsDw[i])));
if (i > 0) {
polyLineLengthPx += pointsPx[i].subtract(pointsPx[i - 1]).modulus();
}
}
// shorten the line to fit the arrowhead, dropping points and moving the last point
var drawArrowHead, arrowheadEndPx, arrowheadOffsetPx, arrowheadLengthPx;
if (polyLineLengthPx < 1) {
// if too short, don't draw the arrowhead
drawArrowHead = false;
} else {
drawArrowHead = true;
var arrowheadMaxLengthPx = this._props.arrowheadLengthRatio * this._props.arrowLineWidthPx;
arrowheadLengthPx = Math.min(arrowheadMaxLengthPx, polyLineLengthPx / 2);
var arrowheadCenterLengthPx = (1 - this._props.arrowheadOffsetRatio) * arrowheadLengthPx;
var lengthToRemovePx = arrowheadCenterLengthPx;
i = pointsPx.length - 1;
arrowheadEndPx = pointsPx[i];
var segmentLengthPx;
while (i > 0) {
segmentLengthPx = pointsPx[i].subtract(pointsPx[i - 1]).modulus();
if (lengthToRemovePx > segmentLengthPx) {
lengthToRemovePx -= segmentLengthPx;
pointsPx.pop();
i--;
} else {
pointsPx[i] = PrairieGeom.linearInterpVector(
pointsPx[i],
pointsPx[i - 1],
lengthToRemovePx / segmentLengthPx
);
break;
}
}
var arrowheadBasePx = pointsPx[i];
arrowheadOffsetPx = arrowheadEndPx.subtract(arrowheadBasePx);
}
// draw the line
this._ctx.save();
this._ctx.lineWidth = this._props.arrowLineWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.arrowLinePattern));
this._setLineStyles(type);
this._ctx.beginPath();
var pPx = pointsPx[0];
this._ctx.moveTo(pPx.e(1), pPx.e(2));
for (i = 1; i < pointsPx.length; i++) {
pPx = pointsPx[i];
this._ctx.lineTo(pPx.e(1), pPx.e(2));
}
this._ctx.stroke();
// draw the arrowhead
if (drawArrowHead) {
i = pointsPx[i];
this._arrowheadPx(arrowheadEndPx, arrowheadOffsetPx, arrowheadLengthPx);
}
this._ctx.restore();
};
/*****************************************************************************/
/** Draw a circle.
@param {Vector} centerDw The center in drawing coords.
@param {number} radiusDw the radius in drawing coords.
@param {bool} filled (Optional) Whether to fill the circle (default: true).
*/
PrairieDraw.prototype.circle = function (centerDw, radiusDw, filled) {
filled = filled === undefined ? true : filled;
var centerPx = this.pos2Px(centerDw);
var offsetDw = $V([radiusDw, 0]);
var offsetPx = this.vec2Px(offsetDw);
var radiusPx = offsetPx.modulus();
this._ctx.save();
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.beginPath();
this._ctx.arc(centerPx.e(1), centerPx.e(2), radiusPx, 0, 2 * Math.PI);
if (filled) {
this._ctx.fill();
}
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a filled circle.
@param {Vector} centerDw The center in drawing coords.
@param {number} radiusDw the radius in drawing coords.
*/
PrairieDraw.prototype.filledCircle = function (centerDw, radiusDw) {
var centerPx = this.pos2Px(centerDw);
var offsetDw = $V([radiusDw, 0]);
var offsetPx = this.vec2Px(offsetDw);
var radiusPx = offsetPx.modulus();
this._ctx.save();
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.fillStyle = this._props.shapeOutlineColor;
this._ctx.beginPath();
this._ctx.arc(centerPx.e(1), centerPx.e(2), radiusPx, 0, 2 * Math.PI);
this._ctx.fill();
this._ctx.restore();
};
/*****************************************************************************/
/** Draw a triagular distributed load
@param {Vector} startDw The first point (in drawing coordinates) of the distributed load
@param {Vector} endDw The end point (in drawing coordinates) of the distributed load
@param {number} sizeStartDw length of the arrow at startDw
@param {number} sizeEndDw length of the arrow at endDw
@param {string} label the arrow size at startDw
@param {string} label the arrow size at endDw
@param {boolean} true if arrow heads are towards the line that connects points startDw and endDw, opposite direction if false
@param {boolean} true if arrow points up (positive y-axis), false otherwise
*/
PrairieDraw.prototype.triangularDistributedLoad = function (
startDw,
endDw,
sizeStartDw,
sizeEndDw,
labelStart,
labelEnd,
arrowToLine,
arrowDown
) {
var LengthDw = endDw.subtract(startDw);
var L = LengthDw.modulus();
if (arrowDown) {
var sizeStartDwSign = sizeStartDw;
var sizeEndDwSign = sizeEndDw;
} else {
var sizeStartDwSign = -sizeStartDw;
var sizeEndDwSign = -sizeEndDw;
}
var nSpaces = Math.ceil((2 * L) / sizeStartDw);
var spacing = L / nSpaces;
var inc = 0;
this.save();
this.setProp('shapeOutlineColor', 'rgb(255,0,0)');
this.setProp('arrowLineWidthPx', 1);
this.setProp('arrowheadLengthRatio', 11);
if (arrowToLine) {
this.line(startDw.add($V([0, sizeStartDwSign])), endDw.add($V([0, sizeEndDwSign])));
var startArrow = startDw.add($V([0, sizeStartDwSign]));
var endArrow = startDw;
for (i = 0; i <= nSpaces; i++) {
this.arrow(
startArrow.add($V([inc, (inc * (sizeEndDwSign - sizeStartDwSign)) / L])),
endArrow.add($V([inc, 0]))
);
inc = inc + spacing;
}
this.text(startArrow, $V([2, 0]), labelStart);
this.text(
startArrow.add(
$V([inc - spacing, ((inc - spacing) * (sizeEndDwSign - sizeStartDwSign)) / L])
),
$V([-2, 0]),
labelEnd
);
} else {
this.line(startDw, endDw);
var startArrow = startDw;
var endArrow = startDw.subtract($V([0, sizeStartDwSign]));
for (i = 0; i <= nSpaces; i++) {
this.arrow(
startArrow.add($V([inc, 0])),
endArrow.add($V([inc, (-inc * (sizeEndDwSign - sizeStartDwSign)) / L]))
);
inc = inc + spacing;
}
this.text(endArrow, $V([2, 0]), labelStart);
this.text(
endArrow.add(
$V([inc - spacing, (-(inc - spacing) * (sizeEndDwSign - sizeStartDwSign)) / L])
),
$V([-2, 0]),
labelEnd
);
}
this.restore();
};
/*****************************************************************************/
/** Draw a rod with hinge points at start and end and the given width.
@param {Vector} startDw The first hinge point (center of circular end) in drawing coordinates.
@param {Vector} startDw The second hinge point (drawing coordinates).
@param {number} widthDw The width of the rod (drawing coordinates).
*/
PrairieDraw.prototype.rod = function (startDw, endDw, widthDw) {
var offsetLengthDw = endDw.subtract(startDw);
var offsetWidthDw = offsetLengthDw
.rotate(Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(widthDw);
var startPx = this.pos2Px(startDw);
var offsetLengthPx = this.vec2Px(offsetLengthDw);
var offsetWidthPx = this.vec2Px(offsetWidthDw);
var lengthPx = offsetLengthPx.modulus();
var rPx = offsetWidthPx.modulus() / 2;
this._ctx.save();
this._ctx.translate(startPx.e(1), startPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(offsetLengthPx));
this._ctx.beginPath();
this._ctx.moveTo(0, rPx);
this._ctx.arcTo(lengthPx + rPx, rPx, lengthPx + rPx, -rPx, rPx);
this._ctx.arcTo(lengthPx + rPx, -rPx, 0, -rPx, rPx);
this._ctx.arcTo(-rPx, -rPx, -rPx, rPx, rPx);
this._ctx.arcTo(-rPx, rPx, 0, rPx, rPx);
if (this._props.shapeInsideColor !== 'none') {
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.fill();
}
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a L-shape rod with hinge points at start, center and end, and the given width.
@param {Vector} startDw The first hinge point (center of circular end) in drawing coordinates.
@param {Vector} centerDw The second hinge point (drawing coordinates).
@param {Vector} endDw The third hinge point (drawing coordinates).
@param {number} widthDw The width of the rod (drawing coordinates).
*/
PrairieDraw.prototype.LshapeRod = function (startDw, centerDw, endDw, widthDw) {
var offsetLength1Dw = centerDw.subtract(startDw);
var offsetLength2Dw = endDw.subtract(centerDw);
var offsetWidthDw = offsetLength1Dw
.rotate(Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(widthDw);
var startPx = this.pos2Px(startDw);
var centerPx = this.pos2Px(centerDw);
var endPx = this.pos2Px(endDw);
var offsetLength1Px = this.vec2Px(offsetLength1Dw);
var offsetLength2Px = this.vec2Px(offsetLength2Dw);
var offsetWidthPx = this.vec2Px(offsetWidthDw);
var length1Px = offsetLength1Px.modulus();
var length2Px = offsetLength2Px.modulus();
var rPx = offsetWidthPx.modulus() / 2;
this._ctx.save();
this._ctx.translate(startPx.e(1), startPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(offsetLength1Px));
this._ctx.beginPath();
this._ctx.moveTo(0, rPx);
var beta = -PrairieGeom.angleFrom(offsetLength1Px, offsetLength2Px);
var x1 = length1Px + rPx / Math.sin(beta) - rPx / Math.tan(beta);
var y1 = rPx;
var x2 = length1Px + length2Px * Math.cos(beta);
var y2 = -length2Px * Math.sin(beta);
var x3 = x2 + rPx * Math.sin(beta);
var y3 = y2 + rPx * Math.cos(beta);
var x4 = x3 + rPx * Math.cos(beta);
var y4 = y3 - rPx * Math.sin(beta);
var x5 = x2 + rPx * Math.cos(beta);
var y5 = y2 - rPx * Math.sin(beta);
var x6 = x5 - rPx * Math.sin(beta);
var y6 = y5 - rPx * Math.cos(beta);
var x7 = length1Px - rPx / Math.sin(beta) + rPx / Math.tan(beta);
var y7 = -rPx;
this._ctx.arcTo(x1, y1, x3, y3, rPx);
this._ctx.arcTo(x4, y4, x5, y5, rPx);
this._ctx.arcTo(x6, y6, x7, y7, rPx);
this._ctx.arcTo(x7, y7, 0, -rPx, rPx);
this._ctx.arcTo(-rPx, -rPx, -rPx, rPx, rPx);
this._ctx.arcTo(-rPx, rPx, 0, rPx, rPx);
if (this._props.shapeInsideColor !== 'none') {
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.fill();
}
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a T-shape rod with hinge points at start, center, center-end and end, and the given width.
@param {Vector} startDw The first hinge point (center of circular end) in drawing coordinates.
@param {Vector} centerDw The second hinge point (drawing coordinates).
@param {Vector} endDw The third hinge point (drawing coordinates).
@param {Vector} centerEndDw The fourth hinge point (drawing coordinates).
@param {number} widthDw The width of the rod (drawing coordinates).
*/
PrairieDraw.prototype.TshapeRod = function (startDw, centerDw, endDw, centerEndDw, widthDw) {
var offsetStartRodDw = centerDw.subtract(startDw);
var offsetEndRodDw = endDw.subtract(centerDw);
var offsetCenterRodDw = centerEndDw.subtract(centerDw);
var offsetWidthDw = offsetStartRodDw
.rotate(Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(widthDw);
var startPx = this.pos2Px(startDw);
var centerPx = this.pos2Px(centerDw);
var endPx = this.pos2Px(endDw);
var offsetStartRodPx = this.vec2Px(offsetStartRodDw);
var offsetEndRodPx = this.vec2Px(offsetEndRodDw);
var offsetCenterRodPx = this.vec2Px(offsetCenterRodDw);
var offsetWidthPx = this.vec2Px(offsetWidthDw);
var lengthStartRodPx = offsetStartRodPx.modulus();
var lengthEndRodPx = offsetEndRodPx.modulus();
var lengthCenterRodPx = offsetCenterRodPx.modulus();
var rPx = offsetWidthPx.modulus() / 2;
this._ctx.save();
this._ctx.translate(startPx.e(1), startPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(offsetStartRodPx));
this._ctx.beginPath();
this._ctx.moveTo(0, rPx);
var angleStartToEnd = PrairieGeom.angleFrom(offsetStartRodPx, offsetEndRodPx);
var angleEndToCenter = PrairieGeom.angleFrom(offsetEndRodPx, offsetCenterRodPx);
if (Math.abs(angleEndToCenter) < Math.PI) {
var length1Px = lengthStartRodPx;
var length2Px = lengthEndRodPx;
var length3Px = lengthCenterRodPx;
var beta = -angleStartToEnd;
var alpha = -angleEndToCenter;
} else {
var length1Px = lengthStartRodPx;
var length2Px = lengthCenterRodPx;
var length3Px = lengthEndRodPx;
var beta = -PrairieGeom.angleFrom(offsetStartRodPx, offsetCenterRodPx);
var alpha = angleEndToCenter;
}
var x1 = length1Px + rPx / Math.sin(beta) - rPx / Math.tan(beta);
var y1 = rPx;
var x2 = length1Px + length2Px * Math.cos(beta);
var y2 = -length2Px * Math.sin(beta);
var x3 = x2 + rPx * Math.sin(beta);
var y3 = y2 + rPx * Math.cos(beta);
var x4 = x3 + rPx * Math.cos(beta);
var y4 = y3 - rPx * Math.sin(beta);
var x5 = x2 + rPx * Math.cos(beta);
var y5 = y2 - rPx * Math.sin(beta);
var x6 = x5 - rPx * Math.sin(beta);
var y6 = y5 - rPx * Math.cos(beta);
var x7 =
length1Px +
rPx * Math.cos(beta) * (1 / Math.sin(alpha) + 1 / Math.tan(alpha) - Math.tan(beta));
var y7 =
-rPx / Math.cos(beta) -
rPx * Math.sin(beta) * (1 / Math.sin(alpha) + 1 / Math.tan(alpha) - Math.tan(beta));
var x8 = length1Px + length3Px * Math.cos(beta + alpha);
var y8 = -length3Px * Math.sin(beta + alpha);
var x9 = x8 + rPx * Math.sin(beta + alpha);
var y9 = y8 + rPx * Math.cos(beta + alpha);
var x10 = x9 + rPx * Math.cos(beta + alpha);
var y10 = y9 - rPx * Math.sin(beta + alpha);
var x11 = x8 + rPx * Math.cos(beta + alpha);
var y11 = y8 - rPx * Math.sin(beta + alpha);
var x12 = x11 - rPx * Math.sin(beta + alpha);
var y12 = y11 - rPx * Math.cos(beta + alpha);
var x13 = length1Px - rPx / Math.sin(beta + alpha) + rPx / Math.tan(beta + alpha);
var y13 = -rPx;
this._ctx.arcTo(x1, y1, x3, y3, rPx);
this._ctx.arcTo(x4, y4, x5, y5, rPx);
this._ctx.arcTo(x6, y6, x7, y7, rPx);
this._ctx.arcTo(x7, y7, x9, y9, rPx);
this._ctx.arcTo(x10, y10, x11, y11, rPx);
this._ctx.arcTo(x12, y12, x13, y13, rPx);
this._ctx.arcTo(x13, y13, 0, -rPx, rPx);
this._ctx.arcTo(-rPx, -rPx, -rPx, rPx, rPx);
this._ctx.arcTo(-rPx, rPx, 0, rPx, rPx);
if (this._props.shapeInsideColor !== 'none') {
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.fill();
}
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a pivot.
@param {Vector} baseDw The center of the base (drawing coordinates).
@param {Vector} hingeDw The hinge point (center of circular end) in drawing coordinates.
@param {number} widthDw The width of the pivot (drawing coordinates).
*/
PrairieDraw.prototype.pivot = function (baseDw, hingeDw, widthDw) {
var offsetLengthDw = hingeDw.subtract(baseDw);
var offsetWidthDw = offsetLengthDw
.rotate(Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(widthDw);
var basePx = this.pos2Px(baseDw);
var offsetLengthPx = this.vec2Px(offsetLengthDw);
var offsetWidthPx = this.vec2Px(offsetWidthDw);
var lengthPx = offsetLengthPx.modulus();
var rPx = offsetWidthPx.modulus() / 2;
this._ctx.save();
this._ctx.translate(basePx.e(1), basePx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(offsetLengthPx));
this._ctx.beginPath();
this._ctx.moveTo(0, rPx);
this._ctx.arcTo(lengthPx + rPx, rPx, lengthPx + rPx, -rPx, rPx);
this._ctx.arcTo(lengthPx + rPx, -rPx, 0, -rPx, rPx);
this._ctx.lineTo(0, -rPx);
this._ctx.closePath();
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.fill();
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a square with a given base point and center.
@param {Vector} baseDw The mid-point of the base (drawing coordinates).
@param {Vector} centerDw The center of the square (drawing coordinates).
*/
PrairieDraw.prototype.square = function (baseDw, centerDw) {
var basePx = this.pos2Px(baseDw);
var centerPx = this.pos2Px(centerDw);
var offsetPx = centerPx.subtract(basePx);
var rPx = offsetPx.modulus();
this._ctx.save();
this._ctx.translate(basePx.e(1), basePx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(offsetPx));
this._ctx.beginPath();
this._ctx.rect(0, -rPx, 2 * rPx, 2 * rPx);
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.shapeOutlineColor;
this._ctx.fillStyle = this._props.shapeInsideColor;
this._ctx.fill();
this._ctx.stroke();
this._ctx.restore();
};
/** Draw an axis-aligned rectangle with a given width and height, centered at the origin.
@param {number} widthDw The width of the rectangle.
@param {number} heightDw The height of the rectangle.
@param {number} centerDw Optional: The center of the rectangle (default: the origin).
@param {number} angleDw Optional: The rotation angle of the rectangle (default: zero).
@param {bool} filled Optional: Whether to fill the rectangle (default: true).
*/
PrairieDraw.prototype.rectangle = function (widthDw, heightDw, centerDw, angleDw, filled) {
centerDw = centerDw === undefined ? $V([0, 0]) : centerDw;
angleDw = angleDw === undefined ? 0 : angleDw;
var pointsDw = [
$V([-widthDw / 2, -heightDw / 2]),
$V([widthDw / 2, -heightDw / 2]),
$V([widthDw / 2, heightDw / 2]),
$V([-widthDw / 2, heightDw / 2]),
];
var closed = true;
filled = filled === undefined ? true : filled;
this.save();
this.translate(centerDw);
this.rotate(angleDw);
this.polyLine(pointsDw, closed, filled);
this.restore();
};
/** Draw a rectangle with the given corners and height.
@param {Vector} pos1Dw First corner of the rectangle.
@param {Vector} pos2Dw Second corner of the rectangle.
@param {number} heightDw The height of the rectangle.
*/
PrairieDraw.prototype.rectangleGeneric = function (pos1Dw, pos2Dw, heightDw) {
var dDw = PrairieGeom.perp(pos2Dw.subtract(pos1Dw)).toUnitVector().x(heightDw);
var pointsDw = [pos1Dw, pos2Dw, pos2Dw.add(dDw), pos1Dw.add(dDw)];
var closed = true;
this.polyLine(pointsDw, closed);
};
/** Draw a ground element.
@param {Vector} posDw The position of the ground center (drawing coordinates).
@param {Vector} normDw The outward normal (drawing coordinates).
@param (number} lengthDw The total length of the ground segment.
*/
PrairieDraw.prototype.ground = function (posDw, normDw, lengthDw) {
var tangentDw = normDw
.rotate(Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(lengthDw);
var posPx = this.pos2Px(posDw);
var normPx = this.vec2Px(normDw);
var tangentPx = this.vec2Px(tangentDw);
var lengthPx = tangentPx.modulus();
var groundDepthPx = Math.min(lengthPx, this._props.groundDepthPx);
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(normPx) - Math.PI / 2);
this._ctx.beginPath();
this._ctx.rect(-lengthPx / 2, -groundDepthPx, lengthPx, groundDepthPx);
this._ctx.fillStyle = this._props.groundInsideColor;
this._ctx.fill();
this._ctx.beginPath();
this._ctx.moveTo(-lengthPx / 2, 0);
this._ctx.lineTo(lengthPx / 2, 0);
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.groundOutlineColor;
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a ground element with hashed shading.
@param {Vector} posDw The position of the ground center (drawing coords).
@param {Vector} normDw The outward normal (drawing coords).
@param (number} lengthDw The total length of the ground segment (drawing coords).
@param {number} offsetDw (Optional) The offset of the shading (drawing coords).
*/
PrairieDraw.prototype.groundHashed = function (posDw, normDw, lengthDw, offsetDw) {
offsetDw = offsetDw === undefined ? 0 : offsetDw;
var tangentDw = normDw
.rotate(Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(lengthDw);
var offsetVecDw = tangentDw.toUnitVector().x(offsetDw);
var posPx = this.pos2Px(posDw);
var normPx = this.vec2Px(normDw);
var tangentPx = this.vec2Px(tangentDw);
var lengthPx = tangentPx.modulus();
var offsetVecPx = this.vec2Px(offsetVecDw);
var offsetPx = offsetVecPx.modulus() * PrairieGeom.sign(offsetDw);
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(normPx) + Math.PI / 2);
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.groundOutlineColor;
this._ctx.beginPath();
this._ctx.moveTo(-lengthPx / 2, 0);
this._ctx.lineTo(lengthPx / 2, 0);
this._ctx.stroke();
var startX = offsetPx % this._props.groundSpacingPx;
var x = startX;
while (x < lengthPx / 2) {
this._ctx.beginPath();
this._ctx.moveTo(x, 0);
this._ctx.lineTo(x - this._props.groundWidthPx, this._props.groundDepthPx);
this._ctx.stroke();
x += this._props.groundSpacingPx;
}
x = startX - this._props.groundSpacingPx;
while (x > -lengthPx / 2) {
this._ctx.beginPath();
this._ctx.moveTo(x, 0);
this._ctx.lineTo(x - this._props.groundWidthPx, this._props.groundDepthPx);
this._ctx.stroke();
x -= this._props.groundSpacingPx;
}
this._ctx.restore();
};
/** Draw an arc ground element.
@param {Vector} centerDw The center of the circle.
@param {Vector} radiusDw The radius of the circle.
@param {number} startAngle (Optional) The start angle of the arc (radians, default: 0).
@param {number} endAngle (Optional) The end angle of the arc (radians, default: 2 pi).
@param {bool} outside (Optional) Whether to draw the ground outside the curve (default: true).
*/
PrairieDraw.prototype.arcGround = function (centerDw, radiusDw, startAngle, endAngle, outside) {
startAngle = startAngle === undefined ? 0 : startAngle;
endAngle = endAngle === undefined ? 2 * Math.PI : endAngle;
outside = outside === undefined ? true : outside;
var centerPx = this.pos2Px(centerDw);
var offsetDw = $V([radiusDw, 0]);
var offsetPx = this.vec2Px(offsetDw);
var radiusPx = offsetPx.modulus();
var groundDepthPx = Math.min(radiusPx, this._props.groundDepthPx);
var groundOffsetPx = outside ? groundDepthPx : -groundDepthPx;
this._ctx.save();
// fill the shaded area
this._ctx.beginPath();
this._ctx.arc(centerPx.e(1), centerPx.e(2), radiusPx, -endAngle, -startAngle, false);
this._ctx.arc(
centerPx.e(1),
centerPx.e(2),
radiusPx + groundOffsetPx,
-startAngle,
-endAngle,
true
);
this._ctx.fillStyle = this._props.groundInsideColor;
this._ctx.fill();
// draw the ground surface
this._ctx.beginPath();
this._ctx.arc(centerPx.e(1), centerPx.e(2), radiusPx, -endAngle, -startAngle);
this._ctx.lineWidth = this._props.shapeStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.shapeStrokePattern));
this._ctx.strokeStyle = this._props.groundOutlineColor;
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a center-of-mass object.
@param {Vector} posDw The position of the center of mass.
*/
PrairieDraw.prototype.centerOfMass = function (posDw) {
var posPx = this.pos2Px(posDw);
var r = this._props.centerOfMassRadiusPx;
this._ctx.save();
this._ctx.lineWidth = this._props.centerOfMassStrokeWidthPx;
this._ctx.strokeStyle = this._props.centerOfMassColor;
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.beginPath();
this._ctx.moveTo(-r, 0);
this._ctx.lineTo(r, 0);
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.moveTo(0, -r);
this._ctx.lineTo(0, r);
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.arc(0, 0, r, 0, 2 * Math.PI);
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a measurement line.
@param {Vector} startDw The start position of the measurement.
@param {Vector} endDw The end position of the measurement.
@param {string} text The measurement label.
*/
PrairieDraw.prototype.measurement = function (startDw, endDw, text) {
var startPx = this.pos2Px(startDw);
var endPx = this.pos2Px(endDw);
var offsetPx = endPx.subtract(startPx);
var d = offsetPx.modulus();
var h = this._props.measurementEndLengthPx;
var o = this._props.measurementOffsetPx;
this._ctx.save();
this._ctx.lineWidth = this._props.measurementStrokeWidthPx;
this._ctx.setLineDash(this._dashPattern(this._props.measurementStrokePattern));
this._ctx.strokeStyle = this._props.measurementColor;
this._ctx.translate(startPx.e(1), startPx.e(2));
this._ctx.rotate(PrairieGeom.angleOf(offsetPx));
this._ctx.beginPath();
this._ctx.moveTo(0, o);
this._ctx.lineTo(0, o + h);
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.moveTo(d, o);
this._ctx.lineTo(d, o + h);
this._ctx.stroke();
this._ctx.beginPath();
this._ctx.moveTo(0, o + h / 2);
this._ctx.lineTo(d, o + h / 2);
this._ctx.stroke();
this._ctx.restore();
var orthPx = offsetPx
.rotate(-Math.PI / 2, $V([0, 0]))
.toUnitVector()
.x(-o - h / 2);
var lineStartPx = startPx.add(orthPx);
var lineEndPx = endPx.add(orthPx);
var lineStartDw = this.pos2Dw(lineStartPx);
var lineEndDw = this.pos2Dw(lineEndPx);
this.labelLine(lineStartDw, lineEndDw, $V([0, -1]), text);
};
/** Draw a right angle.
@param {Vector} posDw The position angle point.
@param {Vector} dirDw The baseline direction (angle is counter-clockwise from this direction in 2D).
@param {Vector} normDw (Optional) The third direction (required for 3D).
*/
PrairieDraw.prototype.rightAngle = function (posDw, dirDw, normDw) {
if (dirDw.modulus() < 1e-20) {
return;
}
var posPx, dirPx, normPx;
if (posDw.elements.length === 3) {
posPx = this.pos2Px(this.pos3To2(posDw));
var d = this.vec2To3(this.vec2Dw($V([this._props.rightAngleSizePx, 0]))).modulus();
dirPx = this.vec2Px(this.vec3To2(dirDw.toUnitVector().x(d), posDw));
normPx = this.vec2Px(this.vec3To2(normDw.toUnitVector().x(d), posDw));
} else {
posPx = this.pos2Px(posDw);
dirPx = this.vec2Px(dirDw).toUnitVector().x(this._props.rightAngleSizePx);
if (normDw !== undefined) {
normPx = this.vec2Px(normDw).toUnitVector().x(this._props.rightAngleSizePx);
} else {
normPx = dirPx.rotate(-Math.PI / 2, $V([0, 0]));
}
}
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.lineWidth = this._props.rightAngleStrokeWidthPx;
this._ctx.strokeStyle = this._props.rightAngleColor;
this._ctx.beginPath();
this._ctx.moveTo(dirPx.e(1), dirPx.e(2));
this._ctx.lineTo(dirPx.e(1) + normPx.e(1), dirPx.e(2) + normPx.e(2));
this._ctx.lineTo(normPx.e(1), normPx.e(2));
this._ctx.stroke();
this._ctx.restore();
};
/** Draw a right angle (improved version).
@param {Vector} p0Dw The base point.
@param {Vector} p1Dw The first other point.
@param {Vector} p2Dw The second other point.
*/
PrairieDraw.prototype.rightAngleImproved = function (p0Dw, p1Dw, p2Dw) {
var p0Px = this.pos2Px(this.pos3To2(p0Dw));
var p1Px = this.pos2Px(this.pos3To2(p1Dw));
var p2Px = this.pos2Px(this.pos3To2(p2Dw));
var d1Px = p1Px.subtract(p0Px);
var d2Px = p2Px.subtract(p0Px);
var minDLen = Math.min(d1Px.modulus(), d2Px.modulus());
if (minDLen < 1e-10) {
return;
}
var rightAngleSizePx = Math.min(minDLen / 2, this._props.rightAngleSizePx);
d1Px = d1Px.toUnitVector().x(rightAngleSizePx);
d2Px = d2Px.toUnitVector().x(rightAngleSizePx);
p1Px = p0Px.add(d1Px);
p2Px = p0Px.add(d2Px);
var p12Px = p1Px.add(d2Px);
this._ctx.save();
this._ctx.lineWidth = this._props.rightAngleStrokeWidthPx;
this._ctx.strokeStyle = this._props.rightAngleColor;
this._ctx.beginPath();
this._ctx.moveTo(p1Px.e(1), p1Px.e(2));
this._ctx.lineTo(p12Px.e(1), p12Px.e(2));
this._ctx.lineTo(p2Px.e(1), p2Px.e(2));
this._ctx.stroke();
this._ctx.restore();
};
/*****************************************************************************/
/** Draw text.
@param {Vector} posDw The position to draw at.
@param {Vector} anchor The anchor on the text that will be located at pos (in -1 to 1 local coordinates).
@param {string} text The text to draw. If text begins with "TEX:" then it is interpreted as LaTeX.
@param {bool} boxed (Optional) Whether to draw a white box behind the text (default: false).
@param {Number} angle (Optional) The rotation angle (radians, default: 0).
*/
PrairieDraw.prototype.text = function (posDw, anchor, text, boxed, angle) {
if (text === undefined) {
return;
}
boxed = boxed === undefined ? false : boxed;
angle = angle === undefined ? 0 : angle;
var posPx = this.pos2Px(this.pos3To2(posDw));
var offsetPx;
if (text.length >= 4 && text.slice(0, 4) === 'TEX:') {
var texText = text.slice(4);
var hash = Sha1.hash(texText);
this._texts = this._texts || {};
var img;
if (hash in this._texts) {
img = this._texts[hash];
var xPx = (-(anchor.e(1) + 1) / 2) * img.width;
var yPx = ((anchor.e(2) - 1) / 2) * img.height;
//var offsetPx = anchor.toUnitVector().x(Math.abs(anchor.max()) * this._props.textOffsetPx);
offsetPx = anchor.x(this._props.textOffsetPx);
var textBorderPx = 5;
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.rotate(angle);
if (boxed) {
this._ctx.save();
this._ctx.fillStyle = 'white';
this._ctx.fillRect(
xPx - offsetPx.e(1) - textBorderPx,
yPx + offsetPx.e(2) - textBorderPx,
img.width + 2 * textBorderPx,
img.height + 2 * textBorderPx
);
this._ctx.restore();
}
this._ctx.drawImage(img, xPx - offsetPx.e(1), yPx + offsetPx.e(2));
this._ctx.restore();
} else {
var imgSrc = 'text/' + hash + '.png';
img = new Image();
var that = this;
img.onload = function () {
that.redraw();
if (that.trigger) {
that.trigger('imgLoad');
}
};
img.src = imgSrc;
this._texts[hash] = img;
}
} else {
var align, baseline, bbRelOffset;
/* jshint indent: false */
switch (PrairieGeom.sign(anchor.e(1))) {
case -1:
align = 'left';
bbRelOffset = 0;
break;
case 0:
align = 'center';
bbRelOffset = 0.5;
break;
case 1:
align = 'right';
bbRelOffset = 1;
break;
}
switch (PrairieGeom.sign(anchor.e(2))) {
case -1:
baseline = 'bottom';
break;
case 0:
baseline = 'middle';
break;
case 1:
baseline = 'top';
break;
}
this.save();
this._ctx.textAlign = align;
this._ctx.textBaseline = baseline;
this._ctx.translate(posPx.e(1), posPx.e(2));
offsetPx = anchor.toUnitVector().x(Math.abs(anchor.max()) * this._props.textOffsetPx);
var drawPx = $V([-offsetPx.e(1), offsetPx.e(2)]);
var metrics = this._ctx.measureText(text);
var d = this._props.textOffsetPx;
//var bb0 = drawPx.add($V([-metrics.actualBoundingBoxLeft - d, -metrics.actualBoundingBoxAscent - d]));
//var bb1 = drawPx.add($V([metrics.actualBoundingBoxRight + d, metrics.actualBoundingBoxDescent + d]));
var textHeight = this._props.textFontSize;
var bb0 = drawPx.add($V([-bbRelOffset * metrics.width - d, -d]));
var bb1 = drawPx.add($V([(1 - bbRelOffset) * metrics.width + d, textHeight + d]));
if (boxed) {
this._ctx.save();
this._ctx.fillStyle = 'white';
this._ctx.fillRect(bb0.e(1), bb0.e(2), bb1.e(1) - bb0.e(1), bb1.e(2) - bb0.e(2));
this._ctx.restore();
}
this._ctx.font = this._props.textFontSize.toString() + 'px serif';
this._ctx.fillText(text, drawPx.e(1), drawPx.e(2));
this.restore();
}
};
/** Draw text to label a line.
@param {Vector} startDw The start position of the line.
@param {Vector} endDw The end position of the line.
@param {Vector} pos The position relative to the line (-1 to 1 local coordinates, x along the line, y orthogonal).
@param {string} text The text to draw.
@param {Vector} anchor (Optional) The anchor position on the text.
*/
PrairieDraw.prototype.labelLine = function (startDw, endDw, pos, text, anchor) {
if (text === undefined) {
return;
}
startDw = this.pos3To2(startDw);
endDw = this.pos3To2(endDw);
var midpointDw = startDw.add(endDw).x(0.5);
var offsetDw = endDw.subtract(startDw).x(0.5);
var pDw = midpointDw.add(offsetDw.x(pos.e(1)));
var u1Dw = offsetDw.toUnitVector();
var u2Dw = u1Dw.rotate(Math.PI / 2, $V([0, 0]));
var oDw = u1Dw.x(pos.e(1)).add(u2Dw.x(pos.e(2)));
var a = oDw.x(-1).toUnitVector().x(Math.abs(pos.max()));
if (anchor !== undefined) {
a = anchor;
}
this.text(pDw, a, text);
};
/** Draw text to label a circle line.
@param {Vector} posDw The center of the circle line.
@param {number} radDw The radius at the mid-angle.
@param {number} startAngleDw The starting angle (counterclockwise from x axis, in radians).
@param {number} endAngleDw The ending angle (counterclockwise from x axis, in radians).
@param {Vector} pos The position relative to the line (-1 to 1 local coordinates, x along the line, y orthogonal).
@param {string} text The text to draw.
@param {bool} fixedRad (Optional) Whether to use a fixed radius (default: false).
*/
PrairieDraw.prototype.labelCircleLine = function (
posDw,
radDw,
startAngleDw,
endAngleDw,
pos,
text,
fixedRad
) {
// convert to Px coordinates
var startOffsetDw = PrairieGeom.vector2DAtAngle(startAngleDw).x(radDw);
var posPx = this.pos2Px(posDw);
var startOffsetPx = this.vec2Px(startOffsetDw);
var radiusPx = startOffsetPx.modulus();
var startAnglePx = PrairieGeom.angleOf(startOffsetPx);
var deltaAngleDw = endAngleDw - startAngleDw;
// assume a possibly reflected/rotated but equally scaled Dw/Px transformation
var deltaAnglePx = this._transIsReflection() ? -deltaAngleDw : deltaAngleDw;
var endAnglePx = startAnglePx + deltaAnglePx;
var textAnglePx =
((1.0 - pos.e(1)) / 2.0) * startAnglePx + ((1.0 + pos.e(1)) / 2.0) * endAnglePx;
var u1Px = PrairieGeom.vector2DAtAngle(textAnglePx);
var u2Px = u1Px.rotate(-Math.PI / 2, $V([0, 0]));
var u1Dw = this.vec2Dw(u1Px).toUnitVector();
var u2Dw = this.vec2Dw(u2Px).toUnitVector();
var oDw = u1Dw.x(pos.e(2)).add(u2Dw.x(pos.e(1)));
var aDw = oDw.x(-1).toUnitVector();
var a = aDw.x(1.0 / Math.abs(aDw.max())).x(Math.abs(pos.max()));
var rPx = this._circleArrowRadius(radiusPx, textAnglePx, startAnglePx, endAnglePx, fixedRad);
var pPx = u1Px.x(rPx).add(posPx);
var pDw = this.pos2Dw(pPx);
this.text(pDw, a, text);
};
/** Find the anchor for the intersection of several lines.
@param {Vector} labelPoint The point to be labeled.
@param {Array} points The end of the lines that meet at labelPoint.
@return {Vector} The anchor offset.
*/
PrairieDraw.prototype.findAnchorForIntersection = function (labelPointDw, pointsDw) {
// find the angles on the unit circle for each of the lines
var labelPointPx = this.pos2Px(this.pos3To2(labelPointDw));
var i, v;
var angles = [];
for (i = 0; i < pointsDw.length; i++) {
v = this.pos2Px(this.pos3To2(pointsDw[i])).subtract(labelPointPx);
v = $V([v.e(1), -v.e(2)]);
if (v.modulus() > 1e-6) {
angles.push(PrairieGeom.angleOf(v));
}
}
if (angles.length === 0) {
return $V([1, 0]);
}
// save the first angle to tie-break later
var tieBreakAngle = angles[0];
// find the biggest gap between angles (might be multiple)
angles.sort(function (a, b) {
return a - b;
});
var maxAngleDiff = angles[0] - angles[angles.length - 1] + 2 * Math.PI;
var maxIs = [0];
var angleDiff;
for (i = 1; i < angles.length; i++) {
angleDiff = angles[i] - angles[i - 1];
if (angleDiff > maxAngleDiff - 1e-6) {
if (angleDiff > maxAngleDiff + 1e-6) {
// we are clearly greater
maxAngleDiff = angleDiff;
maxIs = [i];
} else {
// we are basically equal
maxIs.push(i);
}
}
}
// tie-break by choosing the first angle CCW from the tieBreakAngle
var minCCWDiff = 2 * Math.PI;
var angle, bestAngle;
for (i = 0; i < maxIs.length; i++) {
angle = angles[maxIs[i]] - maxAngleDiff / 2;
angleDiff = angle - tieBreakAngle;
if (angleDiff < 0) {
angleDiff += 2 * Math.PI;
}
if (angleDiff < minCCWDiff) {
minCCWDiff = angleDiff;
bestAngle = angle;
}
}
// find anchor from bestAngle
var dir = PrairieGeom.vector2DAtAngle(bestAngle);
dir = dir.x(1 / PrairieGeom.supNorm(dir));
return dir.x(-1);
};
/** Label the intersection of several lines.
@param {Vector} labelPoint The point to be labeled.
@param {Array} points The end of the lines that meet at labelPoint.
@param {String} label The label text.
@param {Number} scaleOffset (Optional) Scale factor for the offset (default: 1).
*/
PrairieDraw.prototype.labelIntersection = function (labelPoint, points, label, scaleOffset) {
scaleOffset = scaleOffset === undefined ? 1 : scaleOffset;
var anchor = this.findAnchorForIntersection(labelPoint, points);
this.text(labelPoint, anchor.x(scaleOffset), label);
};
/*****************************************************************************/
PrairieDraw.prototype.clearHistory = function (name) {
if (name in this._history) {
delete this._history[name];
} else {
console.log('WARNING: history not found: ' + name);
}
};
PrairieDraw.prototype.clearAllHistory = function () {
this._history = {};
};
/** Save the history of a data value.
@param {string} name The history variable name.
@param {number} dt The time resolution to save at.
@param {number} maxTime The maximum age of history to save.
@param {number} curTime The current time.
@param {object} curValue The current data value.
@return {Array} A history array of vectors of the form [time, value].
*/
PrairieDraw.prototype.history = function (name, dt, maxTime, curTime, curValue) {
if (!(name in this._history)) {
this._history[name] = [[curTime, curValue]];
} else {
var h = this._history[name];
if (h.length < 2) {
h.push([curTime, curValue]);
} else {
var prevPrevTime = h[h.length - 2][0];
if (curTime - prevPrevTime < dt) {
// new time jump will still be short, replace the last record
h[h.length - 1] = [curTime, curValue];
} else {
// new time jump would be too long, just add the new record
h.push([curTime, curValue]);
}
}
// discard old values as necessary
var i = 0;
while (curTime - h[i][0] > maxTime && i < h.length - 1) {
i++;
}
if (i > 0) {
this._history[name] = h.slice(i);
}
}
return this._history[name];
};
PrairieDraw.prototype.pairsToVectors = function (pairArray) {
var vectorArray = [];
for (var i = 0; i < pairArray.length; i++) {
vectorArray.push($V(pairArray[i]));
}
return vectorArray;
};
PrairieDraw.prototype.historyToTrace = function (data) {
var trace = [];
for (var i = 0; i < data.length; i++) {
trace.push(data[i][1]);
}
return trace;
};
/** Plot a history sequence.
@param {Vector} originDw The lower-left position of the axes.
@param {Vector} sizeDw The size of the axes (vector from lower-left to upper-right).
@param {Vector} sizeData The size of the axes in data coordinates.
@param {number} timeOffset The horizontal position for the current time.
@param {string} yLabel The vertical axis label.
@param {Array} data An array of [time, value] arrays to plot.
@param {string} type (Optional) The type of line being drawn.
*/
PrairieDraw.prototype.plotHistory = function (
originDw,
sizeDw,
sizeData,
timeOffset,
yLabel,
data,
type
) {
var scale = $V([sizeDw.e(1) / sizeData.e(1), sizeDw.e(2) / sizeData.e(2)]);
var lastTime = data[data.length - 1][0];
var offset = $V([timeOffset - lastTime, 0]);
var plotData = PrairieGeom.scalePoints(
PrairieGeom.translatePoints(this.pairsToVectors(data), offset),
scale
);
this.save();
this.translate(originDw);
this.save();
this.setProp('arrowLineWidthPx', 1);
this.setProp('arrowheadLengthRatio', 11);
this.arrow($V([0, 0]), $V([sizeDw.e(1), 0]));
this.arrow($V([0, 0]), $V([0, sizeDw.e(2)]));
this.text($V([sizeDw.e(1), 0]), $V([1, 1.5]), 'TEX:$t$');
this.text($V([0, sizeDw.e(2)]), $V([1.5, 1]), yLabel);
this.restore();
var col = this._getColorProp(type);
this.setProp('shapeOutlineColor', col);
this.setProp('pointRadiusPx', '4');
this.save();
this._ctx.beginPath();
var bottomLeftPx = this.pos2Px($V([0, 0]));
var topRightPx = this.pos2Px(sizeDw);
var offsetPx = topRightPx.subtract(bottomLeftPx);
this._ctx.rect(bottomLeftPx.e(1), 0, offsetPx.e(1), this._height);
this._ctx.clip();
this.polyLine(plotData, false);
this.restore();
this.point(plotData[plotData.length - 1]);
this.restore();
};
/** Draw a history of positions as a faded line.
@param {Array} history History data, array of [time, position] pairs, where position is a vector.
@param {number} t Current time.
@param {number} maxT Maximum history time.
@param {Array} currentRGB RGB triple for current time color.
@param {Array} oldRGB RGB triple for old time color.
*/
PrairieDraw.prototype.fadeHistoryLine = function (history, t, maxT, currentRGB, oldRGB) {
if (history.length < 2) {
return;
}
for (var i = history.length - 2; i >= 0; i--) {
// draw line backwards so newer segments are on top
var pT = history[i][0];
var pDw1 = history[i][1];
var pDw2 = history[i + 1][1];
var alpha = (t - pT) / maxT;
var rgb = PrairieGeom.linearInterpArray(currentRGB, oldRGB, alpha);
var color =
'rgb(' + rgb[0].toFixed(0) + ', ' + rgb[1].toFixed(0) + ', ' + rgb[2].toFixed(0) + ')';
this.line(pDw1, pDw2, color);
}
};
/*****************************************************************************/
PrairieDraw.prototype.mouseDown3D = function (event) {
event.preventDefault();
this._mouseDown3D = true;
this._lastMouseX3D = event.clientX;
this._lastMouseY3D = event.clientY;
};
PrairieDraw.prototype.mouseUp3D = function () {
this._mouseDown3D = false;
};
PrairieDraw.prototype.mouseMove3D = function (event) {
if (!this._mouseDown3D) {
return;
}
var deltaX = event.clientX - this._lastMouseX3D;
var deltaY = event.clientY - this._lastMouseY3D;
this._lastMouseX3D = event.clientX;
this._lastMouseY3D = event.clientY;
this.incrementView3D(deltaY * 0.01, 0, deltaX * 0.01);
};
PrairieDraw.prototype.activate3DControl = function () {
/* Listen just on the canvas for mousedown, but on whole window
* for move/up. This allows mouseup while off-canvas (and even
* off-window) to be captured. Ideally we should also listen for
* mousedown on the whole window and use mouseEventOnCanvas(), but
* this is broken on Canary for some reason (some areas off-canvas
* don't work). The advantage of listening for mousedown on the
* whole window is that we can get the event during the "capture"
* phase rather than the later "bubble" phase, allowing us to
* preventDefault() before things like select-drag starts. */
this._canvas.addEventListener('mousedown', this.mouseDown3D.bind(this), true);
window.addEventListener('mouseup', this.mouseUp3D.bind(this), true);
window.addEventListener('mousemove', this.mouseMove3D.bind(this), true);
};
/*****************************************************************************/
PrairieDraw.prototype.mouseDownTracking = function (event) {
event.preventDefault();
this._mouseDownTracking = true;
this._lastMouseXTracking = event.pageX;
this._lastMouseYTracking = event.pageY;
};
PrairieDraw.prototype.mouseUpTracking = function () {
this._mouseDownTracking = false;
};
PrairieDraw.prototype.mouseMoveTracking = function (event) {
if (!this._mouseDownTracking) {
return;
}
this._lastMouseXTracking = event.pageX;
this._lastMouseYTracking = event.pageY;
};
PrairieDraw.prototype.activateMouseTracking = function () {
this._canvas.addEventListener('mousedown', this.mouseDownTracking.bind(this), true);
window.addEventListener('mouseup', this.mouseUpTracking.bind(this), true);
window.addEventListener('mousemove', this.mouseMoveTracking.bind(this), true);
};
PrairieDraw.prototype.mouseDown = function () {
if (this._mouseDownTracking !== undefined) {
return this._mouseDownTracking;
} else {
return false;
}
};
PrairieDraw.prototype.mousePositionDw = function () {
var xPx = this._lastMouseXTracking - this._canvas.offsetLeft;
var yPx = this._lastMouseYTracking - this._canvas.offsetTop;
var posPx = $V([xPx, yPx]);
var posDw = this.pos2Dw(posPx);
return posDw;
};
/*****************************************************************************/
/** Creates a PrairieDrawAnim object.
@constructor
@this {PrairieDraw}
@param {HTMLCanvasElement or string} canvas The canvas element to draw on or the ID of the canvas elemnt.
@param {Function} drawfcn An optional function that draws on the canvas at time t.
*/
function PrairieDrawAnim(canvas, drawFcn) {
PrairieDraw.call(this, canvas, null);
this._drawTime = 0;
this._deltaTime = 0;
this._running = false;
this._sequences = {};
this._animStateCallbacks = [];
this._animStepCallbacks = [];
if (drawFcn) {
this.draw = drawFcn.bind(this);
}
this.save();
this.draw(0);
this.restoreAll();
}
PrairieDrawAnim.prototype = new PrairieDraw();
/** @private Store the appropriate version of requestAnimationFrame.
Use this like:
prairieDraw.requestAnimationFrame.call(window, this.callback.bind(this));
We can't do prairieDraw.requestAnimationFrame(callback), because
that would run requestAnimationFrame in the context of prairieDraw
("this" would be prairieDraw), and requestAnimationFrame needs
"this" to be "window".
We need to pass this.callback.bind(this) as the callback function
rather than just this.callback as otherwise the callback functions
is called from "window" context, and we want it to be called from
the context of our own object.
*/
/* jshint laxbreak: true */
if (typeof window !== 'undefined') {
PrairieDrawAnim.prototype._requestAnimationFrame =
window.requestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.msRequestAnimationFrame;
}
/** Prototype function to draw on the canvas, should be implemented by children.
@param {number} t Current animation time in seconds.
*/
PrairieDrawAnim.prototype.draw = function (t) {
/* jshint unused: false */
};
/** Start the animation.
*/
PrairieDrawAnim.prototype.startAnim = function () {
if (!this._running) {
this._running = true;
this._startFrame = true;
this._requestAnimationFrame.call(window, this._callback.bind(this));
for (var i = 0; i < this._animStateCallbacks.length; i++) {
this._animStateCallbacks[i](true);
}
}
};
/** Stop the animation.
*/
PrairieDrawAnim.prototype.stopAnim = function () {
this._running = false;
for (var i = 0; i < this._animStateCallbacks.length; i++) {
this._animStateCallbacks[i](false);
}
};
/** Toggle the animation.
*/
PrairieDrawAnim.prototype.toggleAnim = function () {
if (this._running) {
this.stopAnim();
} else {
this.startAnim();
}
};
/** Register a callback on animation state changes.
@param {Function} callback The callback(animated) function.
*/
PrairieDrawAnim.prototype.registerAnimCallback = function (callback) {
this._animStateCallbacks.push(callback.bind(this));
callback.apply(this, [this._running]);
};
/** Register a callback on animation steps.
@param {Function} callback The callback(t) function.
*/
PrairieDrawAnim.prototype.registerAnimStepCallback = function (callback) {
this._animStepCallbacks.push(callback.bind(this));
};
/** @private Callback function to handle the animationFrame events.
*/
PrairieDrawAnim.prototype._callback = function (tMS) {
if (this._startFrame) {
this._startFrame = false;
this._timeOffset = tMS - this._drawTime;
}
var animTime = tMS - this._timeOffset;
this._deltaTime = (animTime - this._drawTime) / 1000;
this._drawTime = animTime;
var t = animTime / 1000;
for (var i = 0; i < this._animStepCallbacks.length; i++) {
this._animStepCallbacks[i](t);
}
this.save();
this.draw(t);
this._deltaTime = 0;
this.restoreAll();
if (this._running) {
this._requestAnimationFrame.call(window, this._callback.bind(this));
}
};
/** Get the elapsed time since the last redraw.
return {number} Elapsed time in seconds.
*/
PrairieDrawAnim.prototype.deltaTime = function () {
return this._deltaTime;
};
/** Redraw the drawing at the current time.
*/
PrairieDrawAnim.prototype.redraw = function () {
if (!this._running) {
this.save();
this.draw(this._drawTime / 1000);
this.restoreAll();
}
};
/** Reset the animation time to zero.
@param {bool} redraw (Optional) Whether to redraw (default: true).
*/
PrairieDrawAnim.prototype.resetTime = function (redraw) {
this._drawTime = 0;
for (var i = 0; i < this._animStepCallbacks.length; i++) {
this._animStepCallbacks[i](0);
}
this._startFrame = true;
if (redraw === undefined || redraw === true) {
this.redraw();
}
};
/** Reset everything to the intial state.
*/
PrairieDrawAnim.prototype.reset = function () {
for (var optionName in this._options) {
this.resetOptionValue(optionName);
}
this.resetAllSequences();
this.clearAllHistory();
this.stopAnim();
this.resetView3D(false);
this.resetTime(false);
this.redraw();
};
/** Stop all action and computation.
*/
PrairieDrawAnim.prototype.stop = function () {
this.stopAnim();
};
PrairieDrawAnim.prototype.lastDrawTime = function () {
return this._drawTime / 1000;
};
/*****************************************************************************/
PrairieDrawAnim.prototype.mouseDownAnimOnClick = function (event) {
event.preventDefault();
this.startAnim();
};
PrairieDrawAnim.prototype.activateAnimOnClick = function () {
this._canvas.addEventListener('mousedown', this.mouseDownAnimOnClick.bind(this), true);
};
/*****************************************************************************/
/** Interpolate between different states in a sequence.
@param {Array} states An array of objects, each specifying scalar or vector state values.
@param {Array} transTimes Transition times. transTimes[i] is the transition time from states[i] to states[i+1].
@param {Array} holdTimes Hold times for the corresponding state.
@param {Array} t Current time.
@return Object with state variables set to current values, as well as t being the time within the current transition (0 if holding), index being the current state index (or the next state if transitioning), and alpha being the proportion of the current transition (0 if holding).
*/
PrairieDrawAnim.prototype.sequence = function (states, transTimes, holdTimes, t) {
var totalTime = 0;
var i;
for (i = 0; i < states.length; i++) {
totalTime += transTimes[i];
totalTime += holdTimes[i];
}
var ts = t % totalTime;
totalTime = 0;
var state = {};
var e, ip;
var lastTotalTime = 0;
for (i = 0; i < states.length; i++) {
ip = i === states.length - 1 ? 0 : i + 1;
totalTime += transTimes[i];
if (totalTime > ts) {
// in transition from i to i+1
state.t = ts - lastTotalTime;
state.index = i;
state.alpha = state.t / (totalTime - lastTotalTime);
for (e in states[i]) {
state[e] = PrairieGeom.linearInterp(states[i][e], states[ip][e], state.alpha);
}
return state;
}
lastTotalTime = totalTime;
totalTime += holdTimes[i];
if (totalTime > ts) {
// holding at i+1
state.t = 0;
state.index = ip;
state.alpha = 0;
for (e in states[i]) {
state[e] = states[ip][e];
}
return state;
}
lastTotalTime = totalTime;
}
};
/*****************************************************************************/
/** Interpolate between different states in a sequence under external prompting.
@param {string} name Name of this transition sequence.
@param {Array} states An array of objects, each specifying scalar or vector state values.
@param {Array} transTimes Transition times. transTimes[i] is the transition time from states[i] to states[i+1].
@param {Array} t Current animation time.
@return Object with state variables set to current values, as well as t being the time within the current transition (0 if holding), index being the current state index (or the next state if transitioning), and alpha being the proportion of the current transition (0 if holding).
*/
PrairieDrawAnim.prototype.controlSequence = function (name, states, transTimes, t) {
if (!(name in this._sequences)) {
this._sequences[name] = {
index: 0,
inTransition: false,
startTransition: false,
indefiniteHold: true,
callbacks: [],
};
}
var seq = this._sequences[name];
var state;
var transTime = 0;
if (seq.startTransition) {
seq.startTransition = false;
seq.inTransition = true;
seq.indefiniteHold = false;
seq.startTime = t;
}
if (seq.inTransition) {
transTime = t - seq.startTime;
}
if (seq.inTransition && transTime >= transTimes[seq.index]) {
seq.inTransition = false;
seq.indefiniteHold = true;
seq.index = (seq.index + 1) % states.length;
delete seq.startTime;
}
if (!seq.inTransition) {
state = PrairieGeom.dupState(states[seq.index]);
state.index = seq.index;
state.t = 0;
state.alpha = 0;
state.inTransition = false;
return state;
}
var alpha = transTime / transTimes[seq.index];
var nextIndex = (seq.index + 1) % states.length;
state = PrairieGeom.linearInterpState(states[seq.index], states[nextIndex], alpha);
state.t = transTime;
state.index = seq.index;
state.alpha = alpha;
state.inTransition = true;
return state;
};
/** Start the next transition for the given sequence.
@param {string} name Name of the sequence to transition.
@param {string} stateName (Optional) Only transition if we are currently in stateName.
*/
PrairieDrawAnim.prototype.stepSequence = function (name, stateName) {
if (!(name in this._sequences)) {
throw new Error('PrairieDraw: unknown sequence: ' + name);
}
var seq = this._sequences[name];
if (!seq.lastState.indefiniteHold) {
return;
}
if (stateName !== undefined) {
if (seq.lastState.name !== stateName) {
return;
}
}
seq.startTransition = true;
this.startAnim();
};
/*****************************************************************************/
/** Interpolate between different states (new version).
@param {string} name Name of this transition sequence.
@param {Array} states An array of objects, each specifying scalar or vector state values.
@param {Array} transTimes Transition times. transTimes[i] is the transition time from states[i] to states[i+1].
@param {Array} holdtimes Hold times for each state. A negative value means to hold until externally triggered.
@param {Array} t Current animation time.
@return Object with state variables set to current values, as well as t being the time within the current transition (0 if holding), index being the current state index (or the next state if transitioning), and alpha being the proportion of the current transition (0 if holding).
*/
PrairieDrawAnim.prototype.newSequence = function (
name,
states,
transTimes,
holdTimes,
interps,
names,
t
) {
var seq = this._sequences[name];
if (seq === undefined) {
this._sequences[name] = {
startTransition: false,
lastState: {},
callbacks: [],
initialized: false,
};
seq = this._sequences[name];
}
var i;
if (!seq.initialized) {
seq.initialized = true;
for (var e in states[0]) {
if (typeof states[0][e] === 'number') {
seq.lastState[e] = states[0][e];
} else if (typeof states[0][e] === 'function') {
seq.lastState[e] = states[0][e](null, 0);
}
}
seq.lastState.inTransition = false;
seq.lastState.indefiniteHold = false;
seq.lastState.index = 0;
seq.lastState.name = names[seq.lastState.index];
seq.lastState.t = 0;
seq.lastState.realT = t;
if (holdTimes[0] < 0) {
seq.lastState.indefiniteHold = true;
}
for (i = 0; i < seq.callbacks.length; i++) {
seq.callbacks[i]('enter', seq.lastState.index, seq.lastState.name);
}
}
if (seq.startTransition) {
seq.startTransition = false;
seq.lastState.inTransition = true;
seq.lastState.indefiniteHold = false;
seq.lastState.t = 0;
seq.lastState.realT = t;
for (i = 0; i < seq.callbacks.length; i++) {
seq.callbacks[i]('exit', seq.lastState.index, seq.lastState.name);
}
}
var endTime, nextIndex;
while (true) {
nextIndex = (seq.lastState.index + 1) % states.length;
if (seq.lastState.inTransition) {
endTime = seq.lastState.realT + transTimes[seq.lastState.index];
if (t >= endTime) {
seq.lastState = this._interpState(
seq.lastState,
states[nextIndex],
interps,
endTime,
endTime
);
seq.lastState.inTransition = false;
seq.lastState.index = nextIndex;
seq.lastState.name = names[seq.lastState.index];
if (holdTimes[nextIndex] < 0) {
seq.lastState.indefiniteHold = true;
} else {
seq.lastState.indefiniteHold = false;
}
for (i = 0; i < seq.callbacks.length; i++) {
seq.callbacks[i]('enter', seq.lastState.index, seq.lastState.name);
}
} else {
return this._interpState(seq.lastState, states[nextIndex], interps, t, endTime);
}
} else {
endTime = seq.lastState.realT + holdTimes[seq.lastState.index];
if (holdTimes[seq.lastState.index] >= 0 && t > endTime) {
seq.lastState = this._extrapState(seq.lastState, states[seq.lastState.index], endTime);
seq.lastState.inTransition = true;
seq.lastState.indefiniteHold = false;
for (i = 0; i < seq.callbacks.length; i++) {
seq.callbacks[i]('exit', seq.lastState.index, seq.lastState.name);
}
} else {
return this._extrapState(seq.lastState, states[seq.lastState.index], t);
}
}
}
};
PrairieDrawAnim.prototype._interpState = function (lastState, nextState, interps, t, tFinal) {
var s1 = PrairieGeom.dupState(nextState);
s1.realT = tFinal;
s1.t = tFinal - lastState.realT;
var s = {};
var alpha = (t - lastState.realT) / (tFinal - lastState.realT);
for (var e in nextState) {
if (e in interps) {
s[e] = interps[e](lastState, s1, t - lastState.realT);
} else {
s[e] = PrairieGeom.linearInterp(lastState[e], s1[e], alpha);
}
}
s.realT = t;
s.t = Math.min(t - lastState.realT, s1.t);
s.index = lastState.index;
s.inTransition = lastState.inTransition;
s.indefiniteHold = lastState.indefiniteHold;
return s;
};
PrairieDrawAnim.prototype._extrapState = function (lastState, lastStateData, t) {
var s = {};
for (var e in lastStateData) {
if (typeof lastStateData[e] === 'number') {
s[e] = lastStateData[e];
} else if (typeof lastStateData[e] === 'function') {
s[e] = lastStateData[e](lastState, t - lastState.realT);
}
}
s.realT = t;
s.t = t - lastState.realT;
s.index = lastState.index;
s.inTransition = lastState.inTransition;
s.indefiniteHold = lastState.indefiniteHold;
return s;
};
/** Register a callback on animation sequence events.
@param {string} seqName The sequence to register on.
@param {Function} callback The callback(event, index, stateName) function.
*/
PrairieDrawAnim.prototype.registerSeqCallback = function (seqName, callback) {
if (!(seqName in this._sequences)) {
throw new Error('PrairieDraw: unknown sequence: ' + seqName);
}
var seq = this._sequences[seqName];
seq.callbacks.push(callback.bind(this));
if (seq.inTransition) {
callback.apply(this, ['exit', seq.lastState.index, seq.lastState.name]);
} else {
callback.apply(this, ['enter', seq.lastState.index, seq.lastState.name]);
}
};
/** Make a two-state sequence transitioning to and from 0 and 1.
@param {string} name The name of the sequence;
@param {number} transTime The transition time between the two states.
@return {number} The current state (0 to 1).
*/
PrairieDrawAnim.prototype.activationSequence = function (name, transTime, t) {
var stateZero = { trans: 0 };
var stateOne = { trans: 1 };
var states = [stateZero, stateOne];
var transTimes = [transTime, transTime];
var holdTimes = [-1, -1];
var interps = {};
var names = ['zero', 'one'];
var state = this.newSequence(name, states, transTimes, holdTimes, interps, names, t);
return state.trans;
};
PrairieDrawAnim.prototype.resetSequence = function (name) {
var seq = this._sequences[name];
if (seq !== undefined) {
seq.initialized = false;
}
};
PrairieDrawAnim.prototype.resetAllSequences = function () {
for (var name in this._sequences) {
this.resetSequence(name);
}
};
/*****************************************************************************/
PrairieDraw.prototype.drawImage = function (imgSrc, posDw, anchor, widthDw) {
var img;
if (imgSrc in this._images) {
// FIXME: should check that the image is really loaded, in case we are fired beforehand (also for text images).
img = this._images[imgSrc];
var posPx = this.pos2Px(posDw);
var scale;
if (widthDw === undefined) {
scale = 1;
} else {
var offsetDw = $V([widthDw, 0]);
var offsetPx = this.vec2Px(offsetDw);
var widthPx = offsetPx.modulus();
scale = widthPx / img.width;
}
var xPx = (-(anchor.e(1) + 1) / 2) * img.width;
var yPx = ((anchor.e(2) - 1) / 2) * img.height;
this._ctx.save();
this._ctx.translate(posPx.e(1), posPx.e(2));
this._ctx.scale(scale, scale);
this._ctx.translate(xPx, yPx);
this._ctx.drawImage(img, 0, 0);
this._ctx.restore();
} else {
img = new Image();
var that = this;
img.onload = function () {
that.redraw();
if (that.trigger) {
that.trigger('imgLoad');
}
};
img.src = imgSrc;
this._images[imgSrc] = img;
}
};
/*****************************************************************************/
PrairieDraw.prototype.mouseEventPx = function (event) {
var element = this._canvas;
var xPx = event.pageX;
var yPx = event.pageY;
do {
xPx -= element.offsetLeft;
yPx -= element.offsetTop;
/* jshint boss: true */ // suppress warning for assignment on next line
} while ((element = element.offsetParent));
xPx *= this._canvas.width / this._canvas.scrollWidth;
yPx *= this._canvas.height / this._canvas.scrollHeight;
var posPx = $V([xPx, yPx]);
return posPx;
};
PrairieDraw.prototype.mouseEventDw = function (event) {
var posPx = this.mouseEventPx(event);
var posDw = this.pos2Dw(posPx);
return posDw;
};
PrairieDraw.prototype.mouseEventOnCanvas = function (event) {
var posPx = this.mouseEventPx(event);
console.log(posPx.e(1), posPx.e(2), this._width, this._height);
/* jshint laxbreak: true */
if (
posPx.e(1) >= 0 &&
posPx.e(1) <= this._width &&
posPx.e(2) >= 0 &&
posPx.e(2) <= this._height
) {
console.log(true);
return true;
}
console.log(false);
return false;
};
PrairieDraw.prototype.reportMouseSample = function (event) {
var posDw = this.mouseEventDw(event);
var numDecPlaces = 2;
/* jshint laxbreak: true */
console.log(
'$V([' + posDw.e(1).toFixed(numDecPlaces) + ', ' + posDw.e(2).toFixed(numDecPlaces) + ']),'
);
};
PrairieDraw.prototype.activateMouseSampling = function () {
this._canvas.addEventListener('click', this.reportMouseSample.bind(this));
};
/*****************************************************************************/
PrairieDraw.prototype.activateMouseLineDraw = function () {
if (this._mouseLineDrawActive === true) {
return;
}
this._mouseLineDrawActive = true;
this.mouseLineDraw = false;
this.mouseLineDrawing = false;
if (this._mouseLineDrawInitialized !== true) {
this._mouseLineDrawInitialized = true;
if (this._mouseDrawCallbacks === undefined) {
this._mouseDrawCallbacks = [];
}
this._canvas.addEventListener('mousedown', this.mouseLineDrawMousedown.bind(this), true);
window.addEventListener('mouseup', this.mouseLineDrawMouseup.bind(this), true);
window.addEventListener('mousemove', this.mouseLineDrawMousemove.bind(this), true);
}
/*
for (var i = 0; i < this._mouseDrawCallbacks.length; i++) {
this._mouseDrawCallbacks[i]();
}
this.redraw();
*/
};
PrairieDraw.prototype.deactivateMouseLineDraw = function () {
this._mouseLineDrawActive = false;
this.mouseLineDraw = false;
this.mouseLineDrawing = false;
this.redraw();
};
PrairieDraw.prototype.mouseLineDrawMousedown = function (event) {
if (!this._mouseLineDrawActive) {
return;
}
event.preventDefault();
var posDw = this.mouseEventDw(event);
this.mouseLineDrawStart = posDw;
this.mouseLineDrawEnd = posDw;
this.mouseLineDrawing = true;
this.mouseLineDraw = true;
for (var i = 0; i < this._mouseDrawCallbacks.length; i++) {
this._mouseDrawCallbacks[i]();
}
this.redraw();
};
PrairieDraw.prototype.mouseLineDrawMousemove = function (event) {
if (!this._mouseLineDrawActive) {
return;
}
if (!this.mouseLineDrawing) {
return;
}
this.mouseLineDrawEnd = this.mouseEventDw(event);
for (var i = 0; i < this._mouseDrawCallbacks.length; i++) {
this._mouseDrawCallbacks[i]();
}
this.redraw(); // FIXME: add rate-limiting
};
PrairieDraw.prototype.mouseLineDrawMouseup = function () {
if (!this._mouseLineDrawActive) {
return;
}
if (!this.mouseLineDrawing) {
return;
}
this.mouseLineDrawing = false;
for (var i = 0; i < this._mouseDrawCallbacks.length; i++) {
this._mouseDrawCallbacks[i]();
}
this.redraw();
};
PrairieDraw.prototype.mouseLineDrawMouseout = function (event) {
if (!this._mouseLineDrawActive) {
return;
}
if (!this.mouseLineDrawing) {
return;
}
this.mouseLineDrawEnd = this.mouseEventDw(event);
this.mouseLineDrawing = false;
for (var i = 0; i < this._mouseDrawCallbacks.length; i++) {
this._mouseDrawCallbacks[i]();
}
this.redraw();
};
PrairieDraw.prototype.registerMouseLineDrawCallback = function (callback) {
if (this._mouseDrawCallbacks === undefined) {
this._mouseDrawCallbacks = [];
}
this._mouseDrawCallbacks.push(callback.bind(this));
};
/*****************************************************************************/
/** Plot a line graph.
@param {Array} data Array of vectors to plot.
@param {Vector} originDw The lower-left position of the axes.
@param {Vector} sizeDw The size of the axes (vector from lower-left to upper-right).
@param {Vector} originData The lower-left position of the axes in data coordinates.
@param {Vector} sizeData The size of the axes in data coordinates.
@param {string} xLabel The vertical axis label.
@param {string} yLabel The vertical axis label.
@param {string} type (Optional) The type of line being drawn.
@param {string} drawAxes (Optional) Whether to draw the axes (default: true).
@param {string} drawPoint (Optional) Whether to draw the last point (default: true).
@param {string} pointLabel (Optional) Label for the last point (default: undefined).
@param {string} pointAnchor (Optional) Anchor for the last point label (default: $V([0, -1])).
@param {Object} options (Optional) Plotting options:
horizAxisPos: "bottom", "top", or a numerical value in data coordinates (default: "bottom")
vertAxisPos: "left", "right", or a numerical value in data coordinates (default: "left")
*/
PrairieDraw.prototype.plot = function (
data,
originDw,
sizeDw,
originData,
sizeData,
xLabel,
yLabel,
type,
drawAxes,
drawPoint,
pointLabel,
pointAnchor,
options
) {
drawAxes = drawAxes === undefined ? true : drawAxes;
drawPoint = drawPoint === undefined ? true : drawPoint;
options = options === undefined ? {} : options;
var horizAxisPos = options.horizAxisPos === undefined ? 'bottom' : options.horizAxisPos;
var vertAxisPos = options.vertAxisPos === undefined ? 'left' : options.vertAxisPos;
var drawXGrid = options.drawXGrid === undefined ? false : options.drawXGrid;
var drawYGrid = options.drawYGrid === undefined ? false : options.drawYGrid;
var dXGrid = options.dXGrid === undefined ? 1 : options.dXGrid;
var dYGrid = options.dYGrid === undefined ? 1 : options.dYGrid;
var drawXTickLabels = options.drawXTickLabels === undefined ? false : options.drawXTickLabels;
var drawYTickLabels = options.drawYTickLabels === undefined ? false : options.drawYTickLabels;
var xLabelPos = options.xLabelPos === undefined ? 1 : options.xLabelPos;
var yLabelPos = options.yLabelPos === undefined ? 1 : options.yLabelPos;
var xLabelAnchor = options.xLabelAnchor === undefined ? $V([1, 1.5]) : options.xLabelAnchor;
var yLabelAnchor = options.yLabelAnchor === undefined ? $V([1.5, 1]) : options.yLabelAnchor;
var yLabelRotate = options.yLabelRotate === undefined ? false : options.yLabelRotate;
this.save();
this.translate(originDw);
// grid
var ix0 = Math.ceil(originData.e(1) / dXGrid);
var ix1 = Math.floor((originData.e(1) + sizeData.e(1)) / dXGrid);
var x0 = 0;
var x1 = sizeDw.e(1);
var iy0 = Math.ceil(originData.e(2) / dYGrid);
var iy1 = Math.floor((originData.e(2) + sizeData.e(2)) / dYGrid);
var y0 = 0;
var y1 = sizeDw.e(2);
var i, x, y;
if (drawXGrid) {
for (i = ix0; i <= ix1; i++) {
x = PrairieGeom.linearMap(
originData.e(1),
originData.e(1) + sizeData.e(1),
0,
sizeDw.e(1),
i * dXGrid
);
this.line($V([x, y0]), $V([x, y1]), 'grid');
}
}
if (drawYGrid) {
for (i = iy0; i <= iy1; i++) {
y = PrairieGeom.linearMap(
originData.e(2),
originData.e(2) + sizeData.e(2),
0,
sizeDw.e(2),
i * dYGrid
);
this.line($V([x0, y]), $V([x1, y]), 'grid');
}
}
var label;
if (drawXTickLabels) {
for (i = ix0; i <= ix1; i++) {
x = PrairieGeom.linearMap(
originData.e(1),
originData.e(1) + sizeData.e(1),
0,
sizeDw.e(1),
i * dXGrid
);
label = String(i * dXGrid);
this.text($V([x, y0]), $V([0, 1]), label);
}
}
if (drawYTickLabels) {
for (i = iy0; i <= iy1; i++) {
y = PrairieGeom.linearMap(
originData.e(2),
originData.e(2) + sizeData.e(2),
0,
sizeDw.e(2),
i * dYGrid
);
label = String(i * dYGrid);
this.text($V([x0, y]), $V([1, 0]), label);
}
}
// axes
var axisX, axisY;
if (vertAxisPos === 'left') {
axisX = 0;
} else if (vertAxisPos === 'right') {
axisX = sizeDw.e(1);
} else {
axisX = PrairieGeom.linearMap(
originData.e(1),
originData.e(1) + sizeData.e(1),
0,
sizeDw.e(1),
vertAxisPos
);
}
if (horizAxisPos === 'bottom') {
axisY = 0;
} else if (horizAxisPos === 'top') {
axisY = sizeDw.e(2);
} else {
axisY = PrairieGeom.linearMap(
originData.e(2),
originData.e(2) + sizeData.e(2),
0,
sizeDw.e(2),
horizAxisPos
);
}
if (drawAxes) {
this.save();
this.setProp('arrowLineWidthPx', 1);
this.setProp('arrowheadLengthRatio', 11);
this.arrow($V([0, axisY]), $V([sizeDw.e(1), axisY]));
this.arrow($V([axisX, 0]), $V([axisX, sizeDw.e(2)]));
x = xLabelPos * sizeDw.e(1);
y = yLabelPos * sizeDw.e(2);
this.text($V([x, axisY]), xLabelAnchor, xLabel);
var angle = yLabelRotate ? -Math.PI / 2 : 0;
this.text($V([axisX, y]), yLabelAnchor, yLabel, undefined, angle);
this.restore();
}
var col = this._getColorProp(type);
this.setProp('shapeOutlineColor', col);
this.setProp('pointRadiusPx', '4');
var bottomLeftPx = this.pos2Px($V([0, 0]));
var topRightPx = this.pos2Px(sizeDw);
var offsetPx = topRightPx.subtract(bottomLeftPx);
this.save();
this.scale(sizeDw);
this.scale($V([1 / sizeData.e(1), 1 / sizeData.e(2)]));
this.translate(originData.x(-1));
this.save();
this._ctx.beginPath();
this._ctx.rect(bottomLeftPx.e(1), 0, offsetPx.e(1), this._height);
this._ctx.clip();
this.polyLine(data, false);
this.restore();
if (drawPoint) {
this.point(data[data.length - 1]);
if (pointLabel !== undefined) {
if (pointAnchor === undefined) {
pointAnchor = $V([0, -1]);
}
this.text(data[data.length - 1], pointAnchor, pointLabel);
}
}
this.restore();
this.restore();
};
/*****************************************************************************/
return {
PrairieDraw: PrairieDraw,
PrairieDrawAnim: PrairieDrawAnim,
};
});
| PrairieLearn/PrairieLearn | public/localscripts/calculationQuestion/PrairieDraw.js | JavaScript | agpl-3.0 | 137,277 |
var clover = new Object();
// JSON: {classes : [{name, id, sl, el, methods : [{sl, el}, ...]}, ...]}
clover.pageData = {"classes":[{"el":162,"id":11268,"methods":[{"el":52,"sc":2,"sl":50},{"el":138,"sc":2,"sl":54},{"el":147,"sc":2,"sl":140},{"el":161,"sc":2,"sl":149}],"name":"ChiSquaredWeighting","sl":46}]}
// JSON: {test_ID : {"methods": [ID1, ID2, ID3...], "name" : "testXXX() void"}, ...};
clover.testTargets = {}
// JSON: { lines : [{tests : [testid1, testid2, testid3, ...]}, ...]};
clover.srcFileLines = [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]
| cm-is-dog/rapidminer-studio-core | report/html/com/rapidminer/operator/features/weighting/ChiSquaredWeighting.js | JavaScript | agpl-3.0 | 1,169 |
import _ from 'underscore'
import Base from '../graphs/base'
import DayBinner from '../graphs/DayBinner'
import WeekBinner from '../graphs/WeekBinner'
import MonthBinner from '../graphs/MonthBinner'
import ScaleByBins from '../graphs/ScaleByBins'
import helpers from '../helpers'
import I18n from 'i18n!page_views'
// #
// Parent class for all graphs that have a date-aligned x-axis. Note: Left
// padding for this graph style is space from the frame to the start date's
// tick mark, not the leading graph element's edge. Similarly, right padding
// is space from the frame to the end date's tick, not the trailing graph
// element's edge. This is necessary to keep the date graphs aligned.
const defaultOptions = {
// #
// The date for the left end of the graph. Required.
startDate: null,
// #
// The date for the right end of the graph. Required.
endDate: null,
// #
// The size of the date tick marks, in pixels.
tickSize: 5,
// #
// If any date is outside the bounds of the graph, we have a clipped date
clippedDate: false
}
export default class DateAlignedGraph extends Base {
// #
// Takes an element and options, same as for Base. Recognizes the options
// described above in addition to the options for Base.
constructor(div, options) {
super(...arguments)
// mixin ScaleByBins functionality
_.extend(this, ScaleByBins)
// check for required options
if (options.startDate == null) throw new Error('startDate is required')
if (options.endDate == null) throw new Error('endDate is required')
// copy in recognized options with defaults
for (const key in defaultOptions) {
const defaultValue = defaultOptions[key]
this[key] = options[key] != null ? options[key] : defaultValue
}
this.initScale()
}
// #
// Set up X-axis scale
initScale() {
const interior = this.width - this.leftPadding - this.rightPadding
// mixin for the appropriate bin size
// use a minimum of 10 pixels for bar width plus spacing before consolidating
this.binner = new DayBinner(this.startDate, this.endDate)
if (this.binner.count() * 10 > interior)
this.binner = new WeekBinner(this.startDate, this.endDate)
if (this.binner.count() * 10 > interior)
this.binner = new MonthBinner(this.startDate, this.endDate)
// scale the x-axis for the number of bins
return this.scaleByBins(this.binner.count())
}
// #
// Reset the graph chrome. Adds an x-axis with daily ticks and weekly (on
// Mondays) labels.
reset() {
super.reset(...arguments)
if (this.startDate) this.initScale()
return this.drawDateAxis()
}
// #
// Convert a date to a bin index.
dateBin(date) {
return this.binner.bin(date)
}
// #
// Convert a date to its bin's x-coordinate.
binnedDateX(date) {
return this.binX(this.dateBin(date))
}
// #
// Given a datetime, return the floor and ceil as calculated by the binner
dateExtent(datetime) {
const floor = this.binner.reduce(datetime)
return [floor, this.binner.nextTick(floor)]
}
// #
// Given a datetime and a datetime range, return a number from 0.0 to 1.0
dateFraction(datetime, floorDate, ceilDate) {
const deltaSeconds = datetime.getTime() - floorDate.getTime()
const totalSeconds = ceilDate.getTime() - floorDate.getTime()
return deltaSeconds / totalSeconds
}
// #
// Convert a date to an intra-bin x-coordinate.
dateX(datetime) {
const minX = this.leftMargin
const maxX = this.leftMargin + this.width
const [floorDate, ceilDate] = this.dateExtent(datetime)
const floorX = this.binnedDateX(floorDate)
const ceilX = this.binnedDateX(ceilDate)
const fraction = this.dateFraction(datetime, floorDate, ceilDate)
if (datetime.getTime() < this.startDate.getTime()) {
// out of range, left
this.clippedDate = true
return minX
} else if (datetime.getTime() > this.endDate.getTime()) {
// out of range, right
this.clippedDate = true
return maxX
} else {
// in range
return floorX + fraction * (ceilX - floorX)
}
}
// #
// Draw a guide along the x-axis. Each day gets a pair of ticks; one from
// the top of the frame, the other from the bottom. The ticks are replaced
// by a full vertical grid line on Mondays, accompanied by a label.
drawDateAxis() {
// skip if we haven't set start/end dates yet (@reset will be called by
// Base's constructor before we set startDate or endDate)
if (this.startDate == null || this.endDate == null) return
return this.binner.eachTick((tick, chrome) => {
const x = this.binnedDateX(tick)
if (chrome && chrome.label) return this.dateLabel(x, this.topMargin + this.height, chrome.label)
})
}
// #
// Draw label text at (x, y).
dateLabel(x, y, text) {
const label = this.paper.text(x, y, text)
return label.attr({fill: this.frameColor})
}
// #
// Get date text for a bin
binDateText(bin) {
const lastDay = this.binner.nextTick(bin.date).addDays(-1)
const daysBetween = helpers.daysBetween(bin.date, lastDay)
if (daysBetween < 1) {
// single-day bucket: label the date
return I18n.l('date.formats.medium', bin.date)
} else if (daysBetween < 7) {
// one-week bucket: label the start and end days; include the year only with the end day unless they're different
return I18n.t('%{start_date} - %{end_date}', {
start_date: I18n.l(
bin.date.getFullYear() === lastDay.getFullYear()
? 'date.formats.short'
: 'date.formats.medium',
bin.date
),
end_date: I18n.l('date.formats.medium', lastDay)
})
} else {
// one-month bucket; label the month and year
return I18n.l('date.formats.medium_month', bin.date)
}
}
}
| instructure/analytics | app/jsx/graphs/DateAlignedGraph.js | JavaScript | agpl-3.0 | 5,859 |
SavedSearchSelect.$inject = ['session', 'savedSearch'];
export function SavedSearchSelect(session, savedSearch) {
return {
link: function(scope) {
savedSearch.getUserSavedSearches(session.identity).then(function(res) {
scope.searches = res;
});
}
};
}
| lnogues/superdesk-client-core | scripts/superdesk-search/directives/SavedSearchSelect.js | JavaScript | agpl-3.0 | 316 |
OC.L10N.register(
"encryption",
{
"Missing recovery key password" : "Brakujące hasło klucza odzyskiwania",
"Please repeat the recovery key password" : "Proszę powtórz nowe hasło klucza odzyskiwania",
"Repeated recovery key password does not match the provided recovery key password" : "Hasła klucza odzyskiwania nie zgadzają się",
"Recovery key successfully enabled" : "Klucz odzyskiwania włączony",
"Could not enable recovery key. Please check your recovery key password!" : "Nie można włączyć klucza odzyskiwania. Proszę sprawdzić swoje hasło odzyskiwania!",
"Recovery key successfully disabled" : "Klucz odzyskiwania wyłączony",
"Could not disable recovery key. Please check your recovery key password!" : "Nie można wyłączyć klucza odzyskiwania. Proszę sprawdzić swoje hasło odzyskiwania!",
"Missing parameters" : "Brakujące dane",
"Please provide the old recovery password" : "Podaj stare hasło odzyskiwania",
"Please provide a new recovery password" : "Podaj nowe hasło odzyskiwania",
"Please repeat the new recovery password" : "Proszę powtórz nowe hasło odzyskiwania",
"Password successfully changed." : "Zmiana hasła udana.",
"Could not change the password. Maybe the old password was not correct." : "Nie można zmienić hasła. Może stare hasło nie było poprawne.",
"Recovery Key disabled" : "Klucz odzyskiwania wyłączony",
"Recovery Key enabled" : "Klucz odzyskiwania włączony",
"Could not enable the recovery key, please try again or contact your administrator" : "Nie można włączyć klucza odzyskiwania. Proszę spróbować ponownie lub skontakuj sie z administratorem",
"Could not update the private key password." : "Nie można zmienić hasła klucza prywatnego.",
"The old password was not correct, please try again." : "Stare hasło nie było poprawne. Spróbuj jeszcze raz.",
"The current log-in password was not correct, please try again." : "Obecne hasło logowania nie było poprawne. Spróbuj ponownie.",
"Private key password successfully updated." : "Pomyślnie zaktualizowano hasło klucza prywatnego.",
"You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please run 'occ encryption:migrate' or contact your administrator" : "Musisz przenieść swoje klucze szyfrowania ze starego sposobu szyfrowania (Nextcloud <= 8,0) na nowy. Proszę uruchomić 'occ encryption:migrate' lub skontaktować się z administratorem",
"Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files." : "Nieprawidłowy klucz prywatny do szyfrowania aplikacji. Należy zaktualizować hasło klucza prywatnego w ustawieniach osobistych, aby odzyskać dostęp do zaszyfrowanych plików.",
"Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again." : "Aplikacja szyfrująca jest włączona, ale Twoje klucze nie są zainicjowane. Proszę się wylogować i zalogować ponownie.",
"Please enable server side encryption in the admin settings in order to use the encryption module." : "Aby móc korzystać z modułu szyfrowania trzeba włączyć w panelu administratora szyfrowanie po stronie serwera. ",
"Encryption app is enabled and ready" : "Szyfrowanie aplikacja jest włączone i gotowe",
"Bad Signature" : "Zła sygnatura",
"Missing Signature" : "Brakująca sygnatura",
"one-time password for server-side-encryption" : "jednorazowe hasło do serwera szyfrowania strony",
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." : "Nie można odszyfrować tego pliku, prawdopodobnie jest to plik udostępniony. Poproś właściciela pliku o ponowne udostępnianie pliku Tobie.",
"Can not read this file, probably this is a shared file. Please ask the file owner to reshare the file with you." : "Nie można odczytać tego pliku, prawdopodobnie plik nie jest współdzielony. Proszę zwrócić się do właściciela pliku, aby udostępnił go dla Ciebie.",
"Default encryption module" : "Domyślny moduł szyfrujący",
"Hey there,\n\nthe admin enabled server-side-encryption. Your files were encrypted using the password '%s'.\n\nPlease login to the web interface, go to the section 'basic encryption module' of your personal settings and update your encryption password by entering this password into the 'old log-in password' field and your current login-password.\n\n" : "Hej tam,\n\nadmin włączył szyfrowanie po stronie serwera. Twoje pliki zostały zaszyfrowane przy użyciu hasła '%s'.\n\nProszę zalogować się do interfejsu internetowego, przejdź do sekcji Nextcloud podstawowy moduł szyfrowania, następnie osobiste ustawienia i zaktualizuj hasło szyfrowania wpisując aktualny login, w polu stare hasło logowania wpisz stare hasło, a następnie aktualne hasło.\n\n",
"The share will expire on %s." : "Ten zasób wygaśnie %s",
"Cheers!" : "Dzięki!",
"Hey there,<br><br>the admin enabled server-side-encryption. Your files were encrypted using the password <strong>%s</strong>.<br><br>Please login to the web interface, go to the section \"basic encryption module\" of your personal settings and update your encryption password by entering this password into the \"old log-in password\" field and your current login-password.<br><br>" : "Hej tam,<br><br>admin włączył szyfrowanie po stronie serwera. Twoje pliki zostały zaszyfrowane przy użyciu hasła <strong>%s</strong>.<br><br>Proszę zalogować się do interfejsu internetowego, przejdź do sekcji Nextcloud podstawowy moduł szyfrowania, następnie osobiste ustawienia i zaktualizuj hasło szyfrowania wpisując aktualny login, w polu stare hasło logowania wpisz stare hasło, a następnie aktualne hasło.<br><br>",
"Encryption app is enabled but your keys are not initialized, please log-out and log-in again" : "Szyfrowanie w aplikacji jest włączone, ale klucze nie są zainicjowane. Prosimy wylogować się i ponownie zalogować się.",
"Encrypt the home storage" : "Szyfrowanie przechowywanie w domu",
"Enabling this option encrypts all files stored on the main storage, otherwise only files on external storage will be encrypted" : "Włączenie tej opcji spowoduje szyfrowanie wszystkich plików zapisanych na pamięci wewnętrznej. W innym wypadku szyfrowane będą tylko pliki na pamięci zewnętrznej.",
"Enable recovery key" : "Włącz klucz odzyskiwania",
"Disable recovery key" : "Wyłącz klucz odzyskiwania",
"The recovery key is an extra encryption key that is used to encrypt files. It allows recovery of a user's files if the user forgets his or her password." : "Kluczem do odzyskiwania jest dodatkowy klucz szyfrujący, który służy do szyfrowania plików. Umożliwia on odzyskanie plików użytkownika, jeśli użytkownik zapomni swoje hasło.",
"Recovery key password" : "Hasło klucza odzyskiwania",
"Repeat recovery key password" : "Powtórz hasło klucza odzyskiwania",
"Change recovery key password:" : "Zmień hasło klucza odzyskiwania",
"Old recovery key password" : "Stare hasło klucza odzyskiwania",
"New recovery key password" : "Nowe hasło klucza odzyskiwania",
"Repeat new recovery key password" : "Powtórz nowe hasło klucza odzyskiwania",
"Change Password" : "Zmień hasło",
"Basic encryption module" : "Podstawowy moduł szyfrujący",
"Your private key password no longer matches your log-in password." : "Hasło Twojego klucza prywatnego nie pasuje już do Twojego hasła logowania.",
"Set your old private key password to your current log-in password:" : "Ustaw stare hasło klucza prywatnego na aktualne hasło logowania:",
" If you don't remember your old password you can ask your administrator to recover your files." : "Jeśli nie pamiętasz swojego starego hasła, poproś swojego administratora, aby odzyskać pliki.",
"Old log-in password" : "Stare hasło logowania",
"Current log-in password" : "Bieżące hasło logowania",
"Update Private Key Password" : "Aktualizacja hasła klucza prywatnego",
"Enable password recovery:" : "Włącz hasło odzyskiwania:",
"Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" : "Włączenie tej opcji umożliwia otrzymać dostęp do zaszyfrowanych plików w przypadku utraty hasła",
"Enabled" : "Włączone",
"Disabled" : "Wyłączone"
},
"nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);");
| michaelletzgus/nextcloud-server | apps/encryption/l10n/pl.js | JavaScript | agpl-3.0 | 8,768 |
import { Ability } from "./ability";
import { search } from "./utility/pathfinding";
import { Hex } from "./utility/hex";
import * as arrayUtils from "./utility/arrayUtils";
import { Drop } from "./drops";
import { Effect } from "./effect";
/**
* Creature Class
*
* Creature contains all creatures properties and attacks
*/
export class Creature {
/* Attributes
*
* NOTE : attributes and variables starting with $ are jquery element
* and jquery function can be called dirrectly from them.
*
* // Jquery attributes
* $display : Creature representation
* $effects : Effects container (inside $display)
*
* // Normal attributes
* x : Integer : Hex coordinates
* y : Integer : Hex coordinates
* pos : Object : Pos object for hex comparison {x,y}
*
* name : String : Creature name
* id : Integer : Creature Id incrementing for each creature starting to 1
* size : Integer : Creature size in hexes (1,2 or 3)
* type : Integer : Type of the creature stocked in the database
* team : Integer : Owner's ID (0,1,2 or 3)
* player : Player : Player object shortcut
* hexagons : Array : Array containing the hexes where the creature is
*
* dead : Boolean : True if dead
* stats : Object : Object containing stats of the creature
* statsAlt : Object : Object containing the alteration value for each stat //todo
* abilities : Array : Array containing the 4 abilities
* remainingMove : Integer : Remaining moves allowed untill the end of turn
*
*/
/* Constructor(obj)
*
* obj : Object : Object containing all creature stats
*
*/
constructor(obj, game) {
// Engine
this.game = game;
this.name = obj.name;
this.id = game.creatureIdCounter++;
this.x = obj.x - 0;
this.y = obj.y - 0;
this.pos = {
x: this.x,
y: this.y
};
this.size = obj.size - 0;
this.type = obj.type;
this.level = obj.level - 0;
this.realm = obj.realm;
this.animation = obj.animation;
this.display = obj.display;
this.drop = obj.drop;
this._movementType = "normal";
if (obj.movementType) {
this._movementType = obj.movementType;
}
this.hexagons = [];
// Game
this.team = obj.team; // = playerID (0,1,2,3)
this.player = game.players[obj.team];
this.dead = false;
this.killer = undefined;
this.hasWait = false;
this.travelDist = 0;
this.effects = [];
this.dropCollection = [];
this.protectedFromFatigue = (this.type == "--") ? true : false;
this.turnsActive = 0;
// Statistics
this.baseStats = {
health: obj.stats.health - 0,
regrowth: obj.stats.regrowth - 0,
endurance: obj.stats.endurance - 0,
energy: obj.stats.energy - 0,
meditation: obj.stats.meditation - 0,
initiative: obj.stats.initiative - 0,
offense: obj.stats.offense - 0,
defense: obj.stats.defense - 0,
movement: obj.stats.movement - 0,
pierce: obj.stats.pierce - 0,
slash: obj.stats.slash - 0,
crush: obj.stats.crush - 0,
shock: obj.stats.shock - 0,
burn: obj.stats.burn - 0,
frost: obj.stats.frost - 0,
poison: obj.stats.poison - 0,
sonic: obj.stats.sonic - 0,
mental: obj.stats.mental - 0,
moveable: true,
fatigueImmunity: false,
frozen: false,
// Extra energy required for abilities
reqEnergy: 0
};
this.stats = $j.extend({}, this.baseStats); //Copy
this.health = obj.stats.health;
this.endurance = obj.stats.endurance;
this.energy = obj.stats.energy;
this.remainingMove = 0; //Default value recovered each turn
// Abilities
this.abilities = [
new Ability(this, 0, game),
new Ability(this, 1, game),
new Ability(this, 2, game),
new Ability(this, 3, game)
];
this.updateHex();
let dp = (this.type !== "--") ? "" :
(this.team === 0) ? "red" :
(this.team === 1) ? "blue" :
(this.team === 2) ? "orange" : "green";
// Creature Container
this.grp = game.Phaser.add.group(game.grid.creatureGroup, "creatureGrp_" + this.id);
this.grp.alpha = 0;
// Adding sprite
this.sprite = this.grp.create(0, 0, this.name + dp + '_cardboard');
this.sprite.anchor.setTo(0.5, 1);
// Placing sprite
this.sprite.x = ((!this.player.flipped) ? this.display["offset-x"] : 90 * this.size - this.sprite.texture.width - this.display["offset-x"]) + this.sprite.texture.width / 2;
this.sprite.y = this.display["offset-y"] + this.sprite.texture.height;
// Placing Group
this.grp.x = this.hexagons[this.size - 1].displayPos.x;
this.grp.y = this.hexagons[this.size - 1].displayPos.y;
this.facePlayerDefault();
// Hint Group
this.hintGrp = game.Phaser.add.group(this.grp, "creatureHintGrp_" + this.id);
this.hintGrp.x = 45 * this.size;
this.hintGrp.y = -this.sprite.texture.height + 5;
// Health indicator
this.healthIndicatorGroup = game.Phaser.add.group(this.grp, "creatureHealthGrp_" + this.id);
// Adding background sprite
this.healthIndicatorSprite = this.healthIndicatorGroup.create(
this.player.flipped ? 19 : 19 + 90 * (this.size - 1),
49,
"p" + this.team + '_health');
// Add text
this.healthIndicatorText = game.Phaser.add.text(
this.player.flipped ? 45 : 45 + 90 * (this.size - 1),
63,
this.health, {
font: "bold 15pt Play",
fill: "#fff",
align: "center",
stroke: "#000",
strokeThickness: 6
});
this.healthIndicatorText.anchor.setTo(0.5, 0.5);
this.healthIndicatorGroup.add(this.healthIndicatorText);
// Hide it
this.healthIndicatorGroup.alpha = 0;
// State variable for displaying endurance/fatigue text
this.fatigueText = "";
// Adding Himself to creature arrays and queue
game.creatures[this.id] = this;
this.delayable = true;
this.delayed = false;
this.materializationSickness = (this.type == "--") ? false : true;
this.noActionPossible = false;
}
/* summon()
*
* Summon animation
*
*/
summon() {
let game = this.game;
game.queue.addByInitiative(this);
game.updateQueueDisplay();
game.grid.orderCreatureZ();
if (game.grid.materialize_overlay) {
game.grid.materialize_overlay.alpha = 0.5;
game.Phaser.add.tween(game.grid.materialize_overlay)
.to({
alpha: 0
}, 500, Phaser.Easing.Linear.None)
.start();
}
game.Phaser.add.tween(this.grp)
.to({
alpha: 1
}, 500, Phaser.Easing.Linear.None)
.start();
// Reveal and position health indicator
this.updateHealth();
this.healthShow();
// Trigger trap under
this.hexagons.forEach((hex) => {
hex.activateTrap(game.triggers.onStepIn, this);
});
// Pickup drop
this.pickupDrop();
}
healthHide() {
this.healthIndicatorGroup.alpha = 0;
}
healthShow() {
this.healthIndicatorGroup.alpha = 1;
}
/* activate()
*
* Activate the creature by showing movement range and binding controls to this creature
*
*/
activate() {
this.travelDist = 0;
this.oldEnergy = this.energy;
this.oldHealth = this.health;
this.noActionPossible = false;
let game = this.game;
let stats = this.stats;
let varReset = function () {
this.game.onReset(this);
// Variables reset
this.updateAlteration();
this.remainingMove = stats.movement;
if (!this.materializationSickness) {
// Fatigued creatures (endurance 0) should not regenerate, but fragile
// ones (max endurance 0) should anyway
if (!this.isFatigued()) {
this.heal(stats.regrowth, true);
if (stats.meditation > 0) {
this.recharge(stats.meditation);
}
} else {
if (stats.regrowth < 0) {
this.heal(stats.regrowth, true);
} else {
this.hint("♦", 'damage');
}
}
} else {
this.hint("♣", 'damage');
}
setTimeout(() => {
game.UI.energyBar.animSize(this.energy / stats.energy);
game.UI.healthBar.animSize(this.health / stats.health);
}, 1000);
this.endurance = stats.endurance;
this.abilities.forEach((ability) => {
ability.reset();
});
}.bind(this);
// Frozen effect
if (stats.frozen) {
varReset();
var interval = setInterval(() => {
if (!game.turnThrottle) {
clearInterval(interval);
game.skipTurn({
tooltip: "Frozen"
});
}
}, 50);
return;
}
if (!this.hasWait) {
varReset();
// Trigger
game.onStartPhase(this);
}
this.materializationSickness = false;
var interval = setInterval(() => {
if (!game.freezedInput) {
clearInterval(interval);
if (game.turn >= game.minimumTurnBeforeFleeing) {
game.UI.btnFlee.changeState("normal");
}
game.startTimer();
this.queryMove();
}
}, 50);
}
/* deactivate(wait)
*
* wait : Boolean : Deactivate while waiting or not
*
* Preview the creature position at the given coordinates
*
*/
deactivate(wait) {
let game = this.game;
this.hasWait = this.delayed = !!wait;
this.stats.frozen = false;
// Effects triggers
if (!wait) {
this.turnsActive += 1;
game.onEndPhase(this);
}
this.delayable = false;
}
/* wait()
*
* Move the creature to the end of the queue
*
*/
wait() {
let abilityAvailable = false;
if (this.delayed) {
return;
}
// If at least one ability has not been used
this.abilities.forEach((ability) => {
abilityAvailable = abilityAvailable || !ability.used;
});
if (this.remainingMove > 0 && abilityAvailable) {
this.delay(this.game.activeCreature === this);
this.deactivate(true);
}
}
delay(excludeActiveCreature) {
let game = this.game;
game.queue.delay(this);
this.delayable = false;
this.delayed = true;
this.hint("Delayed", "msg_effects");
game.updateQueueDisplay(excludeActiveCreature);
}
/* queryMove()
*
* launch move action query
*
*/
queryMove(o) {
let game = this.game;
if (this.dead) {
// Creatures can die during their turns from trap effects; make sure this
// function doesn't do anything
return;
}
// Once Per Damage Abilities recover
game.creatures.forEach((creature) => { //For all Creature
if (creature instanceof Creature) {
creature.abilities.forEach((ability) => {
if (game.triggers.oncePerDamageChain.test(ability.getTrigger())) {
ability.setUsed(false);
}
});
}
});
let remainingMove = this.remainingMove;
// No movement range if unmoveable
if (!this.stats.moveable) {
remainingMove = 0;
}
o = $j.extend({
targeting:false,
noPath: false,
isAbility: false,
ownCreatureHexShade: true,
range: game.grid.getMovementRange(
this.x, this.y, remainingMove, this.size, this.id),
callback: function (hex, args) {
if (hex.x == args.creature.x && hex.y == args.creature.y) {
// Prevent null movement
game.activeCreature.queryMove();
return;
}
game.gamelog.add({
action: "move",
target: {
x: hex.x,
y: hex.y
}
});
args.creature.delayable = false;
game.UI.btnDelay.changeState("disabled");
args.creature.moveTo(hex, {
animation: args.creature.movementType() === "flying" ? "fly" : "walk",
callback: function () {
game.activeCreature.queryMove();
}
});
}
}, o);
if (!o.isAbility) {
if (game.UI.selectedAbility != -1) {
this.hint("Canceled", 'gamehintblack');
}
$j("#abilities .ability").removeClass("active");
game.UI.selectAbility(-1);
game.UI.checkAbilities();
game.UI.updateQueueDisplay();
}
game.grid.orderCreatureZ();
this.facePlayerDefault();
this.updateHealth();
if (this.movementType() === "flying") {
o.range = game.grid.getFlyingRange(
this.x, this.y, remainingMove, this.size, this.id);
}
let selectNormal = function (hex, args) {
args.creature.tracePath(hex);
};
let selectFlying = function (hex, args) {
args.creature.tracePosition({
x: hex.x,
y: hex.y,
overlayClass: "creature moveto selected player" + args.creature.team
});
};
let select = (o.noPath || this.movementType() === "flying") ? selectFlying : selectNormal;
if (this.noActionPossible) {
game.grid.querySelf({
fnOnConfirm: function () {
game.UI.btnSkipTurn.click();
},
fnOnCancel: function () { },
confirmText: "Skip turn"
});
} else {
game.grid.queryHexes({
fnOnSelect: select,
fnOnConfirm: o.callback,
args: {
creature: this,
args: o.args
}, // Optional args
size: this.size,
flipped: this.player.flipped,
id: this.id,
hexes: o.range,
ownCreatureHexShade: o.ownCreatureHexShade,
targeting: o.targeting
});
}
}
/* previewPosition(hex)
*
* hex : Hex : Position
*
* Preview the creature position at the given Hex
*
*/
previewPosition(hex) {
let game = this.game;
game.grid.cleanOverlay("hover h_player" + this.team);
if (!game.grid.hexes[hex.y][hex.x].isWalkable(this.size, this.id)) {
return; // Break if not walkable
}
this.tracePosition({
x: hex.x,
y: hex.y,
overlayClass: "hover h_player" + this.team
});
}
/* cleanHex()
*
* Clean current creature hexagons
*
*/
cleanHex() {
this.hexagons.forEach((hex) => {
hex.creature = undefined;
});
this.hexagons = [];
}
/* updateHex()
*
* Update the current hexes containing the creature and their display
*
*/
updateHex() {
let count = this.size,
i;
for (i = 0; i < count; i++) {
this.hexagons.push(this.game.grid.hexes[this.y][this.x - i]);
}
this.hexagons.forEach((hex) => {
hex.creature = this;
});
}
/* faceHex(facefrom,faceto)
*
* facefrom : Hex or Creature : Hex to face from
* faceto : Hex or Creature : Hex to face
*
* Face creature at given hex
*
*/
faceHex(faceto, facefrom, ignoreCreaHex, attackFix) {
if (!facefrom) {
facefrom = (this.player.flipped) ? this.hexagons[this.size - 1] : this.hexagons[0];
}
if (ignoreCreaHex && this.hexagons.indexOf(faceto) != -1 && this.hexagons.indexOf(facefrom) != -1) {
this.facePlayerDefault();
return;
}
if (faceto instanceof Creature) {
faceto = (faceto.size < 2) ? faceto.hexagons[0] : faceto.hexagons[1];
}
if (faceto.x == facefrom.x && faceto.y == facefrom.y) {
this.facePlayerDefault();
return;
}
if (attackFix && this.size > 1) {
//only works on 2hex creature targeting the adjacent row
if (facefrom.y % 2 === 0) {
if (faceto.x - this.player.flipped == facefrom.x) {
this.facePlayerDefault();
return;
}
} else {
if (faceto.x + 1 - this.player.flipped == facefrom.x) {
this.facePlayerDefault();
return;
}
}
}
if (facefrom.y % 2 === 0) {
var flipped = (faceto.x <= facefrom.x);
} else {
var flipped = (faceto.x < facefrom.x);
}
if (flipped) {
this.sprite.scale.setTo(-1, 1);
} else {
this.sprite.scale.setTo(1, 1);
}
this.sprite.x = ((!flipped) ? this.display["offset-x"] : 90 * this.size - this.sprite.texture.width - this.display["offset-x"]) + this.sprite.texture.width / 2;
}
/* facePlayerDefault()
*
* Face default direction
*
*/
facePlayerDefault() {
if (this.player.flipped) {
this.sprite.scale.setTo(-1, 1);
} else {
this.sprite.scale.setTo(1, 1);
}
this.sprite.x = ((!this.player.flipped) ? this.display["offset-x"] : 90 * this.size - this.sprite.texture.width - this.display["offset-x"]) + this.sprite.texture.width / 2;
}
/* moveTo(hex,opts)
*
* hex : Hex : Destination Hex
* opts : Object : Optional args object
*
* Move the creature along a calculated path to the given coordinates
*
*/
moveTo(hex, opts) {
let game = this.game,
defaultOpt = {
callback: function () {
return true;
},
callbackStepIn: function () {
return true;
},
animation: this.movementType() === "flying" ? "fly" : "walk",
ignoreMovementPoint: false,
ignorePath: false,
customMovementPoint: 0,
overrideSpeed: 0,
turnAroundOnComplete: true
},
path;
opts = $j.extend(defaultOpt, opts);
// Teleportation ignores moveable
if (this.stats.moveable || opts.animation === "teleport") {
let x = hex.x;
let y = hex.y;
if (opts.ignorePath || opts.animation == "fly") {
path = [hex];
} else {
path = this.calculatePath(x, y);
}
if (path.length === 0) {
return; // Break if empty path
}
game.grid.xray(new Hex(0, 0, false, game)); // Clean Xray
this.travelDist = 0;
game.animations[opts.animation](this, path, opts);
} else {
game.log("This creature cannot be moved");
}
let interval = setInterval(() => {
if (!game.freezedInput) {
clearInterval(interval);
opts.callback();
}
}, 100);
}
/* tracePath(hex)
*
* hex : Hex : Destination Hex
*
* Trace the path from the current possition to the given coordinates
*
*/
tracePath(hex) {
let game = this.game,
x = hex.x,
y = hex.y,
path = this.calculatePath(x, y); // Store path in grid to be able to compare it later
if (path.length === 0) {
return; // Break if empty path
}
path.forEach((item) => {
this.tracePosition({
x: item.x,
y: item.y,
displayClass: "adj",
drawOverCreatureTiles: false
});
}); // Trace path
// Highlight final position
var last = arrayUtils.last(path);
this.tracePosition({
x: last.x,
y: last.y,
overlayClass: "creature moveto selected player" + this.team,
drawOverCreatureTiles: false
});
}
tracePosition(args) {
let defaultArgs = {
x: this.x,
y: this.y,
overlayClass: "",
displayClass: "",
drawOverCreatureTiles: true
};
args = $j.extend(defaultArgs, args);
for (let i = 0; i < this.size; i++) {
let canDraw = true;
if(!args.drawOverCreatureTiles){ // then check to ensure this is not a creature tile
for(let j = 0; j < this.hexagons.length;j++){
if(this.hexagons[j].x == args.x-i && this.hexagons[j].y == args.y){
canDraw = false;
break;
}
}
}
if(canDraw){
let hex = this.game.grid.hexes[args.y][args.x - i];
this.game.grid.cleanHex(hex);
hex.overlayVisualState(args.overlayClass);
hex.displayVisualState(args.displayClass);
}
}
}
/* calculatePath(x,y)
*
* x : Integer : Destination coordinates
* y : Integer : Destination coordinates
*
* return : Array : Array containing the path hexes
*
*/
calculatePath(x, y) {
let game = this.game;
return search(
game.grid.hexes[this.y][this.x],
game.grid.hexes[y][x],
this.size,
this.id,
this.game.grid
); // Calculate path
}
/* calcOffset(x,y)
*
* x : Integer : Destination coordinates
* y : Integer : Destination coordinates
*
* return : Object : New position taking into acount the size, orientation and obstacle {x,y}
*
* Return the first possible position for the creature at the given coordinates
*
*/
calcOffset(x, y) {
let offset = (game.players[this.team].flipped) ? this.size - 1 : 0,
mult = (game.players[this.team].flipped) ? 1 : -1, // For FLIPPED player
game = this.game;
for (let i = 0; i < this.size; i++) { // Try next hexagons to see if they fit
if ((x + offset - i * mult >= game.grid.hexes[y].length) || (x + offset - i * mult < 0)) {
continue;
}
if (game.grid.hexes[y][x + offset - i * mult].isWalkable(this.size, this.id)) {
x += offset - i * mult;
break;
}
}
return {
x: x,
y: y
};
}
/* getInitiative()
*
* return : Integer : Initiative value to order the queue
*
*/
getInitiative() {
// To avoid 2 identical initiative
return this.stats.initiative * 500 - this.id;
}
/* adjacentHexes(dist)
*
* dist : Integer : Distance in hexagons
*
* return : Array : Array of adjacent hexagons
*
*/
adjacentHexes(dist, clockwise) {
let game = this.game;
// TODO Review this algo to allow distance
if (!!clockwise) {
let hexes = [],
c;
let o = (this.y % 2 === 0) ? 1 : 0;
if (this.size == 1) {
c = [{
y: this.y,
x: this.x + 1
},
{
y: this.y - 1,
x: this.x + o
},
{
y: this.y - 1,
x: this.x - 1 + o
},
{
y: this.y,
x: this.x - 1
},
{
y: this.y + 1,
x: this.x - 1 + o
},
{
y: this.y + 1,
x: this.x + o
}
];
}
if (this.size == 2) {
c = [{
y: this.y,
x: this.x + 1
},
{
y: this.y - 1,
x: this.x + o
},
{
y: this.y - 1,
x: this.x - 1 + o
},
{
y: this.y - 1,
x: this.x - 2 + o
},
{
y: this.y,
x: this.x - 2
},
{
y: this.y + 1,
x: this.x - 2 + o
},
{
y: this.y + 1,
x: this.x - 1 + o
},
{
y: this.y + 1,
x: this.x + o
}
];
}
if (this.size == 3) {
c = [{
y: this.y,
x: this.x + 1
},
{
y: this.y - 1,
x: this.x + o
},
{
y: this.y - 1,
x: this.x - 1 + o
},
{
y: this.y - 1,
x: this.x - 2 + o
},
{
y: this.y - 1,
x: this.x - 3 + o
},
{
y: this.y,
x: this.x - 3
},
{
y: this.y + 1,
x: this.x - 3 + o
},
{
y: this.y + 1,
x: this.x - 2 + o
},
{
y: this.y + 1,
x: this.x - 1 + o
},
{
y: this.y + 1,
x: this.x + o
}
];
}
let total = c.length;
for (let i = 0; i < total; i++) {
const { x, y } = c[i];
if (game.grid.hexExists(y, x)) {
hexes.push(game.grid.hexes[y][x]);
}
}
return hexes;
}
if (this.size > 1) {
let hexes = this.hexagons[0].adjacentHex(dist);
let lasthexes = this.hexagons[this.size - 1].adjacentHex(dist);
hexes.forEach((hex) => {
if (arrayUtils.findPos(this.hexagons, hex)) {
arrayUtils.removePos(hexes, hex);
} // Remove from array if own creature hex
});
lasthexes.forEach((hex) => {
// If node doesnt already exist in final collection and if it's not own creature hex
if (!arrayUtils.findPos(hexes, hex) && !arrayUtils.findPos(this.hexagons, hex)) {
hexes.push(hex);
}
});
return hexes;
} else {
return this.hexagons[0].adjacentHex(dist);
}
}
/**
* Restore energy up to the max limit
* amount: amount of energy to restore
*/
recharge(amount) {
this.energy = Math.min(this.stats.energy, this.energy + amount);
}
/* heal(amount)
*
* amount : Damage : Amount of health point to restore
*/
heal(amount, isRegrowth) {
let game = this.game;
// Cap health point
amount = Math.min(amount, this.stats.health - this.health);
if (this.health + amount < 1) {
amount = this.health - 1; // Cap to 1hp
}
this.health += amount;
// Health display Update
this.updateHealth(isRegrowth);
if (amount > 0) {
if (isRegrowth) {
this.hint("+" + amount + " ♥", 'healing d' + amount);
} else {
this.hint("+" + amount, 'healing d' + amount);
}
game.log("%CreatureName" + this.id + "% recovers +" + amount + " health");
} else if (amount === 0) {
if (isRegrowth) {
this.hint("♦", 'msg_effects');
} else {
this.hint("!", 'msg_effects');
}
} else {
if (isRegrowth) {
this.hint(amount + " ♠", 'damage d' + amount);
} else {
this.hint(amount, 'damage d ' + amount);
}
game.log("%CreatureName" + this.id + "% loses " + amount + " health");
}
game.onHeal(this, amount);
}
/* takeDamage(damage)
*
* damage : Damage : Damage object
*
* return : Object : Contains damages dealed and if creature is killed or not
*/
takeDamage(damage, o) {
let game = this.game;
if (this.dead) {
game.log("%CreatureName" + this.id + "% is already dead, aborting takeDamage call.");
return;
}
let defaultOpt = {
ignoreRetaliation: false,
isFromTrap: false
};
o = $j.extend(defaultOpt, o);
// Determine if melee attack
damage.melee = false;
this.adjacentHexes(1).forEach((hex) => {
if (damage.attacker == hex.creature) {
damage.melee = true;
}
});
damage.target = this;
damage.isFromTrap = o.isFromTrap;
// Trigger
game.onUnderAttack(this, damage);
game.onAttack(damage.attacker, damage);
// Calculation
if (damage.status === "") {
// Damages
let dmg = damage.applyDamage();
let dmgAmount = dmg.total;
if (!isFinite(dmgAmount)) { // Check for Damage Errors
this.hint("Error", 'damage');
game.log("Oops something went wrong !");
return {
damages: 0,
kill: false
};
}
this.health -= dmgAmount;
this.health = (this.health < 0) ? 0 : this.health; // Cap
this.addFatigue(dmgAmount);
// Display
let nbrDisplayed = (dmgAmount) ? "-" + dmgAmount : 0;
this.hint(nbrDisplayed, 'damage d' + dmgAmount);
if (!damage.noLog) {
game.log("%CreatureName" + this.id + "% is hit : " + nbrDisplayed + " health");
}
// If Health is empty
if (this.health <= 0) {
this.die(damage.attacker);
return {
damages: dmg,
damageObj: damage,
kill: true
}; // Killed
}
// Effects
damage.effects.forEach((effect) => {
this.addEffect(effect);
});
// Unfreeze if taking non-zero damage
if (dmgAmount > 0) {
this.stats.frozen = false;
}
// Health display Update
// Note: update health after adding effects as some effects may affect
// health display
this.updateHealth();
game.UI.updateFatigue();
// Trigger
if (!o.ignoreRetaliation) {
game.onDamage(this, damage);
}
return {
damages: dmg,
damageObj: damage,
kill: false
}; // Not Killed
} else {
if (damage.status == "Dodged") { // If dodged
if (!damage.noLog) {
game.log("%CreatureName" + this.id + "% dodged the attack");
}
}
if (damage.status == "Shielded") { // If Shielded
if (!damage.noLog) {
game.log("%CreatureName" + this.id + "% shielded the attack");
}
}
if (damage.status == "Disintegrated") { // If Disintegrated
if (!damage.noLog) {
game.log("%CreatureName" + this.id + "% has been disintegrated");
}
this.die(damage.attacker);
}
// Hint
this.hint(damage.status, 'damage ' + damage.status.toLowerCase());
}
return {
damageObj: damage,
kill: false
}; // Not killed
}
updateHealth(noAnimBar) {
let game = this.game;
if (this == game.activeCreature && !noAnimBar) {
game.UI.healthBar.animSize(this.health / this.stats.health);
}
// Dark Priest plasma shield when inactive
if (this.type == "--") {
if (this.hasCreaturePlayerGotPlasma() && this !== game.activeCreature) {
this.displayPlasmaShield();
} else {
this.displayHealthStats()
}
} else {
this.displayHealthStats();
}
}
displayHealthStats() {
if (this.stats.frozen) {
this.healthIndicatorSprite.loadTexture("p" + this.team + "_frozen");
} else {
this.healthIndicatorSprite.loadTexture("p" + this.team + "_health");
}
this.healthIndicatorText.setText(this.health);
}
displayPlasmaShield() {
this.healthIndicatorSprite.loadTexture("p" + this.team + "_plasma");
this.healthIndicatorText.setText(this.player.plasma);
}
hasCreaturePlayerGotPlasma() {
return this.player.plasma > 0;
}
addFatigue(dmgAmount) {
if (!this.stats.fatigueImmunity) {
this.endurance -= dmgAmount;
this.endurance = this.endurance < 0 ? 0 : this.endurance; // Cap
}
this.game.UI.updateFatigue();
}
/* addEffect(effect)
*
* effect : Effect : Effect object
*
*/
addEffect(effect, specialString, specialHint) {
let game = this.game;
if (!effect.stackable && this.findEffect(effect.name).length !== 0) {
//G.log(this.player.name+"'s "+this.name+" is already affected by "+effect.name);
return false;
}
effect.target = this;
this.effects.push(effect);
game.onEffectAttach(this, effect);
this.updateAlteration();
if (effect.name !== "") {
if (specialHint || effect.specialHint) {
this.hint(specialHint, 'msg_effects');
} else {
this.hint(effect.name, 'msg_effects');
}
if (specialString) {
game.log(specialString);
} else {
game.log("%CreatureName" + this.id + "% is affected by " + effect.name);
}
}
}
/**
* Add effect, but if the effect is already attached, replace it with the new
* effect.
* Note that for stackable effects, this is the same as addEffect()
*
* effect - the effect to add
*/
replaceEffect(effect) {
if (!effect.stackable && this.findEffect(effect.name).length !== 0) {
this.removeEffect(effect.name);
}
this.addEffect(effect);
}
/**
* Remove an effect by name
*
* name - name of effect
*/
removeEffect(name) {
let totalEffects = this.effects.length;
for (var i = 0; i < totalEffects; i++) {
if (this.effects[i].name === name) {
this.effects.splice(i, 1);
break;
}
}
}
hint(text, cssClass) {
let game = this.game,
tooltipSpeed = 250,
tooltipDisplaySpeed = 500,
tooltipTransition = Phaser.Easing.Linear.None;
let hintColor = {
confirm: {
fill: "#ffffff",
stroke: "#000000"
},
gamehintblack: {
fill: "#ffffff",
stroke: "#000000"
},
healing: {
fill: "#00ff00"
},
msg_effects: {
fill: "#ffff00"
}
};
let style = $j.extend({
font: "bold 20pt Play",
fill: "#ff0000",
align: "center",
stroke: "#000000",
strokeThickness: 2
}, hintColor[cssClass]);
// Remove constant element
this.hintGrp.forEach((grpHintElem) => {
if (grpHintElem.cssClass == 'confirm') {
grpHintElem.cssClass = "confirm_deleted";
grpHintElem.tweenAlpha = game.Phaser.add.tween(grpHintElem).to({
alpha: 0
}, tooltipSpeed, tooltipTransition).start();
grpHintElem.tweenAlpha.onComplete.add(function () {
this.destroy();
}, grpHintElem);
}
}, this, true);
var hint = game.Phaser.add.text(0, 50, text, style);
hint.anchor.setTo(0.5, 0.5);
hint.alpha = 0;
hint.cssClass = cssClass;
if (cssClass == 'confirm') {
hint.tweenAlpha = game.Phaser.add.tween(hint)
.to({
alpha: 1
}, tooltipSpeed, tooltipTransition)
.start();
} else {
hint.tweenAlpha = game.Phaser.add.tween(hint)
.to({
alpha: 1
}, tooltipSpeed, tooltipTransition)
.to({
alpha: 1
}, tooltipDisplaySpeed, tooltipTransition)
.to({
alpha: 0
}, tooltipSpeed, tooltipTransition).start();
hint.tweenAlpha.onComplete.add(function () {
this.destroy();
}, hint);
}
this.hintGrp.add(hint);
// Stacking
this.hintGrp.forEach((grpHintElem) => {
let index = this.hintGrp.total - this.hintGrp.getIndex(grpHintElem) - 1;
let offset = -50 * index;
if (grpHintElem.tweenPos) {
grpHintElem.tweenPos.stop();
}
grpHintElem.tweenPos = game.Phaser.add.tween(grpHintElem).to({
y: offset
}, tooltipSpeed, tooltipTransition).start();
}, this, true);
}
/* updateAlteration()
*
* Update the stats taking into account the effects' alteration
*
*/
updateAlteration() {
this.stats = $j.extend({}, this.baseStats); // Copy
let buffDebuffArray = this.effects;
buffDebuffArray.forEach((buff) => {
$j.each(buff.alterations, (key, value) => {
if (typeof value == "string") {
// Multiplication Buff
if (value.match(/\*/)) {
this.stats[key] = eval(this.stats[key] + value);
}
// Division Debuff
if (value.match(/\//)) {
this.stats[key] = eval(this.stats[key] + value);
}
}
// Usual Buff/Debuff
if ((typeof value) == "number") {
this.stats[key] += value;
}
// Boolean Buff/Debuff
if ((typeof value) == "boolean") {
this.stats[key] = value;
}
});
});
this.stats.endurance = Math.max(this.stats.endurance, 0);
this.endurance = Math.min(this.endurance, this.stats.endurance);
this.energy = Math.min(this.energy, this.stats.energy);
this.remainingMove = Math.min(this.remainingMove, this.stats.movement);
}
/* die()
*
* kill animation. remove creature from queue and from hexes
*
* killer : Creature : Killer of this creature
*
*/
die(killer) {
let game = this.game;
game.log("%CreatureName" + this.id + "% is dead");
this.dead = true;
// Triggers
game.onCreatureDeath(this);
this.killer = killer.player;
let isDeny = (this.killer.flipped == this.player.flipped);
// Drop item
if (game.unitDrops == 1 && this.drop) {
var offsetX = (this.player.flipped) ? this.x - this.size + 1 : this.x;
new Drop(this.drop.name, this.drop.health, this.drop.energy, offsetX, this.y, game);
}
if (!game.firstKill && !isDeny) { // First Kill
this.killer.score.push({
type: "firstKill"
});
game.firstKill = true;
}
if (this.type == "--") { // If Dark Priest
if (isDeny) {
// TEAM KILL (DENY)
this.killer.score.push({
type: "deny",
creature: this
});
} else {
// Humiliation
this.killer.score.push({
type: "humiliation",
player: this.team
});
}
}
if (!this.undead) { // Only if not undead
if (isDeny) {
// TEAM KILL (DENY)
this.killer.score.push({
type: "deny",
creature: this
});
} else {
// KILL
this.killer.score.push({
type: "kill",
creature: this
});
}
}
if (this.player.isAnnihilated()) {
// Remove humiliation as annihilation is an upgrade
let total = this.killer.score.length;
for (let i = 0; i < total; i++) {
var s = this.killer.score[i];
if (s.type == "humiliation") {
if (s.player == this.team) {
this.killer.score.splice(i, 1);
}
break;
}
}
// ANNIHILATION
this.killer.score.push({
type: "annihilation",
player: this.team
});
}
if (this.type == "--") {
this.player.deactivate(); // Here because of score calculation
}
// Kill animation
var tweenSprite = game.Phaser.add.tween(this.sprite).to({
alpha: 0
}, 500, Phaser.Easing.Linear.None).start();
var tweenHealth = game.Phaser.add.tween(this.healthIndicatorGroup).to({
alpha: 0
}, 500, Phaser.Easing.Linear.None).start();
tweenSprite.onComplete.add(() => {
this.sprite.destroy();
});
tweenHealth.onComplete.add(() => {
this.healthIndicatorGroup.destroy();
});
this.cleanHex();
game.queue.remove(this);
game.updateQueueDisplay();
game.grid.updateDisplay();
if (game.activeCreature === this) {
game.nextCreature();
return;
} //End turn if current active creature die
// As hex occupation changes, path must be recalculated for the current creature not the dying one
game.activeCreature.queryMove();
// Queue cleaning
game.UI.updateActivebox();
game.UI.updateQueueDisplay(); // Just in case
}
isFatigued() {
return this.endurance === 0 && !this.isFragile();
}
isFragile() {
return this.stats.endurance === 0;
}
/* getHexMap()
*
* shortcut convenience function to grid.getHexMap
*/
getHexMap(map, invertFlipped) {
var x = (this.player.flipped ? !invertFlipped : invertFlipped) ? this.x + 1 - this.size : this.x;
return this.game.grid.getHexMap(x, this.y - map.origin[1], 0 - map.origin[0], (this.player.flipped ? !invertFlipped : invertFlipped), map);
}
getBuffDebuff(stat) {
let buffDebuffArray = this.effects.concat(this.dropCollection),
buff = 0,
debuff = 0,
buffObjs = {
effects: [],
drops: []
};
let addToBuffObjs = function (obj) {
if (obj instanceof Effect) {
buffObjs.effects.push(obj);
} else if (obj instanceof Drop) {
buffObjs.drops.push(obj);
}
};
buffDebuffArray.forEach((buff) => {
let o = buff;
$j.each(buff.alterations, (key, value) => {
if (typeof value == "string") {
if (key === stat || stat === undefined) {
// Multiplication Buff
if (value.match(/\*/)) {
addToBuffObjs(o);
let base = this.stats[key];
let result = eval(this.stats[key] + value);
if (result > base) {
buff += result - base;
} else {
debuff += result - base;
}
}
// Division Debuff
if (value.match(/\//)) {
addToBuffObjs(o);
let base = this.stats[key];
let result = eval(this.stats[key] + value);
if (result > base) {
buff += result - base;
} else {
debuff += result - base;
}
}
}
}
// Usual Buff/Debuff
if ((typeof value) == "number") {
if (key === stat || stat === undefined) {
addToBuffObjs(o);
if (value > 0) {
buff += value;
} else {
debuff += value;
}
}
}
});
});
return {
buff: buff,
debuff: debuff,
objs: buffObjs
};
}
findEffect(name) {
let ret = [];
this.effects.forEach((effect) => {
if (effect.name == name) {
ret.push(effect);
}
});
return ret;
}
// Make units transparent
xray(enable) {
let game = this.game;
if (enable) {
game.Phaser.add.tween(this.grp)
.to({
alpha: 0.5
}, 250, Phaser.Easing.Linear.None)
.start();
} else {
game.Phaser.add.tween(this.grp)
.to({
alpha: 1
}, 250, Phaser.Easing.Linear.None)
.start();
}
}
pickupDrop() {
this.hexagons.forEach((hex) => {
hex.pickupDrop(this);
});
}
/**
* Get movement type for this creature
* @return {string} "normal", "hover", or "flying"
*/
movementType() {
let totalAbilities = this.abilities.length;
// If the creature has an ability that modifies movement type, use that,
// otherwise use the creature's base movement type
for (let i = 0; i < totalAbilities; i++) {
if ('movementType' in this.abilities[i]) {
return this.abilities[i].movementType();
}
}
return this._movementType;
}
}
| ShaneWalsh/AncientBeast | src/creature.js | JavaScript | agpl-3.0 | 37,616 |
{"":{"domain":"ckan","lang":"no","plural-forms":"nplurals=2; plural=(n != 1);"},"Cancel":[null,"Avbryt"],"Edit":[null,"Rediger"],"Follow":[null,"Følg"],"Loading...":[null,"Laster..."],"URL":[null,"URL"],"Unfollow":[null,"Ikke følg"],"Upload a file":[null,"Last opp en fil"]} | sergitrilles/geoctheme | ckanext/geoc_theme/public/base/i18n/no.min.js | JavaScript | agpl-3.0 | 276 |
import React from 'react';
import { Card } from 'bm-kit';
import './_pillar.schedule.source.scss';
const friday = [
{
start: '6:00 PM',
name: '📋 Check in begins'
},
{
start: '8:00 PM',
name: '🎤 Opening Ceremonies'
},
{
start: '9:00 PM',
name: '🤝 Team assembly'
},
{
start: '9:30 PM',
name: '🌮 Dinner'
},
{
start: '10:00 PM',
name: '💻 Hacking Begins'
},
{
start: '10:00 PM',
name: '🤖 Fundamentals of AI with Intel'
},
{
start: '12:00 AM',
name: '🥋 Ninja'
}
];
let saturday = [
{
start: '3:00 AM',
name: '🍿 Late Night Snack'
},
{
start: '8:00 AM',
name: '🥓 Breakfast'
},
{
start: '9:00 AM',
name: '🏗 Workshop'
},
{
start: '12:30 PM',
name: '🍝 Lunch'
},
{
start: '1:00 PM',
name: '👪 Facebook Tech Talk'
},
{
start: '2:00 PM',
name: '🐶 Doggos/Woofers'
},
{
start: '2:30 PM',
name: '✈️ Rockwell Collins Talk'
},
{
start: '3:00 PM',
name: '🍿 Snack'
},
{
start: '3:00 PM',
name: '🚣🏽 Activity'
},
{
start: '4:00 PM',
name: '📈 Startups with T.A. MaCann'
},
{
start: '6:00 PM',
name: '🍕 Dinner'
},
{
start: '9:00 PM',
name: '🥤 Cup stacking with MLH'
},
{
start: '10:00 PM',
name: '🍩 Donuts and Kona Ice'
},
{
start: '10:00 PM',
name: '🏗️ Jenga'
}
];
let sunday = [
{
start: '1:00 AM',
name: '🍿 Late Night Snack'
},
{
start: '8:00 AM',
name: '🍳 Breakfast'
},
{
start: '9:30 AM',
name: '🛑 Hacking Ends'
},
{
start: '10:00 AM',
name: '📔 Expo Begins'
},
{
start: '11:30 AM',
name: '🍞 Lunch'
},
{
start: '1:00 PM',
name: '🎭 Closing Ceremonies'
},
{
start: '2:30 PM',
name: '🚌 Buses Depart'
}
];
const ScheduleDay = ({ dayData, title }) => (
<Card className="p-schedule__day">
<h3 className="text-center">{title}</h3>
{dayData.map(item => (
<div className="p-schedule__item" key={item.name + item.start}>
<div className="p-schedule__item_about">
<span className="p-schedule__item_time">{item.start}</span>
<span className="p-schedule__item_title">{item.name}</span>
</div>
<div className="p-schedule__item_info">{item.info}</div>
</div>
))}
</Card>
);
const Schedule = ({ small }) => (
<div className="p-schedule">
{small ? <h3 style={{ marginTop: 0 }}>Schedule</h3> : <h1>Schedule</h1>}
<div className="p-schedule__days">
<ScheduleDay dayData={friday} title="Friday (10/19)" />
<ScheduleDay dayData={saturday} title="Saturday (10/20)" />
<ScheduleDay dayData={sunday} title="Sunday (10/21)" />
</div>
</div>
);
export default Schedule;
| BoilerMake/frontend | src/components/Schedule/index.js | JavaScript | agpl-3.0 | 2,859 |
window.addEventListener("DOMContentLoaded", () => {
let watchers = {};
new DOM('@Dialog').forEach((dialog) => {
dialogPolyfill.registerDialog(dialog);
if (dialog.querySelector('Button[Data-Action="Dialog_Submit"]')) {
dialog.addEventListener("keydown", (event) => {
if (event.ctrlKey && event.keyCode == 13) dialog.querySelector('Button[Data-Action="Dialog_Submit"]').click();
});
}
dialog.querySelectorAll('Dialog *[Required]').forEach((input) => {
input.addEventListener("input", () => {
let result = true;
dialog.querySelectorAll('Dialog *[Required]').forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
if (result) {
dialog.querySelector('Button[Data-Action="Dialog_Submit"]').classList.remove("mdl-button--disabled");
} else {
dialog.querySelector('Button[Data-Action="Dialog_Submit"]').classList.add("mdl-button--disabled");
}
});
});
dialog.querySelectorAll('Dialog Button[Data-Action="Dialog_Close"]').forEach((btn) => {
btn.addEventListener("click", () => {
btn.offsetParent.close();
});
});
});
new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email-Input").addEventListener("input", () => {
if (new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email-Input").value == base.user.email) {
new DOM("#Dialogs_Profile_DeleteConfirmer_Btns_Yes").classList.remove("mdl-button--disabled");
} else {
new DOM("#Dialogs_Profile_DeleteConfirmer_Btns_Yes").classList.add("mdl-button--disabled");
}
});
new DOM("#Dialogs_Profile_DeleteConfirmer_Btns_Yes").addEventListener("click", (event) => {
if (new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email-Input").value == base.user.email) {
base.delete();
} else {
new DOM("#Dialogs_Profile_DeleteConfirmer_Content_Email").classList.add("is-invalid");
}
});
watchers["Dialogs_Profile_InfoViewer_UID"] = {
valueObj: { value: "" },
watcher: null
}; watchers["Dialogs_Profile_InfoViewer_UID"].watcher = new DOM.Watcher({
target: watchers["Dialogs_Profile_InfoViewer_UID"].valueObj,
onGet: () => { watchers["Dialogs_Profile_InfoViewer_UID"].valueObj.value = new DOM("#Dialogs_Profile_InfoViewer_UID").value },
onChange: (watcher) => {
base.Database.get(base.Database.ONCE, `users/${watcher.newValue}`, (res) => {
new DOM("#Dialogs_Profile_InfoViewer_Content_Photo").dataset.uid = watcher.newValue,
new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Name").textContent = res.userName,
new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Detail").textContent = res.detail;
while (new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Links").childNodes.length > 0) new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Links").childNodes[0].remove();
if (res.links) {
for (let i = 0; i < res.links.length; i++) {
let link = new Component.Dialogs.Profile.InfoViewer.Links.Link(res.links[i].name, res.links[i].url);
new DOM("#Dialogs_Profile_InfoViewer_Content_Info_Links").appendChild(link);
}
}
});
}
});
new DOM("#Dialogs_Thread_DeleteConfirmer_Btns_Yes").addEventListener("click", () => {
base.Database.delete(`threads/${new DOM("#Dialogs_Thread_DeleteConfirmer_TID").value}/`);
parent.document.querySelector("IFrame.mdl-layout__content").contentWindow.postMessage({ code: "Code-Refresh" }, "*");
new DOM("#Dialogs_Thread_EditNotify").showModal();
});
new DOM("@#Dialogs_Thread_InfoInputter *[Required]").forEach((input) => {
input.addEventListener("input", () => {
let result = true;
let list = [
new DOM("#Dialogs_Thread_InfoInputter_Content_Name-Input"),
new DOM("#Dialogs_Thread_InfoInputter_Content_Overview-Input")
];
if (new DOM("#Dialogs_Thread_InfoInputter_Content_Secured-Input").checked) list.push(new DOM("#Dialogs_Thread_InfoInputter_Content_Password-Input"));
list.forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
if (result) {
new DOM("#Dialogs_Thread_InfoInputter").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.remove("mdl-button--disabled");
});
} else {
new DOM("#Dialogs_Thread_InfoInputter").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.add("mdl-button--disabled");
});
}
});
});
new DOM("#Dialogs_Thread_InfoInputter_Content_Secured-Input").addEventListener("change", (event) => {
let result = true;
switch (event.target.checked) {
case true:
new DOM("#Dialogs_Thread_InfoInputter_Content_Password").classList.remove("mdl-switch__child-hide");
[new DOM("#Dialogs_Thread_InfoInputter_Content_Name-Input"), new DOM("#Dialogs_Thread_InfoInputter_Content_Overview-Input"), new DOM("#Dialogs_Thread_InfoInputter_Content_Password-Input")].forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
break;
case false:
new DOM("#Dialogs_Thread_InfoInputter_Content_Password").classList.add("mdl-switch__child-hide");
[new DOM("#Dialogs_Thread_InfoInputter_Content_Name-Input"), new DOM("#Dialogs_Thread_InfoInputter_Content_Overview-Input")].forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
break;
}
if (result) {
new DOM("#Dialogs_Thread_InfoInputter").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.remove("mdl-button--disabled");
});
} else {
new DOM("#Dialogs_Thread_InfoInputter").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.add("mdl-button--disabled");
});
}
});
new DOM("#Dialogs_Thread_InfoInputter_Btns_Create").addEventListener("click", (event) => {
base.Database.transaction("threads", (res) => {
let now = new Date().getTime();
base.Database.set("threads/" + res.length, {
title: new DOM("#Dialogs_Thread_InfoInputter_Content_Name-Input").value,
overview: new DOM("#Dialogs_Thread_InfoInputter_Content_Overview-Input").value,
detail: new DOM("#Dialogs_Thread_InfoInputter_Content_Detail-Input").value,
jobs: {
Owner: (() => {
let owner = {}; owner[base.user.uid] = "";
return owner;
})(),
Admin: {
}
},
createdAt: now,
data: [
{
uid: "!SYSTEM_INFO",
content: new DOM("#Dialogs_Thread_InfoInputter_Content_Name-Input").value,
createdAt: now
}
],
password: new DOM("#Dialogs_Thread_InfoInputter_Content_Secured-Input").checked ? Encrypter.encrypt(new DOM("#Dialogs_Thread_InfoInputter_Content_Password-Input").value) : ""
});
new DOM("#Dialogs_Thread_InfoInputter").close();
parent.document.querySelector("IFrame.mdl-layout__content").src = "Thread/Viewer/?tid=" + res.length;
});
});
new DOM("#Dialogs_Thread_InfoInputter_Btns_Edit").addEventListener("click", (event) => {
base.Database.update(`threads/${new DOM("#Dialogs_Thread_InfoInputter_TID").value}/`, {
title: new DOM("#Dialogs_Thread_InfoInputter_Content_Name-Input").value,
overview: new DOM("#Dialogs_Thread_InfoInputter_Content_Overview-Input").value,
detail: new DOM("#Dialogs_Thread_InfoInputter_Content_Detail-Input").value,
password: new DOM("#Dialogs_Thread_InfoInputter_Content_Secured-Input").checked ? Encrypter.encrypt(new DOM("#Dialogs_Thread_InfoInputter_Content_Password-Input").value) : ""
});
new DOM("#Dialogs_Thread_InfoInputter").close();
new DOM("#Dialogs_Thread_EditNotify").showModal();
});
new DOM("#Dialogs_Thread_PasswordConfirmer_Btns_OK").addEventListener("click", (event) => {
if (Encrypter.encrypt(new DOM("#Dialogs_Thread_PasswordConfirmer_Content_Password-Input").value) == new DOM("#Dialogs_Thread_PasswordConfirmer_Password").value) {
sessionStorage.setItem("com.GenbuProject.SimpleThread.currentPassword", new DOM("#Dialogs_Thread_PasswordConfirmer_Content_Password-Input").value);
new DOM("$IFrame.mdl-layout__content").src = new DOM("#Dialogs_Thread_PasswordConfirmer_Link").value;
new DOM("#Dialogs_Thread_PasswordConfirmer_Link").value = "",
new DOM("#Dialogs_Thread_PasswordConfirmer_Password").value = "";
} else {
new DOM("#Dialogs_Thread_PasswordConfirmer_Content_Password").classList.add("is-invalid");
}
});
new DOM("#Dialogs_Thread_PasswordConfirmer_Btns_Cancel").addEventListener("click", (event) => {
new DOM("$IFrame.mdl-layout__content").src = "/SimpleThread/Thread/";
});
watchers["Dialogs_Thread_InfoViewer_TID"] = {
valueObj: { value: "0" },
watcher: null
}; watchers["Dialogs_Thread_InfoViewer_TID"].watcher = new DOM.Watcher({
target: watchers["Dialogs_Thread_InfoViewer_TID"].valueObj,
onGet: () => { watchers["Dialogs_Thread_InfoViewer_TID"].valueObj.value = new DOM("#Dialogs_Thread_InfoViewer_TID").value },
onChange: (watcher) => {
base.Database.get(base.Database.ONCE, `threads/${watcher.newValue}`, (res) => {
new DOM("#Dialogs_Thread_InfoViewer_Content_Name").textContent = res.title,
new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").textContent = res.overview,
new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").textContent = res.detail;
URL.filter(new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").textContent).forEach((urlString) => {
new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").innerHTML = new DOM("#Dialogs_Thread_InfoViewer_Content_Overview").innerHTML.replace(urlString, `<A Href = "${urlString}" Target = "_blank">${urlString}</A>`);
});
URL.filter(new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").textContent).forEach((urlString) => {
new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").innerHTML = new DOM("#Dialogs_Thread_InfoViewer_Content_Detail").innerHTML.replace(urlString, `<A Href = "${urlString}" Target = "_blank">${urlString}</A>`);
});
});
}
});
new DOM("#Dialogs_Thread_Poster_Menu_MenuItem-EmbedLink").addEventListener("click", () => {
new DOM("#Dialogs_Thread_Poster_LinkEmbedder").showModal();
});
new DOM("#Dialogs_Thread_Poster_Menu_MenuItem-EmbedImage").addEventListener("click", () => {
new DOM("#Dialogs_Thread_Poster").close();
let picker = new Picker.PhotoPicker(data => {
console.log(data);
switch (data[google.picker.Response.ACTION]) {
case google.picker.Action.CANCEL:
case google.picker.Action.PICKED:
new DOM("#Dialogs_Thread_Poster").showModal();
break;
}
});
picker.show();
});
new DOM("#Dialogs_Thread_Poster_Menu_MenuItem-EmbedFile").addEventListener("click", () => {
new DOM("#Dialogs_Thread_Poster").close();
let picker = new Picker.FilePicker(data => {
console.log(data);
switch (data[google.picker.Response.ACTION]) {
case google.picker.Action.CANCEL:
case google.picker.Action.PICKED:
new DOM("#Dialogs_Thread_Poster").showModal();
break;
}
});
picker.show();
});
new DOM("#Dialogs_Thread_Poster_Content_Text-Input").addEventListener("keydown", (event) => {
let inputter = event.target;
let selectionStart = inputter.selectionStart,
selectionEnd = inputter.selectionEnd;
switch (event.keyCode) {
case 9:
event.preventDefault();
inputter.value = `${inputter.value.slice(0, selectionStart)}\t${inputter.value.slice(selectionEnd)}`;
inputter.setSelectionRange(selectionStart + 1, selectionStart + 1);
new DOM("#Dialogs_Thread_Poster_Content_Text").classList.add("is-dirty");
break;
}
});
new DOM("#Dialogs_Thread_Poster_Btns_OK").addEventListener("click", (event) => {
base.Database.transaction("threads/" + new DOM("#Dialogs_Thread_Poster_TID").value + "/data", (res) => {
base.Database.set("threads/" + new DOM("#Dialogs_Thread_Poster_TID").value + "/data/" + res.length, {
uid: base.user.uid,
content: new DOM("#Dialogs_Thread_Poster_Content_Text-Input").value,
createdAt: new Date().getTime()
});
new DOM("#Dialogs_Thread_Poster_Btns_OK").classList.add("mdl-button--disabled"),
new DOM("#Dialogs_Thread_Poster_Content_Text").classList.remove("is-dirty"),
new DOM("#Dialogs_Thread_Poster_Content_Text-Input").value = "";
new DOM("#Page").contentDocument.querySelector("#FlowPanel_Btns_CreatePost").removeAttribute("Disabled");
new DOM("#Dialogs_Thread_Poster").close();
});
});
new DOM("#Dialogs_Thread_Poster_Btns_Cancel").addEventListener("click", () => {
new DOM("#Dialogs_Thread_Poster_Btns_OK").classList.add("mdl-button--disabled"),
new DOM("#Dialogs_Thread_Poster_Content_Text").classList.remove("is-dirty"),
new DOM("#Dialogs_Thread_Poster_Content_Text-Input").value = "";
new DOM("#Page").contentDocument.querySelector("#FlowPanel_Btns_CreatePost").removeAttribute("Disabled");
});
for (let watcherName in watchers) DOM.Watcher.addWatcher(watchers[watcherName].watcher);
}); | GenbuProject/SimpleThread | Dialog.js | JavaScript | agpl-3.0 | 13,060 |
function timenow(){
var timenow1 = Date.getHours();
return timenow1;
} | trynothingy/JQSchProj | assets/js/func.js | JavaScript | agpl-3.0 | 78 |
'use strict';
angular.module('cheeperApp')
.controller('AuthCtrl', function ($scope, $http) {
$scope.signin = function() {
$http
.post('http://127.0.0.1:8000/auth-token/', $scope.credentials)
.success(function(data, status, headers, config) {
$scope.token = data.token;
})
.error(function(data, status, headers, config) {
console.log(data);
});
};
});
| hnarayanan/cheeper | app/scripts/controllers/auth.js | JavaScript | agpl-3.0 | 430 |
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "./";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var _addClass = __webpack_require__(25);
var _addClass2 = _interopRequireDefault(_addClass);
var _removeClass = __webpack_require__(26);
var _removeClass2 = _interopRequireDefault(_removeClass);
var _after = __webpack_require__(96);
var _after2 = _interopRequireDefault(_after);
var _browser = __webpack_require__(97);
var _browser2 = _interopRequireDefault(_browser);
var _fix = __webpack_require__(98);
var _fix2 = _interopRequireDefault(_fix);
var _util = __webpack_require__(27);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// fix hexo 不支持的配置
function isPathMatch(path, href) {
var reg = /\/|index.html/g;
return path.replace(reg, '') === href.replace(reg, '');
}
// 浏览器判断
function tabActive() {
var $tabs = document.querySelectorAll('.js-header-menu li a');
var path = window.location.pathname;
for (var i = 0, len = $tabs.length; i < len; i++) {
var $tab = $tabs[i];
if (isPathMatch(path, $tab.getAttribute('href'))) {
(0, _addClass2.default)($tab, 'active');
}
}
}
function getElementLeft(element) {
var actualLeft = element.offsetLeft;
var current = element.offsetParent;
while (current !== null) {
actualLeft += current.offsetLeft;
current = current.offsetParent;
}
return actualLeft;
}
function getElementTop(element) {
var actualTop = element.offsetTop;
var current = element.offsetParent;
while (current !== null) {
actualTop += current.offsetTop;
current = current.offsetParent;
}
return actualTop;
}
function scrollStop($dom, top, limit, zIndex, diff) {
var nowLeft = getElementLeft($dom);
var nowTop = getElementTop($dom) - top;
if (nowTop - limit <= diff) {
var $newDom = $dom.$newDom;
if (!$newDom) {
$newDom = $dom.cloneNode(true);
(0, _after2.default)($dom, $newDom);
$dom.$newDom = $newDom;
$newDom.style.position = 'fixed';
$newDom.style.top = (limit || nowTop) + 'px';
$newDom.style.left = nowLeft + 'px';
$newDom.style.zIndex = zIndex || 2;
$newDom.style.width = '100%';
$newDom.style.color = '#fff';
}
$newDom.style.visibility = 'visible';
$dom.style.visibility = 'hidden';
} else {
$dom.style.visibility = 'visible';
var _$newDom = $dom.$newDom;
if (_$newDom) {
_$newDom.style.visibility = 'hidden';
}
}
}
function handleScroll() {
var $overlay = document.querySelector('.js-overlay');
var $menu = document.querySelector('.js-header-menu');
scrollStop($overlay, document.body.scrollTop, -63, 2, 0);
scrollStop($menu, document.body.scrollTop, 1, 3, 0);
}
function bindScroll() {
document.querySelector('#container').addEventListener('scroll', function (e) {
handleScroll();
});
window.addEventListener('scroll', function (e) {
handleScroll();
});
handleScroll();
}
function init() {
if (_browser2.default.versions.mobile && window.screen.width < 800) {
tabActive();
bindScroll();
}
}
init();
(0, _util.addLoadEvent)(function () {
_fix2.default.init();
});
module.exports = {};
/***/ },
/* 1 */,
/* 2 */,
/* 3 */,
/* 4 */,
/* 5 */,
/* 6 */,
/* 7 */,
/* 8 */,
/* 9 */,
/* 10 */,
/* 11 */,
/* 12 */,
/* 13 */,
/* 14 */,
/* 15 */,
/* 16 */,
/* 17 */,
/* 18 */,
/* 19 */,
/* 20 */,
/* 21 */,
/* 22 */,
/* 23 */,
/* 24 */,
/* 25 */
/***/ function(module, exports) {
/**
* addClass : addClass(el, className)
* Adds a class name to an element. Compare with `$.fn.addClass`.
*
* var addClass = require('dom101/add-class');
*
* addClass(el, 'active');
*/
function addClass (el, className) {
if (el.classList) {
el.classList.add(className);
} else {
el.className += ' ' + className;
}
}
module.exports = addClass;
/***/ },
/* 26 */
/***/ function(module, exports) {
/**
* removeClass : removeClass(el, className)
* Removes a classname.
*
* var removeClass = require('dom101/remove-class');
*
* el.className = 'selected active';
* removeClass(el, 'active');
*
* el.className
* => "selected"
*/
function removeClass (el, className) {
if (el.classList) {
el.classList.remove(className);
} else {
var expr =
new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi');
el.className = el.className.replace(expr, ' ');
}
}
module.exports = removeClass;
/***/ },
/* 27 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var _typeof2 = __webpack_require__(28);
var _typeof3 = _interopRequireDefault(_typeof2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var e = function () {
function r(e, r, n) {
return r || n ? String.fromCharCode(r || n) : u[e] || e;
}
function n(e) {
return p[e];
}
var t = /"|<|>|&| |'|&#(\d+);|&#(\d+)/g,
o = /['<> "&]/g,
u = {
""": '"',
"<": "<",
">": ">",
"&": "&",
" ": " "
},
c = /\u00a0/g,
a = /<br\s*\/?>/gi,
i = /\r?\n/g,
f = /\s/g,
p = {};
for (var s in u) {
p[u[s]] = s;
}return u["'"] = "'", p["'"] = "'", {
encode: function encode(e) {
return e ? ("" + e).replace(o, n).replace(i, "<br/>").replace(f, " ") : "";
},
decode: function decode(e) {
return e ? ("" + e).replace(a, "\n").replace(t, r).replace(c, " ") : "";
},
encodeBase16: function encodeBase16(e) {
if (!e) return e;
e += "";
for (var r = [], n = 0, t = e.length; t > n; n++) {
r.push(e.charCodeAt(n).toString(16).toUpperCase());
}return r.join("");
},
encodeBase16forJSON: function encodeBase16forJSON(e) {
if (!e) return e;
e = e.replace(/[\u4E00-\u9FBF]/gi, function (e) {
return escape(e).replace("%u", "\\u");
});
for (var r = [], n = 0, t = e.length; t > n; n++) {
r.push(e.charCodeAt(n).toString(16).toUpperCase());
}return r.join("");
},
decodeBase16: function decodeBase16(e) {
if (!e) return e;
e += "";
for (var r = [], n = 0, t = e.length; t > n; n += 2) {
r.push(String.fromCharCode("0x" + e.slice(n, n + 2)));
}return r.join("");
},
encodeObject: function encodeObject(r) {
if (r instanceof Array) for (var n = 0, t = r.length; t > n; n++) {
r[n] = e.encodeObject(r[n]);
} else if ("object" == (typeof r === "undefined" ? "undefined" : (0, _typeof3.default)(r))) for (var o in r) {
r[o] = e.encodeObject(r[o]);
} else if ("string" == typeof r) return e.encode(r);
return r;
},
loadScript: function loadScript(path) {
var $script = document.createElement('script');
document.getElementsByTagName('body')[0].appendChild($script);
$script.setAttribute('src', path);
},
addLoadEvent: function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != "function") {
window.onload = func;
} else {
window.onload = function () {
oldonload();
func();
};
}
}
};
}();
module.exports = e;
/***/ },
/* 28 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(29);
var _iterator2 = _interopRequireDefault(_iterator);
var _symbol = __webpack_require__(80);
var _symbol2 = _interopRequireDefault(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
/***/ },
/* 29 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(30), __esModule: true };
/***/ },
/* 30 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(31);
__webpack_require__(75);
module.exports = __webpack_require__(79).f('iterator');
/***/ },
/* 31 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(32)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(35)(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %StringIteratorPrototype%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
/***/ },
/* 32 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(33)
, defined = __webpack_require__(34);
// true -> String#at
// false -> String#codePointAt
module.exports = function(TO_STRING){
return function(that, pos){
var s = String(defined(that))
, i = toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
/***/ },
/* 33 */
/***/ function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ },
/* 34 */
/***/ function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
/***/ },
/* 35 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(36)
, $export = __webpack_require__(37)
, redefine = __webpack_require__(52)
, hide = __webpack_require__(42)
, has = __webpack_require__(53)
, Iterators = __webpack_require__(54)
, $iterCreate = __webpack_require__(55)
, setToStringTag = __webpack_require__(71)
, getPrototypeOf = __webpack_require__(73)
, ITERATOR = __webpack_require__(72)('iterator')
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
$iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, DEF_VALUES = DEFAULT == VALUES
, VALUES_BUG = false
, proto = Base.prototype
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, $default = $native || getMethod(DEFAULT)
, $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
, $anyNative = NAME == 'Array' ? proto.entries || $native : $native
, methods, key, IteratorPrototype;
// Fix native
if($anyNative){
IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
if(IteratorPrototype !== Object.prototype){
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES && $native && $native.name !== VALUES){
VALUES_BUG = true;
$default = function values(){ return $native.call(this); };
}
// Define iterator
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if(FORCED)for(key in methods){
if(!(key in proto))redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
/***/ },
/* 36 */
/***/ function(module, exports) {
module.exports = true;
/***/ },
/* 37 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(38)
, core = __webpack_require__(39)
, ctx = __webpack_require__(40)
, hide = __webpack_require__(42)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, expProto = exports[PROTOTYPE]
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(a, b, c){
if(this instanceof C){
switch(arguments.length){
case 0: return new C;
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if(IS_PROTO){
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ },
/* 38 */
/***/ function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
/***/ },
/* 39 */
/***/ function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
/***/ },
/* 40 */
/***/ function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(41);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
/***/ },
/* 41 */
/***/ function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
/***/ },
/* 42 */
/***/ function(module, exports, __webpack_require__) {
var dP = __webpack_require__(43)
, createDesc = __webpack_require__(51);
module.exports = __webpack_require__(47) ? function(object, key, value){
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
/***/ },
/* 43 */
/***/ function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(44)
, IE8_DOM_DEFINE = __webpack_require__(46)
, toPrimitive = __webpack_require__(50)
, dP = Object.defineProperty;
exports.f = __webpack_require__(47) ? Object.defineProperty : function defineProperty(O, P, Attributes){
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if(IE8_DOM_DEFINE)try {
return dP(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)O[P] = Attributes.value;
return O;
};
/***/ },
/* 44 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(45);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
/***/ },
/* 45 */
/***/ function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ },
/* 46 */
/***/ function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(47) && !__webpack_require__(48)(function(){
return Object.defineProperty(__webpack_require__(49)('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 47 */
/***/ function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(48)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
/***/ },
/* 48 */
/***/ function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
/***/ },
/* 49 */
/***/ function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(45)
, document = __webpack_require__(38).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
/***/ },
/* 50 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(45);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S){
if(!isObject(it))return it;
var fn, val;
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ },
/* 51 */
/***/ function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
/***/ },
/* 52 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(42);
/***/ },
/* 53 */
/***/ function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
/***/ },
/* 54 */
/***/ function(module, exports) {
module.exports = {};
/***/ },
/* 55 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var create = __webpack_require__(56)
, descriptor = __webpack_require__(51)
, setToStringTag = __webpack_require__(71)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(42)(IteratorPrototype, __webpack_require__(72)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
setToStringTag(Constructor, NAME + ' Iterator');
};
/***/ },
/* 56 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(44)
, dPs = __webpack_require__(57)
, enumBugKeys = __webpack_require__(69)
, IE_PROTO = __webpack_require__(66)('IE_PROTO')
, Empty = function(){ /* empty */ }
, PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(49)('iframe')
, i = enumBugKeys.length
, lt = '<'
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
__webpack_require__(70).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties){
var result;
if(O !== null){
Empty[PROTOTYPE] = anObject(O);
result = new Empty;
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ },
/* 57 */
/***/ function(module, exports, __webpack_require__) {
var dP = __webpack_require__(43)
, anObject = __webpack_require__(44)
, getKeys = __webpack_require__(58);
module.exports = __webpack_require__(47) ? Object.defineProperties : function defineProperties(O, Properties){
anObject(O);
var keys = getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)dP.f(O, P = keys[i++], Properties[P]);
return O;
};
/***/ },
/* 58 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(59)
, enumBugKeys = __webpack_require__(69);
module.exports = Object.keys || function keys(O){
return $keys(O, enumBugKeys);
};
/***/ },
/* 59 */
/***/ function(module, exports, __webpack_require__) {
var has = __webpack_require__(53)
, toIObject = __webpack_require__(60)
, arrayIndexOf = __webpack_require__(63)(false)
, IE_PROTO = __webpack_require__(66)('IE_PROTO');
module.exports = function(object, names){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(names.length > i)if(has(O, key = names[i++])){
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ },
/* 60 */
/***/ function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(61)
, defined = __webpack_require__(34);
module.exports = function(it){
return IObject(defined(it));
};
/***/ },
/* 61 */
/***/ function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(62);
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ },
/* 62 */
/***/ function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
/***/ },
/* 63 */
/***/ function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(60)
, toLength = __webpack_require__(64)
, toIndex = __webpack_require__(65);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ },
/* 64 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(33)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ },
/* 65 */
/***/ function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(33)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ },
/* 66 */
/***/ function(module, exports, __webpack_require__) {
var shared = __webpack_require__(67)('keys')
, uid = __webpack_require__(68);
module.exports = function(key){
return shared[key] || (shared[key] = uid(key));
};
/***/ },
/* 67 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(38)
, SHARED = '__core-js_shared__'
, store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
return store[key] || (store[key] = {});
};
/***/ },
/* 68 */
/***/ function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ },
/* 69 */
/***/ function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(38).document && document.documentElement;
/***/ },
/* 71 */
/***/ function(module, exports, __webpack_require__) {
var def = __webpack_require__(43).f
, has = __webpack_require__(53)
, TAG = __webpack_require__(72)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
/***/ },
/* 72 */
/***/ function(module, exports, __webpack_require__) {
var store = __webpack_require__(67)('wks')
, uid = __webpack_require__(68)
, Symbol = __webpack_require__(38).Symbol
, USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function(name){
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ },
/* 73 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(53)
, toObject = __webpack_require__(74)
, IE_PROTO = __webpack_require__(66)('IE_PROTO')
, ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function(O){
O = toObject(O);
if(has(O, IE_PROTO))return O[IE_PROTO];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
/***/ },
/* 74 */
/***/ function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(34);
module.exports = function(it){
return Object(defined(it));
};
/***/ },
/* 75 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(76);
var global = __webpack_require__(38)
, hide = __webpack_require__(42)
, Iterators = __webpack_require__(54)
, TO_STRING_TAG = __webpack_require__(72)('toStringTag');
for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
var NAME = collections[i]
, Collection = global[NAME]
, proto = Collection && Collection.prototype;
if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
Iterators[NAME] = Iterators.Array;
}
/***/ },
/* 76 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
var addToUnscopables = __webpack_require__(77)
, step = __webpack_require__(78)
, Iterators = __webpack_require__(54)
, toIObject = __webpack_require__(60);
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(35)(Array, 'Array', function(iterated, kind){
this._t = toIObject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %ArrayIteratorPrototype%.next()
}, function(){
var O = this._t
, kind = this._k
, index = this._i++;
if(!O || index >= O.length){
this._t = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
/***/ },
/* 77 */
/***/ function(module, exports) {
module.exports = function(){ /* empty */ };
/***/ },
/* 78 */
/***/ function(module, exports) {
module.exports = function(done, value){
return {value: value, done: !!done};
};
/***/ },
/* 79 */
/***/ function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(72);
/***/ },
/* 80 */
/***/ function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(81), __esModule: true };
/***/ },
/* 81 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(82);
__webpack_require__(93);
__webpack_require__(94);
__webpack_require__(95);
module.exports = __webpack_require__(39).Symbol;
/***/ },
/* 82 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var global = __webpack_require__(38)
, has = __webpack_require__(53)
, DESCRIPTORS = __webpack_require__(47)
, $export = __webpack_require__(37)
, redefine = __webpack_require__(52)
, META = __webpack_require__(83).KEY
, $fails = __webpack_require__(48)
, shared = __webpack_require__(67)
, setToStringTag = __webpack_require__(71)
, uid = __webpack_require__(68)
, wks = __webpack_require__(72)
, wksExt = __webpack_require__(79)
, wksDefine = __webpack_require__(84)
, keyOf = __webpack_require__(85)
, enumKeys = __webpack_require__(86)
, isArray = __webpack_require__(89)
, anObject = __webpack_require__(44)
, toIObject = __webpack_require__(60)
, toPrimitive = __webpack_require__(50)
, createDesc = __webpack_require__(51)
, _create = __webpack_require__(56)
, gOPNExt = __webpack_require__(90)
, $GOPD = __webpack_require__(92)
, $DP = __webpack_require__(43)
, $keys = __webpack_require__(58)
, gOPD = $GOPD.f
, dP = $DP.f
, gOPN = gOPNExt.f
, $Symbol = global.Symbol
, $JSON = global.JSON
, _stringify = $JSON && $JSON.stringify
, PROTOTYPE = 'prototype'
, HIDDEN = wks('_hidden')
, TO_PRIMITIVE = wks('toPrimitive')
, isEnum = {}.propertyIsEnumerable
, SymbolRegistry = shared('symbol-registry')
, AllSymbols = shared('symbols')
, OPSymbols = shared('op-symbols')
, ObjectProto = Object[PROTOTYPE]
, USE_NATIVE = typeof $Symbol == 'function'
, QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function(){
return _create(dP({}, 'a', {
get: function(){ return dP(this, 'a', {value: 7}).a; }
})).a != 7;
}) ? function(it, key, D){
var protoDesc = gOPD(ObjectProto, key);
if(protoDesc)delete ObjectProto[key];
dP(it, key, D);
if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
} : dP;
var wrap = function(tag){
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
sym._k = tag;
return sym;
};
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
return typeof it == 'symbol';
} : function(it){
return it instanceof $Symbol;
};
var $defineProperty = function defineProperty(it, key, D){
if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
anObject(it);
key = toPrimitive(key, true);
anObject(D);
if(has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D = _create(D, {enumerable: createDesc(0, false)});
} return setSymbolDesc(it, key, D);
} return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P){
anObject(it);
var keys = enumKeys(P = toIObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P){
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key){
var E = isEnum.call(this, key = toPrimitive(key, true));
if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
it = toIObject(it);
key = toPrimitive(key, true);
if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
var D = gOPD(it, key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it){
var names = gOPN(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i){
if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
} return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
var IS_OP = it === ObjectProto
, names = gOPN(IS_OP ? OPSymbols : toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i){
if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
} return result;
};
// 19.4.1.1 Symbol([description])
if(!USE_NATIVE){
$Symbol = function Symbol(){
if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
var $set = function(value){
if(this === ObjectProto)$set.call(OPSymbols, value);
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
};
if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
return wrap(tag);
};
redefine($Symbol[PROTOTYPE], 'toString', function toString(){
return this._k;
});
$GOPD.f = $getOwnPropertyDescriptor;
$DP.f = $defineProperty;
__webpack_require__(91).f = gOPNExt.f = $getOwnPropertyNames;
__webpack_require__(88).f = $propertyIsEnumerable;
__webpack_require__(87).f = $getOwnPropertySymbols;
if(DESCRIPTORS && !__webpack_require__(36)){
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
}
wksExt.f = function(name){
return wrap(wks(name));
}
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
for(var symbols = (
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
if(isSymbol(key))return keyOf(SymbolRegistry, key);
throw TypeError(key + ' is not a symbol!');
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
});
$export($export.S + $export.F * !USE_NATIVE, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: $getOwnPropertySymbols
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
stringify: function stringify(it){
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
var args = [it]
, i = 1
, replacer, $replacer;
while(arguments.length > i)args.push(arguments[i++]);
replacer = args[1];
if(typeof replacer == 'function')$replacer = replacer;
if($replacer || !isArray(replacer))replacer = function(key, value){
if($replacer)value = $replacer.call(this, key, value);
if(!isSymbol(value))return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
}
});
// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(42)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
/***/ },
/* 83 */
/***/ function(module, exports, __webpack_require__) {
var META = __webpack_require__(68)('meta')
, isObject = __webpack_require__(45)
, has = __webpack_require__(53)
, setDesc = __webpack_require__(43).f
, id = 0;
var isExtensible = Object.isExtensible || function(){
return true;
};
var FREEZE = !__webpack_require__(48)(function(){
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function(it){
setDesc(it, META, {value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
}});
};
var fastKey = function(it, create){
// return primitive with prefix
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if(!has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return 'F';
// not necessary to add metadata
if(!create)return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function(it, create){
if(!has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return true;
// not necessary to add metadata
if(!create)return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function(it){
if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
/***/ },
/* 84 */
/***/ function(module, exports, __webpack_require__) {
var global = __webpack_require__(38)
, core = __webpack_require__(39)
, LIBRARY = __webpack_require__(36)
, wksExt = __webpack_require__(79)
, defineProperty = __webpack_require__(43).f;
module.exports = function(name){
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
};
/***/ },
/* 85 */
/***/ function(module, exports, __webpack_require__) {
var getKeys = __webpack_require__(58)
, toIObject = __webpack_require__(60);
module.exports = function(object, el){
var O = toIObject(object)
, keys = getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
/***/ },
/* 86 */
/***/ function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(58)
, gOPS = __webpack_require__(87)
, pIE = __webpack_require__(88);
module.exports = function(it){
var result = getKeys(it)
, getSymbols = gOPS.f;
if(getSymbols){
var symbols = getSymbols(it)
, isEnum = pIE.f
, i = 0
, key;
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
} return result;
};
/***/ },
/* 87 */
/***/ function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ },
/* 88 */
/***/ function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ },
/* 89 */
/***/ function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(62);
module.exports = Array.isArray || function isArray(arg){
return cof(arg) == 'Array';
};
/***/ },
/* 90 */
/***/ function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(60)
, gOPN = __webpack_require__(91).f
, toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function(it){
try {
return gOPN(it);
} catch(e){
return windowNames.slice();
}
};
module.exports.f = function getOwnPropertyNames(it){
return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};
/***/ },
/* 91 */
/***/ function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(59)
, hiddenKeys = __webpack_require__(69).concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
return $keys(O, hiddenKeys);
};
/***/ },
/* 92 */
/***/ function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(88)
, createDesc = __webpack_require__(51)
, toIObject = __webpack_require__(60)
, toPrimitive = __webpack_require__(50)
, has = __webpack_require__(53)
, IE8_DOM_DEFINE = __webpack_require__(46)
, gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(47) ? gOPD : function getOwnPropertyDescriptor(O, P){
O = toIObject(O);
P = toPrimitive(P, true);
if(IE8_DOM_DEFINE)try {
return gOPD(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
};
/***/ },
/* 93 */
/***/ function(module, exports) {
/***/ },
/* 94 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(84)('asyncIterator');
/***/ },
/* 95 */
/***/ function(module, exports, __webpack_require__) {
__webpack_require__(84)('observable');
/***/ },
/* 96 */
/***/ function(module, exports) {
/**
* after : after(el, newEl)
* Inserts a new element `newEl` just after `el`.
*
* var after = require('dom101/after');
* var newNode = document.createElement('div');
* var button = document.querySelector('#submit');
*
* after(button, newNode);
*/
function after (el, newEl) {
if (typeof newEl === 'string') {
return el.insertAdjacentHTML('afterend', newEl);
} else {
var next = el.nextSibling;
if (next) {
return el.parentNode.insertBefore(newEl, next);
} else {
return el.parentNode.appendChild(newEl);
}
}
}
module.exports = after;
/***/ },
/* 97 */
/***/ function(module, exports) {
'use strict';
var browser = {
versions: function () {
var u = window.navigator.userAgent;
return {
trident: u.indexOf('Trident') > -1, //IE内核
presto: u.indexOf('Presto') > -1, //opera内核
webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或者uc浏览器
iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //是否为iPhone或者安卓QQ浏览器
iPad: u.indexOf('iPad') > -1, //是否为iPad
webApp: u.indexOf('Safari') == -1, //是否为web应用程序,没有头部与底部
weixin: u.indexOf('MicroMessenger') == -1 //是否为微信浏览器
};
}()
};
module.exports = browser;
/***/ },
/* 98 */
/***/ function(module, exports) {
'use strict';
function init() {
// 由于hexo分页不支持,手工美化
var $nav = document.querySelector('#page-nav');
if ($nav && !document.querySelector('#page-nav .extend.prev')) {
$nav.innerHTML = '<a class="extend prev disabled" rel="prev">« Prev</a>' + $nav.innerHTML;
}
if ($nav && !document.querySelector('#page-nav .extend.next')) {
$nav.innerHTML = $nav.innerHTML + '<a class="extend next disabled" rel="next">Next »</a>';
}
// 新窗口打开
if (yiliaConfig && yiliaConfig.open_in_new) {
var $a = document.querySelectorAll('.article-entry a:not(.article-more-a)');
$a.forEach(function ($em) {
$em.setAttribute('target', '_blank');
});
}
// about me 转义
var $aboutme = document.querySelector('#js-aboutme');
if ($aboutme && $aboutme.length !== 0) {
$aboutme.innerHTML = $aboutme.innerText;
}
}
module.exports = {
init: init
};
/***/ }
/******/ ]); | halochen90/Hexo-Theme-Luna | source/mobile.09c351.js | JavaScript | lgpl-2.1 | 51,975 |
/**
* @file common/js/xml_handler.js
* @brief XE에서 ajax기능을 이용함에 있어 module, act를 잘 사용하기 위한 자바스크립트
**/
// xml handler을 이용하는 user function
var show_waiting_message = true;
/* This work is licensed under Creative Commons GNU LGPL License.
License: http://creativecommons.org/licenses/LGPL/2.1/
Version: 0.9
Author: Stefan Goessner/2006
Web: http://goessner.net/
*/
function xml2json(xml, tab, ignoreAttrib) {
var X = {
toObj: function(xml) {
var o = {};
if (xml.nodeType==1) { // element node ..
if (ignoreAttrib && xml.attributes.length) // element with attributes ..
for (var i=0; i<xml.attributes.length; i++)
o["@"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||"").toString();
if (xml.firstChild) { // element has child nodes ..
var textChild=0, cdataChild=0, hasElementChild=false;
for (var n=xml.firstChild; n; n=n.nextSibling) {
if (n.nodeType==1) hasElementChild = true;
else if (n.nodeType==3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) textChild++; // non-whitespace text
else if (n.nodeType==4) cdataChild++; // cdata section node
}
if (hasElementChild) {
if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..
X.removeWhite(xml);
for (var n=xml.firstChild; n; n=n.nextSibling) {
if (n.nodeType == 3) // text node
o = X.escape(n.nodeValue);
else if (n.nodeType == 4) // cdata node
// o["#cdata"] = X.escape(n.nodeValue);
o = X.escape(n.nodeValue);
else if (o[n.nodeName]) { // multiple occurence of element ..
if (o[n.nodeName] instanceof Array)
o[n.nodeName][o[n.nodeName].length] = X.toObj(n);
else
o[n.nodeName] = [o[n.nodeName], X.toObj(n)];
}
else // first occurence of element..
o[n.nodeName] = X.toObj(n);
}
}
else { // mixed content
if (!xml.attributes.length)
o = X.escape(X.innerXml(xml));
else
o["#text"] = X.escape(X.innerXml(xml));
}
}
else if (textChild) { // pure text
if (!xml.attributes.length)
o = X.escape(X.innerXml(xml));
else
o["#text"] = X.escape(X.innerXml(xml));
}
else if (cdataChild) { // cdata
if (cdataChild > 1)
o = X.escape(X.innerXml(xml));
else
for (var n=xml.firstChild; n; n=n.nextSibling){
//o["#cdata"] = X.escape(n.nodeValue);
o = X.escape(n.nodeValue);
}
}
}
if (!xml.attributes.length && !xml.firstChild) o = null;
}
else if (xml.nodeType==9) { // document.node
o = X.toObj(xml.documentElement);
}
else
alert("unhandled node type: " + xml.nodeType);
return o;
},
toJson: function(o, name, ind) {
var json = name ? ("\""+name+"\"") : "";
if (o instanceof Array) {
for (var i=0,n=o.length; i<n; i++)
o[i] = X.toJson(o[i], "", ind+"\t");
json += (name?":[":"[") + (o.length > 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]";
}
else if (o == null)
json += (name&&":") + "null";
else if (typeof(o) == "object") {
var arr = [];
for (var m in o)
arr[arr.length] = X.toJson(o[m], m, ind+"\t");
json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}";
}
else if (typeof(o) == "string")
json += (name&&":") + "\"" + o.toString() + "\"";
else
json += (name&&":") + o.toString();
return json;
},
innerXml: function(node) {
var s = ""
if ("innerHTML" in node)
s = node.innerHTML;
else {
var asXml = function(n) {
var s = "";
if (n.nodeType == 1) {
s += "<" + n.nodeName;
for (var i=0; i<n.attributes.length;i++)
s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue||"").toString() + "\"";
if (n.firstChild) {
s += ">";
for (var c=n.firstChild; c; c=c.nextSibling)
s += asXml(c);
s += "</"+n.nodeName+">";
}
else
s += "/>";
}
else if (n.nodeType == 3)
s += n.nodeValue;
else if (n.nodeType == 4)
s += "<![CDATA[" + n.nodeValue + "]]>";
return s;
};
for (var c=node.firstChild; c; c=c.nextSibling)
s += asXml(c);
}
return s;
},
escape: function(txt) {
return txt.replace(/[\\]/g, "\\\\")
.replace(/[\"]/g, '\\"')
.replace(/[\n]/g, '\\n')
.replace(/[\r]/g, '\\r');
},
removeWhite: function(e) {
e.normalize();
for (var n = e.firstChild; n; ) {
if (n.nodeType == 3) { // text node
if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node
var nxt = n.nextSibling;
e.removeChild(n);
n = nxt;
}
else
n = n.nextSibling;
}
else if (n.nodeType == 1) { // element node
X.removeWhite(n);
n = n.nextSibling;
}
else // any other node
n = n.nextSibling;
}
return e;
}
};
if (xml.nodeType == 9) // document node
xml = xml.documentElement;
var json_obj = X.toObj(X.removeWhite(xml)), json_str;
if (typeof(JSON)=='object' && jQuery.isFunction(JSON.stringify) && false) {
var obj = {}; obj[xml.nodeName] = json_obj;
json_str = JSON.stringify(obj);
return json_str;
} else {
json_str = X.toJson(json_obj, xml.nodeName, "");
return "{" + (tab ? json_str.replace(/\t/g, tab) : json_str.replace(/\t|\n/g, "")) + "}";
}
}
(function($){
/**
* @brief exec_xml
* @author NHN ([email protected])
**/
$.exec_xml = window.exec_xml = function(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) {
var xml_path = request_uri+"index.php"
if(!params) params = {};
// {{{ set parameters
if($.isArray(params)) params = arr2obj(params);
params['module'] = module;
params['act'] = act;
if(typeof(xeVid)!='undefined') params['vid'] = xeVid;
if(typeof(response_tags)=="undefined" || response_tags.length<1) response_tags = ['error','message'];
else {
response_tags.push('error', 'message');
}
// }}} set parameters
// use ssl?
if ($.isArray(ssl_actions) && params['act'] && $.inArray(params['act'], ssl_actions) >= 0)
{
var url = default_url || request_uri;
var port = window.https_port || 443;
var _ul = $('<a>').attr('href', url)[0];
var target = 'https://' + _ul.hostname.replace(/:\d+$/, '');
if(port != 443) target += ':'+port;
if(_ul.pathname[0] != '/') target += '/';
target += _ul.pathname;
xml_path = target.replace(/\/$/, '')+'/index.php';
}
var _u1 = $('<a>').attr('href', location.href)[0];
var _u2 = $('<a>').attr('href', xml_path)[0];
// 현 url과 ajax call 대상 url의 schema 또는 port가 다르면 직접 form 전송
if(_u1.protocol != _u2.protocol || _u1.port != _u2.port) return send_by_form(xml_path, params);
var xml = [], i = 0;
xml[i++] = '<?xml version="1.0" encoding="utf-8" ?>';
xml[i++] = '<methodCall>';
xml[i++] = '<params>';
$.each(params, function(key, val) {
xml[i++] = '<'+key+'><![CDATA['+val+']]></'+key+'>';
});
xml[i++] = '</params>';
xml[i++] = '</methodCall>';
var _xhr = null;
if (_xhr && _xhr.readyState != 0) _xhr.abort();
// 전송 성공시
function onsuccess(data, textStatus, xhr) {
var resp_xml = $(data).find('response')[0], resp_obj, txt='', ret=[], tags={}, json_str='';
waiting_obj.css('visibility', 'hidden');
if(!resp_xml) {
alert(_xhr.responseText);
return null;
}
json_str = xml2json(resp_xml, false, false);
resp_obj = (typeof(JSON)=='object' && $.isFunction(JSON.parse))?JSON.parse(json_str):eval('('+json_str+')');
resp_obj = resp_obj.response;
if (typeof(resp_obj)=='undefined') {
ret['error'] = -1;
ret['message'] = 'Unexpected error occured.';
try {
if(typeof(txt=resp_xml.childNodes[0].firstChild.data)!='undefined') ret['message'] += '\r\n'+txt;
} catch(e){};
return ret;
}
$.each(response_tags, function(key, val){ tags[val] = true; });
tags["redirect_url"] = true;
tags["act"] = true;
$.each(resp_obj, function(key, val){ if(tags[key]) ret[key] = val; });
if(ret['error'] != 0) {
if ($.isFunction($.exec_xml.onerror)) {
return $.exec_xml.onerror(module, act, ret, callback_func, response_tags, callback_func_arg, fo_obj);
}
alert(ret['message'] || 'error!');
return null;
}
if(ret['redirect_url']) {
location.href = ret['redirect_url'].replace(/&/g, '&');
return null;
}
if($.isFunction(callback_func)) callback_func(ret, response_tags, callback_func_arg, fo_obj);
}
// 모든 xml데이터는 POST방식으로 전송. try-catch문으로 오류 발생시 대처
try {
$.ajax({
url : xml_path,
type : 'POST',
dataType : 'xml',
data : xml.join('\n'),
contentType : 'text/plain',
beforeSend : function(xhr){ _xhr = xhr; },
success : onsuccess,
error : function(xhr, textStatus) {
waiting_obj.css('visibility', 'hidden');
var msg = '';
if (textStatus == 'parsererror') {
msg = 'The result is not valid XML :\n-------------------------------------\n';
if(xhr.responseText == "") return;
msg += xhr.responseText.replace(/<[^>]+>/g, '');
} else {
msg = textStatus;
}
alert(msg);
}
});
} catch(e) {
alert(e);
return;
}
// ajax 통신중 대기 메세지 출력 (show_waiting_message값을 false로 세팅시 보이지 않음)
var waiting_obj = $('#waitingforserverresponse');
if(show_waiting_message && waiting_obj.length) {
var d = $(document);
waiting_obj.html(waiting_message).css({
'top' : (d.scrollTop()+20)+'px',
'left' : (d.scrollLeft()+20)+'px',
'visibility' : 'visible'
});
}
}
function send_by_form(url, params) {
var frame_id = 'xeTmpIframe';
var form_id = 'xeVirtualForm';
if (!$('#'+frame_id).length) {
$('<iframe name="%id%" id="%id%" style="position:absolute;left:-1px;top:1px;width:1px;height:1px"></iframe>'.replace(/%id%/g, frame_id)).appendTo(document.body);
}
$('#'+form_id).remove();
var form = $('<form id="%id%"></form>'.replace(/%id%/g, form_id)).attr({
'id' : form_id,
'method' : 'post',
'action' : url,
'target' : frame_id
});
params['xeVirtualRequestMethod'] = 'xml';
params['xeRequestURI'] = location.href.replace(/#(.*)$/i,'');
params['xeVirtualRequestUrl'] = request_uri;
$.each(params, function(key, value){
$('<input type="hidden">').attr('name', key).attr('value', value).appendTo(form);
});
form.appendTo(document.body).submit();
}
function arr2obj(arr) {
var ret = {};
for(var key in arr) {
if(arr.hasOwnProperty(key)) ret[key] = arr[key];
}
return ret;
}
/**
* @brief exec_json (exec_xml와 같은 용도)
**/
$.exec_json = function(action,data,func){
if(typeof(data) == 'undefined') data = {};
action = action.split(".");
if(action.length == 2){
if(show_waiting_message) {
$("#waitingforserverresponse").html(waiting_message).css('top',$(document).scrollTop()+20).css('left',$(document).scrollLeft()+20).css('visibility','visible');
}
$.extend(data,{module:action[0],act:action[1]});
if(typeof(xeVid)!='undefined') $.extend(data,{vid:xeVid});
$.ajax({
type:"POST"
,dataType:"json"
,url:request_uri
,contentType:"application/json"
,data:$.param(data)
,success : function(data){
$("#waitingforserverresponse").css('visibility','hidden');
if(data.error > 0) alert(data.message);
if($.isFunction(func)) func(data);
}
});
}
};
$.fn.exec_html = function(action,data,type,func,args){
if(typeof(data) == 'undefined') data = {};
if(!$.inArray(type, ['html','append','prepend'])) type = 'html';
var self = $(this);
action = action.split(".");
if(action.length == 2){
if(show_waiting_message) {
$("#waitingforserverresponse").html(waiting_message).css('top',$(document).scrollTop()+20).css('left',$(document).scrollLeft()+20).css('visibility','visible');
}
$.extend(data,{module:action[0],act:action[1]});
$.ajax({
type:"POST"
,dataType:"html"
,url:request_uri
,data:$.param(data)
,success : function(html){
$("#waitingforserverresponse").css('visibility','hidden');
self[type](html);
if($.isFunction(func)) func(args);
}
});
}
};
})(jQuery);
| haegyung/xe-core | common/js/src/xml_handler.js | JavaScript | lgpl-2.1 | 14,624 |
tinymce.addI18n('it',{
"Cut": "Taglia",
"Heading 5": "Intestazione 5",
"Header 2": "Header 2",
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Il tuo browser non supporta l'accesso diretto negli Appunti. Per favore usa i tasti di scelta rapida Ctrl+X\/C\/V.",
"Heading 4": "Intestazione 4",
"Div": "Div",
"Heading 2": "Intestazione 2",
"Paste": "Incolla",
"Close": "Chiudi",
"Font Family": "Famiglia font",
"Pre": "Pre",
"Align right": "Allinea a Destra",
"New document": "Nuovo Documento",
"Blockquote": "Blockquote",
"Numbered list": "Elenchi Numerati",
"Heading 1": "Intestazione 1",
"Headings": "Intestazioni",
"Increase indent": "Aumenta Rientro",
"Formats": "Formattazioni",
"Headers": "Intestazioni",
"Select all": "Seleziona Tutto",
"Header 3": "Intestazione 3",
"Blocks": "Blocchi",
"Undo": "Indietro",
"Strikethrough": "Barrato",
"Bullet list": "Elenchi Puntati",
"Header 1": "Intestazione 1",
"Superscript": "Apice",
"Clear formatting": "Cancella Formattazione",
"Font Sizes": "Dimensioni font",
"Subscript": "Pedice",
"Header 6": "Intestazione 6",
"Redo": "Ripeti",
"Paragraph": "Paragrafo",
"Ok": "Ok",
"Bold": "Grassetto",
"Code": "Codice",
"Italic": "Corsivo",
"Align center": "Allinea al Cento",
"Header 5": "Intestazione 5",
"Heading 6": "Intestazione 6",
"Heading 3": "Intestazione 3",
"Decrease indent": "Riduci Rientro",
"Header 4": "Intestazione 4",
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Incolla \u00e8 in modalit\u00e0 testo normale. I contenuti sono incollati come testo normale se non disattivi l'opzione.",
"Underline": "Sottolineato",
"Cancel": "Annulla",
"Justify": "Giustifica",
"Inline": "Inlinea",
"Copy": "Copia",
"Align left": "Allinea a Sinistra",
"Visual aids": "Elementi Visivi",
"Lower Greek": "Greek Minore",
"Square": "Quadrato",
"Default": "Default",
"Lower Alpha": "Alpha Minore",
"Circle": "Cerchio",
"Disc": "Disco",
"Upper Alpha": "Alpha Superiore",
"Upper Roman": "Roman Superiore",
"Lower Roman": "Roman Minore",
"Name": "Nome",
"Anchor": "Fissa",
"You have unsaved changes are you sure you want to navigate away?": "Non hai salvato delle modifiche, sei sicuro di andartene?",
"Restore last draft": "Ripristina l'ultima bozza.",
"Special character": "Carattere Speciale",
"Source code": "Codice Sorgente",
"B": "B",
"R": "R",
"G": "G",
"Color": "Colore",
"Right to left": "Da Destra a Sinistra",
"Left to right": "Da Sinistra a Destra",
"Emoticons": "Emoction",
"Robots": "Robot",
"Document properties": "Propriet\u00e0 Documento",
"Title": "Titolo",
"Keywords": "Parola Chiave",
"Encoding": "Codifica",
"Description": "Descrizione",
"Author": "Autore",
"Fullscreen": "Schermo Intero",
"Horizontal line": "Linea Orizzontale",
"Horizontal space": "Spazio Orizzontale",
"Insert\/edit image": "Aggiungi\/Modifica Immagine",
"General": "Generale",
"Advanced": "Avanzato",
"Source": "Fonte",
"Border": "Bordo",
"Constrain proportions": "Mantieni Proporzioni",
"Vertical space": "Spazio Verticale",
"Image description": "Descrizione Immagine",
"Style": "Stile",
"Dimensions": "Dimenzioni",
"Insert image": "Inserisci immagine",
"Zoom in": "Ingrandisci",
"Contrast": "Contrasto",
"Back": "Indietro",
"Gamma": "Gamma",
"Flip horizontally": "Rifletti orizzontalmente",
"Resize": "Ridimensiona",
"Sharpen": "Contrasta",
"Zoom out": "Rimpicciolisci",
"Image options": "Opzioni immagine",
"Apply": "Applica",
"Brightness": "Luminosit\u00e0",
"Rotate clockwise": "Ruota in senso orario",
"Rotate counterclockwise": "Ruota in senso antiorario",
"Edit image": "Modifica immagine",
"Color levels": "Livelli colore",
"Crop": "Taglia",
"Orientation": "Orientamento",
"Flip vertically": "Rifletti verticalmente",
"Invert": "Inverti",
"Insert date\/time": "Inserisci Data\/Ora",
"Remove link": "Rimuovi link",
"Url": "Url",
"Text to display": "Testo da Visualizzare",
"Anchors": "Anchors",
"Insert link": "Inserisci il Link",
"New window": "Nuova Finestra",
"None": "No",
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "L'URL inserito sembra essere un collegamento esterno. Vuoi aggiungere il prefisso necessario http:\/\/?",
"Target": "Target",
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "L'URL inserito sembra essere un indirizzo email. Vuoi aggiungere il prefisso necessario mailto:?",
"Insert\/edit link": "Inserisci\/Modifica Link",
"Insert\/edit video": "Inserisci\/Modifica Video",
"Poster": "Anteprima",
"Alternative source": "Alternativo",
"Paste your embed code below:": "Incolla il codice d'incorporamento qui:",
"Insert video": "Inserisci Video",
"Embed": "Incorporare",
"Nonbreaking space": "Spazio unificatore",
"Page break": "Interruzione di pagina",
"Paste as text": "incolla come testo",
"Preview": "Anteprima",
"Print": "Stampa",
"Save": "Salva",
"Could not find the specified string.": "Impossibile trovare la parola specifica.",
"Replace": "Sostituisci",
"Next": "Successivo",
"Whole words": "Parole Sbagliate",
"Find and replace": "Trova e Sostituisci",
"Replace with": "Sostituisci Con",
"Find": "Trova",
"Replace all": "Sostituisci Tutto",
"Match case": "Maiuscole\/Minuscole ",
"Prev": "Precedente",
"Spellcheck": "Controllo ortografico",
"Finish": "Termina",
"Ignore all": "Ignora Tutto",
"Ignore": "Ignora",
"Add to Dictionary": "Aggiungi al Dizionario",
"Insert row before": "Inserisci una Riga Prima",
"Rows": "Righe",
"Height": "Altezza",
"Paste row after": "Incolla una Riga Dopo",
"Alignment": "Allineamento",
"Border color": "Colore bordo",
"Column group": "Gruppo di Colonne",
"Row": "Riga",
"Insert column before": "Inserisci una Colonna Prima",
"Split cell": "Dividi Cella",
"Cell padding": "Padding della Cella",
"Cell spacing": "Spaziatura della Cella",
"Row type": "Tipo di Riga",
"Insert table": "Inserisci Tabella",
"Body": "Body",
"Caption": "Didascalia",
"Footer": "Footer",
"Delete row": "Cancella Riga",
"Paste row before": "Incolla una Riga Prima",
"Scope": "Campo",
"Delete table": "Cancella Tabella",
"H Align": "Allineamento H",
"Top": "In alto",
"Header cell": "cella d'intestazione",
"Column": "Colonna",
"Row group": "Gruppo di Righe",
"Cell": "Cella",
"Middle": "In mezzo",
"Cell type": "Tipo di Cella",
"Copy row": "Copia Riga",
"Row properties": "Propriet\u00e0 della Riga",
"Table properties": "Propiet\u00e0 della Tabella",
"Bottom": "In fondo",
"V Align": "Allineamento V",
"Header": "Header",
"Right": "Destra",
"Insert column after": "Inserisci una Colonna Dopo",
"Cols": "Colonne",
"Insert row after": "Inserisci una Riga Dopo",
"Width": "Larghezza",
"Cell properties": "Propiet\u00e0 della Cella",
"Left": "Sinistra",
"Cut row": "Taglia Riga",
"Delete column": "Cancella Colonna",
"Center": "Centro",
"Merge cells": "Unisci Cella",
"Insert template": "Inserisci Template",
"Templates": "Template",
"Background color": "Colore Background",
"Custom...": "Personalizzato...",
"Custom color": "Colore personalizzato",
"No color": "Nessun colore",
"Text color": "Colore Testo",
"Show blocks": "Mostra Blocchi",
"Show invisible characters": "Mostra Caratteri Invisibili",
"Words: {0}": "Parole: {0}",
"Insert": "Inserisci",
"File": "File",
"Edit": "Modifica",
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Rich Text Area. Premi ALT-F9 per il men\u00f9. Premi ALT-F10 per la barra degli strumenti. Premi ALT-0 per l'aiuto.",
"Tools": "Strumenti",
"View": "Visualizza",
"Table": "Tabella",
"Format": "Formato"
});
| OpenSlides/tinymce-i18n | langs/it.js | JavaScript | lgpl-2.1 | 7,599 |
// in all regexp "\" must be replaced by "\\"
var datas= {
"default": { // the name of this definition group. It's posisble to have different rules inside the same definition file
"REGEXP": { "before_word": "[^a-zA-Z0-9_]|^" // \\s|\\.|
,"possible_words_letters": "[a-zA-Z0-9_]+"
,"letter_after_word_must_match": "[^a-zA-Z0-9_]|$"
,"prefix_separator": "\\.|->"
}
,"CASE_SENSITIVE": true
,"MAX_TEXT_LENGTH": 100 // the length of the text being analyzed before the cursor position
,"KEYWORDS": [
// [
// 0 : the keyword the user is typing
// 1 : the string inserted in code ("{_@_}" being the new position of the cursor)
// 2 : the needed prefix
// 3 : the text the appear in the suggestion box (if empty, the string to insert will be displayed
['Array', 'Array()', '', 'alert( String message )']
,['alert', 'alert({_@_})', '', 'alert(message)']
,['ascrollTo', 'scrollTo({_@_})', '', 'scrollTo(x,y)']
,['alert', 'alert({_@_},bouh);', '', 'alert(message, message2)']
,['aclose', 'close({_@_})', '', 'alert(message)']
,['aconfirm', 'confirm({_@_})', '', 'alert(message)']
,['aonfocus', 'onfocus', '', '']
,['aonerror', 'onerror', '', 'blabla']
,['aonerror', 'onerror', '', '']
,['window', '', '', '']
,['location', 'location', 'window', '']
,['document', 'document', 'window', '']
,['href', 'href', 'location', '']
]
}
};
// the second identifier must be the same as the one of the syntax coloring definition file
EditArea_autocompletion._load_auto_complete_file( datas, "php" ); | cdolivet/EditArea | _devel/old_autocompletion/autocompletion_files/php.js | JavaScript | lgpl-2.1 | 1,656 |
#!/usr/bin/env kjscmd5
function Calculator(ui)
{
// Setup entry functions
var display = ui.findChild('display');
this.display = display;
this.one = function() { display.intValue = display.intValue*10+1; }
this.two = function() { display.intValue = display.intValue*10+2; }
this.three = function() { display.intValue = display.intValue*10+3; }
this.four = function() { display.intValue = display.intValue*10+4; }
this.five = function() { display.intValue = display.intValue*10+5; }
this.six = function() { display.intValue = display.intValue*10+6; }
this.seven = function() { display.intValue = display.intValue*10+7; }
this.eight = function() { display.intValue = display.intValue*10+8; }
this.nine = function() { display.intValue = display.intValue*10+9; }
this.zero = function() { display.intValue = display.intValue*10+0; }
ui.connect( ui.findChild('one'), 'clicked()', this, 'one()' );
ui.connect( ui.findChild('two'), 'clicked()', this, 'two()' );
ui.connect( ui.findChild('three'), 'clicked()', this, 'three()' );
ui.connect( ui.findChild('four'), 'clicked()', this, 'four()' );
ui.connect( ui.findChild('five'), 'clicked()', this, 'five()' );
ui.connect( ui.findChild('six'), 'clicked()', this, 'six()' );
ui.connect( ui.findChild('seven'), 'clicked()', this, 'seven()' );
ui.connect( ui.findChild('eight'), 'clicked()', this, 'eight()' );
ui.connect( ui.findChild('nine'), 'clicked()', this, 'nine()' );
ui.connect( ui.findChild('zero'), 'clicked()', this, 'zero()' );
this.val = 0;
this.display.intValue = 0;
this.lastop = function() {}
this.plus = function()
{
this.val = display.intValue+this.val;
display.intValue = 0;
this.lastop=this.plus
}
this.minus = function()
{
this.val = display.intValue-this.val;
display.intValue = 0;
this.lastop=this.minus;
}
ui.connect( ui.findChild('plus'), 'clicked()', this, 'plus()' );
ui.connect( ui.findChild('minus'), 'clicked()', this, 'minus()' );
this.equals = function() { this.lastop(); display.intValue = this.val; }
this.clear = function() { this.lastop=function(){}; display.intValue = 0; this.val = 0; }
ui.connect( ui.findChild('equals'), 'clicked()', this, 'equals()' );
ui.connect( ui.findChild('clear'), 'clicked()', this, 'clear()' );
}
var loader = new QUiLoader();
var ui = loader.load('calc.ui', this);
var calc = new Calculator(ui);
ui.show();
exec();
| KDE/kjsembed | examples/calc/calc.js | JavaScript | lgpl-2.1 | 2,564 |
var namespaces =
[
[ "shyft", "namespaceshyft.html", "namespaceshyft" ]
]; | statkraft/shyft-doc | core/html/namespaces.js | JavaScript | lgpl-3.0 | 78 |
/*
* Copyright (C) 2021 Inera AB (http://www.inera.se)
*
* This file is part of sklintyg (https://github.com/sklintyg).
*
* sklintyg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* sklintyg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
angular.module('StatisticsApp.treeMultiSelector.controller', [])
.controller('treeMultiSelectorCtrl', ['$scope', '$uibModal',
function($scope, $uibModal) {
'use strict';
$scope.openDialogClicked = function() {
if (angular.isFunction($scope.onOpen)) {
$scope.onOpen();
}
var modalInstance = $uibModal.open({
animation: false,
templateUrl: '/app/shared/treemultiselector/modal/modal.html',
controller: 'TreeMultiSelectorModalCtrl',
windowTopClass: 'tree-multi-selector',
size: 'lg',
backdrop: 'true',
resolve: {
directiveScope: $scope
}
});
modalInstance.result.then(function() {
$scope.doneClicked();
}, function() {
});
};
}]);
| sklintyg/statistik | web/src/main/webapp/app/shared/treemultiselector/treeMultiSelectorCtrl.js | JavaScript | lgpl-3.0 | 1,547 |
// node/this-3.js
var object = {
id: "xyz",
printId: function() {
console.log('The id is '+
this.id + ' ' +
this.toString());
}
};
// setTimeout(object.printId, 100);
var callback = object.printId;
callback();
| sistemas-web/nodejs-exemplos | node/this-3.js | JavaScript | lgpl-3.0 | 238 |
var complexExample = {
"edges" : [
{
"id" : 0,
"sbo" : 15,
"source" : "Reactome:109796",
"target" : "Reactome:177938"
},
{
"id" : 1,
"sbo" : 15,
"source" : "MAP:Cb15996_CY_Reactome:177938",
"target" : "Reactome:177938"
},
{
"id" : 2,
"sbo" : 11,
"source" : "Reactome:177938",
"target" : "MAP:Cb17552_CY_Reactome:177938"
},
{
"id" : 3,
"sbo" : 11,
"source" : "Reactome:177938",
"target" : "Reactome:109783"
},
{
"id" : 4,
"sbo" : 13,
"source" : "Reactome:179820",
"target" : "Reactome:177938"
},
{
"id" : 5,
"sbo" : 15,
"source" : "Reactome:179845",
"target" : "Reactome:177934"
},
{
"id" : 6,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:177934",
"target" : "Reactome:177934"
},
{
"id" : 7,
"sbo" : 11,
"source" : "Reactome:177934",
"target" : "MAP:Cb16761_CY_Reactome:177934"
},
{
"id" : 8,
"sbo" : 11,
"source" : "Reactome:177934",
"target" : "Reactome:179882"
},
{
"id" : 9,
"sbo" : 13,
"source" : "Reactome:179845",
"target" : "Reactome:177934"
},
{
"id" : 10,
"sbo" : 15,
"source" : "Reactome:109844",
"target" : "Reactome:109867"
},
{
"id" : 11,
"sbo" : 11,
"source" : "Reactome:109867",
"target" : "Reactome:109845"
},
{
"id" : 12,
"sbo" : 15,
"source" : "Reactome:29358_MAN:R12",
"target" : "MAN:R12"
},
{
"id" : 13,
"sbo" : 15,
"source" : "Reactome:198710",
"target" : "MAN:R12"
},
{
"id" : 14,
"sbo" : 11,
"source" : "MAN:R12",
"target" : "Reactome:113582_MAN:R12"
},
{
"id" : 15,
"sbo" : 11,
"source" : "MAN:R12",
"target" : "Reactome:198666"
},
{
"id" : 16,
"sbo" : 13,
"source" : "Reactome:109845",
"target" : "MAN:R12"
},
{
"id" : 17,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:109841",
"target" : "Reactome:109841"
},
{
"id" : 18,
"sbo" : 15,
"source" : "Reactome:109794",
"target" : "Reactome:109841"
},
{
"id" : 19,
"sbo" : 11,
"source" : "Reactome:109841",
"target" : "MAP:Cb16761_CY_Reactome:109841"
},
{
"id" : 20,
"sbo" : 11,
"source" : "Reactome:109841",
"target" : "Reactome:109793"
},
{
"id" : 21,
"sbo" : 11,
"source" : "Reactome:109841",
"target" : "MAP:UQ02750_CY_pho218pho222"
},
{
"id" : 22,
"sbo" : 13,
"source" : "Reactome:112406",
"target" : "Reactome:109841"
},
{
"id" : 23,
"sbo" : 15,
"source" : "Reactome:179882",
"target" : "Reactome:177940"
},
{
"id" : 24,
"sbo" : 15,
"source" : "Reactome:179849",
"target" : "Reactome:177940"
},
{
"id" : 25,
"sbo" : 11,
"source" : "Reactome:177940",
"target" : "Reactome:180348"
},
{
"id" : 26,
"sbo" : 15,
"source" : "Reactome:109788",
"target" : "Reactome:109802"
},
{
"id" : 27,
"sbo" : 15,
"source" : "MAP:UP31946_CY",
"target" : "Reactome:109802"
},
{
"id" : 28,
"sbo" : 11,
"source" : "Reactome:109802",
"target" : "Reactome:109789"
},
{
"id" : 29,
"sbo" : 15,
"source" : "Reactome:109787",
"target" : "Reactome:109803"
},
{
"id" : 30,
"sbo" : 15,
"source" : "Reactome:109783",
"target" : "Reactome:109803"
},
{
"id" : 31,
"sbo" : 11,
"source" : "Reactome:109803",
"target" : "Reactome:109788"
},
{
"id" : 32,
"sbo" : 11,
"source" : "Reactome:109803",
"target" : "MAP:UP31946_CY"
},
{
"id" : 33,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:177930",
"target" : "Reactome:177930"
},
{
"id" : 34,
"sbo" : 15,
"source" : "Reactome:180348",
"target" : "Reactome:177930"
},
{
"id" : 35,
"sbo" : 11,
"source" : "Reactome:177930",
"target" : "Reactome:180286"
},
{
"id" : 36,
"sbo" : 11,
"source" : "Reactome:177930",
"target" : "MAP:Cb16761_CY_Reactome:177930"
},
{
"id" : 37,
"sbo" : 13,
"source" : "Reactome:180348",
"target" : "Reactome:177930"
},
{
"id" : 38,
"sbo" : 15,
"source" : "Reactome:109796",
"target" : "Reactome:177945"
},
{
"id" : 39,
"sbo" : 15,
"source" : "MAP:Cb15996_CY_Reactome:177945",
"target" : "Reactome:177945"
},
{
"id" : 40,
"sbo" : 11,
"source" : "Reactome:177945",
"target" : "MAP:Cb17552_CY_Reactome:177945"
},
{
"id" : 41,
"sbo" : 11,
"source" : "Reactome:177945",
"target" : "Reactome:109783"
},
{
"id" : 42,
"sbo" : 13,
"source" : "Reactome:180331",
"target" : "Reactome:177945"
},
{
"id" : 43,
"sbo" : 15,
"source" : "Reactome:109793",
"target" : "MAN:R1"
},
{
"id" : 44,
"sbo" : 15,
"source" : "MAP:UP36507_CY",
"target" : "MAN:R1"
},
{
"id" : 45,
"sbo" : 11,
"source" : "MAN:R1",
"target" : "Reactome:109795"
},
{
"id" : 46,
"sbo" : 15,
"source" : "Reactome:109843",
"target" : "Reactome:109863"
},
{
"id" : 47,
"sbo" : 11,
"source" : "Reactome:109863",
"target" : "MAP:UP27361_CY_pho202pho204"
},
{
"id" : 48,
"sbo" : 11,
"source" : "Reactome:109863",
"target" : "MAP:UQ02750_CY_pho218pho222"
},
{
"id" : 49,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:177933",
"target" : "Reactome:177933"
},
{
"id" : 50,
"sbo" : 15,
"source" : "Reactome:180301",
"target" : "Reactome:177933"
},
{
"id" : 51,
"sbo" : 11,
"source" : "Reactome:177933",
"target" : "MAP:Cb16761_CY_Reactome:177933"
},
{
"id" : 52,
"sbo" : 11,
"source" : "Reactome:177933",
"target" : "Reactome:180337"
},
{
"id" : 53,
"sbo" : 13,
"source" : "Reactome:180301",
"target" : "Reactome:177933"
},
{
"id" : 54,
"sbo" : 15,
"source" : "MAP:UQ02750_CY",
"target" : "MAN:R2"
},
{
"id" : 55,
"sbo" : 15,
"source" : "Reactome:109793",
"target" : "MAN:R2"
},
{
"id" : 56,
"sbo" : 11,
"source" : "MAN:R2",
"target" : "Reactome:109794"
},
{
"id" : 57,
"sbo" : 15,
"source" : "MAP:UP04049_CY_pho259pho621",
"target" : "Reactome:109804"
},
{
"id" : 58,
"sbo" : 15,
"source" : "MAP:UP31946_CY",
"target" : "Reactome:109804"
},
{
"id" : 59,
"sbo" : 11,
"source" : "Reactome:109804",
"target" : "Reactome:109787"
},
{
"id" : 60,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:109852",
"target" : "Reactome:109852"
},
{
"id" : 61,
"sbo" : 15,
"source" : "Reactome:109795",
"target" : "Reactome:109852"
},
{
"id" : 62,
"sbo" : 11,
"source" : "Reactome:109852",
"target" : "MAP:Cb16761_CY_Reactome:109852"
},
{
"id" : 63,
"sbo" : 11,
"source" : "Reactome:109852",
"target" : "Reactome:109793"
},
{
"id" : 64,
"sbo" : 11,
"source" : "Reactome:109852",
"target" : "Reactome:109848"
},
{
"id" : 65,
"sbo" : 13,
"source" : "Reactome:112406",
"target" : "Reactome:109852"
},
{
"id" : 66,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:177939",
"target" : "Reactome:177939"
},
{
"id" : 67,
"sbo" : 15,
"source" : "Reactome:179856",
"target" : "Reactome:177939"
},
{
"id" : 68,
"sbo" : 11,
"source" : "Reactome:177939",
"target" : "MAP:Cb16761_CY_Reactome:177939"
},
{
"id" : 69,
"sbo" : 11,
"source" : "Reactome:177939",
"target" : "Reactome:179838"
},
{
"id" : 70,
"sbo" : 13,
"source" : "Reactome:179791",
"target" : "Reactome:177939"
},
{
"id" : 71,
"sbo" : 15,
"source" : "Reactome:180286",
"target" : "MAN:R25"
},
{
"id" : 72,
"sbo" : 15,
"source" : "MAP:C3",
"target" : "MAN:R25"
},
{
"id" : 73,
"sbo" : 15,
"source" : "MAP:C2",
"target" : "MAN:R25"
},
{
"id" : 74,
"sbo" : 11,
"source" : "MAN:R25",
"target" : "Reactome:179791"
},
{
"id" : 75,
"sbo" : 15,
"source" : "MAP:Cx114",
"target" : "Reactome:177936"
},
{
"id" : 76,
"sbo" : 15,
"source" : "Reactome:180337",
"target" : "Reactome:177936"
},
{
"id" : 77,
"sbo" : 11,
"source" : "Reactome:177936",
"target" : "Reactome:180331"
},
{
"id" : 78,
"sbo" : 15,
"source" : "MAP:C3",
"target" : "MAN:R28"
},
{
"id" : 79,
"sbo" : 15,
"source" : "MAP:C2",
"target" : "MAN:R28"
},
{
"id" : 80,
"sbo" : 15,
"source" : "Reactome:109783",
"target" : "MAN:R28"
},
{
"id" : 81,
"sbo" : 11,
"source" : "MAN:R28",
"target" : "MAN:C10"
},
{
"id" : 82,
"sbo" : 15,
"source" : "Reactome:179847",
"target" : "Reactome:177922"
},
{
"id" : 83,
"sbo" : 11,
"source" : "Reactome:177922",
"target" : "Reactome:179845"
},
{
"id" : 84,
"sbo" : 15,
"source" : "Reactome:109838",
"target" : "Reactome:109860"
},
{
"id" : 85,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:109860",
"target" : "Reactome:109860"
},
{
"id" : 86,
"sbo" : 11,
"source" : "Reactome:109860",
"target" : "MAP:Cb16761_CY_Reactome:109860"
},
{
"id" : 87,
"sbo" : 11,
"source" : "Reactome:109860",
"target" : "Reactome:109843"
},
{
"id" : 88,
"sbo" : 13,
"source" : "Reactome:109838",
"target" : "Reactome:109860"
},
{
"id" : 89,
"sbo" : 20,
"source" : "Reactome:112340",
"target" : "Reactome:109860"
},
{
"id" : 90,
"sbo" : 15,
"source" : "MAP:Cx114",
"target" : "Reactome:177943"
},
{
"id" : 91,
"sbo" : 15,
"source" : "Reactome:179882",
"target" : "Reactome:177943"
},
{
"id" : 92,
"sbo" : 11,
"source" : "Reactome:177943",
"target" : "Reactome:179820"
},
{
"id" : 93,
"sbo" : 15,
"source" : "MAP:UP27361_CY_pho202pho204",
"target" : "Reactome:109865"
},
{
"id" : 94,
"sbo" : 11,
"source" : "Reactome:109865",
"target" : "Reactome:109844"
},
{
"id" : 95,
"sbo" : 15,
"source" : "Reactome:179882",
"target" : "Reactome:177925"
},
{
"id" : 96,
"sbo" : 15,
"source" : "MAP:UP29353_CY",
"target" : "Reactome:177925"
},
{
"id" : 97,
"sbo" : 11,
"source" : "Reactome:177925",
"target" : "Reactome:180301"
},
{
"id" : 98,
"sbo" : 15,
"source" : "Reactome:109789",
"target" : "Reactome:109829"
},
{
"id" : 99,
"sbo" : 15,
"source" : "MAP:Cs56-65-5_CY_Reactome:109829",
"target" : "Reactome:109829"
},
{
"id" : 100,
"sbo" : 11,
"source" : "Reactome:109829",
"target" : "MAP:Cb16761_CY_Reactome:109829"
},
{
"id" : 101,
"sbo" : 11,
"source" : "Reactome:109829",
"target" : "Reactome:109793"
},
{
"id" : 102,
"sbo" : 13,
"source" : "Reactome:163338",
"target" : "Reactome:109829"
},
{
"id" : 103,
"sbo" : 15,
"source" : "MAP:UP27361_CY",
"target" : "Reactome:109857"
},
{
"id" : 104,
"sbo" : 15,
"source" : "MAP:UQ02750_CY_pho218pho222",
"target" : "Reactome:109857"
},
{
"id" : 105,
"sbo" : 11,
"source" : "Reactome:109857",
"target" : "Reactome:109838"
},
{
"id" : 106,
"sbo" : 15,
"source" : "Reactome:179863",
"target" : "Reactome:177942"
},
{
"id" : 107,
"sbo" : 15,
"source" : "Reactome:179837",
"target" : "Reactome:177942"
},
{
"id" : 108,
"sbo" : 11,
"source" : "Reactome:177942",
"target" : "Reactome:179847"
},
{
"id" : 109,
"sbo" : 20,
"source" : "Reactome:197745",
"target" : "Reactome:177942"
}
],
"nodes" : [
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GDP",
"modification" : [],
"ref" : "Reactome:109796",
"subnodes" : [
"MAP:Cb17552_CY_Reactome:109796_1",
"Reactome:109782_Reactome:109796_1"
],
"x" : 1889,
"y" : 2293
},
"id" : "Reactome:109796",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "RAS:RAF:14-3-3",
"modification" : [],
"ref" : "Reactome:109789",
"subnodes" : [
"Reactome:109788_Reactome:109789_1",
"MAP:UP31946_CY_Reactome:109789_1"
],
"x" : 1757,
"y" : 1680
},
"id" : "Reactome:109789",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "PI3K alpha",
"modification" : [],
"ref" : "MAP:Cx156"
},
"id" : "MAP:Cx156",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex",
"modification" : [],
"ref" : "Reactome:109793",
"subnodes" : [
"MAP:UP31946_CY_Reactome:109793_1",
"Reactome:109783_Reactome:109793_1",
"Reactome:109792_Reactome:109793_1"
],
"x" : 2402,
"y" : 1480
},
"id" : "Reactome:109793",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR-SHC",
"modification" : [],
"ref" : "Reactome:180301",
"subnodes" : [
"Reactome:179882_Reactome:180301_1",
"MAP:UP29353_CY_Reactome:180301_1"
],
"x" : 1478,
"y" : 2706
},
"id" : "Reactome:180301",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "phospho-ERK-1 dimer",
"modification" : [],
"ref" : "Reactome:109845",
"subnodes" : [
"Reactome:112359_Reactome:109845_1",
"Reactome:112359_Reactome:109845_2"
],
"x" : 3261,
"y" : 202
},
"id" : "Reactome:109845",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GRB2:Phospho-GAB1",
"modification" : [],
"ref" : "Reactome:180304"
},
"id" : "Reactome:180304",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860"
},
"id" : "Reactome:179860",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "GAB1:GRB2-EGF-Phospho-EGFR dimer",
"modification" : [],
"ref" : "Reactome:180348",
"subnodes" : [
"Reactome:179882_Reactome:180348_1",
"Reactome:179849_Reactome:180348_1"
],
"x" : 477,
"y" : 2293
},
"id" : "Reactome:180348",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho-ERK-1:MEK1",
"modification" : [],
"ref" : "Reactome:109843",
"subnodes" : [
"MAP:UP27361_CY_pho202pho204_Reactome:109843_1",
"MAP:UQ02750_CY_pho218pho222_Reactome:109843_1"
],
"x" : 3519,
"y" : 722
},
"id" : "Reactome:109843",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "RAS:RAF",
"modification" : [],
"ref" : "Reactome:109788",
"subnodes" : [
"MAP:UP04049_CY_pho259pho621_Reactome:109788_1",
"Reactome:109783_Reactome:109788_1"
],
"x" : 1569,
"y" : 1880
},
"id" : "Reactome:109788",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GRB2:GAB1",
"modification" : [],
"ref" : "Reactome:179849",
"subnodes" : [
"MAP:UP62993_CY_Reactome:179849_1",
"MAP:UQ13480_CY_Reactome:179849_1"
],
"x" : 686,
"y" : 2506
},
"id" : "Reactome:179849",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "GRB2:Phospho GAB1-EGF-Phospho-EGFR dimer",
"modification" : [],
"ref" : "Reactome:180286",
"subnodes" : [
"Reactome:180304_Reactome:180286_1",
"Reactome:179882_Reactome:180286_1"
],
"x" : 770,
"y" : 2080
},
"id" : "Reactome:180286",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:EGFR dimer",
"modification" : [],
"ref" : "Reactome:179845",
"subnodes" : [
"Reactome:179847_Reactome:179845_1",
"Reactome:179847_Reactome:179845_2"
],
"x" : 1331,
"y" : 3106
},
"id" : "Reactome:179845",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho-ERK-1 dimer",
"modification" : [],
"ref" : "Reactome:109844",
"subnodes" : [
"MAP:UP27361_CY_pho202pho204_Reactome:109844_1",
"MAP:UP27361_CY_pho202pho204_Reactome:109844_2"
],
"x" : 3261,
"y" : 378
},
"id" : "Reactome:109844",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:EGFR",
"modification" : [],
"ref" : "Reactome:179847",
"subnodes" : [
"Reactome:179863_Reactome:179847_1",
"Reactome:179837_Reactome:179847_1"
],
"x" : 1331,
"y" : 3294
},
"id" : "Reactome:179847",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GRB2:SOS1",
"modification" : [],
"ref" : "MAP:Cx114",
"subnodes" : [
"MAP:UQ07889_CY_MAP:Cx114_1",
"MAP:UP62993_CY_MAP:Cx114_1"
],
"x" : 1555,
"y" : 2506
},
"id" : "MAP:Cx114",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_1",
"Reactome:179860_Reactome:179882_2"
],
"x" : 967,
"y" : 2906
},
"id" : "Reactome:179882",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "MEK1:ERK-1",
"modification" : [],
"ref" : "Reactome:109838",
"subnodes" : [
"MAP:UP27361_CY_Reactome:109838_1",
"MAP:UQ02750_CY_pho218pho222_Reactome:109838_1"
],
"x" : 3806,
"y" : 898
},
"id" : "Reactome:109838",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "RAS:GTP:PI3Ka",
"modification" : [],
"ref" : "MAN:C10",
"subnodes" : [
"MAP:Cx156_MAN:C10_1",
"Reactome:109783_MAN:C10_1"
],
"x" : 1292,
"y" : 1880
},
"id" : "MAN:C10",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "p-Raf1(S259,S621):14-3-3 protein beta/alpha",
"modification" : [],
"ref" : "Reactome:109787",
"subnodes" : [
"MAP:UP04049_CY_pho259pho621_Reactome:109787_1",
"MAP:UP31946_CY_Reactome:109787_1"
],
"x" : 2423,
"y" : 1680
},
"id" : "Reactome:109787",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "GRB2:SOS-Phospho-SHC:EGF:Phospho-EGFR dimer",
"modification" : [],
"ref" : "Reactome:180331",
"subnodes" : [
"MAP:Cx114_Reactome:180331_1",
"Reactome:180337_Reactome:180331_1"
],
"x" : 2310,
"y" : 2293
},
"id" : "Reactome:180331",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex:MEK2",
"modification" : [],
"ref" : "Reactome:109795",
"subnodes" : [
"Reactome:109793_Reactome:109795_1",
"MAP:UP36507_CY_Reactome:109795_1"
],
"x" : 2070,
"y" : 1267
},
"id" : "Reactome:109795",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "EGF:Phospho-EGFR-GRB2:GAB1:PI3Kreg:PI3Kcat",
"modification" : [],
"ref" : "Reactome:179791",
"subnodes" : [
"MAP:C3_Reactome:179791_1",
"Reactome:179882_Reactome:179791_1",
"MAP:C2_Reactome:179791_1",
"Reactome:179849_Reactome:179791_1"
],
"x" : 963,
"y" : 1880
},
"id" : "Reactome:179791",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex:MEK1",
"modification" : [],
"ref" : "Reactome:109794",
"subnodes" : [
"MAP:UQ02750_CY_Reactome:109794_1",
"Reactome:109793_Reactome:109794_1"
],
"x" : 2762,
"y" : 1267
},
"id" : "Reactome:109794",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex:MEK",
"modification" : [],
"ref" : "Reactome:112406",
"subnodes" : [
"Reactome:109793_Reactome:112406_1",
"Reactome:112398_Reactome:112406_1"
],
"x" : 2416,
"y" : 1267
},
"id" : "Reactome:112406",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR:Phospho-SHC",
"modification" : [],
"ref" : "Reactome:180337",
"subnodes" : [
"Reactome:180276_Reactome:180337_1",
"Reactome:179882_Reactome:180337_1"
],
"x" : 1945,
"y" : 2506
},
"id" : "Reactome:180337",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "GRB2:SOS-EGF-Phospho-EGFR dimer",
"modification" : [],
"ref" : "Reactome:179820",
"subnodes" : [
"MAP:Cx114_Reactome:179820_1",
"Reactome:179882_Reactome:179820_1"
],
"x" : 1514,
"y" : 2293
},
"id" : "Reactome:179820",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_1",
"MAP:Cb15996_CY_Reactome:109783_1"
],
"x" : 1886,
"y" : 2080
},
"id" : "Reactome:109783",
"is_abstract" : 0,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GDP",
"modification" : [],
"ref" : "MAP:Cb17552_CY"
},
"id" : "MAP:Cb17552_CY",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "ATP",
"modification" : [],
"ref" : "Reactome:29358"
},
"id" : "Reactome:29358",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY"
},
"id" : "MAP:Cs56-65-5_CY",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Phosphatidylinositol-4,5-bisphosphate",
"modification" : [],
"ref" : "Reactome:179856",
"x" : 543,
"y" : 1880
},
"id" : "Reactome:179856",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY"
},
"id" : "MAP:Cb16761_CY",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "ADP",
"modification" : [],
"ref" : "Reactome:113582"
},
"id" : "Reactome:113582",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Phosphatidylinositol-3,4,5-trisphosphate",
"modification" : [],
"ref" : "Reactome:179838",
"x" : 733,
"y" : 1680
},
"id" : "Reactome:179838",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "Phospho-ELK1",
"modification" : [],
"ref" : "Reactome:198666",
"x" : 3722,
"y" : 30
},
"id" : "Reactome:198666",
"is_abstract" : 0,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "ELK1",
"modification" : [],
"ref" : "Reactome:198710",
"x" : 3556,
"y" : 202
},
"id" : "Reactome:198710",
"is_abstract" : 0,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "MEK",
"modification" : [],
"ref" : "Reactome:112398"
},
"id" : "Reactome:112398",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho_MEK1",
"modification" : [],
"ref" : "Reactome:112340",
"x" : 3186,
"y" : 898
},
"id" : "Reactome:112340",
"is_abstract" : 0,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho-MEK2",
"modification" : [
[
216,
null
],
[
216,
null
]
],
"ref" : "Reactome:109848",
"x" : 2325,
"y" : 1070
},
"id" : "Reactome:109848",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Transforming protein N-Ras",
"modification" : [],
"ref" : "MAP:C79"
},
"id" : "MAP:C79",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "phospho-ERK-1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "Reactome:112359"
},
"id" : "Reactome:112359",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY",
"x" : 1887,
"y" : 1880
},
"id" : "MAP:UP31946_CY",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "Phospho-SHC transforming protein",
"modification" : [
[
216,
"349"
],
[
216,
"350"
]
],
"ref" : "Reactome:180276"
},
"id" : "Reactome:180276",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "K-RAS isoform 2A",
"modification" : [],
"ref" : "MAP:UP01116_"
},
"id" : "MAP:UP01116_",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho-MEK1",
"modification" : [
[
216,
"286"
],
[
216,
"292"
]
],
"ref" : "Reactome:112374"
},
"id" : "Reactome:112374",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "Son of sevenless protein homolog 1",
"modification" : [],
"ref" : "MAP:UQ07889_CY"
},
"id" : "MAP:UQ07889_CY",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "ETS-domain protein Elk-1-1",
"modification" : [],
"ref" : "MAP:UP19419_NU(1-428)"
},
"id" : "MAP:UP19419_NU(1-428)",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "SHC",
"modification" : [],
"ref" : "MAP:UP29353_CY",
"x" : 1370,
"y" : 2906
},
"id" : "MAP:UP29353_CY",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "MEK1",
"modification" : [],
"ref" : "MAP:UQ02750_CY",
"x" : 2748,
"y" : 1480
},
"id" : "MAP:UQ02750_CY",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "cRaf",
"modification" : [
[
216,
"340"
],
[
216,
"621"
],
[
216,
"259"
],
[
216,
"341"
]
],
"ref" : "Reactome:109792"
},
"id" : "Reactome:109792",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "Phospho-GAB1",
"modification" : [
[
216,
"627"
],
[
216,
"659"
],
[
216,
"447"
],
[
216,
"472"
],
[
216,
"589"
]
],
"ref" : "Reactome:180344"
},
"id" : "Reactome:180344",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "c-H-ras",
"modification" : [],
"ref" : "MAP:UP01112_PM"
},
"id" : "MAP:UP01112_PM",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "unidentified protein tyrosine kinase",
"modification" : [],
"ref" : "Reactome:163338",
"x" : 2811,
"y" : 1680
},
"id" : "Reactome:163338",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "PI3K-p85",
"modification" : [],
"ref" : "MAP:C3",
"x" : 1292,
"y" : 2080
},
"id" : "MAP:C3",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "RAF1(ph259,ph621)",
"modification" : [
[
216,
"259"
],
[
216,
"621"
]
],
"ref" : "MAP:UP04049_CY_pho259pho621",
"x" : 2294,
"y" : 1880
},
"id" : "MAP:UP04049_CY_pho259pho621",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "MEK2()",
"modification" : [],
"ref" : "MAP:UP36507_CY",
"x" : 2084,
"y" : 1480
},
"id" : "MAP:UP36507_CY",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "Activated ERK1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "MAP:UP27361_CY_pho202pho204",
"x" : 3261,
"y" : 550
},
"id" : "MAP:UP27361_CY_pho202pho204",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863",
"x" : 1331,
"y" : 3466
},
"id" : "Reactome:179863",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho-MEK1",
"modification" : [
[
216,
"218"
],
[
216,
"222"
]
],
"ref" : "MAP:UQ02750_CY_pho218pho222",
"x" : 3102,
"y" : 1070
},
"id" : "MAP:UQ02750_CY_pho218pho222",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "EGFR",
"modification" : [],
"ref" : "Reactome:179837",
"x" : 928,
"y" : 3466
},
"id" : "Reactome:179837",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "GAB1",
"modification" : [],
"ref" : "MAP:UQ13480_CY"
},
"id" : "MAP:UQ13480_CY",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "phospho-MEK1",
"modification" : [
[
216,
"218"
],
[
216,
"222"
],
[
216,
"286"
],
[
216,
"292"
]
],
"ref" : "Reactome:112339"
},
"id" : "Reactome:112339",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"label" : "SOS1",
"modification" : [],
"ref" : "PID:C200496"
},
"id" : "PID:C200496",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Leucine-rich repeats and immunoglobulin-like domains protein 1 precursor",
"modification" : [],
"ref" : "Reactome:197745",
"x" : 1902,
"y" : 3466
},
"id" : "Reactome:197745",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Nucleus",
"label" : "Phospho-ETS-domain protein Elk-1-2",
"modification" : [
[
216,
"324"
],
[
216,
"383"
],
[
216,
"389"
],
[
216,
"336"
],
[
216,
"422"
]
],
"ref" : "MAP:UP19419_NU(1-428)_pho324pho336pho383pho389pho422"
},
"id" : "MAP:UP19419_NU(1-428)_pho324pho336pho383pho389pho422",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "PI3K-p110",
"modification" : [],
"ref" : "MAP:C2",
"x" : 1066,
"y" : 2080
},
"id" : "MAP:C2",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Cytosol",
"label" : "ERK1",
"modification" : [],
"ref" : "MAP:UP27361_CY",
"x" : 3707,
"y" : 1070
},
"id" : "MAP:UP27361_CY",
"is_abstract" : 0,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"label" : "GRB2",
"modification" : [],
"ref" : "PID:C200490"
},
"id" : "PID:C200490",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177938",
"x" : 1569,
"y" : 2180
},
"id" : "Reactome:177938",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY",
"x" : 1131,
"y" : 2293
},
"id" : "MAP:Cb15996_CY_Reactome:177938",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb17552_CY",
"compartment" : "MAP:Cytosol",
"label" : "GDP",
"modification" : [],
"ref" : "MAP:Cb17552_CY",
"x" : 1569,
"y" : 2080
},
"id" : "MAP:Cb17552_CY_Reactome:177938",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177934",
"x" : 1331,
"y" : 3006
},
"id" : "Reactome:177934",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 1008,
"y" : 3106
},
"id" : "MAP:Cs56-65-5_CY_Reactome:177934",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 1696,
"y" : 2906
},
"id" : "MAP:Cb16761_CY_Reactome:177934",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109867",
"x" : 3261,
"y" : 290
},
"id" : "Reactome:109867",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "MAN:R12",
"x" : 3556,
"y" : 114
},
"id" : "MAN:R12",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "Reactome:29358",
"compartment" : "MAP:Nucleus",
"label" : "ATP",
"modification" : [],
"ref" : "Reactome:29358",
"x" : 3881,
"y" : 202
},
"id" : "Reactome:29358_MAN:R12",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:113582",
"compartment" : "MAP:Nucleus",
"label" : "ADP",
"modification" : [],
"ref" : "Reactome:113582",
"x" : 3390,
"y" : 30
},
"id" : "Reactome:113582_MAN:R12",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109841",
"x" : 2716,
"y" : 1154
},
"id" : "Reactome:109841",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 3085,
"y" : 1267
},
"id" : "MAP:Cs56-65-5_CY_Reactome:109841",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 2696,
"y" : 1070
},
"id" : "MAP:Cb16761_CY_Reactome:109841",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177940",
"x" : 549,
"y" : 2406
},
"id" : "Reactome:177940",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109802",
"x" : 1757,
"y" : 1780
},
"id" : "Reactome:109802",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109803",
"x" : 1886,
"y" : 1980
},
"id" : "Reactome:109803",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177930",
"x" : 477,
"y" : 2180
},
"id" : "Reactome:177930",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 800,
"y" : 2293
},
"id" : "MAP:Cs56-65-5_CY_Reactome:177930",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 425,
"y" : 2080
},
"id" : "MAP:Cb16761_CY_Reactome:177930",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177945",
"x" : 2256,
"y" : 2180
},
"id" : "Reactome:177945",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY",
"x" : 2739,
"y" : 2293
},
"id" : "MAP:Cb15996_CY_Reactome:177945",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb17552_CY",
"compartment" : "MAP:Cytosol",
"label" : "GDP",
"modification" : [],
"ref" : "MAP:Cb17552_CY",
"x" : 2256,
"y" : 2080
},
"id" : "MAP:Cb17552_CY_Reactome:177945",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "MAN:R1",
"x" : 2084,
"y" : 1380
},
"id" : "MAN:R1",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109863",
"x" : 3261,
"y" : 634
},
"id" : "Reactome:109863",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177933",
"x" : 1478,
"y" : 2606
},
"id" : "Reactome:177933",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 1155,
"y" : 2706
},
"id" : "MAP:Cs56-65-5_CY_Reactome:177933",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 1221,
"y" : 2506
},
"id" : "MAP:Cb16761_CY_Reactome:177933",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "MAN:R2",
"x" : 2748,
"y" : 1380
},
"id" : "MAN:R2",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109804",
"x" : 2294,
"y" : 1780
},
"id" : "Reactome:109804",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109852",
"x" : 2080,
"y" : 1154
},
"id" : "Reactome:109852",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 1747,
"y" : 1267
},
"id" : "MAP:Cs56-65-5_CY_Reactome:109852",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 1999,
"y" : 1070
},
"id" : "MAP:Cb16761_CY_Reactome:109852",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177939",
"x" : 543,
"y" : 1780
},
"id" : "Reactome:177939",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 160,
"y" : 1880
},
"id" : "MAP:Cs56-65-5_CY_Reactome:177939",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 354,
"y" : 1680
},
"id" : "MAP:Cb16761_CY_Reactome:177939",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "MAN:R25",
"x" : 1014,
"y" : 1980
},
"id" : "MAN:R25",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177936",
"x" : 1945,
"y" : 2406
},
"id" : "Reactome:177936",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "MAN:R28",
"x" : 1292,
"y" : 1980
},
"id" : "MAN:R28",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177922",
"x" : 1331,
"y" : 3206
},
"id" : "Reactome:177922",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109860",
"x" : 3519,
"y" : 810
},
"id" : "Reactome:109860",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 3519,
"y" : 898
},
"id" : "MAP:Cs56-65-5_CY_Reactome:109860",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 3228,
"y" : 722
},
"id" : "MAP:Cb16761_CY_Reactome:109860",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177943",
"x" : 1514,
"y" : 2406
},
"id" : "Reactome:177943",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109865",
"x" : 3261,
"y" : 466
},
"id" : "Reactome:109865",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177925",
"x" : 1370,
"y" : 2806
},
"id" : "Reactome:177925",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109829",
"x" : 2080,
"y" : 1580
},
"id" : "Reactome:109829",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "MAP:Cs56-65-5_CY",
"compartment" : "MAP:Cytosol",
"label" : "ATP",
"modification" : [],
"ref" : "MAP:Cs56-65-5_CY",
"x" : 2080,
"y" : 1680
},
"id" : "MAP:Cs56-65-5_CY_Reactome:109829",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:Cb16761_CY",
"compartment" : "MAP:Cytosol",
"label" : "ADP",
"modification" : [],
"ref" : "MAP:Cb16761_CY",
"x" : 1758,
"y" : 1480
},
"id" : "MAP:Cb16761_CY_Reactome:109829",
"is_abstract" : 0,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:109857",
"x" : 3707,
"y" : 986
},
"id" : "Reactome:109857",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"label" : null,
"ref" : "Reactome:177942",
"x" : 1331,
"y" : 3382
},
"id" : "Reactome:177942",
"is_abstract" : 0,
"sbo" : 167,
"type" : "Reaction"
},
{
"data" : {
"clone_marker" : "Reactome:109788",
"compartment" : "MAP:Plasmamembrane",
"label" : "RAS:RAF",
"modification" : [],
"ref" : "Reactome:109788",
"subnodes" : [
"MAP:UP04049_CY_pho259pho621_Reactome:109788_Reactome:109789_1_1",
"Reactome:109783_Reactome:109788_Reactome:109789_1_1"
]
},
"id" : "Reactome:109788_Reactome:109789_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP31946_CY",
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY"
},
"id" : "MAP:UP31946_CY_Reactome:109789_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:Cb17552_CY",
"compartment" : "MAP:Cytosol",
"label" : "GDP",
"modification" : [],
"ref" : "MAP:Cb17552_CY"
},
"id" : "MAP:Cb17552_CY_Reactome:109796_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109796_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:UP31946_CY",
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY"
},
"id" : "MAP:UP31946_CY_Reactome:109793_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_Reactome:109793_1_1",
"MAP:Cb15996_CY_Reactome:109783_Reactome:109793_1_1"
]
},
"id" : "Reactome:109783_Reactome:109793_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109792",
"compartment" : "MAP:Plasmamembrane",
"label" : "cRaf",
"modification" : [
[
216,
"340"
],
[
216,
"621"
],
[
216,
"259"
],
[
216,
"341"
]
],
"ref" : "Reactome:109792"
},
"id" : "Reactome:109792_Reactome:109793_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:180301_1_1",
"Reactome:179860_Reactome:179882_Reactome:180301_1_2"
]
},
"id" : "Reactome:179882_Reactome:180301_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP29353_CY",
"compartment" : "MAP:Cytosol",
"label" : "SHC",
"modification" : [],
"ref" : "MAP:UP29353_CY"
},
"id" : "MAP:UP29353_CY_Reactome:180301_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:112359",
"compartment" : "MAP:Nucleus",
"label" : "phospho-ERK-1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "Reactome:112359"
},
"id" : "Reactome:112359_Reactome:109845_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:112359",
"compartment" : "MAP:Nucleus",
"label" : "phospho-ERK-1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "Reactome:112359"
},
"id" : "Reactome:112359_Reactome:109845_2",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:180348_1_1",
"Reactome:179860_Reactome:179882_Reactome:180348_1_2"
]
},
"id" : "Reactome:179882_Reactome:180348_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179849",
"compartment" : "MAP:Cytosol",
"label" : "GRB2:GAB1",
"modification" : [],
"ref" : "Reactome:179849",
"subnodes" : [
"MAP:UP62993_CY_Reactome:179849_Reactome:180348_1_1",
"MAP:UQ13480_CY_Reactome:179849_Reactome:180348_1_1"
]
},
"id" : "Reactome:179849_Reactome:180348_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP27361_CY_pho202pho204",
"compartment" : "MAP:Cytosol",
"label" : "Activated ERK1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "MAP:UP27361_CY_pho202pho204"
},
"id" : "MAP:UP27361_CY_pho202pho204_Reactome:109843_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ02750_CY_pho218pho222",
"compartment" : "MAP:Cytosol",
"label" : "phospho-MEK1",
"modification" : [
[
216,
"218"
],
[
216,
"222"
]
],
"ref" : "MAP:UQ02750_CY_pho218pho222"
},
"id" : "MAP:UQ02750_CY_pho218pho222_Reactome:109843_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP04049_CY_pho259pho621",
"compartment" : "MAP:Cytosol",
"label" : "RAF1(ph259,ph621)",
"modification" : [
[
216,
"259"
],
[
216,
"621"
]
],
"ref" : "MAP:UP04049_CY_pho259pho621"
},
"id" : "MAP:UP04049_CY_pho259pho621_Reactome:109788_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_Reactome:109788_1_1",
"MAP:Cb15996_CY_Reactome:109783_Reactome:109788_1_1"
]
},
"id" : "Reactome:109783_Reactome:109788_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_Reactome:179849_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ13480_CY",
"compartment" : "MAP:Cytosol",
"label" : "GAB1",
"modification" : [],
"ref" : "MAP:UQ13480_CY"
},
"id" : "MAP:UQ13480_CY_Reactome:179849_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:180304",
"compartment" : "MAP:Cytosol",
"label" : "GRB2:Phospho-GAB1",
"modification" : [],
"ref" : "Reactome:180304",
"subnodes" : [
"MAP:UP62993_CY_Reactome:180304_Reactome:180286_1_1",
"Reactome:180344_Reactome:180304_Reactome:180286_1_1"
]
},
"id" : "Reactome:180304_Reactome:180286_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:180286_1_1",
"Reactome:179860_Reactome:179882_Reactome:180286_1_2"
]
},
"id" : "Reactome:179882_Reactome:180286_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179847",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:EGFR",
"modification" : [],
"ref" : "Reactome:179847",
"subnodes" : [
"Reactome:179863_Reactome:179847_Reactome:179845_1_1",
"Reactome:179837_Reactome:179847_Reactome:179845_1_1"
]
},
"id" : "Reactome:179847_Reactome:179845_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179847",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:EGFR",
"modification" : [],
"ref" : "Reactome:179847",
"subnodes" : [
"Reactome:179863_Reactome:179847_Reactome:179845_2_1",
"Reactome:179837_Reactome:179847_Reactome:179845_2_1"
]
},
"id" : "Reactome:179847_Reactome:179845_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP27361_CY_pho202pho204",
"compartment" : "MAP:Cytosol",
"label" : "Activated ERK1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "MAP:UP27361_CY_pho202pho204"
},
"id" : "MAP:UP27361_CY_pho202pho204_Reactome:109844_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP27361_CY_pho202pho204",
"compartment" : "MAP:Cytosol",
"label" : "Activated ERK1",
"modification" : [
[
216,
"202"
],
[
216,
"204"
]
],
"ref" : "MAP:UP27361_CY_pho202pho204"
},
"id" : "MAP:UP27361_CY_pho202pho204_Reactome:109844_2",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ07889_CY",
"compartment" : "MAP:Cytosol",
"label" : "Son of sevenless protein homolog 1",
"modification" : [],
"ref" : "MAP:UQ07889_CY"
},
"id" : "MAP:UQ07889_CY_MAP:Cx114_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_MAP:Cx114_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179847_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179837",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGFR",
"modification" : [],
"ref" : "Reactome:179837"
},
"id" : "Reactome:179837_Reactome:179847_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP27361_CY",
"compartment" : "MAP:Cytosol",
"label" : "ERK1",
"modification" : [],
"ref" : "MAP:UP27361_CY"
},
"id" : "MAP:UP27361_CY_Reactome:109838_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ02750_CY_pho218pho222",
"compartment" : "MAP:Cytosol",
"label" : "phospho-MEK1",
"modification" : [
[
216,
"218"
],
[
216,
"222"
]
],
"ref" : "MAP:UQ02750_CY_pho218pho222"
},
"id" : "MAP:UQ02750_CY_pho218pho222_Reactome:109838_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP04049_CY_pho259pho621",
"compartment" : "MAP:Cytosol",
"label" : "RAF1(ph259,ph621)",
"modification" : [
[
216,
"259"
],
[
216,
"621"
]
],
"ref" : "MAP:UP04049_CY_pho259pho621"
},
"id" : "MAP:UP04049_CY_pho259pho621_Reactome:109787_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP31946_CY",
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY"
},
"id" : "MAP:UP31946_CY_Reactome:109787_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:Cx156",
"compartment" : "MAP:Cytosol",
"label" : "PI3K alpha",
"modification" : [],
"ref" : "MAP:Cx156",
"subnodes" : [
"MAP:C3_MAP:Cx156_MAN:C10_1_1",
"MAP:C2_MAP:Cx156_MAN:C10_1_1"
]
},
"id" : "MAP:Cx156_MAN:C10_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_MAN:C10_1_1",
"MAP:Cb15996_CY_Reactome:109783_MAN:C10_1_1"
]
},
"id" : "Reactome:109783_MAN:C10_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109793",
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex",
"modification" : [],
"ref" : "Reactome:109793",
"subnodes" : [
"MAP:UP31946_CY_Reactome:109793_Reactome:109795_1_1",
"Reactome:109783_Reactome:109793_Reactome:109795_1_1",
"Reactome:109792_Reactome:109793_Reactome:109795_1_1"
]
},
"id" : "Reactome:109793_Reactome:109795_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP36507_CY",
"compartment" : "MAP:Cytosol",
"label" : "MEK2()",
"modification" : [],
"ref" : "MAP:UP36507_CY"
},
"id" : "MAP:UP36507_CY_Reactome:109795_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:Cx114",
"compartment" : "MAP:Cytosol",
"label" : "GRB2:SOS1",
"modification" : [],
"ref" : "MAP:Cx114",
"subnodes" : [
"MAP:UQ07889_CY_MAP:Cx114_Reactome:180331_1_1",
"MAP:UP62993_CY_MAP:Cx114_Reactome:180331_1_1"
]
},
"id" : "MAP:Cx114_Reactome:180331_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:180337",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR:Phospho-SHC",
"modification" : [],
"ref" : "Reactome:180337",
"subnodes" : [
"Reactome:180276_Reactome:180337_Reactome:180331_1_1",
"Reactome:179882_Reactome:180337_Reactome:180331_1_1"
]
},
"id" : "Reactome:180337_Reactome:180331_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:C3",
"compartment" : "MAP:Cytosol",
"label" : "PI3K-p85",
"modification" : [],
"ref" : "MAP:C3"
},
"id" : "MAP:C3_Reactome:179791_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:179791_1_1",
"Reactome:179860_Reactome:179882_Reactome:179791_1_2"
]
},
"id" : "Reactome:179882_Reactome:179791_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:C2",
"compartment" : "MAP:Cytosol",
"label" : "PI3K-p110",
"modification" : [],
"ref" : "MAP:C2"
},
"id" : "MAP:C2_Reactome:179791_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179849",
"compartment" : "MAP:Cytosol",
"label" : "GRB2:GAB1",
"modification" : [],
"ref" : "Reactome:179849",
"subnodes" : [
"MAP:UP62993_CY_Reactome:179849_Reactome:179791_1_1",
"MAP:UQ13480_CY_Reactome:179849_Reactome:179791_1_1"
]
},
"id" : "Reactome:179849_Reactome:179791_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109793",
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex",
"modification" : [],
"ref" : "Reactome:109793",
"subnodes" : [
"MAP:UP31946_CY_Reactome:109793_Reactome:112406_1_1",
"Reactome:109783_Reactome:109793_Reactome:112406_1_1",
"Reactome:109792_Reactome:109793_Reactome:112406_1_1"
]
},
"id" : "Reactome:109793_Reactome:112406_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:112398",
"compartment" : "MAP:Cytosol",
"label" : "MEK",
"modification" : [],
"ref" : "Reactome:112398"
},
"id" : "Reactome:112398_Reactome:112406_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:UQ02750_CY",
"compartment" : "MAP:Cytosol",
"label" : "MEK1",
"modification" : [],
"ref" : "MAP:UQ02750_CY"
},
"id" : "MAP:UQ02750_CY_Reactome:109794_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109793",
"compartment" : "MAP:Plasmamembrane",
"label" : "Activated RAF1 complex",
"modification" : [],
"ref" : "Reactome:109793",
"subnodes" : [
"MAP:UP31946_CY_Reactome:109793_Reactome:109794_1_1",
"Reactome:109783_Reactome:109793_Reactome:109794_1_1",
"Reactome:109792_Reactome:109793_Reactome:109794_1_1"
]
},
"id" : "Reactome:109793_Reactome:109794_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:180276",
"compartment" : "MAP:Cytosol",
"label" : "Phospho-SHC transforming protein",
"modification" : [
[
216,
"349"
],
[
216,
"350"
]
],
"ref" : "Reactome:180276"
},
"id" : "Reactome:180276_Reactome:180337_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:180337_1_1",
"Reactome:179860_Reactome:179882_Reactome:180337_1_2"
]
},
"id" : "Reactome:179882_Reactome:180337_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:Cx114",
"compartment" : "MAP:Cytosol",
"label" : "GRB2:SOS1",
"modification" : [],
"ref" : "MAP:Cx114",
"subnodes" : [
"MAP:UQ07889_CY_MAP:Cx114_Reactome:179820_1_1",
"MAP:UP62993_CY_MAP:Cx114_Reactome:179820_1_1"
]
},
"id" : "MAP:Cx114_Reactome:179820_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:179820_1_1",
"Reactome:179860_Reactome:179882_Reactome:179820_1_2"
]
},
"id" : "Reactome:179882_Reactome:179820_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:UP04049_CY_pho259pho621",
"compartment" : "MAP:Cytosol",
"label" : "RAF1(ph259,ph621)",
"modification" : [
[
216,
"259"
],
[
216,
"621"
]
],
"ref" : "MAP:UP04049_CY_pho259pho621"
},
"id" : "MAP:UP04049_CY_pho259pho621_Reactome:109788_Reactome:109789_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_Reactome:109788_Reactome:109789_1_1_1",
"MAP:Cb15996_CY_Reactome:109783_Reactome:109788_Reactome:109789_1_1_1"
]
},
"id" : "Reactome:109783_Reactome:109788_Reactome:109789_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_Reactome:109793_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_Reactome:109793_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180301_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180301_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180301_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180301_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180301_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180301_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180348_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180348_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180348_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180348_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180348_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180348_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_Reactome:179849_Reactome:180348_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ13480_CY",
"compartment" : "MAP:Cytosol",
"label" : "GAB1",
"modification" : [],
"ref" : "MAP:UQ13480_CY"
},
"id" : "MAP:UQ13480_CY_Reactome:179849_Reactome:180348_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_Reactome:109788_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_Reactome:109788_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_Reactome:180304_Reactome:180286_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:180344",
"compartment" : "MAP:Cytosol",
"label" : "Phospho-GAB1",
"modification" : [
[
216,
"627"
],
[
216,
"659"
],
[
216,
"447"
],
[
216,
"472"
],
[
216,
"589"
]
],
"ref" : "Reactome:180344"
},
"id" : "Reactome:180344_Reactome:180304_Reactome:180286_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180286_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180286_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180286_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180286_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180286_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180286_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179847_Reactome:179845_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179837",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGFR",
"modification" : [],
"ref" : "Reactome:179837"
},
"id" : "Reactome:179837_Reactome:179847_Reactome:179845_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179847_Reactome:179845_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179837",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGFR",
"modification" : [],
"ref" : "Reactome:179837"
},
"id" : "Reactome:179837_Reactome:179847_Reactome:179845_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:C3",
"compartment" : "MAP:Cytosol",
"label" : "PI3K-p85",
"modification" : [],
"ref" : "MAP:C3"
},
"id" : "MAP:C3_MAP:Cx156_MAN:C10_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:C2",
"compartment" : "MAP:Cytosol",
"label" : "PI3K-p110",
"modification" : [],
"ref" : "MAP:C2"
},
"id" : "MAP:C2_MAP:Cx156_MAN:C10_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_MAN:C10_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_MAN:C10_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "MAP:UP31946_CY",
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY"
},
"id" : "MAP:UP31946_CY_Reactome:109793_Reactome:109795_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_Reactome:109793_Reactome:109795_1_1_1",
"MAP:Cb15996_CY_Reactome:109783_Reactome:109793_Reactome:109795_1_1_1"
]
},
"id" : "Reactome:109783_Reactome:109793_Reactome:109795_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109792",
"compartment" : "MAP:Plasmamembrane",
"label" : "cRaf",
"modification" : [
[
216,
"340"
],
[
216,
"621"
],
[
216,
"259"
],
[
216,
"341"
]
],
"ref" : "Reactome:109792"
},
"id" : "Reactome:109792_Reactome:109793_Reactome:109795_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ07889_CY",
"compartment" : "MAP:Cytosol",
"label" : "Son of sevenless protein homolog 1",
"modification" : [],
"ref" : "MAP:UQ07889_CY"
},
"id" : "MAP:UQ07889_CY_MAP:Cx114_Reactome:180331_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_MAP:Cx114_Reactome:180331_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:180276",
"compartment" : "MAP:Cytosol",
"label" : "Phospho-SHC transforming protein",
"modification" : [
[
216,
"349"
],
[
216,
"350"
]
],
"ref" : "Reactome:180276"
},
"id" : "Reactome:180276_Reactome:180337_Reactome:180331_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179882",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR (Y992, Y1068, Y1086, Y1148, Y1173) dimer",
"modification" : [],
"ref" : "Reactome:179882",
"subnodes" : [
"Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_1",
"Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_2"
]
},
"id" : "Reactome:179882_Reactome:180337_Reactome:180331_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179791_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179791_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:179791_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179791_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179791_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:179791_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_Reactome:179849_Reactome:179791_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UQ13480_CY",
"compartment" : "MAP:Cytosol",
"label" : "GAB1",
"modification" : [],
"ref" : "MAP:UQ13480_CY"
},
"id" : "MAP:UQ13480_CY_Reactome:179849_Reactome:179791_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP31946_CY",
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY"
},
"id" : "MAP:UP31946_CY_Reactome:109793_Reactome:112406_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_Reactome:109793_Reactome:112406_1_1_1",
"MAP:Cb15996_CY_Reactome:109783_Reactome:109793_Reactome:112406_1_1_1"
]
},
"id" : "Reactome:109783_Reactome:109793_Reactome:112406_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109792",
"compartment" : "MAP:Plasmamembrane",
"label" : "cRaf",
"modification" : [
[
216,
"340"
],
[
216,
"621"
],
[
216,
"259"
],
[
216,
"341"
]
],
"ref" : "Reactome:109792"
},
"id" : "Reactome:109792_Reactome:109793_Reactome:112406_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP31946_CY",
"compartment" : "MAP:Cytosol",
"label" : "YWHAB()",
"modification" : [],
"ref" : "MAP:UP31946_CY"
},
"id" : "MAP:UP31946_CY_Reactome:109793_Reactome:109794_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109783",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS:GTP",
"modification" : [],
"ref" : "Reactome:109783",
"subnodes" : [
"Reactome:109782_Reactome:109783_Reactome:109793_Reactome:109794_1_1_1",
"MAP:Cb15996_CY_Reactome:109783_Reactome:109793_Reactome:109794_1_1_1"
]
},
"id" : "Reactome:109783_Reactome:109793_Reactome:109794_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109792",
"compartment" : "MAP:Plasmamembrane",
"label" : "cRaf",
"modification" : [
[
216,
"340"
],
[
216,
"621"
],
[
216,
"259"
],
[
216,
"341"
]
],
"ref" : "Reactome:109792"
},
"id" : "Reactome:109792_Reactome:109793_Reactome:109794_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180337_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180337_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "MAP:UQ07889_CY",
"compartment" : "MAP:Cytosol",
"label" : "Son of sevenless protein homolog 1",
"modification" : [],
"ref" : "MAP:UQ07889_CY"
},
"id" : "MAP:UQ07889_CY_MAP:Cx114_Reactome:179820_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "MAP:UP62993_CY",
"compartment" : "MAP:Cytosol",
"label" : "GRB2()",
"modification" : [],
"ref" : "MAP:UP62993_CY"
},
"id" : "MAP:UP62993_CY_MAP:Cx114_Reactome:179820_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179820_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179820_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:179820_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179820_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179820_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:179820_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_Reactome:109788_Reactome:109789_1_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_Reactome:109788_Reactome:109789_1_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180301_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180301_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180301_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180301_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180348_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180348_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180348_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180348_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180286_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180286_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180286_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180286_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_Reactome:109793_Reactome:109795_1_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_Reactome:109793_Reactome:109795_1_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_1_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_1_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_1",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179860",
"compartment" : "MAP:Plasmamembrane",
"label" : "EGF:Phospho-EGFR",
"modification" : [],
"ref" : "Reactome:179860",
"subnodes" : [
"Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_2_1",
"Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_2_1"
]
},
"id" : "Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_2",
"is_abstract" : 1,
"sbo" : 253,
"type" : "Complex"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179791_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179791_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179791_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179791_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_Reactome:109793_Reactome:112406_1_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_Reactome:109793_Reactome:112406_1_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:109782",
"compartment" : "MAP:Plasmamembrane",
"label" : "p21 RAS",
"modification" : [],
"ref" : "Reactome:109782"
},
"id" : "Reactome:109782_Reactome:109783_Reactome:109793_Reactome:109794_1_1_1",
"is_abstract" : 1,
"sbo" : 240,
"type" : "Compound"
},
{
"data" : {
"clone_marker" : "MAP:Cb15996_CY",
"compartment" : "MAP:Cytosol",
"label" : "GTP",
"modification" : [],
"ref" : "MAP:Cb15996_CY"
},
"id" : "MAP:Cb15996_CY_Reactome:109783_Reactome:109793_Reactome:109794_1_1_1",
"is_abstract" : 1,
"sbo" : 247,
"type" : "SimpleCompound"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179820_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179820_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:179820_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:179820_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_1_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179863",
"compartment" : "MAP:Extracellular",
"label" : "EGF",
"modification" : [],
"ref" : "Reactome:179863"
},
"id" : "Reactome:179863_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"clone_marker" : "Reactome:179803",
"compartment" : "MAP:Plasmamembrane",
"label" : "Phospho-EGFR",
"modification" : [
[
216,
"1068"
],
[
216,
"1148"
],
[
216,
"1173"
],
[
216,
"1086"
],
[
216,
"992"
]
],
"ref" : "Reactome:179803"
},
"id" : "Reactome:179803_Reactome:179860_Reactome:179882_Reactome:180337_Reactome:180331_1_1_2_1",
"is_abstract" : 1,
"sbo" : 252,
"type" : "Protein"
},
{
"data" : {
"label" : "Extracellular",
"ref" : "MAP:Extracellular",
"subnodes" : [
"Reactome:179863"
]
},
"id" : "MAP:Extracellular",
"is_abstract" : 0,
"sbo" : 290,
"type" : "Compartment"
},
{
"data" : {
"label" : "Plasmamembrane",
"ref" : "MAP:Plasmamembrane",
"subnodes" : [
"Reactome:177934",
"MAP:C79",
"Reactome:179856",
"Reactome:109841",
"Reactome:179860",
"Reactome:177940",
"MAP:UP01116_",
"Reactome:109803",
"Reactome:109788",
"Reactome:177930",
"Reactome:180286",
"MAN:R1",
"MAN:C10",
"Reactome:180331",
"Reactome:177936",
"Reactome:112406",
"MAN:R28",
"Reactome:177922",
"Reactome:180337",
"Reactome:177943",
"Reactome:109792",
"MAP:UP01112_PM",
"Reactome:109789",
"Reactome:109796",
"Reactome:163338",
"Reactome:177938",
"Reactome:109793",
"Reactome:180301",
"Reactome:109802",
"Reactome:180348",
"Reactome:179837",
"Reactome:177945",
"Reactome:179845",
"Reactome:177933",
"Reactome:179847",
"MAN:R2",
"Reactome:179882",
"Reactome:197745",
"Reactome:109852",
"Reactome:177939",
"Reactome:109795",
"Reactome:109794",
"Reactome:109782",
"Reactome:179820",
"Reactome:179803",
"Reactome:179838",
"Reactome:177925",
"Reactome:109829",
"Reactome:109783",
"Reactome:177942"
]
},
"id" : "MAP:Plasmamembrane",
"is_abstract" : 0,
"sbo" : 290,
"type" : "Compartment"
},
{
"data" : {
"label" : "Nucleus",
"ref" : "MAP:Nucleus",
"subnodes" : [
"MAP:UP19419_NU(1-428)",
"Reactome:29358",
"Reactome:198666",
"MAP:UP19419_NU(1-428)_pho324pho336pho383pho389pho422",
"Reactome:112359",
"Reactome:198710",
"Reactome:109845",
"Reactome:113582"
]
},
"id" : "MAP:Nucleus",
"is_abstract" : 0,
"sbo" : 290,
"type" : "Compartment"
},
{
"data" : {
"label" : "Cytosol",
"ref" : "MAP:Cytosol",
"subnodes" : [
"MAP:Cx156",
"Reactome:109848",
"Reactome:109867",
"MAP:UP31946_CY",
"Reactome:180276",
"Reactome:180304",
"Reactome:109843",
"Reactome:179849",
"MAP:Cb17552_CY",
"Reactome:112374",
"MAP:UQ07889_CY",
"MAP:Cx114",
"Reactome:109804",
"Reactome:109787",
"Reactome:112340",
"MAP:UP29353_CY",
"MAP:UQ02750_CY",
"MAP:Cb16761_CY",
"Reactome:109860",
"Reactome:112398",
"MAP:UP62993_CY",
"MAP:Cb15996_CY",
"Reactome:109865",
"Reactome:180344",
"MAP:C3",
"MAP:UP04049_CY_pho259pho621",
"MAP:Cs56-65-5_CY",
"MAP:UP36507_CY",
"MAP:UP27361_CY_pho202pho204",
"MAP:UQ02750_CY_pho218pho222",
"MAP:UQ13480_CY",
"Reactome:112339",
"Reactome:109863",
"Reactome:109844",
"Reactome:109838",
"Reactome:179791",
"MAP:C2",
"MAP:UP27361_CY",
"Reactome:109857"
]
},
"id" : "MAP:Cytosol",
"is_abstract" : 0,
"sbo" : 290,
"type" : "Compartment"
}
]
}; | taye/adeyemitaye-biographer-interactjs | src/test/environment/resources/examples/complex_cp.js | JavaScript | lgpl-3.0 | 146,668 |
/**
* Copyright (C) 2005-2015 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
* @module alfresco/search/FacetFilter
* @extends external:dijit/_WidgetBase
* @mixes external:dojo/_TemplatedMixin
* @mixes module:alfresco/core/Core
* @mixes module:alfresco/documentlibrary/_AlfDocumentListTopicMixin
* @author Dave Draper
*/
define(["dojo/_base/declare",
"dijit/_WidgetBase",
"dijit/_TemplatedMixin",
"dijit/_OnDijitClickMixin",
"dojo/text!./templates/FacetFilter.html",
"alfresco/core/Core",
"dojo/_base/lang",
"dojo/_base/array",
"dojo/dom-construct",
"dojo/dom-class",
"dojo/on",
"alfresco/util/hashUtils",
"dojo/io-query",
"alfresco/core/ArrayUtils"],
function(declare, _WidgetBase, _TemplatedMixin, _OnDijitClickMixin, template, AlfCore, lang, array, domConstruct, domClass, on, hashUtils, ioQuery, arrayUtils) {
return declare([_WidgetBase, _TemplatedMixin, AlfCore], {
/**
* An array of the i18n files to use with this widget.
*
* @instance
* @type {object[]}
* @default [{i18nFile: "./i18n/FacetFilter.properties"}]
*/
i18nRequirements: [{i18nFile: "./i18n/FacetFilter.properties"}],
/**
* An array of the CSS files to use with this widget.
*
* @instance cssRequirements {Array}
* @type {object[]}
* @default [{cssFile:"./css/FacetFilter.css"}]
*/
cssRequirements: [{cssFile:"./css/FacetFilter.css"}],
/**
* The HTML template to use for the widget.
* @instance
* @type {string}
*/
templateString: template,
/**
* Indicate whether or not the filter is currently applied
*
* @instance
* @type {boolean}
* @default
*/
applied: false,
/**
* The alt-text to use for the image that indicates that a filter has been applied
*
* @instance
* @type {string}
* @default
*/
appliedFilterAltText: "facet.filter.applied.alt-text",
/**
* The path to use as the source for the image that indicates that a filter has been applied
*
* @instance
* @type {string}
* @default
*/
appliedFilterImageSrc: "12x12-selected-icon.png",
/**
* The facet qname
*
* @instance
* @type {string}
* @default
*/
facet: null,
/**
* The filter (or more accurately the filterId) for this filter
*
* @instance
* @type {string}
* @default
*/
filter: null,
/**
* Additional data for the filter (appended after the filter with a bar, e.g. tag|sometag)
*
* @instance
* @type {string}
* @default
*/
filterData: "",
/**
* Indicates that the filter should be hidden. This will be set to "true" if any required data is missing
*
* @instance
* @type {boolean}
* @default
*/
hide: false,
/**
* When this is set to true the current URL hash fragment will be used to initialise the facet selection
* and when the facet is selected the hash fragment will be updated with the facet selection.
*
* @instance
* @type {boolean}
* @default
*/
useHash: false,
/**
* Sets up the attributes required for the HTML template.
* @instance
*/
postMixInProperties: function alfresco_search_FacetFilter__postMixInProperties() {
if (this.label && this.facet && this.filter && this.hits)
{
this.label = this.message(this.label);
// Localize the alt-text for the applied filter message...
this.appliedFilterAltText = this.message(this.appliedFilterAltText, {0: this.label});
// Set the source for the image to use to indicate that a filter is applied...
this.appliedFilterImageSrc = require.toUrl("alfresco/search") + "/css/images/" + this.appliedFilterImageSrc;
}
else
{
// Hide the filter if there is no label or no link...
this.alfLog("warn", "Not enough information provided for filter. It will not be displayed", this);
this.hide = true;
}
},
/**
* @instance
*/
postCreate: function alfresco_search_FacetFilter__postCreate() {
if (this.hide === true)
{
domClass.add(this.domNode, "hidden");
}
if (this.applied)
{
domClass.remove(this.removeNode, "hidden");
domClass.add(this.labelNode, "applied");
}
},
/**
* If the filter has previously been applied then it is removed, if the filter is not applied
* then it is applied.
*
* @instance
*/
onToggleFilter: function alfresco_search_FacetFilter__onToggleFilter(/*jshint unused:false*/ evt) {
if (this.applied)
{
this.onClearFilter();
}
else
{
this.onApplyFilter();
}
},
/**
* Applies the current filter by publishing the details of the filter along with the facet to
* which it belongs and then displays the "applied" image.
*
* @instance
*/
onApplyFilter: function alfresco_search_FacetFilter__onApplyFilter() {
var fullFilter = this.facet + "|" + this.filter;
if(this.useHash)
{
this._updateHash(fullFilter, "add");
}
else
{
this.alfPublish("ALF_APPLY_FACET_FILTER", {
filter: fullFilter
});
}
domClass.remove(this.removeNode, "hidden");
domClass.add(this.labelNode, "applied");
this.applied = true;
},
/**
* Removes the current filter by publishing the details of the filter along with the facet
* to which it belongs and then hides the "applied" image
*
* @instance
*/
onClearFilter: function alfresco_search_FacetFilter__onClearFilter() {
var fullFilter = this.facet + "|" + this.filter;
if(this.useHash)
{
this._updateHash(fullFilter, "remove");
}
else
{
this.alfPublish("ALF_REMOVE_FACET_FILTER", {
filter: fullFilter
});
}
domClass.add(this.removeNode, "hidden");
domClass.remove(this.labelNode, "applied");
this.applied = false;
},
/**
* Performs updates to the url hash as facets are selected and de-selected
*
* @instance
*/
_updateHash: function alfresco_search_FacetFilter___updateHash(fullFilter, mode) {
// Get the existing hash and extract the individual facetFilters into an array
var aHash = hashUtils.getHash(),
facetFilters = ((aHash.facetFilters) ? aHash.facetFilters : ""),
facetFiltersArr = (facetFilters === "") ? [] : facetFilters.split(",");
// Add or remove the filter from the hash object
if(mode === "add" && !arrayUtils.arrayContains(facetFiltersArr, fullFilter))
{
facetFiltersArr.push(fullFilter);
}
else if (mode === "remove" && arrayUtils.arrayContains(facetFiltersArr, fullFilter))
{
facetFiltersArr.splice(facetFiltersArr.indexOf(fullFilter), 1);
}
// Put the manipulated filters back into the hash object or remove the property if empty
if(facetFiltersArr.length < 1)
{
delete aHash.facetFilters;
}
else
{
aHash.facetFilters = facetFiltersArr.join();
}
// Send the hash value back to navigation
this.alfPublish("ALF_NAVIGATE_TO_PAGE", {
url: ioQuery.objectToQuery(aHash),
type: "HASH"
}, true);
}
});
}); | nzheyuti/Aikau | aikau/src/main/resources/alfresco/search/FacetFilter.js | JavaScript | lgpl-3.0 | 8,856 |
<import resource="classpath:alfresco/site-webscripts/org/alfresco/callutils.js">
if (!json.isNull("wikipage"))
{
var wikipage = String(json.get("wikipage"));
model.pagecontent = getPageText(wikipage);
model.title = wikipage.replace(/_/g, " ");
}
else
{
model.pagecontent = "<h3>" + msg.get("message.nopage") + "</h3>";
model.title = "";
}
function getPageText(wikipage)
{
var c = sitedata.getComponent(url.templateArgs.componentId);
c.properties["wikipage"] = wikipage;
c.save();
var siteId = String(json.get("siteId"));
var uri = "/slingshot/wiki/page/" + siteId + "/" + encodeURIComponent(wikipage) + "?format=mediawiki";
var connector = remote.connect("alfresco");
var result = connector.get(uri);
if (result.status == status.STATUS_OK)
{
/**
* Always strip unsafe tags here.
* The config to option this is currently webscript-local elsewhere, so this is the safest option
* until the config can be moved to share-config scope in a future version.
*/
return stringUtils.stripUnsafeHTML(result.response);
}
else
{
return "";
}
} | loftuxab/community-edition-old | projects/slingshot/config/alfresco/site-webscripts/org/alfresco/modules/wiki/config-wiki.post.json.js | JavaScript | lgpl-3.0 | 1,134 |
var KevoreeEntity = require('./KevoreeEntity');
/**
* AbstractChannel entity
*
* @type {AbstractChannel} extends KevoreeEntity
*/
module.exports = KevoreeEntity.extend({
toString: 'AbstractChannel',
construct: function () {
this.remoteNodes = {};
this.inputs = {};
},
internalSend: function (portPath, msg) {
var remoteNodeNames = this.remoteNodes[portPath];
for (var remoteNodeName in remoteNodeNames) {
this.onSend(remoteNodeName, msg);
}
},
/**
*
* @param remoteNodeName
* @param msg
*/
onSend: function (remoteNodeName, msg) {
},
remoteCallback: function (msg) {
for (var name in this.inputs) {
this.inputs[name].getCallback().call(this, msg);
}
},
addInternalRemoteNodes: function (portPath, remoteNodes) {
this.remoteNodes[portPath] = remoteNodes;
},
addInternalInputPort: function (port) {
this.inputs[port.getName()] = port;
}
}); | barais/kevoree-js | library/kevoree-entities/lib/AbstractChannel.js | JavaScript | lgpl-3.0 | 938 |
js.Offset = function(rawptr) {
this.rawptr = rawptr;
}
js.Offset.prototype = new konoha.Object();
js.Offset.prototype._new = function(rawptr) {
this.rawptr = rawptr;
}
js.Offset.prototype.getTop = function() {
return this.rawptr.top;
}
js.Offset.prototype.getLeft = function() {
return this.rawptr.left;
}
js.jquery = {};
var initJQuery = function() {
var verifyArgs = function(args) {
for (var i = 0; i < args.length; i++) {
if (args[i].rawptr) {
args[i] = args[i].rawptr;
}
}
return args;
}
var jquery = function(rawptr) {
this.rawptr = rawptr;
}
jquery.prototype = new konoha.Object();
jquery.konohaclass = "js.jquery.JQuery";
/* Selectors */
jquery.prototype.each_ = function(callback) {
this.rawptr.each(callback.rawptr);
}
jquery.prototype.size = function() {
return this.rawptr.size();
}
jquery.prototype.getSelector = function() {
return new konoha.String(this.rawptr.getSelector());
}
jquery.prototype.getContext = function() {
return new js.dom.Node(this.rawptr.getContext());
}
jquery.prototype.getNodeList = function() {
return new js.dom.NodeList(this.rawptr.get());
}
jquery.prototype.getNode = function(index) {
return new js.dom.Node(this.rawptr.get(index));
}
/* Attributes */
jquery.prototype.getAttr = function(arg) {
return new konoha.String(this.rawptr.attr(arg.rawptr));
}
jquery.prototype.attr = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.attr.apply(this.rawptr, args));
}
jquery.prototype.removeAttr = function(name) {
return new jquery(this.rawptr.removeAttr(name.rawptr));
}
jquery.prototype.addClass = function(className) {
return new jquery(this.rawptr.addClass(className.rawptr));
}
jquery.prototype.removeClass = function(className) {
return new jquery(this.rawptr.removeClass(className.rawptr));
}
jquery.prototype.toggleClass = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.toggleClass.apply(this.rawptr, args));
}
jquery.prototype.getHTML = function() {
return new konoha.String(this.rawptr.html());
}
jquery.prototype.html = function(val) {
return new jquery(this.rawptr.html(val.rawptr));
}
jquery.prototype.getText = function() {
return new konoha.String(this.rawptr.text());
}
jquery.prototype.text = function(val) {
return new jquery(this.rawptr.text(val.rawptr));
}
jquery.prototype.getVal = function() {
return new konoha.Array(this.rawptr.val())
}
jquery.prototype.val = function(val) {
return new jquery(this.rawptr.val(val.rawptr));
}
/* Traversing */
jquery.prototype.eq = function(position) {
return new jquery(this.rawptr.eq(position));
}
jquery.prototype.filter = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.filter.apply(this.rawptr, args));
}
jquery.prototype.is = function(expr) {
return this.rawptr.is(expr.rawptr);
}
jquery.prototype.opnot = function(expr) {
return this.rawptr.not(expr.rawptr);
}
jquery.prototype.slice = function() {
return new jquery(this.rawptr.slice.apply(this.rawptr, Array.prototype.slice.call(arguments)));
}
jquery.prototype.add = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.add.apply(this.rawptr, args));
}
jquery.prototype.children = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.children.apply(this.rawptr, args));
}
jquery.prototype.closest = function() {
var args =verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.closest.apply(this.rawptr, args));
}
jquery.prototype.contents = function() {
return new jquery(this.rawptr.contents());
}
jquery.prototype.find = function(expr) {
return new jquery(this.rawptr.find(expr.rawptr));
}
jquery.prototype.next = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.next.apply(this.rawptr, args));
}
jquery.prototype.nextAll = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.nextAll.apply(this.rawptr, args));
}
jquery.prototype.parent = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.parent.apply(this.rawptr, args));
}
jquery.prototype.parents = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.parents.apply(this.rawptr, args));
}
jquery.prototype.prev = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.prev.apply(this.rawptr, args));
}
jquery.prototype.prevAll = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.prevAll.apply(this.rawptr, args));
}
jquery.prototype.siblings = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.siblings.apply(this.rawptr, args));
}
jquery.prototype.andSelf = function() {
return new jquery(this.rawptr.andSelf());
}
jquery.prototype.end = function() {
return new jquery(this.rawptr.end());
}
/* Manipulation */
jquery.prototype.append = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.append.apply(this.rawptr, args));
}
jquery.prototype.appendTo = function(content) {
return new jquery(this.rawptr.appendTo(content.rawptr));
}
jquery.prototype.prepend = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.prepend.apply(this.rawptr, args));
}
jquery.prototype.prependTo = function(content) {
return new jquery(this.rawptr.prependTo(content.rawptr));
}
jquery.prototype.after = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.after.apply(this.rawptr, args));
}
jquery.prototype.before = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.before.apply(this.rawptr, args));
}
jquery.prototype.insertAfter = function(content) {
return new jquery(this.rawptr.insertAfter(content.rawptr));
}
jquery.prototype.insertBefore = function(content) {
return new jquery(this.rawptr.insertBefore(content.rawptr));
}
jquery.prototype.wrap = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.wrap.apply(this.rawptr, args));
}
jquery.prototype.wrapAll = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.wrapAll.apply(this.rawptr, args));
}
jquery.prototype.wrapInner = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.wrapInner.apply(this.rawptr, args));
}
jquery.prototype.replaceWith = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.replaceWith.apply(this.rawptr, args));
}
jquery.prototype.replaceAll = function(selector) {
return new jquery(this.rawptr.replaceAll(selector.rawptr));
}
jquery.prototype.empty = function() {
return new jquery(this.rawptr.empty());
}
jquery.prototype.remove = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.remove.apply(this.rawptr, args));
}
jquery.prototype.clone = function() {
return new jquery(this.rawptr.clone.apply(this.rawptr, Array.prototype.slice.call(arguments)));
}
/* CSS */
jquery.prototype.getCss = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new konoha.String(this.rawptr.css.apply(this.rawptr, args));
}
jquery.prototype.css = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.css.apply(this.rawptr, args));
}
jquery.prototype.offset = function() {
return new js.Offset(this.rawptr.offset());
}
jquery.prototype.position = function() {
return new js.Offset(this.rawptr.position());
}
jquery.prototype.scrollTop = function() {
return this.rawptr.scrollTop.apply(this.rawptr, Array.prototype.slice.call(arguments));
}
jquery.prototype.scrollLeft = function() {
return this.rawptr.scrollLeft.apply(this.rawptr, Array.prototype.slice.call(arguments));
}
jquery.prototype.height = function() {
return this.rawptr.height.apply(this.rawptr, Array.prototype.slice.call(arguments));
}
jquery.prototype.width = function() {
return this.rawptr.width.apply(this.rawptr, Array.prototype.slice.call(arguments));
}
jquery.prototype.innerHeight = function() {
return this.rawptr.innerHeight();
}
jquery.prototype.innerWidth = function() {
return this.rawptr.innerWidth();
}
jquery.prototype.outerHeight = function() {
return this.rawptr.outerHeight();
}
jquery.prototype.outerWidth = function() {
return this.rawptr.outerWidth();
}
/* Events */
jquery.prototype.ready = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.ready.apply(this.rawptr, args));
}
jquery.prototype.bind = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.bind.apply(this.rawptr, args));
}
jquery.prototype.one = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.one.apply(this.rawptr, args));
}
jquery.prototype.trigger = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.trigger.apply(this.rawptr, args));
}
jquery.prototype.triggerHandler = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.triggerHandler.apply(this.rawptr, args));
}
jquery.prototype.unbind = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.unbind.apply(this.rawptr, args));
}
jquery.prototype.hover = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.hover.apply(this.rawptr, args));
}
jquery.prototype.toggleEvent = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
args = verifyArgs(args[0]);
return new jquery(this.rawptr.toggle.apply(this.rawptr, args));
}
jquery.prototype.live = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.live.apply(this.rawptr, args));
}
jquery.prototype.die = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.die.apply(this.rawptr, args));
}
jquery.prototype.blur = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.blur.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.blur(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.change = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.change.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.change(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.click = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.click.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.click(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.dblclick = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.dblclick.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.dblclick(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.error = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.error.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.error(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.focus = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.focus.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.focus(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.keydown = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.keydown.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.keydown(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.keypress = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.keypress.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.keypress(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.keyup = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.keyup.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.keyup(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.load = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.load.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.load(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.mousedown = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.mousedown.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.mousedown(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.mousemove = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.mousemove.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.mousemove(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.mouseout = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.mouseout.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.mouseout(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.mouseover = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.mouseover.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.mouseover(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.mouseup = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.mouseup.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.mouseup(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.resize = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.resize.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.resize(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.scroll = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.scroll.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.scroll(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.select = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.select.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.select(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.submit = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.submit.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.select(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
jquery.prototype.unload = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (args.length == 0) {
return new jquery(this.rawptr.unload.apply(this.rawptr, args));
} else {
return new jquery(this.rawptr.unload(function(e) {
args[0].apply(new js.dom.Element(this), [new js.jquery.JEvent(e)]);
}));
}
}
/* Effects */
jquery.prototype.show = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.show.apply(this.rawptr, args));
}
jquery.prototype.hide = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.hide.apply(this.rawptr, args));
}
jquery.prototype.toggle = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.toggle.apply(this.rawptr, args));
}
jquery.prototype.slideDown = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.slideDown.apply(this.rawptr, args));
}
jquery.prototype.slideUp = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.slideUp.apply(this.rawptr, args));
}
jquery.prototype.slideToggle = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.slideToggle.apply(this.rawptr, args));
}
jquery.prototype.fadeIn = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.fadeIn.apply(this.rawptr, args));
}
jquery.prototype.fadeOut = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.fadeOut.apply(this.rawptr, args));
}
jquery.prototype.fadeTo = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
return new jquery(this.rawptr.fadeTo.apply(this.rawptr, args));
}
jquery.prototype._new = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (arguments.length == 1) {
this.rawptr = new $(args[0]);
} else if (arguments.length == 2) {
this.rawptr = new $(args[0], args[1]);
} else {
throw ("Script !!");
}
return this;
}
return jquery;
}
js.jquery.JQuery = new initJQuery();
js.jquery.JEvent = new function() {
var jevent = function(rawptr) {
this.rawptr = rawptr;
}
jevent.prototype = new konoha.Object();
jevent.konohaclass = "js.jquery.JEvent";
jevent.prototype.type = function() {
return new konoha.String(this.rawptr.type);
}
jevent.prototype.target = function() {
return new konoha.dom.Element(this.rawptr.target);
}
jevent.prototype.relatedTarget = function() {
return new konoha.dom.Element(this.rawptr.relatedTarget);
}
jevent.prototype.currentTarget = function() {
return new konoha.dom.Element(this.rawptr.currentTarget);
}
jevent.prototype.pageX = function() {
return this.rawptr.pageX;
}
jevent.prototype.pageY = function() {
return this.rawptr.pageY;
}
jevent.prototype.timeStamp = function() {
return this.rawptr.timeStamp;
}
jevent.prototype.preventDefault = function() {
return new jevent(this.rawptr.preventDefault());
}
jevent.prototype.isDefaultPrevented = function() {
return this.rawptr.isDefaultPrevented();
}
jevent.prototype.stopPropagation = function() {
return new jevent(this.rawptr.stopPropagation());
}
jevent.prototype.isPropagationStopped = function() {
return this.rawptr.isPropagationStopped();
}
jevent.prototype.stopImmediatePropagation = function() {
return new jevent(this.rawptr.stopImmediatePropagation());
}
jevent.prototype.isImmediatePropagationStopped = function() {
return this.rawptr.isImmediatePropagationStopped();
}
jevent.prototype._new = function() {
var args = verifyArgs(Array.prototype.slice.call(arguments));
if (arguments.length == 1) {
this.rawptr = new $(args[0]);
} else if (arguments.length == 2) {
this.rawptr = new $(args[0], args[1]);
} else {
throw ("Script !!");
}
return this;
}
return jevent;
}();
| imasahiro/konohascript | package/konoha.compiler.js/runtime/js.jquery.js | JavaScript | lgpl-3.0 | 24,892 |
'use strict';
const chai = require('chai');
const assert = chai.assert;
const sinon = require('sinon');
const responseError = require('../../../server/utils/errors/responseError');
describe('responseError', () => {
let spyCall;
const res = {};
let error = 'An error message';
beforeEach(() => {
res.status = sinon.stub().returns(res);
res.json = sinon.stub();
responseError(error, res);
});
it('Calls response method with default(500) error code', () => {
spyCall = res.status.getCall(0);
assert.isTrue(res.status.calledOnce);
assert.isTrue(spyCall.calledWithExactly(500));
});
it('Returns error wrapped in json response', () => {
spyCall = res.json.getCall(0);
assert.isTrue(res.json.calledOnce);
assert.isObject(spyCall.args[0]);
assert.property(spyCall.args[0], 'response', 'status');
});
it('Calls response method with custom error code', () => {
error = {
description: 'Bad request',
status_code: 400,
};
responseError(error, res);
spyCall = res.status.getCall(0);
assert.isTrue(res.status.called);
assert.isTrue(res.status.calledWithExactly(400));
});
});
| kn9ts/project-mulla | test/utils/errors/reponseError.js | JavaScript | lgpl-3.0 | 1,168 |
/*!
* angular-datatables - v0.4.1
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
!function(a,b,c,d){"use strict";function e(a,b){function c(a){function c(a,c){function e(a){var c="T";return h.dom=h.dom?h.dom:b.dom,-1===h.dom.indexOf(c)&&(h.dom=c+h.dom),h.hasTableTools=!0,d.isString(a)&&h.withTableToolsOption("sSwfPath",a),h}function f(a,b){return d.isString(a)&&(h.oTableTools=h.oTableTools&&null!==h.oTableTools?h.oTableTools:{},h.oTableTools[a]=b),h}function g(a){return d.isArray(a)&&h.withTableToolsOption("aButtons",a),h}var h=a(c);return h.withTableTools=e,h.withTableToolsOption=f,h.withTableToolsButtons=g,h}var e=a.newOptions,f=a.fromSource,g=a.fromFnPromise;return a.newOptions=function(){return c(e)},a.fromSource=function(a){return c(f,a)},a.fromFnPromise=function(a){return c(g,a)},a}a.decorator("DTOptionsBuilder",c),c.$inject=["$delegate"]}d.module("datatables.tabletools",["datatables"]).config(e),e.$inject=["$provide","DT_DEFAULT_OPTIONS"]}(window,document,jQuery,angular); | Shohiek/weblims | assets/bower_components/angular-datatables/dist/plugins/tabletools/angular-datatables.tabletools.min.js | JavaScript | lgpl-3.0 | 1,014 |
/**
The GPL License (GPL)
Copyright (c) 2012 Andreas Herz
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details. You should
have received a copy of the GNU General Public License along with this program; if
not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
MA 02111-1307 USA
**/
/**
* @class graphiti.Connection
* A Connection is the line between two {@link graphiti.Port}s.
*
* @inheritable
* @author Andreas Herz
* @extends graphiti.shape.basic.Line
*/
graphiti.Connection = graphiti.shape.basic.PolyLine.extend({
NAME : "graphiti.Connection",
DEFAULT_ROUTER: new graphiti.layout.connection.DirectRouter(),
//DEFAULT_ROUTER: new graphiti.layout.connection.ManhattanConnectionRouter(),
//DEFAULT_ROUTER: new graphiti.layout.connection.BezierConnectionRouter(),
//DEFAULT_ROUTER: new graphiti.layout.connection.ConnectionRouter(),
/**
* @constructor
* Creates a new figure element which are not assigned to any canvas.
*/
init: function() {
this._super();
this.sourcePort = null;
this.targetPort = null;
this.oldPoint=null;
this.sourceDecorator = null; /*:graphiti.ConnectionDecorator*/
this.targetDecorator = null; /*:graphiti.ConnectionDecorator*/
// decoration of the polyline
//
this.startDecoSet = null;
this.endDecoSet=null;
this.regulated = false;
this.draggable = false;
this.selectable = false;
//this.Activator = new g.Buttons.Activate();
//this.Repressor = new g.Buttons.Inhibit();
//this.remove = new g.Buttons.Remove();
//this.addFigure(this.remove, new graphiti.layout.locator.ConnectionLocator());
this.sourceAnchor = new graphiti.ConnectionAnchor(this);
this.targetAnchor = new graphiti.ConnectionAnchor(this);
this.router = this.DEFAULT_ROUTER;
this.setColor("#4cbf2f");
this.setStroke(3);
},
/**
* @private
**/
disconnect : function()
{
if (this.sourcePort !== null) {
this.sourcePort.detachMoveListener(this);
this.fireSourcePortRouteEvent();
}
if (this.targetPort !== null) {
this.targetPort.detachMoveListener(this);
this.fireTargetPortRouteEvent();
}
},
/**
* @private
**/
reconnect : function()
{
if (this.sourcePort !== null) {
this.sourcePort.attachMoveListener(this);
this.fireSourcePortRouteEvent();
}
if (this.targetPort !== null) {
this.targetPort.attachMoveListener(this);
this.fireTargetPortRouteEvent();
}
this.routingRequired =true;
this.repaint();
},
/**
* You can't drag&drop the resize handles of a connector.
* @type boolean
**/
isResizeable : function()
{
return this.isDraggable();
},
/**
* @method
* Add a child figure to the Connection. The hands over figure doesn't support drag&drop
* operations. It's only a decorator for the connection.<br>
* Mainly for labels or other fancy decorations :-)
*
* @param {graphiti.Figure} figure the figure to add as decoration to the connection.
* @param {graphiti.layout.locator.ConnectionLocator} locator the locator for the child.
**/
addFigure : function(child, locator)
{
// just to ensure the right interface for the locator.
// The base class needs only 'graphiti.layout.locator.Locator'.
if(!(locator instanceof graphiti.layout.locator.ConnectionLocator)){
throw "Locator must implement the class graphiti.layout.locator.ConnectionLocator";
}
this._super(child, locator);
},
/**
* @method
* Set the ConnectionDecorator for this object.
*
* @param {graphiti.decoration.connection.Decorator} the new source decorator for the connection
**/
setSourceDecorator:function( decorator)
{
this.sourceDecorator = decorator;
this.routingRequired = true;
this.repaint();
},
/**
* @method
* Get the current source ConnectionDecorator for this object.
*
* @type graphiti.ConnectionDecorator
**/
getSourceDecorator:function()
{
return this.sourceDecorator;
},
/**
* @method
* Set the ConnectionDecorator for this object.
*
* @param {graphiti.decoration.connection.Decorator} the new target decorator for the connection
**/
setTargetDecorator:function( decorator)
{
this.targetDecorator = decorator;
this.routingRequired =true;
this.repaint();
},
/**
* @method
* Get the current target ConnectionDecorator for this object.
*
* @type graphiti.ConnectionDecorator
**/
getTargetDecorator:function()
{
return this.targetDecorator;
},
/**
* @method
* Set the ConnectionAnchor for this object. An anchor is responsible for the endpoint calculation
* of an connection.
*
* @param {graphiti.ConnectionAnchor} the new source anchor for the connection
**/
setSourceAnchor:function(/*:graphiti.ConnectionAnchor*/ anchor)
{
this.sourceAnchor = anchor;
this.sourceAnchor.setOwner(this.sourcePort);
this.routingRequired =true;
this.repaint();
},
/**
* @method
* Set the ConnectionAnchor for this object.
*
* @param {graphiti.ConnectionAnchor} the new target anchor for the connection
**/
setTargetAnchor:function(/*:graphiti.ConnectionAnchor*/ anchor)
{
this.targetAnchor = anchor;
this.targetAnchor.setOwner(this.targetPort);
this.routingRequired =true;
this.repaint();
},
/**
* @method
* Set the ConnectionRouter.
*
**/
setRouter:function(/*:graphiti.ConnectionRouter*/ router)
{
if(router !==null){
this.router = router;
}
else{
this.router = new graphiti.layout.connection.NullRouter();
}
this.routingRequired =true;
// repaint the connection with the new router
this.repaint();
},
/**
* @method
* Return the current active router of this connection.
*
* @type graphiti.ConnectionRouter
**/
getRouter:function()
{
return this.router;
},
/**
* @method
* Calculate the path of the polyline
*
* @private
*/
calculatePath: function(){
if(this.sourcePort===null || this.targetPort===null){
return;
}
this._super();
},
/**
* @private
**/
repaint:function(attributes)
{
if(this.repaintBlocked===true || this.shape===null){
return;
}
if(this.sourcePort===null || this.targetPort===null){
return;
}
this._super(attributes);
// paint the decorator if any exists
//
if(this.getSource().getParent().isMoving===false && this.getTarget().getParent().isMoving===false )
{
if(this.targetDecorator!==null && this.endDecoSet===null){
this.endDecoSet= this.targetDecorator.paint(this.getCanvas().paper);
}
if(this.sourceDecorator!==null && this.startDecoSet===null){
this.startDecoSet= this.sourceDecorator.paint(this.getCanvas().paper);
}
}
// translate/transform the decorations to the end/start of the connection
// and rotate them as well
//
if(this.startDecoSet!==null){
this.startDecoSet.transform("r"+this.getStartAngle()+"," + this.getStartX() + "," + this.getStartY()+" t" + this.getStartX() + "," + this.getStartY());
}
if(this.endDecoSet!==null){
this.endDecoSet.transform("r"+this.getEndAngle()+"," + this.getEndX() + "," + this.getEndY()+" t" + this.getEndX() + "," + this.getEndY());
}
},
postProcess: function(postPorcessCache){
this.router.postProcess(this, this.getCanvas(), postPorcessCache);
},
/**
* @method
* Called by the framework during drag&drop operations.
*
* @param {graphiti.Figure} draggedFigure The figure which is currently dragging
*
* @return {Boolean} true if this port accepts the dragging port for a drop operation
* @template
**/
onDragEnter : function( draggedFigure )
{
this.setGlow(true);
return true;
},
/**
* @method
* Called if the DragDrop object leaving the current hover figure.
*
* @param {graphiti.Figure} draggedFigure The figure which is currently dragging
* @template
**/
onDragLeave:function( draggedFigure )
{
this.setGlow(false);
},
/**
* Return the recalculated position of the start point if we have set an anchor.
*
* @return graphiti.geo.Point
**/
getStartPoint:function()
{
if(this.isMoving===false){
return this.sourceAnchor.getLocation(this.targetAnchor.getReferencePoint());
}
else{
return this._super();
}
},
/**
* Return the recalculated position of the start point if we have set an anchor.
*
* @return graphiti.geo.Point
**/
getEndPoint:function()
{
if(this.isMoving===false){
return this.targetAnchor.getLocation(this.sourceAnchor.getReferencePoint());
}
else{
return this._super();
}
},
/**
* @method
* Set the new source port of this connection. This enforce a repaint of the connection.
*
* @param {graphiti.Port} port The new source port of this connection.
*
**/
setSource:function( port)
{
if(this.sourcePort!==null){
this.sourcePort.detachMoveListener(this);
}
this.sourcePort = port;
if(this.sourcePort===null){
return;
}
this.routingRequired = true;
this.sourceAnchor.setOwner(this.sourcePort);
this.fireSourcePortRouteEvent();
this.sourcePort.attachMoveListener(this);
this.setStartPoint(port.getAbsoluteX(), port.getAbsoluteY());
},
/**
* @method
* Returns the source port of this connection.
*
* @type graphiti.Port
**/
getSource:function()
{
return this.sourcePort;
},
/**
* @method
* Set the target port of this connection. This enforce a repaint of the connection.
*
* @param {graphiti.Port} port The new target port of this connection
**/
setTarget:function( port)
{
if(this.targetPort!==null){
this.targetPort.detachMoveListener(this);
}
this.targetPort = port;
if(this.targetPort===null){
return;
}
this.routingRequired = true;
this.targetAnchor.setOwner(this.targetPort);
this.fireTargetPortRouteEvent();
this.targetPort.attachMoveListener(this);
this.setEndPoint(port.getAbsoluteX(), port.getAbsoluteY());
},
/**
* @method
* Returns the target port of this connection.
*
* @type graphiti.Port
**/
getTarget:function()
{
return this.targetPort;
},
/**
*
**/
onOtherFigureIsMoving:function(/*:graphiti.Figure*/ figure)
{
if(figure===this.sourcePort){
this.setStartPoint(this.sourcePort.getAbsoluteX(), this.sourcePort.getAbsoluteY());
}
else{
this.setEndPoint(this.targetPort.getAbsoluteX(), this.targetPort.getAbsoluteY());
}
this._super(figure);
},
/**
* Returns the angle of the connection at the output port (source)
*
**/
getStartAngle:function()
{
// return a good default value if the connection is not routed at the
// moment
if( this.lineSegments.getSize()===0){
return 0;
}
var p1 = this.lineSegments.get(0).start;
var p2 = this.lineSegments.get(0).end;
// if(this.router instanceof graphiti.layout.connection.BezierConnectionRouter)
// {
// p2 = this.lineSegments.get(5).end;
// }
var length = Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
var angle = -(180/Math.PI) *Math.asin((p1.y-p2.y)/length);
if(angle<0)
{
if(p2.x<p1.x){
angle = Math.abs(angle) + 180;
}
else{
angle = 360- Math.abs(angle);
}
}
else
{
if(p2.x<p1.x){
angle = 180-angle;
}
}
return angle;
},
getEndAngle:function()
{
// return a good default value if the connection is not routed at the
// moment
if (this.lineSegments.getSize() === 0) {
return 90;
}
var p1 = this.lineSegments.get(this.lineSegments.getSize()-1).end;
var p2 = this.lineSegments.get(this.lineSegments.getSize()-1).start;
// if(this.router instanceof graphiti.layout.connection.BezierConnectionRouter)
// {
// p2 = this.lineSegments.get(this.lineSegments.getSize()-5).end;
// }
var length = Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
var angle = -(180/Math.PI) *Math.asin((p1.y-p2.y)/length);
if(angle<0)
{
if(p2.x<p1.x){
angle = Math.abs(angle) + 180;
}
else{
angle = 360- Math.abs(angle);
}
}
else
{
if(p2.x<p1.x){
angle = 180-angle;
}
}
return angle;
},
/**
* @private
**/
fireSourcePortRouteEvent:function()
{
// enforce a repaint of all connections which are related to this port
// this is required for a "FanConnectionRouter" or "ShortesPathConnectionRouter"
//
var connections = this.sourcePort.getConnections();
for(var i=0; i<connections.getSize();i++)
{
connections.get(i).repaint();
}
},
/**
* @private
**/
fireTargetPortRouteEvent:function()
{
// enforce a repaint of all connections which are related to this port
// this is required for a "FanConnectionRouter" or "ShortesPathConnectionRouter"
//
var connections = this.targetPort.getConnections();
for(var i=0; i<connections.getSize();i++)
{
connections.get(i).repaint();
}
},
/**
* @method
* Returns the Command to perform the specified Request or null.
*
* @param {graphiti.command.CommandType} request describes the Command being requested
* @return {graphiti.command.Command} null or a Command
**/
createCommand:function( request)
{
if(request.getPolicy() === graphiti.command.CommandType.MOVE_BASEPOINT)
{
// DragDrop of a connection doesn't create a undo command at this point. This will be done in
// the onDrop method
return new graphiti.command.CommandReconnect(this);
}
return this._super(request);
},
/**
* @method
* Return an objects with all important attributes for XML or JSON serialization
*
* @returns {Object}
*/
getPersistentAttributes : function()
{
var memento = this._super();
delete memento.x;
delete memento.y;
delete memento.width;
delete memento.height;
memento.source = {
node:this.getSource().getParent().getId(),
port: this.getSource().getName()
};
memento.target = {
node:this.getTarget().getParent().getId(),
port:this.getTarget().getName()
};
return memento;
},
/**
* @method
* Read all attributes from the serialized properties and transfer them into the shape.
*
* @param {Object} memento
* @returns
*/
setPersistentAttributes : function(memento)
{
this._super(memento);
// no extra param to read.
// Reason: done by the Layoute/Router
},
onClick: function() {
// wait to be implemented
/*$("#right-container").css({right: '0px'});
var hasClassIn = $("#collapseTwo").hasClass('in');
if(!hasClassIn) {
$("#collapseOne").toggleClass('in');
$("#collapseOne").css({height: '0'});
$("#collapseTwo").toggleClass('in');
$("#collapseTwo").css({height: "auto"});
}
$("#exogenous-factors-config").css({"display": "none"});
$("#protein-config").css({"display": "none"});
$("#component-config").css({"display": "none"});
$("#arrow-config").css({"display": "block"});*/
/*if (this.TYPE == "Activator") {
this.TYPE = "Inhibit";
this.setColor(new graphiti.util.Color("#43B967"));
} else {
this.TYPE = "Activator";
this.setColor(new graphiti.util.Color("#E14545"));
}*/
},
/*onDoubleClick: function() {
this.getCanvas().removeFigure(this);
}*/
});
| igemsoftware/SYSU-Software_2014 | server/static/js/graphiti/Connection.js | JavaScript | lgpl-3.0 | 16,767 |
<import resource="classpath:alfresco/site-webscripts/org/alfresco/components/workflow/workflow.lib.js">
var workflowDefinitions = getWorkflowDefinitions(),
filters = [];
if (workflowDefinitions)
{
for (var i = 0, il = workflowDefinitions.length; i < il; i++)
{
filters.push(
{
id: "workflowType",
data: workflowDefinitions[i].name,
label: workflowDefinitions[i].title
});
}
}
model.filters = filters;
| loftuxab/community-edition-old | projects/slingshot/config/alfresco/site-webscripts/org/alfresco/components/workflow/filter/workflow-type.get.js | JavaScript | lgpl-3.0 | 458 |
/********************************************************************
Export
*********************************************************************/
/** @private */
vs.util.extend (exports, {
Animation: Animation,
Trajectory: Trajectory,
Vector1D: Vector1D,
Vector2D: Vector2D,
Circular2D: Circular2D,
Pace: Pace,
Chronometer: Chronometer,
generateCubicBezierFunction: generateCubicBezierFunction,
createTransition: createTransition,
freeTransition: freeTransition,
animateTransitionBis: animateTransitionBis,
attachTransition: attachTransition,
removeTransition: removeTransition
});
| vinisketch/VSToolkit | src/ext/fx/Exports.js | JavaScript | lgpl-3.0 | 840 |
'use strict';
var app = angular.module('App', ['App.controller']);
| mirzadelic/django-social-example | django_social_example/django_app/public/js/app/app.js | JavaScript | unlicense | 68 |
var Theme = (function() {
var Theme = function() {
};
return Theme;
})();
module.exports = Theme;
| frostney/dropoff | lib/theme/index.js | JavaScript | unlicense | 119 |
const fs = require('fs');
const electron = require('electron');
const cl = require('node-opencl');
const RUN_GAMELOOP_SYNC = true;
const GAMETICK_CL = true;
const INIT_OPENGL = false;
let canvas; // canvas dom element
let gl; // opengl context
let clCtx; // opencl context
let glProgram; // opengl shader program
let clProgram; // opencl program
let clBuildDevice;
let clQueue;
// let clKernelMove;
let clKernelGol;
let clBufferAlive;
let clBufferImageData;
let
inputIndex = 0,
outputIndex = 1;
let locPosition; // location of position variable in frag shader
let locTexCoord; // location of texture coords variable in frag shader
let locSampler; // location of sampler in frag shader
let vertexCoordBuffer; // buffer for vertext coordinates
let texCoordBuffer; // buffer for texture coordinate
let texture; // texture
let imageData; // uint8array for texture data
let textureWidth = 1600;
let textureHeight = 900;
let gridWidth = 1600;
let gridHeight = 900;
const bytesPerPixel = 4; // bytes per pixel in imageData: R,G,B,A
const pixelTotal = textureWidth * textureHeight;
const bytesTotal = pixelTotal * bytesPerPixel;
const cellsTotal = gridWidth * gridHeight;
let cellNeighbors;
const cellAlive = [];
const frameTimes = [];
let frameTimesIndex = 0;
let lastRenderTime;
let fps = 0;
let fpsDisplay;
const FRAMETIMES_TO_KEEP = 10;
function init() {
(async () => {
initDom();
initDrawData();
if (INIT_OPENGL) {
initOpenGL();
}
initData();
await initOpenCL();
initGame();
initEvents();
startGameLoop();
render();
})();
}
function initDom() {
canvas = document.getElementById('glscreen');
fpsDisplay = document.getElementById('fps');
}
function initDrawData() {
imageData = new Uint8Array(bytesTotal);
}
function initOpenGL() {
gl = canvas.getContext('experimental-webgl');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight);
// init vertex buffer
vertexCoordBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexCoordBuffer);
gl.bufferData(
gl.ARRAY_BUFFER,
new Float32Array([
-1.0, -1.0,
1.0, -1.0,
-1.0, 1.0,
-1.0, 1.0,
1.0, -1.0,
1.0, 1.0]),
gl.STATIC_DRAW
);
// ------ SHADER SETUP
const vertexShader = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vertexShader, fs.readFileSync(__dirname + '/shader-vertex.glsl', 'utf-8'));
gl.compileShader(vertexShader);
console.log('vertexShaderLog', gl.getShaderInfoLog(vertexShader));
const fragmentShader = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fragmentShader, fs.readFileSync(__dirname + '/shader-fragment.glsl', 'utf-8'));
gl.compileShader(fragmentShader);
console.log('fragmentShaderLog', gl.getShaderInfoLog(fragmentShader));
glProgram = gl.createProgram();
gl.attachShader(glProgram, vertexShader);
gl.attachShader(glProgram, fragmentShader);
gl.linkProgram(glProgram);
console.log('glProgramLog', gl.getProgramInfoLog(glProgram));
gl.useProgram(glProgram);
// ---
locPosition = gl.getAttribLocation(glProgram, 'a_position');
gl.enableVertexAttribArray(locPosition);
// provide texture coordinates for the rectangle.
locTexCoord = gl.getAttribLocation(glProgram, 'a_texCoord');
gl.enableVertexAttribArray(locTexCoord);
// ------ TEXTURE SETUP
texCoordBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
0.0, 0.0,
1.0, 0.0,
0.0, 1.0,
0.0, 1.0,
1.0, 0.0,
1.0, 1.0]), gl.STATIC_DRAW);
// init texture to be all solid
for (let i = 0; i < pixelTotal; i++) {
const offset = i * bytesPerPixel;
imageData[offset + 3] = 255;
}
texture = gl.createTexture();
locSampler = gl.getUniformLocation(glProgram, 'u_sampler');
}
function initData() {
cellNeighbors = new Uint32Array(cellsTotal * 8);
cellAlive[0] = new Uint8Array(cellsTotal);
cellAlive[1] = new Uint8Array(cellsTotal);
// GOL: Cells
let index = 0, indexNeighbors = 0;
const maxX = gridWidth - 1;
const maxY = gridHeight - 1;
for (let y = 0; y < gridHeight; y++) {
const
prevRow = (y - 1) * gridWidth,
thisRow = prevRow + gridWidth,
nextRow = thisRow + gridWidth;
for (let x = 0; x < gridWidth; x++) {
cellNeighbors[indexNeighbors++] = (prevRow + x - 1 + cellsTotal) % cellsTotal;
cellNeighbors[indexNeighbors++] = (prevRow + x + cellsTotal) % cellsTotal;
cellNeighbors[indexNeighbors++] = (prevRow + x + 1 + cellsTotal) % cellsTotal;
cellNeighbors[indexNeighbors++] = (thisRow + x - 1 + cellsTotal) % cellsTotal;
cellNeighbors[indexNeighbors++] = (thisRow + x + 1) % cellsTotal;
cellNeighbors[indexNeighbors++] = (nextRow + x - 1) % cellsTotal;
cellNeighbors[indexNeighbors++] = (nextRow + x) % cellsTotal;
cellNeighbors[indexNeighbors++] = (nextRow + x + 1) % cellsTotal;
cellAlive[0][index++] = (Math.random() > 0.85) + 0;
}
}
}
async function initOpenCL() {
// --- Init opencl
// Best case we'd init a shared opengl/opencl context here, but node-opencl doesn't currently support that
const platforms = cl.getPlatformIDs();
for(let i = 0; i < platforms.length; i++)
console.info(`Platform ${i}: ${cl.getPlatformInfo(platforms[i], cl.PLATFORM_NAME)}`);
const platform = platforms[0];
const devices = cl.getDeviceIDs(platform, cl.DEVICE_TYPE_ALL);
for(let i = 0; i < devices.length; i++)
console.info(` Devices ${i}: ${cl.getDeviceInfo(devices[i], cl.DEVICE_NAME)}`);
console.info('creating context');
clCtx = cl.createContext([cl.CONTEXT_PLATFORM, platform], devices);
// prepare opencl program
// const clProgramSource = fs.readFileSync(__dirname + '/program.opencl', 'utf-8');
// GOL
const clProgramSource = fs.readFileSync(__dirname + '/gol.opencl', 'utf-8');
clProgram = cl.createProgramWithSource(clCtx, clProgramSource);
cl.buildProgram(clProgram);
// create kernels
// build kernel for first device
clBuildDevice = cl.getContextInfo(clCtx, cl.CONTEXT_DEVICES)[0];
console.info('Using device: ' + cl.getDeviceInfo(clBuildDevice, cl.DEVICE_NAME));
try {
// clKernelMove = cl.createKernel(clProgram, 'kmove');
clKernelGol = cl.createKernel(clProgram, 'kgol');
} catch(err) {
console.error(cl.getProgramBuildInfo(clProgram, clBuildDevice, cl.PROGRAM_BUILD_LOG));
process.exit(-1);
}
// create buffers
const clBufferNeighbors = cl.createBuffer(clCtx, cl.MEM_READ_ONLY, cellNeighbors.byteLength);
clBufferAlive = [
cl.createBuffer(clCtx, cl.MEM_READ_WRITE, cellAlive[inputIndex].byteLength),
cl.createBuffer(clCtx, cl.MEM_READ_WRITE, cellAlive[outputIndex].byteLength)
];
clBufferImageData = cl.createBuffer(clCtx, cl.MEM_WRITE_ONLY, imageData.byteLength);
// will be set when needed so we can swap em
// cl.setKernelArg(clKernelGol, 0, 'uchar*', clBufferAlive[0]);
// cl.setKernelArg(clKernelGol, 1, 'uchar*', clBufferAlive[1]);
cl.setKernelArg(clKernelGol, 2, 'uint*', clBufferNeighbors);
cl.setKernelArg(clKernelGol, 3, 'uchar*', clBufferImageData);
// create queue
if (cl.createCommandQueueWithProperties !== undefined) {
clQueue = cl.createCommandQueueWithProperties(clCtx, clBuildDevice, []); // OpenCL 2
} else {
clQueue = cl.createCommandQueue(clCtx, clBuildDevice, null); // OpenCL 1.x
}
process.stdout.write('enqueue writes\n');
cl.enqueueWriteBuffer(clQueue, clBufferAlive[0], true, 0, cellAlive[inputIndex].byteLength, cellAlive[inputIndex], null);
cl.enqueueWriteBuffer(clQueue, clBufferAlive[1], true, 0, cellAlive[outputIndex].byteLength, cellAlive[outputIndex], null);
process.stdout.write('writes done\n');
}
function initGame() {
}
function initEvents() {
window.addEventListener('resize', () => {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
});
}
// ----------- GAME LOOP
let lastLoopTime;
const timePerTick = 50; // ms
let timeSinceLastLoop = 0;
let tickCounter = 0;
function startGameLoop() {
lastLoopTime = Date.now();
if (!RUN_GAMELOOP_SYNC) {
gameLoop();
}
}
function gameLoop() {
const now = Date.now();
timeSinceLastLoop += now - lastLoopTime;
lastLoopTime = now;
while(timeSinceLastLoop > timePerTick) {
if (GAMETICK_CL) {
gameTickCl();
} else {
gameTick();
}
timeSinceLastLoop -= timePerTick;
}
if (!RUN_GAMELOOP_SYNC) {
setTimeout(gameLoop, timePerTick - timeSinceLastLoop);
}
}
function gameTickCl() {
process.stdout.write('gametick cl\n');
cl.setKernelArg(clKernelGol, 0, 'uchar*', clBufferAlive[inputIndex]);
cl.setKernelArg(clKernelGol, 1, 'uchar*', clBufferAlive[outputIndex]);
process.stdout.write('gametick cl 1\n');
cl.enqueueNDRangeKernel(clQueue, clKernelGol, 1, null, [cellsTotal], null);
process.stdout.write('gametick cl 2\n');
cl.enqueueReadBuffer(clQueue, clBufferImageData, true, 0, imageData.byteLength, imageData);
process.stdout.write('gametick cl done\n');
inputIndex = !inputIndex + 0;
outputIndex = !inputIndex + 0;
}
function gameTick() {
tickCounter++;
const input = cellAlive[inputIndex];
const output = cellAlive[outputIndex];
for (let i = 0, n = 0; i < cellsTotal; i++) {
const sum =
input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]]
+ input[cellNeighbors[n++]];
// sum < 2 -> !(sum & 4294967294)
// sum > 3 -> (sum & 12) 4 bit set OR 8 bit set
const newAlive = (sum === 3 || (sum === 2 && input[i])) + 0
output[i] = newAlive;
imageData[i * 4] = newAlive * 255;
}
// set computed value to red
inputIndex = !inputIndex + 0;
outputIndex = !inputIndex + 0;
}
// ----------- RENDER
function renderOpenGL() {
gl.clearColor(1.0, 0.0, 0.0, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
gl.vertexAttribPointer(locPosition, 2, gl.FLOAT, false, 0, 0);
gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer);
gl.vertexAttribPointer(locTexCoord, 2, gl.FLOAT, false, 0, 0);
// texture
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, textureWidth, textureHeight, 0, gl.RGBA, gl.UNSIGNED_BYTE, imageData);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
gl.bindTexture(gl.TEXTURE_2D, null);
gl.activeTexture(gl.TEXTURE0);
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.uniform1i(locSampler, 0);
// draw
gl.bindBuffer(gl.ARRAY_BUFFER, vertexCoordBuffer);
gl.drawArrays(gl.TRIANGLES, 0, 6);
// console.log(electron.screen.getCursorScreenPoint());
}
function render() {
window.requestAnimationFrame(render);
if (RUN_GAMELOOP_SYNC) {
gameLoop();
}
const now = Date.now();
if (lastRenderTime) {
frameTimes[frameTimesIndex] = now - lastRenderTime;
frameTimesIndex = (frameTimesIndex + 1) % FRAMETIMES_TO_KEEP;
if (frameTimes.length >= FRAMETIMES_TO_KEEP) {
fps = 1000 * frameTimes.length / frameTimes.reduce((pv, cv) => pv + cv);
// do not update every frame
if ((frameTimesIndex % 5) === 0) {
fpsDisplay.innerHTML = fps.toFixed(2);
}
}
}
lastRenderTime = now;
if (INIT_OPENGL) {
renderOpenGL();
}
}
init(); | JohannesBeranek/electron-pixels | renderer.js | JavaScript | unlicense | 11,380 |
/*
@author Zakai Hamilton
@component CoreJson
*/
screens.core.json = function CoreJson(me, { core, storage }) {
me.init = function () {
if (me.platform === "server") {
me.request = require("request");
}
};
me.loadComponent = async function (path, useCache = true) {
var period = path.lastIndexOf(".");
var component_name = path.substring(period + 1);
var package_name = path.substring(0, period);
var url = "/packages/code/" + package_name + "/" + package_name + "_" + component_name + ".json";
var json = await me.loadFile(url, useCache);
return json;
};
me.get = async function (url) {
if (me.platform === "server") {
return new Promise(resolve => {
me.log("requesting: " + url);
me.request.get(url, (error, response, body) => {
if (error) {
resolve({ error });
}
else {
if (body[0] === "<") {
resolve({ error: "response is in an xml format" });
return;
}
let json = JSON.parse(body);
resolve(json);
}
});
});
}
else {
return core.message.send_server("core.json.get", url);
}
};
me.loadFile = async function (path) {
let json = {};
if (path && path.startsWith("/")) {
path = path.substring(1);
}
if (!core.util.isOnline()) {
json = await storage.local.db.get(me.id, path);
if (json) {
return json;
}
}
var info = {
method: "GET",
url: "/" + path
};
let buffer = "{}";
try {
buffer = await core.http.send(info);
}
catch (err) {
var error = "Cannot load json file: " + path + " err: " + err.message || err;
me.log_error(error);
}
if (buffer) {
json = JSON.parse(buffer);
}
await storage.local.db.set(me.id, path, json);
return json;
};
me.compare = function (source, target) {
if (typeof source !== typeof target) {
return false;
}
if (source === target) {
return true;
}
if (!source && !target) {
return true;
}
if (!source || !target) {
return false;
}
else if (Array.isArray(source)) {
var equal = source.length === target.length;
if (equal) {
target.map((item, index) => {
var sourceItem = source[index];
if (!me.compare(sourceItem, item)) {
equal = false;
}
});
}
return equal;
}
else if (typeof source === "object") {
var sourceKeys = Object.getOwnPropertyNames(source);
var targetKeys = Object.getOwnPropertyNames(target);
if (sourceKeys.length !== targetKeys.length) {
return false;
}
for (var i = 0; i < sourceKeys.length; i++) {
var propName = sourceKeys[i];
if (source[propName] !== target[propName]) {
return false;
}
}
return true;
}
else {
return false;
}
};
me.traverse = function (root, path, value) {
var item = root, parent = root, found = false, name = null;
if (root) {
item = path.split(".").reduce((node, token) => {
parent = node;
name = token;
if (!node) {
return;
}
return node[token];
}, root);
if (typeof item !== "undefined") {
value = item;
found = true;
}
}
return { parent, item, value, name, found };
};
me.value = function (root, paths, value) {
var found = false;
Object.entries(paths).forEach(([path, callback]) => {
if (found) {
return;
}
var info = me.traverse(root, path, value);
if (info.found) {
if (callback) {
var result = callback(value, path);
if (result) {
info.value = result;
found = true;
}
}
else {
value = info.value;
found = true;
}
}
});
return value;
};
me.union = function (array, property) {
return array.filter((obj, pos, arr) => {
return arr.map(mapObj => mapObj[property]).indexOf(obj[property]) === pos;
});
};
me.intersection = function (arrays, property) {
var results = [];
results.push(...arrays[0]);
for (var array of arrays) {
var keys = array.map(mapObj => mapObj[property]);
results = results.filter(mapObj => -1 !== keys.indexOf(mapObj[property]));
}
return results;
};
me.processVars = function (object, text, root) {
text = text.replace(/\${[^{}]*}/g, function (match) {
var path = match.substring(2, match.length - 1);
if (path.startsWith("@")) {
path = path.substring(1);
if (path === "date") {
return new Date().toString();
}
else {
var info = core.property.split(object, path);
let item = me.traverse(root, info.value);
if (item.found) {
return core.property.get(object, info.name, item.value);
}
return "";
}
}
let item = me.traverse(root, path);
if (item.found) {
var value = item.value;
if (typeof value === "object") {
value = JSON.stringify(value);
}
return value;
}
return "";
});
return text;
};
me.map = function (root, before, after) {
if (before) {
root = before(root);
}
if (Array.isArray(root)) {
root = Array.from(root);
}
else if (root instanceof ArrayBuffer) {
root = root.slice(0);
}
else if (root !== null && typeof root === "object") {
root = Object.assign({}, root);
}
if (typeof root !== "string") {
for (var key in root) {
root[key] = me.map(root[key], before, after);
}
}
if (after) {
root = after(root);
}
return root;
};
me.isValid = function (str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
};
};
| zakaihamilton/screens | packages/code/core/core_json.js | JavaScript | unlicense | 7,342 |
exports = module.exports = addShims;
function addShims() {
Function.prototype.extend = function(parent) {
var child = this;
var args = Array.prototype.slice.call(arguments, 0);
child.prototype = parent;
child.prototype = new (Function.prototype.bind.apply(parent, args))();
child.prototype.constructor = child;
var parentProxy = child.prototype.parent = {};
for (var i in parent) {
switch(typeof parent[i]) {
case 'function':
parentProxy[i] = parent[i].bind(child);
break;
default:
parentProxy[i] = parent[i];
}
}
return this;
};
}
| cabloo/express-elect-seed | api/src/core/core.shims.js | JavaScript | unlicense | 625 |
/*globals document, setTimeout, clearTimeout, Audio, navigator */
var MallardMayhem = MallardMayhem || {};
(function () {
"use strict";
MallardMayhem.Duck = function (options) {
var self = this;
this.currentTimeout = null;
this.domElement = document.createElement('span');
this.currentLocation = 0;
this.sounds = {};
this.maxAge = (20 * 1000);
this.lifeSpan = null;
this.id = options.id || null;
this.colour = options.colour || null;
this.name = options.name || 'Quacky';
this.direction = 'right';
this.flyTo = function (coords, callback) {
var baseClass = 'duck-' + self.colour,
randomLocation;
switch (typeof coords) {
case 'string':
coords = coords.split(',');
break;
case 'function':
if (coords.x && coords.y) {
coords = [coords.x, coords.y];
}
break;
}
if (!self.currentLocation) {
self.domElement.style.top = '0px';
self.domElement.style.left = '0px';
self.currentLocation = [(MallardMayhem.stage.offsetWidth / 2), MallardMayhem.stage.offsetHeight - (self.domElement.style.height * 2)];
}
if (self.currentLocation[0] === coords[0] && self.currentLocation[1] === coords[1]) {
if (callback) {
callback();
} else {
randomLocation = MallardMayhem.randomCoord();
self.flyTo(randomLocation);
}
} else {
if (self.currentLocation[1] !== coords[1]) {
if (coords[1] > self.currentLocation[1]) {
if ((coords[1] - self.currentLocation[1]) < MallardMayhem.animationStep) {
self.currentLocation[1] = self.currentLocation[1] + (coords[1] - self.currentLocation[1]);
} else {
self.currentLocation[1] = self.currentLocation[1] + MallardMayhem.animationStep;
}
baseClass = baseClass + '-bottom';
}
if (coords[1] < self.currentLocation[1]) {
if ((self.currentLocation[1] - coords[1]) < MallardMayhem.animationStep) {
self.currentLocation[1] = self.currentLocation[1] - (self.currentLocation[1] - coords[1]);
} else {
self.currentLocation[1] = self.currentLocation[1] - MallardMayhem.animationStep;
}
baseClass = baseClass + '-top';
}
}
if (self.currentLocation[0] !== coords[0]) {
if (coords[0] > self.currentLocation[0]) {
if ((coords[0] - self.currentLocation[0]) < MallardMayhem.animationStep) {
self.currentLocation[0] = self.currentLocation[0] + (coords[0] - self.currentLocation[0]);
} else {
self.currentLocation[0] = self.currentLocation[0] + MallardMayhem.animationStep;
}
baseClass = baseClass + '-right';
}
if (coords[0] < self.currentLocation[0]) {
if ((self.currentLocation[0] - coords[0]) < MallardMayhem.animationStep) {
self.currentLocation[0] = self.currentLocation[0] - (self.currentLocation[0] - coords[0]);
} else {
self.currentLocation[0] = self.currentLocation[0] - MallardMayhem.animationStep;
}
baseClass = baseClass + '-left';
}
}
self.domElement.style.left = self.currentLocation[0] + 'px';
self.domElement.style.top = self.currentLocation[1] + 'px';
if (self.domElement.className !== baseClass) {
self.domElement.className = baseClass;
}
self.currentTimeout = setTimeout(function () {
self.flyTo(coords, callback);
}, MallardMayhem.animationSpeed);
}
};
this.drop = function () {
self.currentLocation[1] = self.currentLocation[1] + (MallardMayhem.animationStep * 2);
self.domElement.style.top = self.currentLocation[1] + 'px';
if (self.currentLocation[1] < MallardMayhem.stage.offsetHeight - 72) {
setTimeout(self.drop, MallardMayhem.animationSpeed);
} else {
self.sounds.fall.currentLocation = self.sounds.fall.pause();
self.sounds.ground.play();
MallardMayhem.removeDuck(self.id);
}
};
this.kill = function () {
clearTimeout(self.currentTimeout);
clearTimeout(self.lifeSpan);
self.domElement.className = 'duck-' + self.colour + '-dead';
self.sounds.fall.play();
setTimeout(self.drop, ((1000 / 4) * 3));
};
this.gotShot = function () {
self.domElement.removeEventListener('mousedown', self.gotShot);
self.domElement.removeEventListener('touchstart', self.gotShot);
MallardMayhem.killDuck(self.id);
};
this.flapWing = function () {
self.sounds.flap.play();
};
this.initialize = function () {
self.domElement.id = self.id;
self.domElement.setAttribute('class', 'duck-' + self.colour + '-right');
self.domElement.addEventListener('mousedown', self.gotShot);
self.domElement.addEventListener('touchstart', self.gotShot);
MallardMayhem.stage.appendChild(self.domElement);
var randomLocation = MallardMayhem.randomCoord(),
format = (navigator.userAgent.indexOf('Firefox') > 1) ? 'ogg' : 'mp3';
self.flyTo(randomLocation);
self.lifeSpan = setTimeout(self.flyAway, self.maxAge);
self.sounds = {
fall : new Audio('./audio/fall.' + format),
ground: new Audio('./audio/ground.' + format)
};
self.sounds.fall.volume = 0.1;
};
this.flyAway = function () {
clearTimeout(self.currentTimeout);
self.domElement.removeEventListener('mousedown', self.gotShot);
self.domElement.removeEventListener('touchstart', self.gotShot);
self.domElement.className = 'duck-' + self.colour + '-top';
self.currentLocation[1] = self.currentLocation[1] - (MallardMayhem.animationStep * 3);
self.domElement.style.top = self.currentLocation[1] + 'px';
if (self.currentLocation[1] > (-60)) {
setTimeout(self.flyAway, MallardMayhem.animationSpeed);
} else {
MallardMayhem.removeDuck(self.id);
}
};
this.initialize();
};
}()); | HTMLToronto/MallardMayhem | mm/mm.client.duck.js | JavaScript | unlicense | 7,282 |
#!/usr/bin/env node
var http = require('http');
var moment = require('moment');
var server = undefined;
var threshold = undefined;
var units = undefined;
if (!isValid(process.argv)) {
console.error('invalid arguments, expected hostname threshold and units');
process.exit(-1);
}
var request = http.request('http://' + server + '/api/temperatures', function(response) {
var statusCode = response.statusCode;
var result = [];
var json = undefined;
if (statusCode === 200) {
response.on('data', function(chunk) {
result.push(chunk.toString());
});
response.on('end', function() {
json = JSON.parse(result.join(''));
analyze(json);
});
}
});
request.end();
function analyze(data) {
var length = data.length;
var i, sensorData, sensorId, sensorLog, dates;
var analysis;
for (i = 0; i < length; i++) {
sensorData = data[i];
sensorId = sensorData['_id'];
sensorLog = sensorData['value'];
dates = sensorLog.map(function(log) {
return moment(log.date);
});
dates.sort(function(a, b) {
return (a < b ? -1 : (a > b ? 1 : 0));
});
analysis = dates.reduce(function(analysis, to) {
var from = analysis.previous;
var diff;
if (analysis.previous) {
diff = to.diff(from, units);
if (diff > threshold) {
analysis.result.push({
diff: diff + ' ' + units,
from: from.format('YYMMDDHHmm'),
to: to.format('YYMMDDHHmm')
});
}
}
return {
previous: to,
result: analysis.result
};
}, { result: [] });
console.log(sensorId, analysis.result);
}
}
function isValid(args) {
if (args.length === 5) {
server = args[2];
threshold = parseInt(args[3], 10);
units = args[4];
return true;
}
else {
return false;
}
}
| initcz/thermohome-client-rpi | util/analyzeMissingDates.js | JavaScript | unlicense | 1,860 |
/*******************************************************************************
Add to .git/hooks/pre-commit (and chmod +x) to enable auto-linting/uglifying:
#!/bin/sh
grunt build
if [ $? -ne 0 ]; then
exit 1
fi
git add deflector.min.js
exit 0
*******************************************************************************/
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
connect: {
all: { options: { base: '.', port: 9999 }}
},
jshint: {
all: ['deflector.js', 'deflector.test.js', 'Gruntfile.js']
},
qunit: {
all: ['index.html']
},
'saucelabs-qunit': {
all: {
options: {
testname: '<%= pkg.name %> tests',
tags: ['master'],
urls: ['http://127.0.0.1:9999/'],
build: process.env.TRAVIS_JOB_ID,
browsers: [
{ browserName: "internet explorer", version: "11" },
{ browserName: "android", version: "4.4" },
{ browserName: "iphone", version: "7.1" }
],
tunnelTimeout: 5,
concurrency: 3
}
}
},
uglify: {
all: { files: { 'deflector.min.js': 'deflector.js' }}
},
watch: {
all: {
files: ['deflector.js', 'deflector.test.js'],
tasks: ['build']
}
}
});
for (var key in grunt.file.readJSON('package.json').devDependencies) {
if (key !== 'grunt' && key.indexOf('grunt') === 0) {
grunt.loadNpmTasks(key);
}
}
grunt.registerTask('build', ['jshint', 'uglify', 'qunit']);
grunt.registerTask('test', ['build', 'connect', 'saucelabs-qunit']);
grunt.registerTask('default', ['build', 'connect', 'watch']);
}; | Twissi/deflector | Gruntfile.js | JavaScript | unlicense | 1,998 |
avatar = function(x){
this.x = x;
this.y = 0;
this.prevY = 0;
this.velocity_x = 0;
this.velocity_y = 0;
this.img = loadImage("stickman.png");
this.crouch = loadImage("crouch.png");
this.width = 16;
this.standingHeight=64;
this.crouchHeight=44;
this.height = this.standingHeight;
this.collisionCheck = [];
};
avatar.prototype.addCollisionCheck = function(item){
this.collisionCheck.push(item);
//console.log("add "+item);
}
avatar.prototype.removeCollisionCheck = function(item){
this.collisionCheck.splice(
this.collisionCheck.indexOf(item), 1);
//console.log("remove mushroom");
}
avatar.prototype.platformCheck = function(){
this.talajon=false;
if(this.y<=0){
this.y=0; this.velocity_y=0; this.talajon=true;
}
for(var i in elements.es){
if(elements.es[i] instanceof platform){
var p=elements.es[i];
if(p.x<this.x +this.width && p.x+p.width > this.x){
if(this.prevY>=p.y && this.y<=p.y){
this.y=p.y;
this.velocity_y=0;
this.talajon=true;
}
}
}
}
}
avatar.prototype.death = function(){
new Audio(explosionSound.src).play();
life--;
lifeText.text = "Life: "+life;
if(life <= 0)
gameOver();
this.x = 0;
this.y = 0;
}
avatar.prototype.spikeCheck = function(){
for(var i in elements.es){
if(elements.es[i] instanceof spike){
var p=elements.es[i];
if(p.x<this.x +this.width && p.x+p.width > this.x){
/*console.log("player.y = "+this.y);
console.log("spike.y = "+p.y);
console.log("spike.height = "+p.height);
console.log("player.height = "+this.height);*/
if(p.y<this.y+this.height && p.y+p.height-3 > this.y){
this.death();
}
}
}
}
}
avatar.prototype.mushroomCheck = function(){
for(var i in elements.es){
if(elements.es[i] instanceof mushroom){
var p=elements.es[i];
if(p.x<=this.x +this.width && p.x+p.width >= this.x){
/*console.log("player.y = "+this.y);
console.log("spike.y = "+p.y);
console.log("spike.height = "+p.height);
console.log("player.height = "+this.height);*/
if(p.y<=this.y+this.height && p.y+p.height >= this.y){
if(this.prevY>p.y+p.height) {
p.death();
}else {
this.death();
}
}
}
}
}
}
avatar.prototype.logic = function(){
var speedX = 5;
if(keys[KEY_RIGHT]){
this.x += speedX;
}if(keys[KEY_LEFT]){
this.x -= speedX;
}
this.prevY = this.y;
this.y += this.velocity_y;
if(keys[KEY_UP] && this.talajon){
this.velocity_y = 14;
this.y += 0.001;
}
this.platformCheck();
//this.spikeCheck();
//this.mushroomCheck();
//collision Test
for(var i in this.collisionCheck){
var p = this.collisionCheck[i];
if(p.x<this.x +this.width &&
p.x+p.width > this.x){
if(p.y<this.y+this.height &&
p.y+p.height > this.y){
p.collide(this);
}
}
}
if(!this.talajon){
this.velocity_y-=1;
}
if(keys[KEY_DOWN]){
this.currentImg=this.crouch;
this.height=this.crouchHeight;
}else{
this.currentImg=this.img;
this.height=this.standingHeight;
}
};
avatar.prototype.draw=function(context, t){
context.drawImage(this.currentImg, t.tX(this.x), t.tY(this.y)-this.standingHeight);
};
| rizsi/szakkor2014 | orak/sa-23/avatar.js | JavaScript | unlicense | 3,166 |
var leaderboard2 = function(data) {
return data.data.sort(function(a,b){return b.points-a.points;});
};
function liCreate(name,points) {
var li = $('<li>'+name+'</li>');
li.append('<span>'+points+'</span>');
}
$(document).ready(function() {
// var sorted = leaderboard2(data);
// for (var i=0; i<sorted.length; i++) {
// $('body').append('<div><p>'+sorted[i].name+' '+sorted[i].points+'</p></div>')
// }
// //problem here is with repeated DOM manipulation
var studentArray = [];
$.getJSON('http://192.168.1.35:8000/data.json').success(function(data){
//using '$.getJSON' as opposed to $.ajax specifies
//also, include both success and error handler to account for asynchrony.
//i.e., if/when SUCCESS, execute some code block; if ERROR, execute another.
console.log(data);
var sorted = leaderboard2(data);
for (var i=0; i<sorted.length; i++) {
var student = ('<div><p>'+sorted[i].name+' '+sorted[i].points+'</p></div>');
studentArray.push(student);
}
//^^ FIXED!!! Append entire array ^^
console.log(studentArray);
$('body').append(studentArray);
})
.error(function(error){
console.log(error);
});
});
| sherylpeebee/redditClone | own-playground/karma/script.js | JavaScript | unlicense | 1,196 |
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* [email protected]
* http://www.sencha.com/license
*/
/**
* @class Ext.dd.DragTracker
* @extends Ext.util.Observable
* A DragTracker listens for drag events on an Element and fires events at the start and end of the drag,
* as well as during the drag. This is useful for components such as {@link Ext.slider.MultiSlider}, where there is
* an element that can be dragged around to change the Slider's value.
* DragTracker provides a series of template methods that should be overridden to provide functionality
* in response to detected drag operations. These are onBeforeStart, onStart, onDrag and onEnd.
* See {@link Ext.slider.MultiSlider}'s initEvents function for an example implementation.
*/
Ext.dd.DragTracker = Ext.extend(Ext.util.Observable, {
/**
* @cfg {Boolean} active
* Defaults to <tt>false</tt>.
*/
active: false,
/**
* @cfg {Number} tolerance
* Number of pixels the drag target must be moved before dragging is considered to have started. Defaults to <tt>5</tt>.
*/
tolerance: 5,
/**
* @cfg {Boolean/Number} autoStart
* Defaults to <tt>false</tt>. Specify <tt>true</tt> to defer trigger start by 1000 ms.
* Specify a Number for the number of milliseconds to defer trigger start.
*/
autoStart: false,
constructor : function(config){
Ext.apply(this, config);
this.addEvents(
/**
* @event mousedown
* @param {Object} this
* @param {Object} e event object
*/
'mousedown',
/**
* @event mouseup
* @param {Object} this
* @param {Object} e event object
*/
'mouseup',
/**
* @event mousemove
* @param {Object} this
* @param {Object} e event object
*/
'mousemove',
/**
* @event dragstart
* @param {Object} this
* @param {Object} e event object
*/
'dragstart',
/**
* @event dragend
* @param {Object} this
* @param {Object} e event object
*/
'dragend',
/**
* @event drag
* @param {Object} this
* @param {Object} e event object
*/
'drag'
);
this.dragRegion = new Ext.lib.Region(0,0,0,0);
if(this.el){
this.initEl(this.el);
}
Ext.dd.DragTracker.superclass.constructor.call(this, config);
},
initEl: function(el){
this.el = Ext.get(el);
el.on('mousedown', this.onMouseDown, this,
this.delegate ? {delegate: this.delegate} : undefined);
},
destroy : function(){
this.el.un('mousedown', this.onMouseDown, this);
delete this.el;
},
onMouseDown: function(e, target){
if(this.fireEvent('mousedown', this, e) !== false && this.onBeforeStart(e) !== false){
this.startXY = this.lastXY = e.getXY();
this.dragTarget = this.delegate ? target : this.el.dom;
if(this.preventDefault !== false){
e.preventDefault();
}
Ext.getDoc().on({
scope: this,
mouseup: this.onMouseUp,
mousemove: this.onMouseMove,
selectstart: this.stopSelect
});
if(this.autoStart){
this.timer = this.triggerStart.defer(this.autoStart === true ? 1000 : this.autoStart, this, [e]);
}
}
},
onMouseMove: function(e, target){
// HACK: IE hack to see if button was released outside of window. */
if(this.active && Ext.isIE && !e.browserEvent.button){
e.preventDefault();
this.onMouseUp(e);
return;
}
e.preventDefault();
var xy = e.getXY(), s = this.startXY;
this.lastXY = xy;
if(!this.active){
if(Math.abs(s[0]-xy[0]) > this.tolerance || Math.abs(s[1]-xy[1]) > this.tolerance){
this.triggerStart(e);
}else{
return;
}
}
this.fireEvent('mousemove', this, e);
this.onDrag(e);
this.fireEvent('drag', this, e);
},
onMouseUp: function(e) {
var doc = Ext.getDoc(),
wasActive = this.active;
doc.un('mousemove', this.onMouseMove, this);
doc.un('mouseup', this.onMouseUp, this);
doc.un('selectstart', this.stopSelect, this);
e.preventDefault();
this.clearStart();
this.active = false;
delete this.elRegion;
this.fireEvent('mouseup', this, e);
if(wasActive){
this.onEnd(e);
this.fireEvent('dragend', this, e);
}
},
triggerStart: function(e) {
this.clearStart();
this.active = true;
this.onStart(e);
this.fireEvent('dragstart', this, e);
},
clearStart : function() {
if(this.timer){
clearTimeout(this.timer);
delete this.timer;
}
},
stopSelect : function(e) {
e.stopEvent();
return false;
},
/**
* Template method which should be overridden by each DragTracker instance. Called when the user first clicks and
* holds the mouse button down. Return false to disallow the drag
* @param {Ext.EventObject} e The event object
*/
onBeforeStart : function(e) {
},
/**
* Template method which should be overridden by each DragTracker instance. Called when a drag operation starts
* (e.g. the user has moved the tracked element beyond the specified tolerance)
* @param {Ext.EventObject} e The event object
*/
onStart : function(xy) {
},
/**
* Template method which should be overridden by each DragTracker instance. Called whenever a drag has been detected.
* @param {Ext.EventObject} e The event object
*/
onDrag : function(e) {
},
/**
* Template method which should be overridden by each DragTracker instance. Called when a drag operation has been completed
* (e.g. the user clicked and held the mouse down, dragged the element and then released the mouse button)
* @param {Ext.EventObject} e The event object
*/
onEnd : function(e) {
},
/**
* Returns the drag target
* @return {Ext.Element} The element currently being tracked
*/
getDragTarget : function(){
return this.dragTarget;
},
getDragCt : function(){
return this.el;
},
getXY : function(constrain){
return constrain ?
this.constrainModes[constrain].call(this, this.lastXY) : this.lastXY;
},
getOffset : function(constrain){
var xy = this.getXY(constrain),
s = this.startXY;
return [s[0]-xy[0], s[1]-xy[1]];
},
constrainModes: {
'point' : function(xy){
if(!this.elRegion){
this.elRegion = this.getDragCt().getRegion();
}
var dr = this.dragRegion;
dr.left = xy[0];
dr.top = xy[1];
dr.right = xy[0];
dr.bottom = xy[1];
dr.constrainTo(this.elRegion);
return [dr.left, dr.top];
}
}
}); | ahwxl/cms | icms/src/main/webapp/res/extjs/src/dd/DragTracker.js | JavaScript | apache-2.0 | 7,637 |
sap.ui.define(['sap/ui/webc/common/thirdparty/base/asset-registries/Icons'], function (Icons) { 'use strict';
const name = "status-completed";
const pathData = "M256 0q53 0 99.5 20T437 75t55 81.5 20 99.5-20 99.5-55 81.5-81.5 55-99.5 20-99.5-20T75 437t-55-81.5T0 256t20-99.5T75 75t81.5-55T256 0zM128 256q-14 0-23 9t-9 23q0 12 9 23l64 64q11 9 23 9 13 0 23-9l192-192q9-11 9-23 0-13-9.5-22.5T384 128q-12 0-23 9L192 307l-41-42q-10-9-23-9z";
const ltr = false;
const collection = "SAP-icons-v5";
const packageName = "@ui5/webcomponents-icons";
Icons.registerIcon(name, { pathData, ltr, collection, packageName });
var pathDataV4 = { pathData };
return pathDataV4;
});
| SAP/openui5 | src/sap.ui.webc.common/src/sap/ui/webc/common/thirdparty/icons/v5/status-completed.js | JavaScript | apache-2.0 | 673 |
var baseClone = require('./_baseClone');
/**
* This method is like `_.clone` except that it accepts `customizer` which
* is invoked to produce the cloned value. If `customizer` returns `undefined`,
* cloning is handled by the method instead. The `customizer` is invoked with
* up to four arguments; (value [, index|key, object, stack]).
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to clone.
* @param {Function} [customizer] The function to customize cloning.
* @returns {*} Returns the cloned value.
* @see _.cloneDeepWith
* @example
*
* function customizer(value) {
* if (_.isElement(value)) {
* return value.cloneNode(false);
* }
* }
*
* var el = _.cloneWith(document.body, customizer);
*
* console.log(el === document.body);
* // => false
* console.log(el.nodeName);
* // => 'BODY'
* console.log(el.childNodes.length);
* // => 0
*/
function cloneWith(value, customizer) {
customizer = typeof customizer == 'function' ? customizer : undefined;
return baseClone(value, false, true, customizer);
}
module.exports = cloneWith;
| ionutbarau/petstore | petstore-app/src/main/resources/static/node_modules/bower/lib/node_modules/lodash/cloneWith.js | JavaScript | apache-2.0 | 1,117 |
Potree.TranslationTool = function(camera) {
THREE.Object3D.call( this );
var scope = this;
this.camera = camera;
this.geometry = new THREE.Geometry();
this.material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } );
this.STATE = {
DEFAULT: 0,
TRANSLATE_X: 1,
TRANSLATE_Y: 2,
TRANSLATE_Z: 3
};
this.parts = {
ARROW_X : {name: "arrow_x", object: undefined, color: new THREE.Color( 0xff0000 ), state: this.STATE.TRANSLATE_X},
ARROW_Y : {name: "arrow_y", object: undefined, color: new THREE.Color( 0x00ff00 ), state: this.STATE.TRANSLATE_Y},
ARROW_Z : {name: "arrow_z", object: undefined, color: new THREE.Color( 0x0000ff ), state: this.STATE.TRANSLATE_Z}
}
this.translateStart;
this.state = this.STATE.DEFAULT;
this.highlighted;
this.targets;
this.build = function(){
var arrowX = scope.createArrow(scope.parts.ARROW_X, scope.parts.ARROW_X.color);
arrowX.rotation.z = -Math.PI/2;
var arrowY = scope.createArrow(scope.parts.ARROW_Y, scope.parts.ARROW_Y.color);
var arrowZ = scope.createArrow(scope.parts.ARROW_Z, scope.parts.ARROW_Z.color);
arrowZ.rotation.x = -Math.PI/2;
scope.add(arrowX);
scope.add(arrowY);
scope.add(arrowZ);
var boxXY = scope.createBox(new THREE.Color( 0xffff00 ));
boxXY.scale.z = 0.02;
boxXY.position.set(0.5, 0.5, 0);
var boxXZ = scope.createBox(new THREE.Color( 0xff00ff ));
boxXZ.scale.y = 0.02;
boxXZ.position.set(0.5, 0, -0.5);
var boxYZ = scope.createBox(new THREE.Color( 0x00ffff ));
boxYZ.scale.x = 0.02;
boxYZ.position.set(0, 0.5, -0.5);
scope.add(boxXY);
scope.add(boxXZ);
scope.add(boxYZ);
scope.parts.ARROW_X.object = arrowX;
scope.parts.ARROW_Y.object = arrowY;
scope.parts.ARROW_Z.object = arrowZ;
scope.scale.multiplyScalar(5);
};
this.createBox = function(color){
var boxGeometry = new THREE.BoxGeometry(1, 1, 1);
var boxMaterial = new THREE.MeshBasicMaterial({color: color, transparent: true, opacity: 0.5});
var box = new THREE.Mesh(boxGeometry, boxMaterial);
return box;
};
this.createArrow = function(partID, color){
var material = new THREE.MeshBasicMaterial({color: color});
var shaftGeometry = new THREE.CylinderGeometry(0.1, 0.1, 3, 10, 1, false);
var shaftMatterial = material;
var shaft = new THREE.Mesh(shaftGeometry, shaftMatterial);
shaft.position.y = 1.5;
var headGeometry = new THREE.CylinderGeometry(0, 0.3, 1, 10, 1, false);
var headMaterial = material;
var head = new THREE.Mesh(headGeometry, headMaterial);
head.position.y = 3;
var arrow = new THREE.Object3D();
arrow.add(shaft);
arrow.add(head);
arrow.partID = partID;
arrow.material = material;
return arrow;
};
this.setHighlighted = function(partID){
if(partID === undefined){
if(scope.highlighted){
scope.highlighted.object.material.color = scope.highlighted.color;
scope.highlighted = undefined;
}
return;
}else if(scope.highlighted !== undefined && scope.highlighted !== partID){
scope.highlighted.object.material.color = scope.highlighted.color;
}
scope.highlighted = partID;
partID.object.material.color = new THREE.Color(0xffff00);
}
this.getHoveredObject = function(mouse){
var vector = new THREE.Vector3( mouse.x, mouse.y, 0.5 );
vector.unproject(scope.camera);
var raycaster = new THREE.Raycaster();
raycaster.ray.set( scope.camera.position, vector.sub( scope.camera.position ).normalize() );
var intersections = raycaster.intersectObject(scope, true);
if(intersections.length === 0){
scope.setHighlighted(undefined);
return undefined;
}
var I = intersections[0];
var partID = I.object.parent.partID;
return partID;
}
this.onMouseMove = function(event){
var mouse = event.normalizedPosition;
if(scope.state === scope.STATE.DEFAULT){
scope.setHighlighted(scope.getHoveredObject(mouse));
}else if(scope.state === scope.STATE.TRANSLATE_X || scope.state === scope.STATE.TRANSLATE_Y || scope.state === scope.STATE.TRANSLATE_Z){
var origin = scope.start.lineStart.clone();
var direction = scope.start.lineEnd.clone().sub(scope.start.lineStart);
direction.normalize();
var mousePoint = new THREE.Vector3(mouse.x, mouse.y);
var directionDistance = new THREE.Vector3().subVectors(mousePoint, origin).dot(direction);
var pointOnLine = direction.clone().multiplyScalar(directionDistance).add(origin);
pointOnLine.unproject(scope.camera);
var diff = pointOnLine.clone().sub(scope.position);
scope.position.copy(pointOnLine);
for(var i = 0; i < scope.targets.length; i++){
var target = scope.targets[0];
target.position.add(diff);
}
event.signal.halt();
}
};
this.onMouseDown = function(event){
if(scope.state === scope.STATE.DEFAULT){
var hoveredObject = scope.getHoveredObject(event.normalizedPosition, scope.camera);
if(hoveredObject){
scope.state = hoveredObject.state;
var lineStart = scope.position.clone();
var lineEnd;
if(scope.state === scope.STATE.TRANSLATE_X){
lineEnd = scope.position.clone();
lineEnd.x += 2;
}else if(scope.state === scope.STATE.TRANSLATE_Y){
lineEnd = scope.position.clone();
lineEnd.y += 2;
}else if(scope.state === scope.STATE.TRANSLATE_Z){
lineEnd = scope.position.clone();
lineEnd.z -= 2;
}
lineStart.project(scope.camera);
lineEnd.project(scope.camera);
scope.start = {
mouse: event.normalizedPosition,
lineStart: lineStart,
lineEnd: lineEnd
};
event.signal.halt();
}
}
};
this.onMouseUp = function(event){
scope.setHighlighted();
scope.state = scope.STATE.DEFAULT;
};
this.setTargets = function(targets){
scope.targets = targets;
if(scope.targets.length === 0){
return;
}
//TODO calculate centroid of all targets
var centroid = targets[0].position.clone();
//for(var i = 0; i < targets.length; i++){
// var target = targets[i];
//}
scope.position.copy(centroid);
}
this.build();
};
Potree.TranslationTool.prototype = Object.create( THREE.Object3D.prototype );
| idunshee/Portfolio | Project/WPC/WPC_Viewer/src/utils/TranslationTool.js | JavaScript | apache-2.0 | 6,194 |
'use strict';
var consoleBaseUrl = window.location.href;
consoleBaseUrl = consoleBaseUrl.substring(0, consoleBaseUrl.indexOf("/console"));
consoleBaseUrl = consoleBaseUrl + "/console";
var configUrl = consoleBaseUrl + "/config";
var auth = {};
var resourceBundle;
var locale = 'en';
var module = angular.module('keycloak', [ 'keycloak.services', 'keycloak.loaders', 'ui.bootstrap', 'ui.select2', 'angularFileUpload', 'angularTreeview', 'pascalprecht.translate', 'ngCookies', 'ngSanitize', 'ui.ace']);
var resourceRequests = 0;
var loadingTimer = -1;
angular.element(document).ready(function () {
var keycloakAuth = new Keycloak(configUrl);
function whoAmI(success, error) {
var req = new XMLHttpRequest();
req.open('GET', consoleBaseUrl + "/whoami", true);
req.setRequestHeader('Accept', 'application/json');
req.setRequestHeader('Authorization', 'bearer ' + keycloakAuth.token);
req.onreadystatechange = function () {
if (req.readyState == 4) {
if (req.status == 200) {
var data = JSON.parse(req.responseText);
success(data);
} else {
error();
}
}
}
req.send();
}
function loadResourceBundle(success, error) {
var req = new XMLHttpRequest();
req.open('GET', consoleBaseUrl + '/messages.json?lang=' + locale, true);
req.setRequestHeader('Accept', 'application/json');
req.onreadystatechange = function () {
if (req.readyState == 4) {
if (req.status == 200) {
var data = JSON.parse(req.responseText);
success && success(data);
} else {
error && error();
}
}
}
req.send();
}
function hasAnyAccess(user) {
return user && user['realm_access'];
}
keycloakAuth.onAuthLogout = function() {
location.reload();
}
keycloakAuth.init({ onLoad: 'login-required' }).success(function () {
auth.authz = keycloakAuth;
if (auth.authz.idTokenParsed.locale) {
locale = auth.authz.idTokenParsed.locale;
}
auth.refreshPermissions = function(success, error) {
whoAmI(function(data) {
auth.user = data;
auth.loggedIn = true;
auth.hasAnyAccess = hasAnyAccess(data);
success();
}, function() {
error();
});
};
loadResourceBundle(function(data) {
resourceBundle = data;
auth.refreshPermissions(function () {
module.factory('Auth', function () {
return auth;
});
var injector = angular.bootstrap(document, ["keycloak"]);
injector.get('$translate')('consoleTitle').then(function (consoleTitle) {
document.title = consoleTitle;
});
});
});
}).error(function () {
window.location.reload();
});
});
module.factory('authInterceptor', function($q, Auth) {
return {
request: function (config) {
if (!config.url.match(/.html$/)) {
var deferred = $q.defer();
if (Auth.authz.token) {
Auth.authz.updateToken(5).success(function () {
config.headers = config.headers || {};
config.headers.Authorization = 'Bearer ' + Auth.authz.token;
deferred.resolve(config);
}).error(function () {
location.reload();
});
}
return deferred.promise;
} else {
return config;
}
}
};
});
module.config(['$translateProvider', function($translateProvider) {
$translateProvider.useSanitizeValueStrategy('sanitizeParameters');
$translateProvider.preferredLanguage(locale);
$translateProvider.translations(locale, resourceBundle);
}]);
module.config([ '$routeProvider', function($routeProvider) {
$routeProvider
.when('/create/realm', {
templateUrl : resourceUrl + '/partials/realm-create.html',
resolve : {
},
controller : 'RealmCreateCtrl'
})
.when('/realms/:realm', {
templateUrl : resourceUrl + '/partials/realm-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmDetailCtrl'
})
.when('/realms/:realm/login-settings', {
templateUrl : resourceUrl + '/partials/realm-login-settings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfo) {
return ServerInfo.delay;
}
},
controller : 'RealmLoginSettingsCtrl'
})
.when('/realms/:realm/theme-settings', {
templateUrl : resourceUrl + '/partials/realm-theme-settings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmThemeCtrl'
})
.when('/realms/:realm/cache-settings', {
templateUrl : resourceUrl + '/partials/realm-cache-settings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmCacheCtrl'
})
.when('/realms', {
templateUrl : resourceUrl + '/partials/realm-list.html',
controller : 'RealmListCtrl'
})
.when('/realms/:realm/token-settings', {
templateUrl : resourceUrl + '/partials/realm-tokens.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmTokenDetailCtrl'
})
.when('/realms/:realm/client-initial-access', {
templateUrl : resourceUrl + '/partials/client-initial-access.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
clientInitialAccess : function(ClientInitialAccessLoader) {
return ClientInitialAccessLoader();
},
clientRegTrustedHosts : function(ClientRegistrationTrustedHostListLoader) {
return ClientRegistrationTrustedHostListLoader();
}
},
controller : 'ClientInitialAccessCtrl'
})
.when('/realms/:realm/client-initial-access/create', {
templateUrl : resourceUrl + '/partials/client-initial-access-create.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'ClientInitialAccessCreateCtrl'
})
.when('/realms/:realm/client-reg-trusted-hosts/create', {
templateUrl : resourceUrl + '/partials/client-reg-trusted-host-create.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
clientRegTrustedHost : function() {
return {};
}
},
controller : 'ClientRegistrationTrustedHostDetailCtrl'
})
.when('/realms/:realm/client-reg-trusted-hosts/:hostname', {
templateUrl : resourceUrl + '/partials/client-reg-trusted-host-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
clientRegTrustedHost : function(ClientRegistrationTrustedHostLoader) {
return ClientRegistrationTrustedHostLoader();
}
},
controller : 'ClientRegistrationTrustedHostDetailCtrl'
})
.when('/realms/:realm/keys-settings', {
templateUrl : resourceUrl + '/partials/realm-keys.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmKeysDetailCtrl'
})
.when('/realms/:realm/identity-provider-settings', {
templateUrl : resourceUrl + '/partials/realm-identity-provider.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
instance : function(IdentityProviderLoader) {
return {};
},
providerFactory : function(IdentityProviderFactoryLoader) {
return {};
},
authFlows : function(AuthenticationFlowsLoader) {
return {};
}
},
controller : 'RealmIdentityProviderCtrl'
})
.when('/create/identity-provider/:realm/:provider_id', {
templateUrl : function(params){ return resourceUrl + '/partials/realm-identity-provider-' + params.provider_id + '.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
instance : function(IdentityProviderLoader) {
return {};
},
providerFactory : function(IdentityProviderFactoryLoader) {
return new IdentityProviderFactoryLoader();
},
authFlows : function(AuthenticationFlowsLoader) {
return AuthenticationFlowsLoader();
}
},
controller : 'RealmIdentityProviderCtrl'
})
.when('/realms/:realm/identity-provider-settings/provider/:provider_id/:alias', {
templateUrl : function(params){ return resourceUrl + '/partials/realm-identity-provider-' + params.provider_id + '.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
instance : function(IdentityProviderLoader) {
return IdentityProviderLoader();
},
providerFactory : function(IdentityProviderFactoryLoader) {
return IdentityProviderFactoryLoader();
},
authFlows : function(AuthenticationFlowsLoader) {
return AuthenticationFlowsLoader();
}
},
controller : 'RealmIdentityProviderCtrl'
})
.when('/realms/:realm/identity-provider-settings/provider/:provider_id/:alias/export', {
templateUrl : resourceUrl + '/partials/realm-identity-provider-export.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
identityProvider : function(IdentityProviderLoader) {
return IdentityProviderLoader();
},
providerFactory : function(IdentityProviderFactoryLoader) {
return IdentityProviderFactoryLoader();
}
},
controller : 'RealmIdentityProviderExportCtrl'
})
.when('/realms/:realm/identity-provider-mappers/:alias/mappers', {
templateUrl : function(params){ return resourceUrl + '/partials/identity-provider-mappers.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
identityProvider : function(IdentityProviderLoader) {
return IdentityProviderLoader();
},
mapperTypes : function(IdentityProviderMapperTypesLoader) {
return IdentityProviderMapperTypesLoader();
},
mappers : function(IdentityProviderMappersLoader) {
return IdentityProviderMappersLoader();
}
},
controller : 'IdentityProviderMapperListCtrl'
})
.when('/realms/:realm/identity-provider-mappers/:alias/mappers/:mapperId', {
templateUrl : function(params){ return resourceUrl + '/partials/identity-provider-mapper-detail.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
identityProvider : function(IdentityProviderLoader) {
return IdentityProviderLoader();
},
mapperTypes : function(IdentityProviderMapperTypesLoader) {
return IdentityProviderMapperTypesLoader();
},
mapper : function(IdentityProviderMapperLoader) {
return IdentityProviderMapperLoader();
}
},
controller : 'IdentityProviderMapperCtrl'
})
.when('/create/identity-provider-mappers/:realm/:alias', {
templateUrl : function(params){ return resourceUrl + '/partials/identity-provider-mapper-detail.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
identityProvider : function(IdentityProviderLoader) {
return IdentityProviderLoader();
},
mapperTypes : function(IdentityProviderMapperTypesLoader) {
return IdentityProviderMapperTypesLoader();
}
},
controller : 'IdentityProviderMapperCreateCtrl'
})
.when('/realms/:realm/default-roles', {
templateUrl : resourceUrl + '/partials/realm-default-roles.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
roles : function(RoleListLoader) {
return RoleListLoader();
}
},
controller : 'RealmDefaultRolesCtrl'
})
.when('/realms/:realm/smtp-settings', {
templateUrl : resourceUrl + '/partials/realm-smtp.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmSMTPSettingsCtrl'
})
.when('/realms/:realm/events', {
templateUrl : resourceUrl + '/partials/realm-events.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmEventsCtrl'
})
.when('/realms/:realm/admin-events', {
templateUrl : resourceUrl + '/partials/realm-events-admin.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmAdminEventsCtrl'
})
.when('/realms/:realm/events-settings', {
templateUrl : resourceUrl + '/partials/realm-events-config.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
eventsConfig : function(RealmEventsConfigLoader) {
return RealmEventsConfigLoader();
}
},
controller : 'RealmEventsConfigCtrl'
})
.when('/realms/:realm/partial-import', {
templateUrl : resourceUrl + '/partials/partial-import.html',
resolve : {
resourceName : function() { return 'users'},
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmImportCtrl'
})
.when('/create/user/:realm', {
templateUrl : resourceUrl + '/partials/user-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function() {
return {};
}
},
controller : 'UserDetailCtrl'
})
.when('/realms/:realm/users/:user', {
templateUrl : resourceUrl + '/partials/user-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
}
},
controller : 'UserDetailCtrl'
})
.when('/realms/:realm/users/:user/user-attributes', {
templateUrl : resourceUrl + '/partials/user-attributes.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
}
},
controller : 'UserDetailCtrl'
})
.when('/realms/:realm/users/:user/user-credentials', {
templateUrl : resourceUrl + '/partials/user-credentials.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
}
},
controller : 'UserCredentialsCtrl'
})
.when('/realms/:realm/users/:user/role-mappings', {
templateUrl : resourceUrl + '/partials/role-mappings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
client : function() {
return {};
}
},
controller : 'UserRoleMappingCtrl'
})
.when('/realms/:realm/users/:user/groups', {
templateUrl : resourceUrl + '/partials/user-group-membership.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
groups : function(GroupListLoader) {
return GroupListLoader();
}
},
controller : 'UserGroupMembershipCtrl'
})
.when('/realms/:realm/users/:user/sessions', {
templateUrl : resourceUrl + '/partials/user-sessions.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
sessions : function(UserSessionsLoader) {
return UserSessionsLoader();
}
},
controller : 'UserSessionsCtrl'
})
.when('/realms/:realm/users/:user/federated-identity', {
templateUrl : resourceUrl + '/partials/user-federated-identity-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
federatedIdentities : function(UserFederatedIdentityLoader) {
return UserFederatedIdentityLoader();
}
},
controller : 'UserFederatedIdentityCtrl'
})
.when('/create/federated-identity/:realm/:user', {
templateUrl : resourceUrl + '/partials/user-federated-identity-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
federatedIdentities : function(UserFederatedIdentityLoader) {
return UserFederatedIdentityLoader();
}
},
controller : 'UserFederatedIdentityAddCtrl'
})
.when('/realms/:realm/users/:user/consents', {
templateUrl : resourceUrl + '/partials/user-consents.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
userConsents : function(UserConsentsLoader) {
return UserConsentsLoader();
}
},
controller : 'UserConsentsCtrl'
})
.when('/realms/:realm/users/:user/offline-sessions/:client', {
templateUrl : resourceUrl + '/partials/user-offline-sessions.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(UserLoader) {
return UserLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
offlineSessions : function(UserOfflineSessionsLoader) {
return UserOfflineSessionsLoader();
}
},
controller : 'UserOfflineSessionsCtrl'
})
.when('/realms/:realm/users', {
templateUrl : resourceUrl + '/partials/user-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'UserListCtrl'
})
.when('/create/role/:realm', {
templateUrl : resourceUrl + '/partials/role-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
role : function() {
return {};
},
roles : function(RoleListLoader) {
return RoleListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'RoleDetailCtrl'
})
.when('/realms/:realm/roles/:role', {
templateUrl : resourceUrl + '/partials/role-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
role : function(RoleLoader) {
return RoleLoader();
},
roles : function(RoleListLoader) {
return RoleListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'RoleDetailCtrl'
})
.when('/realms/:realm/roles', {
templateUrl : resourceUrl + '/partials/role-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
roles : function(RoleListLoader) {
return RoleListLoader();
}
},
controller : 'RoleListCtrl'
})
.when('/realms/:realm/groups', {
templateUrl : resourceUrl + '/partials/group-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
groups : function(GroupListLoader) {
return GroupListLoader();
}
},
controller : 'GroupListCtrl'
})
.when('/create/group/:realm/parent/:parentId', {
templateUrl : resourceUrl + '/partials/create-group.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
parentId : function($route) {
return $route.current.params.parentId;
}
},
controller : 'GroupCreateCtrl'
})
.when('/realms/:realm/groups/:group', {
templateUrl : resourceUrl + '/partials/group-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
group : function(GroupLoader) {
return GroupLoader();
}
},
controller : 'GroupDetailCtrl'
})
.when('/realms/:realm/groups/:group/attributes', {
templateUrl : resourceUrl + '/partials/group-attributes.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
group : function(GroupLoader) {
return GroupLoader();
}
},
controller : 'GroupDetailCtrl'
})
.when('/realms/:realm/groups/:group/members', {
templateUrl : resourceUrl + '/partials/group-members.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
group : function(GroupLoader) {
return GroupLoader();
}
},
controller : 'GroupMembersCtrl'
})
.when('/realms/:realm/groups/:group/role-mappings', {
templateUrl : resourceUrl + '/partials/group-role-mappings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
group : function(GroupLoader) {
return GroupLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
client : function() {
return {};
}
},
controller : 'GroupRoleMappingCtrl'
})
.when('/realms/:realm/default-groups', {
templateUrl : resourceUrl + '/partials/default-groups.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
groups : function(GroupListLoader) {
return GroupListLoader();
}
},
controller : 'DefaultGroupsCtrl'
})
.when('/create/role/:realm/clients/:client', {
templateUrl : resourceUrl + '/partials/client-role-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
role : function() {
return {};
},
roles : function(RoleListLoader) {
return RoleListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'ClientRoleDetailCtrl'
})
.when('/realms/:realm/clients/:client/roles/:role', {
templateUrl : resourceUrl + '/partials/client-role-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
role : function(ClientRoleLoader) {
return ClientRoleLoader();
},
roles : function(RoleListLoader) {
return RoleListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'ClientRoleDetailCtrl'
})
.when('/realms/:realm/clients/:client/mappers', {
templateUrl : resourceUrl + '/partials/client-mappers.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientProtocolMapperListCtrl'
})
.when('/realms/:realm/clients/:client/add-mappers', {
templateUrl : resourceUrl + '/partials/client-mappers-add.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'AddBuiltinProtocolMapperCtrl'
})
.when('/realms/:realm/clients/:client/mappers/:id', {
templateUrl : resourceUrl + '/partials/client-protocol-mapper-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
mapper : function(ClientProtocolMapperLoader) {
return ClientProtocolMapperLoader();
}
},
controller : 'ClientProtocolMapperCtrl'
})
.when('/create/client/:realm/:client/mappers', {
templateUrl : resourceUrl + '/partials/client-protocol-mapper-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientProtocolMapperCreateCtrl'
})
.when('/realms/:realm/client-templates/:template/mappers', {
templateUrl : resourceUrl + '/partials/client-template-mappers.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
template : function(ClientTemplateLoader) {
return ClientTemplateLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientTemplateProtocolMapperListCtrl'
})
.when('/realms/:realm/client-templates/:template/add-mappers', {
templateUrl : resourceUrl + '/partials/client-template-mappers-add.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
template : function(ClientTemplateLoader) {
return ClientTemplateLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientTemplateAddBuiltinProtocolMapperCtrl'
})
.when('/realms/:realm/client-templates/:template/mappers/:id', {
templateUrl : resourceUrl + '/partials/client-template-protocol-mapper-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
template : function(ClientTemplateLoader) {
return ClientTemplateLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
mapper : function(ClientTemplateProtocolMapperLoader) {
return ClientTemplateProtocolMapperLoader();
}
},
controller : 'ClientTemplateProtocolMapperCtrl'
})
.when('/create/client-template/:realm/:template/mappers', {
templateUrl : resourceUrl + '/partials/client-template-protocol-mapper-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
},
template : function(ClientTemplateLoader) {
return ClientTemplateLoader();
}
},
controller : 'ClientTemplateProtocolMapperCreateCtrl'
})
.when('/realms/:realm/clients/:client/sessions', {
templateUrl : resourceUrl + '/partials/client-sessions.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
sessionCount : function(ClientSessionCountLoader) {
return ClientSessionCountLoader();
}
},
controller : 'ClientSessionsCtrl'
})
.when('/realms/:realm/clients/:client/offline-access', {
templateUrl : resourceUrl + '/partials/client-offline-sessions.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
offlineSessionCount : function(ClientOfflineSessionCountLoader) {
return ClientOfflineSessionCountLoader();
}
},
controller : 'ClientOfflineSessionsCtrl'
})
.when('/realms/:realm/clients/:client/credentials', {
templateUrl : resourceUrl + '/partials/client-credentials.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
clientAuthenticatorProviders : function(ClientAuthenticatorProvidersLoader) {
return ClientAuthenticatorProvidersLoader();
},
clientConfigProperties: function(PerClientAuthenticationConfigDescriptionLoader) {
return PerClientAuthenticationConfigDescriptionLoader();
}
},
controller : 'ClientCredentialsCtrl'
})
.when('/realms/:realm/clients/:client/credentials/client-jwt/:keyType/import/:attribute', {
templateUrl : resourceUrl + '/partials/client-credentials-jwt-key-import.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
callingContext : function() {
return "jwt-credentials";
}
},
controller : 'ClientCertificateImportCtrl'
})
.when('/realms/:realm/clients/:client/credentials/client-jwt/:keyType/export/:attribute', {
templateUrl : resourceUrl + '/partials/client-credentials-jwt-key-export.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
callingContext : function() {
return "jwt-credentials";
}
},
controller : 'ClientCertificateExportCtrl'
})
.when('/realms/:realm/clients/:client/identity-provider', {
templateUrl : resourceUrl + '/partials/client-identity-provider.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientIdentityProviderCtrl'
})
.when('/realms/:realm/clients/:client/clustering', {
templateUrl : resourceUrl + '/partials/client-clustering.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientClusteringCtrl'
})
.when('/register-node/realms/:realm/clients/:client/clustering', {
templateUrl : resourceUrl + '/partials/client-clustering-node.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientClusteringNodeCtrl'
})
.when('/realms/:realm/clients/:client/clustering/:node', {
templateUrl : resourceUrl + '/partials/client-clustering-node.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientClusteringNodeCtrl'
})
.when('/realms/:realm/clients/:client/saml/keys', {
templateUrl : resourceUrl + '/partials/client-saml-keys.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientSamlKeyCtrl'
})
.when('/realms/:realm/clients/:client/saml/:keyType/import/:attribute', {
templateUrl : resourceUrl + '/partials/client-saml-key-import.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
callingContext : function() {
return "saml";
}
},
controller : 'ClientCertificateImportCtrl'
})
.when('/realms/:realm/clients/:client/saml/:keyType/export/:attribute', {
templateUrl : resourceUrl + '/partials/client-saml-key-export.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
callingContext : function() {
return "saml";
}
},
controller : 'ClientCertificateExportCtrl'
})
.when('/realms/:realm/clients/:client/roles', {
templateUrl : resourceUrl + '/partials/client-role-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
roles : function(ClientRoleListLoader) {
return ClientRoleListLoader();
}
},
controller : 'ClientRoleListCtrl'
})
.when('/realms/:realm/clients/:client/revocation', {
templateUrl : resourceUrl + '/partials/client-revocation.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'ClientRevocationCtrl'
})
.when('/realms/:realm/clients/:client/scope-mappings', {
templateUrl : resourceUrl + '/partials/client-scope-mappings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'ClientScopeMappingCtrl'
})
.when('/realms/:realm/clients/:client/installation', {
templateUrl : resourceUrl + '/partials/client-installation.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientInstallationCtrl'
})
.when('/realms/:realm/clients/:client/service-account-roles', {
templateUrl : resourceUrl + '/partials/client-service-account-roles.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
user : function(ClientServiceAccountUserLoader) {
return ClientServiceAccountUserLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
client : function(ClientLoader) {
return ClientLoader();
}
},
controller : 'UserRoleMappingCtrl'
})
.when('/create/client/:realm', {
templateUrl : resourceUrl + '/partials/create-client.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
client : function() {
return {};
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'CreateClientCtrl'
})
.when('/realms/:realm/clients/:client', {
templateUrl : resourceUrl + '/partials/client-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
client : function(ClientLoader) {
return ClientLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientDetailCtrl'
})
.when('/create/client-template/:realm', {
templateUrl : resourceUrl + '/partials/client-template-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
template : function() {
return {};
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientTemplateDetailCtrl'
})
.when('/realms/:realm/client-templates/:template', {
templateUrl : resourceUrl + '/partials/client-template-detail.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
template : function(ClientTemplateLoader) {
return ClientTemplateLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientTemplateDetailCtrl'
})
.when('/realms/:realm/client-templates/:template/scope-mappings', {
templateUrl : resourceUrl + '/partials/client-template-scope-mappings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
template : function(ClientTemplateLoader) {
return ClientTemplateLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'ClientTemplateScopeMappingCtrl'
})
.when('/realms/:realm/clients', {
templateUrl : resourceUrl + '/partials/client-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientListCtrl'
})
.when('/realms/:realm/client-templates', {
templateUrl : resourceUrl + '/partials/client-template-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
templates : function(ClientTemplateListLoader) {
return ClientTemplateListLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientTemplateListCtrl'
})
.when('/import/client/:realm', {
templateUrl : resourceUrl + '/partials/client-import.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ClientImportCtrl'
})
.when('/', {
templateUrl : resourceUrl + '/partials/home.html',
controller : 'HomeCtrl'
})
.when('/mocks/:realm', {
templateUrl : resourceUrl + '/partials/realm-detail_mock.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmDetailCtrl'
})
.when('/realms/:realm/sessions/revocation', {
templateUrl : resourceUrl + '/partials/session-revocation.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmRevocationCtrl'
})
.when('/realms/:realm/sessions/realm', {
templateUrl : resourceUrl + '/partials/session-realm.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
stats : function(RealmClientSessionStatsLoader) {
return RealmClientSessionStatsLoader();
}
},
controller : 'RealmSessionStatsCtrl'
})
.when('/create/user-storage/:realm/providers/:provider', {
templateUrl : resourceUrl + '/partials/user-storage-generic.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function() {
return {
};
},
providerId : function($route) {
return $route.current.params.provider;
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'GenericUserStorageCtrl'
})
.when('/realms/:realm/user-storage/providers/:provider/:componentId', {
templateUrl : resourceUrl + '/partials/user-storage-generic.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function(ComponentLoader) {
return ComponentLoader();
},
providerId : function($route) {
return $route.current.params.provider;
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'GenericUserStorageCtrl'
})
.when('/realms/:realm/user-federation', {
templateUrl : resourceUrl + '/partials/user-federation.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'UserFederationCtrl'
})
.when('/realms/:realm/user-federation/providers/ldap/:instance', {
templateUrl : resourceUrl + '/partials/federated-ldap.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader();
}
},
controller : 'LDAPCtrl'
})
.when('/create/user-federation/:realm/providers/ldap', {
templateUrl : resourceUrl + '/partials/federated-ldap.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function() {
return {};
}
},
controller : 'LDAPCtrl'
})
.when('/realms/:realm/user-federation/providers/kerberos/:instance', {
templateUrl : resourceUrl + '/partials/federated-kerberos.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader();
},
providerFactory : function() {
return { id: "kerberos" };
}
},
controller : 'GenericUserFederationCtrl'
})
.when('/create/user-federation/:realm/providers/kerberos', {
templateUrl : resourceUrl + '/partials/federated-kerberos.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function() {
return {};
},
providerFactory : function() {
return { id: "kerberos" };
}
},
controller : 'GenericUserFederationCtrl'
})
.when('/create/user-federation/:realm/providers/:provider', {
templateUrl : resourceUrl + '/partials/federated-generic.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function() {
return {
};
},
providerFactory : function(UserFederationFactoryLoader) {
return UserFederationFactoryLoader();
}
},
controller : 'GenericUserFederationCtrl'
})
.when('/realms/:realm/user-federation/providers/:provider/:instance', {
templateUrl : resourceUrl + '/partials/federated-generic.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
instance : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader();
},
providerFactory : function(UserFederationFactoryLoader) {
return UserFederationFactoryLoader();
}
},
controller : 'GenericUserFederationCtrl'
})
.when('/realms/:realm/user-federation/providers/:provider/:instance/mappers', {
templateUrl : function(params){ return resourceUrl + '/partials/federated-mappers.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
provider : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader();
},
mapperTypes : function(UserFederationMapperTypesLoader) {
return UserFederationMapperTypesLoader();
},
mappers : function(UserFederationMappersLoader) {
return UserFederationMappersLoader();
}
},
controller : 'UserFederationMapperListCtrl'
})
.when('/realms/:realm/user-federation/providers/:provider/:instance/mappers/:mapperId', {
templateUrl : function(params){ return resourceUrl + '/partials/federated-mapper-detail.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
provider : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader();
},
mapperTypes : function(UserFederationMapperTypesLoader) {
return UserFederationMapperTypesLoader();
},
mapper : function(UserFederationMapperLoader) {
return UserFederationMapperLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'UserFederationMapperCtrl'
})
.when('/create/user-federation-mappers/:realm/:provider/:instance', {
templateUrl : function(params){ return resourceUrl + '/partials/federated-mapper-detail.html'; },
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
provider : function(UserFederationInstanceLoader) {
return UserFederationInstanceLoader();
},
mapperTypes : function(UserFederationMapperTypesLoader) {
return UserFederationMapperTypesLoader();
},
clients : function(ClientListLoader) {
return ClientListLoader();
}
},
controller : 'UserFederationMapperCreateCtrl'
})
.when('/realms/:realm/defense/headers', {
templateUrl : resourceUrl + '/partials/defense-headers.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'DefenseHeadersCtrl'
})
.when('/realms/:realm/defense/brute-force', {
templateUrl : resourceUrl + '/partials/brute-force.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'RealmBruteForceCtrl'
})
.when('/realms/:realm/protocols', {
templateUrl : resourceUrl + '/partials/protocol-list.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ProtocolListCtrl'
})
.when('/realms/:realm/authentication/flows', {
templateUrl : resourceUrl + '/partials/authentication-flows.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
flows : function(AuthenticationFlowsLoader) {
return AuthenticationFlowsLoader();
},
selectedFlow : function() {
return null;
}
},
controller : 'AuthenticationFlowsCtrl'
})
.when('/realms/:realm/authentication/flow-bindings', {
templateUrl : resourceUrl + '/partials/authentication-flow-bindings.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
flows : function(AuthenticationFlowsLoader) {
return AuthenticationFlowsLoader();
},
serverInfo : function(ServerInfo) {
return ServerInfo.delay;
}
},
controller : 'RealmFlowBindingCtrl'
})
.when('/realms/:realm/authentication/flows/:flow', {
templateUrl : resourceUrl + '/partials/authentication-flows.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
flows : function(AuthenticationFlowsLoader) {
return AuthenticationFlowsLoader();
},
selectedFlow : function($route) {
return $route.current.params.flow;
}
},
controller : 'AuthenticationFlowsCtrl'
})
.when('/realms/:realm/authentication/flows/:flow/create/execution/:topFlow', {
templateUrl : resourceUrl + '/partials/create-execution.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
topFlow: function($route) {
return $route.current.params.topFlow;
},
parentFlow : function(AuthenticationFlowLoader) {
return AuthenticationFlowLoader();
},
formActionProviders : function(AuthenticationFormActionProvidersLoader) {
return AuthenticationFormActionProvidersLoader();
},
authenticatorProviders : function(AuthenticatorProvidersLoader) {
return AuthenticatorProvidersLoader();
},
clientAuthenticatorProviders : function(ClientAuthenticatorProvidersLoader) {
return ClientAuthenticatorProvidersLoader();
}
},
controller : 'CreateExecutionCtrl'
})
.when('/realms/:realm/authentication/flows/:flow/create/flow/execution/:topFlow', {
templateUrl : resourceUrl + '/partials/create-flow-execution.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
topFlow: function($route) {
return $route.current.params.topFlow;
},
parentFlow : function(AuthenticationFlowLoader) {
return AuthenticationFlowLoader();
},
formProviders : function(AuthenticationFormProvidersLoader) {
return AuthenticationFormProvidersLoader();
}
},
controller : 'CreateExecutionFlowCtrl'
})
.when('/realms/:realm/authentication/create/flow', {
templateUrl : resourceUrl + '/partials/create-flow.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
}
},
controller : 'CreateFlowCtrl'
})
.when('/realms/:realm/authentication/required-actions', {
templateUrl : resourceUrl + '/partials/required-actions.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
unregisteredRequiredActions : function(UnregisteredRequiredActionsListLoader) {
return UnregisteredRequiredActionsListLoader();
}
},
controller : 'RequiredActionsCtrl'
})
.when('/realms/:realm/authentication/password-policy', {
templateUrl : resourceUrl + '/partials/password-policy.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'RealmPasswordPolicyCtrl'
})
.when('/realms/:realm/authentication/otp-policy', {
templateUrl : resourceUrl + '/partials/otp-policy.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
serverInfo : function(ServerInfo) {
return ServerInfo.delay;
}
},
controller : 'RealmOtpPolicyCtrl'
})
.when('/realms/:realm/authentication/flows/:flow/config/:provider/:config', {
templateUrl : resourceUrl + '/partials/authenticator-config.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
flow : function(AuthenticationFlowLoader) {
return AuthenticationFlowLoader();
},
configType : function(AuthenticationConfigDescriptionLoader) {
return AuthenticationConfigDescriptionLoader();
},
config : function(AuthenticationConfigLoader) {
return AuthenticationConfigLoader();
}
},
controller : 'AuthenticationConfigCtrl'
})
.when('/create/authentication/:realm/flows/:flow/execution/:executionId/provider/:provider', {
templateUrl : resourceUrl + '/partials/authenticator-config.html',
resolve : {
realm : function(RealmLoader) {
return RealmLoader();
},
flow : function(AuthenticationFlowLoader) {
return AuthenticationFlowLoader();
},
configType : function(AuthenticationConfigDescriptionLoader) {
return AuthenticationConfigDescriptionLoader();
},
execution : function(ExecutionIdLoader) {
return ExecutionIdLoader();
}
},
controller : 'AuthenticationConfigCreateCtrl'
})
.when('/server-info', {
templateUrl : resourceUrl + '/partials/server-info.html',
resolve : {
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ServerInfoCtrl'
})
.when('/server-info/providers', {
templateUrl : resourceUrl + '/partials/server-info-providers.html',
resolve : {
serverInfo : function(ServerInfoLoader) {
return ServerInfoLoader();
}
},
controller : 'ServerInfoCtrl'
})
.when('/logout', {
templateUrl : resourceUrl + '/partials/home.html',
controller : 'LogoutCtrl'
})
.when('/notfound', {
templateUrl : resourceUrl + '/partials/notfound.html'
})
.when('/forbidden', {
templateUrl : resourceUrl + '/partials/forbidden.html'
})
.otherwise({
templateUrl : resourceUrl + '/partials/pagenotfound.html'
});
} ]);
module.config(function($httpProvider) {
$httpProvider.interceptors.push('errorInterceptor');
var spinnerFunction = function(data, headersGetter) {
if (resourceRequests == 0) {
loadingTimer = window.setTimeout(function() {
$('#loading').show();
loadingTimer = -1;
}, 500);
}
resourceRequests++;
return data;
};
$httpProvider.defaults.transformRequest.push(spinnerFunction);
$httpProvider.interceptors.push('spinnerInterceptor');
$httpProvider.interceptors.push('authInterceptor');
});
module.factory('spinnerInterceptor', function($q, $window, $rootScope, $location) {
return {
response: function(response) {
resourceRequests--;
if (resourceRequests == 0) {
if(loadingTimer != -1) {
window.clearTimeout(loadingTimer);
loadingTimer = -1;
}
$('#loading').hide();
}
return response;
},
responseError: function(response) {
resourceRequests--;
if (resourceRequests == 0) {
if(loadingTimer != -1) {
window.clearTimeout(loadingTimer);
loadingTimer = -1;
}
$('#loading').hide();
}
return $q.reject(response);
}
};
});
module.factory('errorInterceptor', function($q, $window, $rootScope, $location, Notifications, Auth) {
return {
response: function(response) {
return response;
},
responseError: function(response) {
if (response.status == 401) {
Auth.authz.logout();
} else if (response.status == 403) {
$location.path('/forbidden');
} else if (response.status == 404) {
$location.path('/notfound');
} else if (response.status) {
if (response.data && response.data.errorMessage) {
Notifications.error(response.data.errorMessage);
} else {
Notifications.error("An unexpected server error has occurred");
}
}
return $q.reject(response);
}
};
});
// collapsable form fieldsets
module.directive('collapsable', function() {
return function(scope, element, attrs) {
element.click(function() {
$(this).toggleClass('collapsed');
$(this).find('.toggle-icons').toggleClass('kc-icon-collapse').toggleClass('kc-icon-expand');
$(this).find('.toggle-icons').text($(this).text() == "Icon: expand" ? "Icon: collapse" : "Icon: expand");
$(this).parent().find('.form-group').toggleClass('hidden');
});
}
});
// collapsable form fieldsets
module.directive('uncollapsed', function() {
return function(scope, element, attrs) {
element.prepend('<i class="toggle-class fa fa-angle-down"></i> ');
element.click(function() {
$(this).find('.toggle-class').toggleClass('fa-angle-down').toggleClass('fa-angle-right');
$(this).parent().find('.form-group').toggleClass('hidden');
});
}
});
// collapsable form fieldsets
module.directive('collapsed', function() {
return function(scope, element, attrs) {
element.prepend('<i class="toggle-class fa fa-angle-right"></i> ');
element.parent().find('.form-group').toggleClass('hidden');
element.click(function() {
$(this).find('.toggle-class').toggleClass('fa-angle-down').toggleClass('fa-angle-right');
$(this).parent().find('.form-group').toggleClass('hidden');
});
}
});
/**
* Directive for presenting an ON-OFF switch for checkbox.
* Usage: <input ng-model="mmm" name="nnn" id="iii" onoffswitch [on-text="ooo" off-text="fff"] />
*/
module.directive('onoffswitch', function() {
return {
restrict: "EA",
replace: true,
scope: {
name: '@',
id: '@',
ngModel: '=',
ngDisabled: '=',
kcOnText: '@onText',
kcOffText: '@offText'
},
// TODO - The same code acts differently when put into the templateURL. Find why and move the code there.
//templateUrl: "templates/kc-switch.html",
template: "<span><div class='onoffswitch' tabindex='0'><input type='checkbox' ng-model='ngModel' ng-disabled='ngDisabled' class='onoffswitch-checkbox' name='{{name}}' id='{{id}}'><label for='{{id}}' class='onoffswitch-label'><span class='onoffswitch-inner'><span class='onoffswitch-active'>{{kcOnText}}</span><span class='onoffswitch-inactive'>{{kcOffText}}</span></span><span class='onoffswitch-switch'></span></label></div></span>",
compile: function(element, attrs) {
/*
We don't want to propagate basic attributes to the root element of directive. Id should be passed to the
input element only to achieve proper label binding (and validity).
*/
element.removeAttr('name');
element.removeAttr('id');
if (!attrs.onText) { attrs.onText = "ON"; }
if (!attrs.offText) { attrs.offText = "OFF"; }
element.bind('keydown', function(e){
var code = e.keyCode || e.which;
if (code === 32 || code === 13) {
e.stopImmediatePropagation();
e.preventDefault();
$(e.target).find('input').click();
}
});
}
}
});
/**
* Directive for presenting an ON-OFF switch for checkbox. The directive expects the value to be string 'true' or 'false', not boolean true/false
* This directive provides some additional capabilities to the default onoffswitch such as:
*
* - Dynamic values for id and name attributes. Useful if you need to use this directive inside a ng-repeat
* - Specific scope to specify the value. Instead of just true or false.
*
* Usage: <input ng-model="mmm" name="nnn" id="iii" kc-onoffswitch-model [on-text="ooo" off-text="fff"] />
*/
module.directive('onoffswitchstring', function() {
return {
restrict: "EA",
replace: true,
scope: {
name: '=',
id: '=',
value: '=',
ngModel: '=',
ngDisabled: '=',
kcOnText: '@onText',
kcOffText: '@offText'
},
// TODO - The same code acts differently when put into the templateURL. Find why and move the code there.
//templateUrl: "templates/kc-switch.html",
template: '<span><div class="onoffswitch" tabindex="0"><input type="checkbox" ng-true-value="\'true\'" ng-false-value="\'false\'" ng-model="ngModel" ng-disabled="ngDisabled" class="onoffswitch-checkbox" name="kc{{name}}" id="kc{{id}}"><label for="kc{{id}}" class="onoffswitch-label"><span class="onoffswitch-inner"><span class="onoffswitch-active">{{kcOnText}}</span><span class="onoffswitch-inactive">{{kcOffText}}</span></span><span class="onoffswitch-switch"></span></label></div></span>',
compile: function(element, attrs) {
if (!attrs.onText) { attrs.onText = "ON"; }
if (!attrs.offText) { attrs.offText = "OFF"; }
element.bind('keydown click', function(e){
var code = e.keyCode || e.which;
if (code === 32 || code === 13) {
e.stopImmediatePropagation();
e.preventDefault();
$(e.target).find('input').click();
}
});
}
}
});
/**
* Directive for presenting an ON-OFF switch for checkbox. The directive expects the true-value or false-value to be string like 'true' or 'false', not boolean true/false.
* This directive provides some additional capabilities to the default onoffswitch such as:
*
* - Specific scope to specify the value. Instead of just 'true' or 'false' you can use any other values. For example: true-value="'foo'" false-value="'bar'" .
* But 'true'/'false' are defaults if true-value and false-value are not specified
*
* Usage: <input ng-model="mmm" name="nnn" id="iii" onoffswitchvalue [ true-value="'true'" false-value="'false'" on-text="ooo" off-text="fff"] />
*/
module.directive('onoffswitchvalue', function() {
return {
restrict: "EA",
replace: true,
scope: {
name: '@',
id: '@',
trueValue: '@',
falseValue: '@',
ngModel: '=',
ngDisabled: '=',
kcOnText: '@onText',
kcOffText: '@offText'
},
// TODO - The same code acts differently when put into the templateURL. Find why and move the code there.
//templateUrl: "templates/kc-switch.html",
template: "<span><div class='onoffswitch' tabindex='0'><input type='checkbox' ng-true-value='{{trueValue}}' ng-false-value='{{falseValue}}' ng-model='ngModel' ng-disabled='ngDisabled' class='onoffswitch-checkbox' name='{{name}}' id='{{id}}'><label for='{{id}}' class='onoffswitch-label'><span class='onoffswitch-inner'><span class='onoffswitch-active'>{{kcOnText}}</span><span class='onoffswitch-inactive'>{{kcOffText}}</span></span><span class='onoffswitch-switch'></span></label></div></span>",
compile: function(element, attrs) {
/*
We don't want to propagate basic attributes to the root element of directive. Id should be passed to the
input element only to achieve proper label binding (and validity).
*/
element.removeAttr('name');
element.removeAttr('id');
if (!attrs.trueValue) { attrs.trueValue = "'true'"; }
if (!attrs.falseValue) { attrs.falseValue = "'false'"; }
if (!attrs.onText) { attrs.onText = "ON"; }
if (!attrs.offText) { attrs.offText = "OFF"; }
element.bind('keydown', function(e){
var code = e.keyCode || e.which;
if (code === 32 || code === 13) {
e.stopImmediatePropagation();
e.preventDefault();
$(e.target).find('input').click();
}
});
}
}
});
module.directive('kcInput', function() {
var d = {
scope : true,
replace : false,
link : function(scope, element, attrs) {
var form = element.children('form');
var label = element.children('label');
var input = element.children('input');
var id = form.attr('name') + '.' + input.attr('name');
element.attr('class', 'control-group');
label.attr('class', 'control-label');
label.attr('for', id);
input.wrap('<div class="controls"/>');
input.attr('id', id);
if (!input.attr('placeHolder')) {
input.attr('placeHolder', label.text());
}
if (input.attr('required')) {
label.append(' <span class="required">*</span>');
}
}
};
return d;
});
module.directive('kcEnter', function() {
return function(scope, element, attrs) {
element.bind("keydown keypress", function(event) {
if (event.which === 13) {
scope.$apply(function() {
scope.$eval(attrs.kcEnter);
});
event.preventDefault();
}
});
};
});
module.directive('kcSave', function ($compile, Notifications) {
return {
restrict: 'A',
link: function ($scope, elem, attr, ctrl) {
elem.addClass("btn btn-primary");
elem.attr("type","submit");
elem.bind('click', function() {
$scope.$apply(function() {
var form = elem.closest('form');
if (form && form.attr('name')) {
var ngValid = form.find('.ng-valid');
if ($scope[form.attr('name')].$valid) {
//ngValid.removeClass('error');
ngValid.parent().removeClass('has-error');
$scope['save']();
} else {
Notifications.error("Missing or invalid field(s). Please verify the fields in red.")
//ngValid.removeClass('error');
ngValid.parent().removeClass('has-error');
var ngInvalid = form.find('.ng-invalid');
//ngInvalid.addClass('error');
ngInvalid.parent().addClass('has-error');
}
}
});
})
}
}
});
module.directive('kcReset', function ($compile, Notifications) {
return {
restrict: 'A',
link: function ($scope, elem, attr, ctrl) {
elem.addClass("btn btn-default");
elem.attr("type","submit");
elem.bind('click', function() {
$scope.$apply(function() {
var form = elem.closest('form');
if (form && form.attr('name')) {
form.find('.ng-valid').removeClass('error');
form.find('.ng-invalid').removeClass('error');
$scope['reset']();
}
})
})
}
}
});
module.directive('kcCancel', function ($compile, Notifications) {
return {
restrict: 'A',
link: function ($scope, elem, attr, ctrl) {
elem.addClass("btn btn-default");
elem.attr("type","submit");
}
}
});
module.directive('kcDelete', function ($compile, Notifications) {
return {
restrict: 'A',
link: function ($scope, elem, attr, ctrl) {
elem.addClass("btn btn-danger");
elem.attr("type","submit");
}
}
});
module.directive('kcDropdown', function ($compile, Notifications) {
return {
scope: {
kcOptions: '=',
kcModel: '=',
id: "=",
kcPlaceholder: '@'
},
restrict: 'EA',
replace: true,
templateUrl: resourceUrl + '/templates/kc-select.html',
link: function(scope, element, attr) {
scope.updateModel = function(item) {
scope.kcModel = item;
};
}
}
});
module.directive('kcReadOnly', function() {
var disabled = {};
var d = {
replace : false,
link : function(scope, element, attrs) {
var disable = function(i, e) {
if (!e.disabled) {
disabled[e.tagName + i] = true;
e.disabled = true;
}
}
var enable = function(i, e) {
if (disabled[e.tagName + i]) {
e.disabled = false;
delete disabled[i];
}
}
var filterIgnored = function(i, e){
return !e.attributes['kc-read-only-ignore'];
}
scope.$watch(attrs.kcReadOnly, function(readOnly) {
if (readOnly) {
element.find('input').filter(filterIgnored).each(disable);
element.find('button').filter(filterIgnored).each(disable);
element.find('select').filter(filterIgnored).each(disable);
element.find('textarea').filter(filterIgnored).each(disable);
} else {
element.find('input').filter(filterIgnored).each(enable);
element.find('input').filter(filterIgnored).each(enable);
element.find('button').filter(filterIgnored).each(enable);
element.find('select').filter(filterIgnored).each(enable);
element.find('textarea').filter(filterIgnored).each(enable);
}
});
}
};
return d;
});
module.directive('kcMenu', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-menu.html'
}
});
module.directive('kcTabsRealm', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-realm.html'
}
});
module.directive('kcTabsAuthentication', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-authentication.html'
}
});
module.directive('kcTabsUser', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-user.html'
}
});
module.directive('kcTabsGroup', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-group.html'
}
});
module.directive('kcTabsGroupList', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-group-list.html'
}
});
module.directive('kcTabsClient', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-client.html'
}
});
module.directive('kcTabsClientTemplate', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-client-template.html'
}
});
module.directive('kcNavigationUser', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-navigation-user.html'
}
});
module.directive('kcTabsIdentityProvider', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-identity-provider.html'
}
});
module.directive('kcTabsUserFederation', function () {
return {
scope: true,
restrict: 'E',
replace: true,
templateUrl: resourceUrl + '/templates/kc-tabs-user-federation.html'
}
});
module.controller('RoleSelectorModalCtrl', function($scope, realm, config, configName, RealmRoles, Client, ClientRole, $modalInstance) {
$scope.selectedRealmRole = {
role: undefined
};
$scope.selectedClientRole = {
role: undefined
};
$scope.client = {
selected: undefined
};
$scope.selectRealmRole = function() {
config[configName] = $scope.selectedRealmRole.role.name;
$modalInstance.close();
}
$scope.selectClientRole = function() {
config[configName] = $scope.client.selected.clientId + "." + $scope.selectedClientRole.role.name;
$modalInstance.close();
}
$scope.cancel = function() {
$modalInstance.dismiss();
}
$scope.changeClient = function() {
if ($scope.client.selected) {
ClientRole.query({realm: realm.realm, client: $scope.client.selected.id}, function (data) {
$scope.clientRoles = data;
});
} else {
console.log('selected client was null');
$scope.clientRoles = null;
}
}
RealmRoles.query({realm: realm.realm}, function(data) {
$scope.realmRoles = data;
})
Client.query({realm: realm.realm}, function(data) {
$scope.clients = data;
if (data.length > 0) {
$scope.client.selected = data[0];
$scope.changeClient();
}
})
});
module.controller('ProviderConfigCtrl', function ($modal, $scope) {
$scope.openRoleSelector = function (configName, config) {
$modal.open({
templateUrl: resourceUrl + '/partials/modal/role-selector.html',
controller: 'RoleSelectorModalCtrl',
resolve: {
realm: function () {
return $scope.realm;
},
config: function () {
return config;
},
configName: function () {
return configName;
}
}
})
}
});
module.directive('kcProviderConfig', function ($modal) {
return {
scope: {
config: '=',
properties: '=',
realm: '=',
clients: '=',
configName: '='
},
restrict: 'E',
replace: true,
controller: 'ProviderConfigCtrl',
templateUrl: resourceUrl + '/templates/kc-provider-config.html'
}
});
module.controller('ComponentRoleSelectorModalCtrl', function($scope, realm, config, configName, RealmRoles, Client, ClientRole, $modalInstance) {
$scope.selectedRealmRole = {
role: undefined
};
$scope.selectedClientRole = {
role: undefined
};
$scope.client = {
selected: undefined
};
$scope.selectRealmRole = function() {
config[configName][0] = $scope.selectedRealmRole.role.name;
$modalInstance.close();
}
$scope.selectClientRole = function() {
config[configName][0] = $scope.client.selected.clientId + "." + $scope.selectedClientRole.role.name;
$modalInstance.close();
}
$scope.cancel = function() {
$modalInstance.dismiss();
}
$scope.changeClient = function() {
if ($scope.client.selected) {
ClientRole.query({realm: realm.realm, client: $scope.client.selected.id}, function (data) {
$scope.clientRoles = data;
});
} else {
console.log('selected client was null');
$scope.clientRoles = null;
}
}
RealmRoles.query({realm: realm.realm}, function(data) {
$scope.realmRoles = data;
})
Client.query({realm: realm.realm}, function(data) {
$scope.clients = data;
if (data.length > 0) {
$scope.client.selected = data[0];
$scope.changeClient();
}
})
});
module.controller('ComponentConfigCtrl', function ($modal, $scope) {
$scope.openRoleSelector = function (configName, config) {
$modal.open({
templateUrl: resourceUrl + '/partials/modal/component-role-selector.html',
controller: 'ComponentRoleSelectorModalCtrl',
resolve: {
realm: function () {
return $scope.realm;
},
config: function () {
return config;
},
configName: function () {
return configName;
}
}
})
}
});
module.directive('kcComponentConfig', function ($modal) {
return {
scope: {
config: '=',
properties: '=',
realm: '=',
clients: '=',
configName: '='
},
restrict: 'E',
replace: true,
controller: 'ComponentConfigCtrl',
templateUrl: resourceUrl + '/templates/kc-component-config.html'
}
});
/*
* Used to select the element (invoke $(elem).select()) on specified action list.
* Usages kc-select-action="click mouseover"
* When used in the textarea element, this will select/highlight the textarea content on specified action (i.e. click).
*/
module.directive('kcSelectAction', function ($compile, Notifications) {
return {
restrict: 'A',
compile: function (elem, attrs) {
var events = attrs.kcSelectAction.split(" ");
for(var i=0; i < events.length; i++){
elem.bind(events[i], function(){
elem.select();
});
}
}
}
});
module.filter('remove', function() {
return function(input, remove, attribute) {
if (!input || !remove) {
return input;
}
var out = [];
for ( var i = 0; i < input.length; i++) {
var e = input[i];
if (Array.isArray(remove)) {
for (var j = 0; j < remove.length; j++) {
if (attribute) {
if (remove[j][attribute] == e[attribute]) {
e = null;
break;
}
} else {
if (remove[j] == e) {
e = null;
break;
}
}
}
} else {
if (attribute) {
if (remove[attribute] == e[attribute]) {
e = null;
}
} else {
if (remove == e) {
e = null;
}
}
}
if (e != null) {
out.push(e);
}
}
return out;
};
});
module.filter('capitalize', function() {
return function(input) {
if (!input) {
return;
}
var splittedWords = input.split(/\s+/);
for (var i=0; i<splittedWords.length ; i++) {
splittedWords[i] = splittedWords[i].charAt(0).toUpperCase() + splittedWords[i].slice(1);
};
return splittedWords.join(" ");
};
});
/*
* Guarantees a deterministic property iteration order.
* See: http://www.2ality.com/2015/10/property-traversal-order-es6.html
*/
module.filter('toOrderedMapSortedByKey', function(){
return function(input){
if(!input){
return input;
}
var keys = Object.keys(input);
if(keys.length <= 1){
return input;
}
keys.sort();
var result = {};
for (var i = 0; i < keys.length; i++) {
result[keys[i]] = input[keys[i]];
}
return result;
};
});
module.directive('kcSidebarResize', function ($window) {
return function (scope, element) {
function resize() {
var navBar = angular.element(document.getElementsByClassName('navbar-pf')).height();
var container = angular.element(document.getElementById("view").getElementsByTagName("div")[0]).height();
var height = Math.max(container, window.innerHeight - navBar - 3);
element[0].style['min-height'] = height + 'px';
}
resize();
var w = angular.element($window);
scope.$watch(function () {
return {
'h': window.innerHeight,
'w': window.innerWidth
};
}, function () {
resize();
}, true);
w.bind('resize', function () {
scope.$apply();
});
}
});
module.directive('kcTooltip', function($compile) {
return {
restrict: 'E',
replace: false,
terminal: true,
priority: 1000,
link: function link(scope,element, attrs) {
var angularElement = angular.element(element[0]);
var tooltip = angularElement.text();
angularElement.text('');
element.addClass('hidden');
var label = angular.element(element.parent().children()[0]);
label.append(' <i class="fa fa-question-circle text-muted" tooltip="' + tooltip + '" tooltip-placement="right" tooltip-trigger="mouseover mouseout"></i>');
$compile(label)(scope);
}
};
});
module.directive( 'kcOpen', function ( $location ) {
return function ( scope, element, attrs ) {
var path;
attrs.$observe( 'kcOpen', function (val) {
path = val;
});
element.bind( 'click', function () {
scope.$apply( function () {
$location.path(path);
});
});
};
});
module.directive('kcOnReadFile', function ($parse) {
console.debug('kcOnReadFile');
return {
restrict: 'A',
scope: false,
link: function(scope, element, attrs) {
var fn = $parse(attrs.kcOnReadFile);
element.on('change', function(onChangeEvent) {
var reader = new FileReader();
reader.onload = function(onLoadEvent) {
scope.$apply(function() {
fn(scope, {$fileContent:onLoadEvent.target.result});
});
};
reader.readAsText((onChangeEvent.srcElement || onChangeEvent.target).files[0]);
});
}
};
});
| wildfly-security-incubator/keycloak | themes/src/main/resources/theme/base/admin/resources/js/app.js | JavaScript | apache-2.0 | 99,144 |
/* jshint sub: true */
/* global exports: true */
'use strict';
// //////////////////////////////////////////////////////////////////////////////
// / @brief node-request-style HTTP requests
// /
// / @file
// /
// / DISCLAIMER
// /
// / Copyright 2015 triAGENS GmbH, Cologne, Germany
// /
// / 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.
// /
// / Copyright holder is triAGENS GmbH, Cologne, Germany
// /
// / @author Alan Plum
// / @author Copyright 2015, triAGENS GmbH, Cologne, Germany
// //////////////////////////////////////////////////////////////////////////////
const internal = require('internal');
const Buffer = require('buffer').Buffer;
const extend = require('lodash').extend;
const httperr = require('http-errors');
const is = require('@arangodb/is');
const querystring = require('querystring');
const qs = require('qs');
const url = require('url');
class Response {
throw (msg) {
if (this.status >= 400) {
throw Object.assign(
httperr(this.status, msg || this.message),
{details: this}
);
}
}
constructor (res, encoding, json) {
this.status = this.statusCode = res.code;
this.message = res.message;
this.headers = res.headers ? res.headers : {};
this.body = this.rawBody = res.body;
if (this.body && encoding !== null) {
this.body = this.body.toString(encoding || 'utf-8');
if (json) {
try {
this.json = JSON.parse(this.body);
} catch (e) {
this.json = undefined;
}
}
}
}
}
function querystringify (query, useQuerystring) {
if (!query) {
return '';
}
if (typeof query === 'string') {
return query.charAt(0) === '?' ? query.slice(1) : query;
}
return (useQuerystring ? querystring : qs).stringify(query)
.replace(/[!'()*]/g, function (c) {
// Stricter RFC 3986 compliance
return '%' + c.charCodeAt(0).toString(16);
});
}
function request (req) {
if (typeof req === 'string') {
req = {url: req, method: 'GET'};
}
let path = req.url || req.uri;
if (!path) {
throw new Error('Request URL must not be empty.');
}
let pathObj = typeof path === 'string' ? url.parse(path) : path;
if (pathObj.auth) {
let auth = pathObj.auth.split(':');
req = extend({
auth: {
username: decodeURIComponent(auth[0]),
password: decodeURIComponent(auth[1])
}
}, req);
delete pathObj.auth;
}
let query = typeof req.qs === 'string' ? req.qs : querystringify(req.qs, req.useQuerystring);
if (query) {
pathObj.search = query;
}
path = url.format(pathObj);
let contentType;
let body = req.body;
if (req.json) {
body = JSON.stringify(body);
contentType = 'application/json';
} else if (typeof body === 'string') {
contentType = 'text/plain; charset=utf-8';
} else if (typeof body === 'object' && body instanceof Buffer) {
contentType = 'application/octet-stream';
} else if (!body) {
if (req.form) {
contentType = 'application/x-www-form-urlencoded';
body = typeof req.form === 'string' ? req.form : querystringify(req.form, req.useQuerystring);
} else if (req.formData) {
// contentType = 'multipart/form-data'
// body = formData(req.formData)
throw new Error('Multipart form encoding is currently not supported.');
} else if (req.multipart) {
// contentType = 'multipart/related'
// body = multipart(req.multipart)
throw new Error('Multipart encoding is currently not supported.');
}
}
const headers = {};
if (contentType) {
headers['content-type'] = contentType;
}
if (req.headers) {
Object.keys(req.headers).forEach(function (name) {
headers[name.toLowerCase()] = req.headers[name];
});
}
if (req.auth) {
headers['authorization'] = ( // eslint-disable-line dot-notation
req.auth.bearer ?
'Bearer ' + req.auth.bearer :
'Basic ' + new Buffer(
req.auth.username + ':' +
req.auth.password
).toString('base64')
);
}
let options = {
method: (req.method || 'get').toUpperCase(),
headers: headers,
returnBodyAsBuffer: true,
returnBodyOnError: req.returnBodyOnError !== false
};
if (is.existy(req.timeout)) {
options.timeout = req.timeout;
}
if (is.existy(req.followRedirect)) {
options.followRedirects = req.followRedirect; // [sic] node-request compatibility
}
if (is.existy(req.maxRedirects)) {
options.maxRedirects = req.maxRedirects;
} else {
options.maxRedirects = 10;
}
if (req.sslProtocol) {
options.sslProtocol = req.sslProtocol;
}
let result = internal.download(path, body, options);
return new Response(result, req.encoding, req.json);
}
exports = request;
exports.request = request;
exports.Response = Response;
['delete', 'get', 'head', 'patch', 'post', 'put']
.forEach(function (method) {
exports[method.toLowerCase()] = function (url, options) {
if (typeof url === 'object') {
options = url;
url = undefined;
} else if (typeof url === 'string') {
options = extend({}, options, {url: url});
}
return request(extend({method: method.toUpperCase()}, options));
};
});
module.exports = exports;
| baslr/ArangoDB | js/common/modules/@arangodb/request.js | JavaScript | apache-2.0 | 5,781 |
/**
* Created by plter on 6/13/16.
*/
(function () {
var files = ["hello.js", "app.js"];
files.forEach(function (file) {
var scriptTag = document.createElement("script");
scriptTag.async = false;
scriptTag.src = file;
document.body.appendChild(scriptTag);
});
}()); | plter/HTML5Course20160612 | 20160613/LoadScript/loader.js | JavaScript | apache-2.0 | 315 |
var interfaceorg_1_1onosproject_1_1grpc_1_1Port_1_1PortStatisticsOrBuilder =
[
[ "getPacketsReceived", "interfaceorg_1_1onosproject_1_1grpc_1_1Port_1_1PortStatisticsOrBuilder.html#a190993a33fa895f9d07145f3a04f5d22", null ],
[ "getPacketsSent", "interfaceorg_1_1onosproject_1_1grpc_1_1Port_1_1PortStatisticsOrBuilder.html#ae9a71f2c48c5430a348eba326eb6d112", null ],
[ "getPort", "interfaceorg_1_1onosproject_1_1grpc_1_1Port_1_1PortStatisticsOrBuilder.html#af9c20290d571c3f0b6bf99f28ffc4005", null ]
]; | onosfw/apis | onos/apis/interfaceorg_1_1onosproject_1_1grpc_1_1Port_1_1PortStatisticsOrBuilder.js | JavaScript | apache-2.0 | 512 |
define([
"settings",
"views/tags"
], function(panelSettings, TagsView) {
var PanelFileView = codebox.require("views/panels/file");
var PanelOutlineView = PanelFileView.extend({
className: "cb-panel-outline",
FileView: TagsView
});
return PanelOutlineView;
}); | cethap/cbcompiled | addons/cb.panel.outline/views/panel.js | JavaScript | apache-2.0 | 301 |
define(["Log","FS"],function (Log,FS) {//MODJSL
return function showErrorPos(elem, err) {
var mesg, src, pos;
if (!err) {
close();
return;
}
var row,col;
if (err.isTError) {
mesg=err.mesg;
src=err.src;
pos=err.pos;
row=err.row+1;
col=err.col+1;
} else {
src={name:function (){return "不明";},text:function () {
return null;
}};
pos=0;
mesg=err;
}
function close(){
elem.empty();
}
if(typeof pos=="object") {row=pos.row; col=pos.col;}
close();
var mesgd=$("<div>").text(mesg+" 場所:"+src.name()+(typeof row=="number"?":"+row+":"+col:""));
//mesgd.append($("<button>").text("閉じる").click(close));
elem.append(mesgd);
elem.append($("<div>").attr("class","quickFix"));
console.log("src=",src);
var str=src.text();
if (str && typeof pos=="object") {
var npos=0;
var lines=str.split(/\n/);
for (var i=0 ; i<lines.length && i+1<pos.row ; i++) {
npos+=lines[i].length;
}
npos+=pos.col;
pos=npos;
}
var srcd=$("<pre>");
srcd.append($("<span>").text(str.substring(0,pos)));
srcd.append($("<img>").attr("src",FS.expandPath("${sampleImg}/ecl.png")));//MODJSL
srcd.append($("<span>").text(str.substring(pos)));
elem.append(srcd);
//elem.attr("title",mesg+" 場所:"+src.name());
elem.attr("title","エラー");
var diag=elem.dialog({width:600,height:400});
Log.d("error", mesg+"\nat "+src+":"+err.pos+"\n"+str.substring(0,err.pos)+"##HERE##"+str.substring(err.pos));
return diag;
};
}); | hoge1e3/tonyuedit | war/js/ide/ErrorPos.js | JavaScript | apache-2.0 | 1,670 |
/*
* JBoss, Home of Professional Open Source.
* Copyright 2014-2020 Red Hat, Inc., and individual contributors
* as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
(function () {
'use strict';
var module = angular.module('pnc.common.restclient', [
'ngResource',
'pnc.common.util',
]);
// TODO: Remove this unnecessary layer of indirection.
module.factory('REST_BASE_URL', [
'restConfig',
function(restConfig) {
return restConfig.getPncUrl();
}
]);
module.factory('REST_BASE_REST_URL', [
'restConfig',
function(restConfig) {
return restConfig.getPncRestUrl();
}
]);
})();
| matedo1/pnc | ui/app/common/restclient/restclient.module.js | JavaScript | apache-2.0 | 1,179 |
HB.RadioButtonComponent = Ember.Component.extend({
tagName: 'input',
type: 'radio',
attributeBindings: ['type', 'htmlChecked:checked', 'value', 'name'],
htmlChecked: function(){
return this.get('value') === this.get('checked');
}.property('value', 'checked'),
change: function(){
this.set('checked', this.get('value'));
}
});
| fractalemagic/hummingbird | app/assets/javascripts/components/radio-button.js | JavaScript | apache-2.0 | 350 |
define([
'./user-settings'
], function (userSettings) {
var context;
var exposed = {
init: function(thisContext){
context = thisContext;
context.sandbox.on('settings.close', userSettings.close);
context.sandbox.on('settings.open', userSettings.open);
context.sandbox.on('menu.opening', userSettings.handleMenuOpening);
context.sandbox.on('data.clear.all', userSettings.clear);
},
publishMessage: function(params) {
context.sandbox.emit('message.publish', params);
},
publishOpening: function(params){
context.sandbox.emit('menu.opening', params);
},
zoomToLocation: function(params){
context.sandbox.emit('map.zoom.toLocation',params);
},
changeBasemap: function(params) {
context.sandbox.emit('map.basemap.change', params);
},
closeUserSettings: function() {
context.sandbox.emit('settings.close');
},
openUserSettings: function() {
context.sandbox.emit('settings.open');
}
};
return exposed;
}); | ozone-development/meridian | app/components/controls/user-settings/user-settings-mediator.js | JavaScript | apache-2.0 | 1,165 |
/*!
* angular-loading-bar v0.8.0
* https://chieffancypants.github.io/angular-loading-bar
* Copyright (c) 2015 Wes Cruver
* License: MIT
*/
/*
* angular-loading-bar
*
* intercepts XHR requests and creates a loading bar.
* Based on the excellent nprogress work by rstacruz (more info in readme)
*
* (c) 2013 Wes Cruver
* License: MIT
*/
(function() {
'use strict';
// Alias the loading bar for various backwards compatibilities since the project has matured:
angular.module('angular-loading-bar', ['cfp.loadingBarInterceptor']);
angular.module('chieffancypants.loadingBar', ['cfp.loadingBarInterceptor']);
/**
* loadingBarInterceptor service
*
* Registers itself as an Angular interceptor and listens for XHR requests.
*/
angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
.config(['$httpProvider', function ($httpProvider) {
var interceptor = ['$q', '$cacheFactory', '$timeout', '$rootScope', '$log', 'cfpLoadingBar', function ($q, $cacheFactory, $timeout, $rootScope, $log, cfpLoadingBar) {
/**
* The total number of requests made
*/
var reqsTotal = 0;
/**
* The number of requests completed (either successfully or not)
*/
var reqsCompleted = 0;
/**
* The amount of time spent fetching before showing the loading bar
*/
var latencyThreshold = cfpLoadingBar.latencyThreshold;
/**
* $timeout handle for latencyThreshold
*/
var startTimeout;
/**
* calls cfpLoadingBar.complete() which removes the
* loading bar from the DOM.
*/
function setComplete() {
$timeout.cancel(startTimeout);
cfpLoadingBar.complete();
reqsCompleted = 0;
reqsTotal = 0;
}
/**
* Determine if the response has already been cached
* @param {Object} config the config option from the request
* @return {Boolean} retrns true if cached, otherwise false
*/
function isCached(config) {
var cache;
var defaultCache = $cacheFactory.get('$http');
var defaults = $httpProvider.defaults;
// Choose the proper cache source. Borrowed from angular: $http service
if ((config.cache || defaults.cache) && config.cache !== false &&
(config.method === 'GET' || config.method === 'JSONP')) {
cache = angular.isObject(config.cache) ? config.cache
: angular.isObject(defaults.cache) ? defaults.cache
: defaultCache;
}
var cached = cache !== undefined ?
cache.get(config.url) !== undefined : false;
if (config.cached !== undefined && cached !== config.cached) {
return config.cached;
}
config.cached = cached;
return cached;
}
return {
'request': function(config) {
// Check to make sure this request hasn't already been cached and that
// the requester didn't explicitly ask us to ignore this request:
if (!config.ignoreLoadingBar && !isCached(config)) {
$rootScope.$broadcast('cfpLoadingBar:loading', {url: config.url});
if (reqsTotal === 0) {
startTimeout = $timeout(function() {
cfpLoadingBar.start();
}, latencyThreshold);
}
reqsTotal++;
cfpLoadingBar.set(reqsCompleted / reqsTotal);
}
return config;
},
'response': function(response) {
if (!response || !response.config) {
$log.error('Broken interceptor detected: Config object not supplied in response:\n https://github.com/chieffancypants/angular-loading-bar/pull/50');
return response;
}
if (!response.config.ignoreLoadingBar && !isCached(response.config)) {
reqsCompleted++;
$rootScope.$broadcast('cfpLoadingBar:loaded', {url: response.config.url, result: response});
if (reqsCompleted >= reqsTotal) {
setComplete();
} else {
cfpLoadingBar.set(reqsCompleted / reqsTotal);
}
}
return response;
},
'responseError': function(rejection) {
if (!rejection || !rejection.config) {
$log.error('Broken interceptor detected: Config object not supplied in rejection:\n https://github.com/chieffancypants/angular-loading-bar/pull/50');
return $q.reject(rejection);
}
if (!rejection.config.ignoreLoadingBar && !isCached(rejection.config)) {
reqsCompleted++;
$rootScope.$broadcast('cfpLoadingBar:loaded', {url: rejection.config.url, result: rejection});
if (reqsCompleted >= reqsTotal) {
setComplete();
} else {
cfpLoadingBar.set(reqsCompleted / reqsTotal);
}
}
return $q.reject(rejection);
}
};
}];
$httpProvider.interceptors.push(interceptor);
}]);
/**
* Loading Bar
*
* This service handles adding and removing the actual element in the DOM.
* Generally, best practices for DOM manipulation is to take place in a
* directive, but because the element itself is injected in the DOM only upon
* XHR requests, and it's likely needed on every view, the best option is to
* use a service.
*/
angular.module('cfp.loadingBar', [])
.provider('cfpLoadingBar', function() {
this.autoIncrement = true;
this.includeSpinner = true;
this.includeBar = true;
this.latencyThreshold = 100;
this.startSize = 0.02;
this.parentSelector = 'body';
this.spinnerTemplate = '<div id="loading-bar-spinner"><div class="spinner-icon"></div></div>';
this.loadingBarTemplate = '<div id="loading-bar"><div class="bar"><div class="peg"></div></div></div>';
this.$get = ['$injector', '$document', '$timeout', '$rootScope', function ($injector, $document, $timeout, $rootScope) {
var $animate;
var $parentSelector = this.parentSelector,
loadingBarContainer = angular.element(this.loadingBarTemplate),
loadingBar = loadingBarContainer.find('div').eq(0),
spinner = angular.element(this.spinnerTemplate);
var incTimeout,
completeTimeout,
started = false,
status = 0;
var autoIncrement = this.autoIncrement;
var includeSpinner = this.includeSpinner;
var includeBar = this.includeBar;
var startSize = this.startSize;
/**
* Inserts the loading bar element into the dom, and sets it to 2%
*/
function _start() {
if (!$animate) {
$animate = $injector.get('$animate');
}
var $parent = $document.find($parentSelector).eq(0);
$timeout.cancel(completeTimeout);
// do not continually broadcast the started event:
if (started) {
return;
}
$rootScope.$broadcast('cfpLoadingBar:started');
started = true;
if (includeBar) {
$animate.enter(loadingBarContainer, $parent, angular.element($parent[0].lastChild));
}
if (includeSpinner) {
$animate.enter(spinner, $parent, angular.element($parent[0].lastChild));
}
_set(startSize);
}
/**
* Set the loading bar's width to a certain percent.
*
* @param n any value between 0 and 1
*/
function _set(n) {
if (!started) {
return;
}
var pct = (n * 100) + '%';
loadingBar.css('width', pct);
status = n;
// increment loadingbar to give the illusion that there is always
// progress but make sure to cancel the previous timeouts so we don't
// have multiple incs running at the same time.
if (autoIncrement) {
$timeout.cancel(incTimeout);
incTimeout = $timeout(function() {
_inc();
}, 250);
}
}
/**
* Increments the loading bar by a random amount
* but slows down as it progresses
*/
function _inc() {
if (_status() >= 1) {
return;
}
var rnd = 0;
// TODO: do this mathmatically instead of through conditions
var stat = _status();
if (stat >= 0 && stat < 0.25) {
// Start out between 3 - 6% increments
rnd = (Math.random() * (5 - 3 + 1) + 3) / 100;
} else if (stat >= 0.25 && stat < 0.65) {
// increment between 0 - 3%
rnd = (Math.random() * 3) / 100;
} else if (stat >= 0.65 && stat < 0.9) {
// increment between 0 - 2%
rnd = (Math.random() * 2) / 100;
} else if (stat >= 0.9 && stat < 0.99) {
// finally, increment it .5 %
rnd = 0.005;
} else {
// after 99%, don't increment:
rnd = 0;
}
var pct = _status() + rnd;
_set(pct);
}
function _status() {
return status;
}
function _completeAnimation() {
status = 0;
started = false;
}
function _complete() {
if (!$animate) {
$animate = $injector.get('$animate');
}
$rootScope.$broadcast('cfpLoadingBar:completed');
_set(1);
$timeout.cancel(completeTimeout);
// Attempt to aggregate any start/complete calls within 500ms:
completeTimeout = $timeout(function() {
var promise = $animate.leave(loadingBarContainer, _completeAnimation);
if (promise && promise.then) {
promise.then(_completeAnimation);
}
$animate.leave(spinner);
}, 500);
}
return {
start : _start,
set : _set,
status : _status,
inc : _inc,
complete : _complete,
autoIncrement : this.autoIncrement,
includeSpinner : this.includeSpinner,
latencyThreshold : this.latencyThreshold,
parentSelector : this.parentSelector,
startSize : this.startSize
};
}]; //
}); // wtf javascript. srsly
})(); // | rexren/Enterprise-Quality | hephaestus-site/src/main/resources/static/scripts/vendor/angular-loading-bar/angular-loading-bar.js | JavaScript | apache-2.0 | 10,213 |
/*
* testdatefmtrange_wo_SN.js - test the date range formatter object Wolof-Senegal
*
* Copyright © 2021, JEDLSoft
*
* 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.
*/
if (typeof(GregorianDate) === "undefined") {
var GregorianDate = require("../../lib/GregorianDate.js");
}
if (typeof(DateRngFmt) === "undefined") {
var DateRngFmt = require("../../lib/DateRngFmt.js");
}
if (typeof(ilib) === "undefined") {
var ilib = require("../../lib/ilib.js");
}
module.exports.testdatefmtrange_wo_SN = {
setUp: function(callback) {
ilib.clearCache();
callback();
},
testDateRngFmtRangeInDayShort_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "short"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "31-12-2011 - 13:45 – 14:30");
test.done();
},
testDateRngFmtRangeInDayMedium_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "medium"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "31 Des, 2011 - 13:45 – 14:30");
test.done();
},
testDateRngFmtRangeInDayLong_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "long"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "31 Desàmbar, 2011 ci 13:45 – 14:30");
test.done();
},
testDateRngFmtRangeInDayFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "31 Des, 2011 ci 13:45 – 14:30");
test.done();
},
testDateRngFmtRangeNextDayShort_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "short"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 30,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "30-12-2011 - 13:45 – 31-12-2011 - 14:30");
test.done();
},
testDateRngFmtRangeNextDayMedium_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "medium"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 30,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "30 Des, 2011 - 13:45 – 31 Des, 2011 - 14:30");
test.done();
},
testDateRngFmtRangeNextDayLong_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "long"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 30,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "30 Desàmbar, 2011 ci 13:45 – 31 Desàmbar, 2011 ci 14:30");
test.done();
},
testDateRngFmtRangeNextDayFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 30,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "30 Des, 2011 ci 13:45 – 31 Des, 2011 ci 14:30");
test.done();
},
testDateRngFmtRangeMultiDayShort_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "short"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 – 31-12-2011");
test.done();
},
testDateRngFmtRangeMultiDayMedium_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "medium"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 – 31 Des, 2011");
test.done();
},
testDateRngFmtRangeMultiDayLong_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "long"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 – 31 Desàmbar, 2011");
test.done();
},
testDateRngFmtRangeMultiDayFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 12,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 – 31 Des, 2011");
test.done();
},
testDateRngFmtRangeNextMonthShort_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "short"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20-11 – 31-12-2011");
test.done();
},
testDateRngFmtRangeNextMonthMedium_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "medium"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 Now – 31 Des, 2011");
test.done();
},
testDateRngFmtRangeNextMonthLong_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "long"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 Nowàmbar – 31 Desàmbar, 2011");
test.done();
},
testDateRngFmtRangeNextMonthFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2011,
month: 12,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 Now – 31 Des, 2011");
test.done();
},
testDateRngFmtRangeNextYearShort_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "short"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2012,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20-11-2011 – 31-01-2012");
test.done();
},
testDateRngFmtRangeNextYearMedium_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "medium"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2012,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 Now, 2011 – 31 Sam, 2012");
test.done();
},
testDateRngFmtRangeNextYearLong_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "long"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2012,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 Nowàmbar, 2011 – 31 Samwiyee, 2012");
test.done();
},
testDateRngFmtRangeNextYearFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2012,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "20 Now, 2011 – 31 Sam, 2012");
test.done();
},
testDateRngFmtRangeMultiYearShort_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "short"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2014,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "11-2011 – 01-2014");
test.done();
},
testDateRngFmtRangeMultiYearMedium_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "medium"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2014,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "Now, 2011 – Sam, 2014");
test.done();
},
testDateRngFmtRangeMultiYearLong_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "long"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2014,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "Nowàmbar, 2011 – Samwiyee, 2014");
test.done();
},
testDateRngFmtRangeMultiYearFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2014,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "Now, 2011 – Sam, 2014");
test.done();
},
testDateRngFmtManyYearsFull_wo_SN: function(test) {
test.expect(2);
var fmt = new DateRngFmt({locale: "wo-SN", length: "full"});
test.ok(fmt !== null);
var start = new GregorianDate({
year: 2011,
month: 11,
day: 20,
hour: 13,
minute: 45,
second: 0,
millisecond: 0
});
var end = new GregorianDate({
year: 2064,
month: 1,
day: 31,
hour: 14,
minute: 30,
second: 0,
millisecond: 0
});
test.equal(fmt.format(start, end), "2011 – 2064");
test.done();
}
}; | iLib-js/iLib | js/test/daterange/testdatefmtrange_wo_SN.js | JavaScript | apache-2.0 | 19,135 |
/*
* Copyright 2020 Google LLC
*
* 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
*
* https://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.
*/
/**
* Generates paragraph text style for a text element.
*
* @param {Object} props Props.
* @param {function(number):any} dataToStyleX Converts a x-unit to CSS.
* @param {function(number):any} dataToStyleY Converts a y-unit to CSS.
* @param {function(number):any} dataToFontSizeY Converts a font-size metric to
* y-unit CSS.
* @param {Object<*>} element Text element properties.
* @param {function(number):any} dataToPaddingY Falls back to dataToStyleX if not provided.
* @return {Object} The map of text style properties and values.
*/
export function generateParagraphTextStyle(
props,
dataToStyleX,
dataToStyleY,
dataToFontSizeY = dataToStyleY,
element,
dataToPaddingY = dataToStyleY
) {
const { font, fontSize, lineHeight, padding, textAlign } = props;
const { marginOffset } = calcFontMetrics(element);
const verticalPadding = padding?.vertical || 0;
const horizontalPadding = padding?.horizontal || 0;
const hasPadding = verticalPadding || horizontalPadding;
const paddingStyle = hasPadding
? `${dataToStyleY(verticalPadding)} ${dataToStyleX(horizontalPadding)}`
: 0;
return {
dataToEditorY: dataToStyleY,
whiteSpace: 'pre-wrap',
overflowWrap: 'break-word',
wordBreak: 'break-word',
margin: `${dataToPaddingY(-marginOffset / 2)} 0`,
fontFamily: generateFontFamily(font),
fontSize: dataToFontSizeY(fontSize),
font,
lineHeight,
textAlign,
padding: paddingStyle,
};
}
export const generateFontFamily = ({ family, fallbacks } = {}) => {
const genericFamilyKeywords = [
'cursive',
'fantasy',
'monospace',
'serif',
'sans-serif',
];
// Wrap into " since some fonts won't work without it.
let fontFamilyDisplay = family ? `"${family}"` : '';
if (fallbacks && fallbacks.length) {
fontFamilyDisplay += family ? `,` : ``;
fontFamilyDisplay += fallbacks
.map((fallback) =>
genericFamilyKeywords.includes(fallback) ? fallback : `"${fallback}"`
)
.join(`,`);
}
return fontFamilyDisplay;
};
export const getHighlightLineheight = function (
lineHeight,
verticalPadding = 0,
unit = 'px'
) {
if (verticalPadding === 0) {
return `${lineHeight}em`;
}
return `calc(${lineHeight}em ${verticalPadding > 0 ? '+' : '-'} ${
2 * Math.abs(verticalPadding)
}${unit})`;
};
export function calcFontMetrics(element) {
if (!element.font.metrics) {
return {
contentAreaPx: 0,
lineBoxPx: 0,
marginOffset: 0,
};
}
const {
fontSize,
lineHeight,
font: {
metrics: { upm, asc, des },
},
} = element;
// We cant to cut some of the "virtual-area"
// More info: https://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align
const contentAreaPx = ((asc - des) / upm) * fontSize;
const lineBoxPx = lineHeight * fontSize;
const marginOffset = lineBoxPx - contentAreaPx;
return {
marginOffset,
contentAreaPx,
lineBoxPx,
};
}
| GoogleForCreators/web-stories-wp | packages/story-editor/src/elements/text/util.js | JavaScript | apache-2.0 | 3,563 |
/**
* @license
* Copyright 2012 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Checkbox field. Checked or not checked.
* @author [email protected] (Neil Fraser)
*/
'use strict';
goog.provide('Blockly.FieldCheckbox');
/** @suppress {extraRequire} */
goog.require('Blockly.Events.BlockChange');
goog.require('Blockly.Field');
goog.require('Blockly.fieldRegistry');
goog.require('Blockly.utils.dom');
goog.require('Blockly.utils.object');
/**
* Class for a checkbox field.
* @param {string|boolean=} opt_value The initial value of the field. Should
* either be 'TRUE', 'FALSE' or a boolean. Defaults to 'FALSE'.
* @param {Function=} opt_validator A function that is called to validate
* changes to the field's value. Takes in a value ('TRUE' or 'FALSE') &
* returns a validated value ('TRUE' or 'FALSE'), or null to abort the
* change.
* @param {Object=} opt_config A map of options used to configure the field.
* See the [field creation documentation]{@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/built-in-fields/checkbox#creation}
* for a list of properties this parameter supports.
* @extends {Blockly.Field}
* @constructor
*/
Blockly.FieldCheckbox = function(opt_value, opt_validator, opt_config) {
/**
* Character for the check mark. Used to apply a different check mark
* character to individual fields.
* @type {?string}
* @private
*/
this.checkChar_ = null;
Blockly.FieldCheckbox.superClass_.constructor.call(
this, opt_value, opt_validator, opt_config);
};
Blockly.utils.object.inherits(Blockly.FieldCheckbox, Blockly.Field);
/**
* The default value for this field.
* @type {*}
* @protected
*/
Blockly.FieldCheckbox.prototype.DEFAULT_VALUE = false;
/**
* Construct a FieldCheckbox from a JSON arg object.
* @param {!Object} options A JSON object with options (checked).
* @return {!Blockly.FieldCheckbox} The new field instance.
* @package
* @nocollapse
*/
Blockly.FieldCheckbox.fromJson = function(options) {
return new Blockly.FieldCheckbox(options['checked'], undefined, options);
};
/**
* Default character for the checkmark.
* @type {string}
* @const
*/
Blockly.FieldCheckbox.CHECK_CHAR = '\u2713';
/**
* Serializable fields are saved by the XML renderer, non-serializable fields
* are not. Editable fields should also be serializable.
* @type {boolean}
*/
Blockly.FieldCheckbox.prototype.SERIALIZABLE = true;
/**
* Mouse cursor style when over the hotspot that initiates editability.
*/
Blockly.FieldCheckbox.prototype.CURSOR = 'default';
/**
* Configure the field based on the given map of options.
* @param {!Object} config A map of options to configure the field based on.
* @protected
* @override
*/
Blockly.FieldCheckbox.prototype.configure_ = function(config) {
Blockly.FieldCheckbox.superClass_.configure_.call(this, config);
if (config['checkCharacter']) {
this.checkChar_ = config['checkCharacter'];
}
};
/**
* Create the block UI for this checkbox.
* @package
*/
Blockly.FieldCheckbox.prototype.initView = function() {
Blockly.FieldCheckbox.superClass_.initView.call(this);
Blockly.utils.dom.addClass(
/** @type {!SVGTextElement} **/ (this.textElement_), 'blocklyCheckbox');
this.textElement_.style.display = this.value_ ? 'block' : 'none';
};
/**
* @override
*/
Blockly.FieldCheckbox.prototype.render_ = function() {
if (this.textContent_) {
this.textContent_.nodeValue = this.getDisplayText_();
}
this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET);
};
/**
* @override
*/
Blockly.FieldCheckbox.prototype.getDisplayText_ = function() {
return this.checkChar_ || Blockly.FieldCheckbox.CHECK_CHAR;
};
/**
* Set the character used for the check mark.
* @param {?string} character The character to use for the check mark, or
* null to use the default.
*/
Blockly.FieldCheckbox.prototype.setCheckCharacter = function(character) {
this.checkChar_ = character;
this.forceRerender();
};
/**
* Toggle the state of the checkbox on click.
* @protected
*/
Blockly.FieldCheckbox.prototype.showEditor_ = function() {
this.setValue(!this.value_);
};
/**
* Ensure that the input value is valid ('TRUE' or 'FALSE').
* @param {*=} opt_newValue The input value.
* @return {?string} A valid value ('TRUE' or 'FALSE), or null if invalid.
* @protected
*/
Blockly.FieldCheckbox.prototype.doClassValidation_ = function(opt_newValue) {
if (opt_newValue === true || opt_newValue === 'TRUE') {
return 'TRUE';
}
if (opt_newValue === false || opt_newValue === 'FALSE') {
return 'FALSE';
}
return null;
};
/**
* Update the value of the field, and update the checkElement.
* @param {*} newValue The value to be saved. The default validator guarantees
* that this is a either 'TRUE' or 'FALSE'.
* @protected
*/
Blockly.FieldCheckbox.prototype.doValueUpdate_ = function(newValue) {
this.value_ = this.convertValueToBool_(newValue);
// Update visual.
if (this.textElement_) {
this.textElement_.style.display = this.value_ ? 'block' : 'none';
}
};
/**
* Get the value of this field, either 'TRUE' or 'FALSE'.
* @return {string} The value of this field.
*/
Blockly.FieldCheckbox.prototype.getValue = function() {
return this.value_ ? 'TRUE' : 'FALSE';
};
/**
* Get the boolean value of this field.
* @return {boolean} The boolean value of this field.
*/
Blockly.FieldCheckbox.prototype.getValueBoolean = function() {
return /** @type {boolean} */ (this.value_);
};
/**
* Get the text of this field. Used when the block is collapsed.
* @return {string} Text representing the value of this field
* ('true' or 'false').
*/
Blockly.FieldCheckbox.prototype.getText = function() {
return String(this.convertValueToBool_(this.value_));
};
/**
* Convert a value into a pure boolean.
*
* Converts 'TRUE' to true and 'FALSE' to false correctly, everything else
* is cast to a boolean.
* @param {*} value The value to convert.
* @return {boolean} The converted value.
* @private
*/
Blockly.FieldCheckbox.prototype.convertValueToBool_ = function(value) {
if (typeof value == 'string') {
return value == 'TRUE';
} else {
return !!value;
}
};
Blockly.fieldRegistry.register('field_checkbox', Blockly.FieldCheckbox);
| mark-friedman/blockly | core/field_checkbox.js | JavaScript | apache-2.0 | 6,315 |
/*
*
* (c) Copyright Ascensio System Limited 2010-2021
*
* 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.
*
*/
NamingPeopleContentManager = function() {
this.SaveSchema = function(parentCallback) {
var schemaId = jq('#namingPeopleSchema').val();
if (schemaId == 'custom') {
NamingPeopleContentController.SaveCustomNamingSettings(jq('#usrcaption').val().substring(0, 30), jq('#usrscaption').val().substring(0, 30),
jq('#grpcaption').val().substring(0, 30), jq('#grpscaption').val().substring(0, 30),
jq('#usrstatuscaption').val().substring(0, 30), jq('#regdatecaption').val().substring(0, 30),
jq('#grpheadcaption').val().substring(0, 30),
jq('#guestcaption').val().substring(0, 30), jq('#guestscaption').val().substring(0, 30),
function(result) { if (parentCallback != null) parentCallback(result.value); });
}
else
NamingPeopleContentController.SaveNamingSettings(schemaId, function(result) { if (parentCallback != null) parentCallback(result.value); });
}
this.SaveSchemaCallback = function(res) {
}
this.LoadSchemaNames = function(parentCallback) {
var schemaId = jq('#namingPeopleSchema').val();
NamingPeopleContentController.GetPeopleNames(schemaId, function(res) {
var names = res.value;
jq('#usrcaption').val(names.UserCaption);
jq('#usrscaption').val(names.UsersCaption);
jq('#grpcaption').val(names.GroupCaption);
jq('#grpscaption').val(names.GroupsCaption);
jq('#usrstatuscaption').val(names.UserPostCaption);
jq('#regdatecaption').val(names.RegDateCaption);
jq('#grpheadcaption').val(names.GroupHeadCaption);
jq('#guestcaption').val(names.GuestCaption);
jq('#guestscaption').val(names.GuestsCaption);
if (parentCallback != null)
parentCallback(res.value);
});
}
}
NamingPeopleContentViewer = new function() {
this.ChangeValue = function(event) {
jq('#namingPeopleSchema').val('custom');
}
};
jq(document).ready(function() {
jq('.namingPeopleBox input[type="text"]').each(function(i, el) {
jq(el).keypress(function(event) { NamingPeopleContentViewer.ChangeValue(); });
});
var manager = new NamingPeopleContentManager();
jq('#namingPeopleSchema').change(function () {
manager.LoadSchemaNames(null);
});
manager.LoadSchemaNames(null);
}); | ONLYOFFICE/CommunityServer | web/studio/ASC.Web.Studio/UserControls/Management/NamingPeopleSettings/js/namingpeoplecontent.js | JavaScript | apache-2.0 | 3,300 |
import React from 'react';
import RadioButton from '../RadioButton';
import { mount } from 'enzyme';
const render = (props) => mount(
<RadioButton
{...props}
className="extra-class"
name="test-name"
value="test-value"
/>
);
describe('RadioButton', () => {
describe('renders as expected', () => {
const wrapper = render({
checked: true,
});
const input = wrapper.find('input');
const label = wrapper.find('label');
const div = wrapper.find('div');
describe('input', () => {
it('is of type radio', () => {
expect(input.props().type).toEqual('radio');
});
it('has the expected class', () => {
expect(input.hasClass('bx--radio-button')).toEqual(true);
});
it('has a unique id set by default', () => {
expect(input.props().id).toBeDefined();
});
it('should have checked set when checked is passed', () => {
wrapper.setProps({ checked: true });
expect(input.props().checked).toEqual(true);
});
it('should set the name prop as expected', () => {
expect(input.props().name).toEqual('test-name');
});
});
describe('label', () => {
it('should set htmlFor', () => {
expect(label.props().htmlFor)
.toEqual(input.props().id);
});
it('should set the correct class', () => {
expect(label.props().className).toEqual('bx--radio-button__label');
});
it('should render a span with the correct class', () => {
const span = label.find('span');
expect(span.hasClass('bx--radio-button__appearance')).toEqual(true);
});
it('should render label text', () => {
wrapper.setProps({ labelText: 'test label text' });
expect(label.text()).toMatch(/test label text/);
});
});
describe('wrapper', () => {
it('should have the correct class', () => {
expect(div.hasClass('radioButtonWrapper')).toEqual(true);
});
it('should have extra classes applied', () => {
expect(div.hasClass('extra-class')).toEqual(true);
});
});
});
it('should set defaultChecked as expected', () => {
const wrapper = render({
defaultChecked: true,
});
const input = wrapper.find('input');
expect(input.props().defaultChecked).toEqual(true);
wrapper.setProps({ defaultChecked: false });
expect(input.props().defaultChecked).toEqual(false);
});
it('should set id if one is passed in', () => {
const wrapper = render({
id: 'unique-id',
});
const input = wrapper.find('input');
expect(input.props().id).toEqual('unique-id');
});
describe('events', () => {
it('should invoke onChange with expected arguments', () => {
const onChange = jest.fn();
const wrapper = render({ onChange });
const input = wrapper.find('input');
const inputElement = input.get(0);
inputElement.checked = true;
wrapper.find('input').simulate('change');
const call = onChange.mock.calls[0];
expect(call[0]).toEqual('test-value');
expect(call[1]).toEqual('test-name');
expect(call[2].target).toBe(inputElement);
});
});
});
| hellobrian/carbon-components-react | components/__tests__/RadioButton-test.js | JavaScript | apache-2.0 | 3,213 |
module.exports = function(fancyRequire) {
fancyRequire('merchant_row');
};
| loop-recur/moo-phone | Resources/views/views.js | JavaScript | apache-2.0 | 77 |
/*
* Copyright (c) 2013 EMBL - European Bioinformatics Institute
* 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.
*/
var lodeNamespacePrefixes = {
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
owl: 'http://www.w3.org/2002/07/owl#',
dc: 'http://purl.org/dc/elements/1.1/',
dcterms: 'http://purl.org/dc/terms/',
obo: 'http://purl.obolibrary.org/obo/',
efo: 'http://www.ebi.ac.uk/efo/',
'biosd-terms': 'http://rdf.ebi.ac.uk/terms/biosd/',
pav: 'http://purl.org/pav/2.0/',
prov: 'http://www.w3.org/ns/prov#',
foaf: 'http://xmlns.com/foaf/0.1/',
sio: 'http://semanticscience.org/resource/',
atlas: 'http://rdf.ebi.ac.uk/terms/atlas/',
oac: 'http://www.openannotation.org/ns/'
};
| EBIBioSamples/lodestar | web-ui/src/main/webapp/scripts/namespaces.js | JavaScript | apache-2.0 | 1,394 |
/**
* @author: Alberto Cerqueira
* @email: [email protected]
*/
jQuery.controller = function() {
var controllerClass = function() {
this.init = (function(){
$("#gravar").click(function(){
_self.gravar();
return false;
});
});
this.gravar = (function() {
$("#manterEntidade").ajaxSubmit({
url : systemURL,
dataType : "json",
success : (function(jsonReturn){
var consequence = jsonReturn.consequence;
if (consequence == "ERRO") {
alert(jsonReturn.message);
} else if (consequence == "SUCESSO") {
alert(jsonReturn.message + ": " + jsonReturn.dado.toString());
} else if(consequence == "MUITOS_ERROS"){
var mensagem = [''];
jQuery.each(jsonReturn.dado, function(i, dado) {
mensagem.push(dado.localizedMessage + "\n");
});
alert(mensagem.join(''));
}
//location.reload();
}),
error : (function(XMLHttpRequest, textStatus, errorThrown){
alert(errorConexao);
})
});
});
var _self = this;
};
return new controllerClass();
}; | g6tech/spring-corp-test | project/viewria/WebContent/app/controller/controller.js | JavaScript | apache-2.0 | 1,076 |
var Alloy = require("alloy"), _ = Alloy._, Backbone = Alloy.Backbone;
Alloy.Globals.steps = 0;
Alloy.Globals.capacity = 0;
Alloy.Globals.basketImage = "";
Alloy.Globals.fruitCount = 0;
Alloy.createController("index"); | jhenziz/Fruit-Basket | Resources/app.js | JavaScript | apache-2.0 | 222 |
Ext.namespace("Ext.haode");
Ext.haode.Control = function(args){
Ext.apply(this, args);
this.init();
};
Ext.haode.Control.prototype = {
userName : '',
version : '',
app_name : '',
copyright : '',
viewport : null,
cn : 1,
init : function() {
this.viewport = this.getViewport();
},
getViewport : function() {
var viewport;
if (this.viewport) {
viewport = this.viewport;
} else {
var centerPanel = this.getCenterPanel();
viewport = new Ext.Viewport({
layout: 'fit',
items: [centerPanel]
});
}
return viewport;
},
getCenterPanel : function() {
var panel;
if (this.viewport) {
panel = this.getViewport().items[0];
} else {
var n = new Ext.Button({
id : 'tsb',
text : '发放任务',
align : 'right',
width : 80,
menu : [{
text : '常规任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
timeout : 1000000,
url : 'task.do?action=normal',
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
}
// }, {
// text : '个别任务',
// handler : function() {
// if (!Ext.getCmp('form').getForm().isValid()) {
// alert('请正确填写表单');
// return;
// }
//
// var sm = new Ext.grid.CheckboxSelectionModel();
// var store1 = new Ext.data.Store({
// proxy : new Ext.data.HttpProxy({
// url : 'customerManager.do?action=queryAll'
// }),
// reader : new Ext.data.JsonReader({
// root : 'rows',
// totalProperty : 'total',
// id : 'id',
// fields : ['id', 'name', 'username']
// })
// });
//
// var paging = new Ext.PagingToolbar({
// pageSize : 20,
// store : store1,
// displayInfo : true,
// displayMsg : '当前显示数据 {0} - {1} of {2}',
// emptyMsg : '没有数据'
// });
//
// var win = new Ext.Window({
// title : '客户经理',
// id : 'bind',
// layout : 'fit',
// border : false,
// modal : true,
// width : 500,
// height : 400,
// items : [new Ext.grid.GridPanel({
// id : 'grid1',
// loadMask : true,
//// tbar : [{
//// xtype : 'textfield',
//// id : 'searchName',
//// emptyText : '请输入客户经理名称...',
//// width : 150
//// }, {
//// text : '搜索',
//// width : 45,
//// xtype : 'button',
//// handler : function() {
////
//// }
//// }],
// store : store1,
// sm : sm,
// cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
// header : '客户经理名称',
// width : 200,
// dataIndex : 'name',
// align : 'center'
// }, {
// header : '客户经理用户名',
// width : 230,
// dataIndex : 'username',
// align : 'center'
// }]),
// bbar : paging
// })],
// buttons : [{
// text : '确定',
// handler : function() {
// var mrecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
// if (mrecords.length < 1) {
// alert('请选择要做任务的客户经理!');
// return;
// }
// var mids = '';
// for (var j = 0; j < mrecords.length; j++) {
// mids += ',' + mrecords[j].get('id');
// }
//
// Ext.getCmp('bind').close();
// Ext.getCmp('form').getForm().submit({
// waitTitle : '提示',
// waitMsg : '正在提交数据请稍后...',
// url : 'task.do?action=indevi',
// params : {
// mids : mids
// },
// method : 'post',
// success : function(form, action) {
// alert(action.result.myHashMap.msg);
// },
// failure : function(form, action) {
// alert(action.result.myHashMap.msg);
// }
// });
//
// }
// }, {
// text : '取消',
// handler : function() {
// Ext.getCmp('bind').close();
// }
// }]
// });
// win.show(Ext.getBody());
// store1.load({
// params : {
// start : 0,
// limit : 20
// }
// });
//
// }
}, {
text : '分组任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
var sm = new Ext.grid.CheckboxSelectionModel();
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customerGroup.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var win = new Ext.Window({
title : '客户分组',
id : 'bind',
layout : 'fit',
border : false,
modal : true,
width : 500,
height : 400,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
sm : sm,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
header : '客户分组名称',
width : 200,
dataIndex : 'name',
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var grecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (grecords.length < 1) {
alert('请选择客户分组!');
return;
}
var gids = '';
for (var j = 0; j < grecords.length; j++) {
gids += ',' + grecords[j].get('id');
}
Ext.getCmp('bind').close();
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=group',
params : {
gids : gids
},
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('bind').close();
}
}]
});
win.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20,
all : 0
}
});
}
}, {
text : '客户任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customer.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name', 'number', 'sell_number', 'store_name', 'level', 'phone_number', 'manager',
'backup_number', 'address', 'order_type', 'gps', 'last_visit_time']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var sm = new Ext.grid.CheckboxSelectionModel();
var win1 = new Ext.Window({
title : '选择客户',
id : 'chooseCustomer',
layout : 'fit',
border : false,
modal : true,
width : 800,
height : 600,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
sm : sm,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
header : '客户名称',
width : 100,
dataIndex : 'name',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户编号',
width : 130,
dataIndex : 'number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '专卖证号',
width : 130,
dataIndex : 'sell_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '店铺名称',
width : 200,
dataIndex : 'store_name',
sortable : true,
remoteSort : true,
align : 'left'
}, {
header : '客户级别',
width : 90,
dataIndex : 'level',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '电话号码',
width : 100,
dataIndex : 'phone_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户经理',
width : 120,
dataIndex : 'manager',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '备用号码',
width : 100,
dataIndex : 'backup_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '经营地址',
width : 240,
dataIndex : 'address',
sortable : true,
remoteSort : true,
align : 'left',
renderer : function(value, meta) {
meta.attr = 'title="' + value + '"';
return value;
}
}, {
header : '订货类型',
width : 60,
dataIndex : 'order_type',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : 'GPS(经度,纬度)',
width : 150,
dataIndex : 'gps',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '最近一次拜访时间',
width : 180,
dataIndex : 'last_visit_time',
sortable : true,
remoteSort : true,
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var crecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (crecords.length < 1) {
alert('请选择要拜访的客户!');
return;
}
var size = crecords.length;
var cids = "";
for (var i = 0; i < size; i++) {
cids += ',' + crecords[i].get('id');
}
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=customerTask',
params : {
cids : cids
},
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
Ext.getCmp('chooseCustomer').close();
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('chooseCustomer').close();
}
}]
});
win1.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20
}
});
}
}, {
text : '自定义任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
var cids = '';
var mid = '';
var win = new Ext.Window({
title : '自定义任务',
id : 'editWin',
layout : 'fit',
border : false,
modal : true,
width : 500,
height : 250,
items : [new Ext.form.FormPanel({
id : 'editForm',
frame : true,
bodyStyle : 'padding : 30px; 20px;',
defaults : {
msgTarget : 'under'
},
height : 'auto',
labelWidth : 80,
labelAlign : 'right',
items : [{
xtype : 'compositefield',
width : 500,
items : [{
fieldLabel : '客户名称',
xtype : 'textfield',
id : 'customer',
allowBlank : false,
width : 300
}, {
text : '浏览…',
xtype : 'button',
handler : function() {
// 选择客户
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customer.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name', 'number', 'sell_number', 'store_name', 'level', 'phone_number', 'manager',
'backup_number', 'address', 'order_type', 'gps', 'last_visit_time']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var sm = new Ext.grid.CheckboxSelectionModel();
var win1 = new Ext.Window({
title : '选择客户',
id : 'chooseCustomer',
layout : 'fit',
border : false,
modal : true,
width : 800,
height : 600,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
sm : sm,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
header : '客户名称',
width : 100,
dataIndex : 'name',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户编号',
width : 130,
dataIndex : 'number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '专卖证号',
width : 130,
dataIndex : 'sell_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '店铺名称',
width : 200,
dataIndex : 'store_name',
sortable : true,
remoteSort : true,
align : 'left'
}, {
header : '客户级别',
width : 90,
dataIndex : 'level',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '电话号码',
width : 100,
dataIndex : 'phone_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户经理',
width : 120,
dataIndex : 'manager',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '备用号码',
width : 100,
dataIndex : 'backup_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '经营地址',
width : 240,
dataIndex : 'address',
sortable : true,
remoteSort : true,
align : 'left',
renderer : function(value, meta) {
meta.attr = 'title="' + value + '"';
return value;
}
}, {
header : '订货类型',
width : 60,
dataIndex : 'order_type',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : 'GPS(经度,纬度)',
width : 150,
dataIndex : 'gps',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '最近一次拜访时间',
width : 180,
dataIndex : 'last_visit_time',
sortable : true,
remoteSort : true,
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var crecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (crecords.length < 1) {
alert('请选择要拜访的客户!');
return;
}
var size = crecords.length;
var cnames = '';
for (var i = 0; i < size; i++) {
cids += ',' + crecords[i].get('id');
cnames += ',' + crecords[i].get('name');
}
Ext.getCmp('customer').setValue(cnames.substring(1));
Ext.getCmp('chooseCustomer').close();
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('chooseCustomer').close();
}
}]
});
win1.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20
}
});
}
}]
}, {
xtype : 'compositefield',
width : 500,
items : [{
fieldLabel : '客户经理',
xtype : 'textfield',
id : 'manager',
allowBlank : false,
width : 300
}, {
text : '浏览…',
xtype : 'button',
handler : function() {
// 选择客户经理
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customerManager.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name', 'username', 'department', 'area']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var win1 = new Ext.Window({
title : '选择客户经理',
id : 'bind',
layout : 'fit',
border : false,
modal : true,
width : 600,
height : 400,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), {
header : '客户经理名称',
width : 130,
dataIndex : 'name',
align : 'center'
}, {
header : '用户名',
width : 130,
dataIndex : 'username',
align : 'center'
}, {
header : '部门',
width : 130,
dataIndex : 'department',
align : 'center'
}, {
header : '片区',
width : 130,
dataIndex : 'area',
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var mrecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (mrecords.length < 1) {
alert('请选择客户经理!');
return;
}
mid = mrecords[0].get('id');
var manager = mrecords[0].get('name');
if (mrecords[0].get('department') != "") {
manager = manager + "-" + mrecords[0].get('department');
}
if (mrecords[0].get('area') != "") {
manager = manager + "-" + mrecords[0].get('area');
}
Ext.getCmp('manager').setValue(manager);
Ext.getCmp('bind').close();
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('bind').close();
}
}]
});
win1.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20
}
});
}
}]
}],
buttons : [{
text : '确定',
handler : function() {
Ext.getCmp('editWin').close();
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=newCustomerTask',
params : {
mid : mid,
cids : cids,
},
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('editWin').close();
}
}]
})]
});
win.show(Ext.getBody());
}
}]
});
panel = new Ext.form.FormPanel({
id : 'form',
defaults : {
width : 250,
msgTarget : 'under'
},
bodyStyle : 'padding : 50px; 150px;',
labelWidth : 80,
labelAlign : 'right',
tbar : [{
xtype : 'button',
id : 'ad',
iconCls : 'add',
text : '增加内容',
align : 'right',
width : 80,
handler : function() {
this.cn = this.cn + 1;
var f = Ext.getCmp('form');
var a = Ext.getCmp('ad');
var t = Ext.getCmp('tsb');
var c = new Ext.form.TextField({
fieldLabel : '任务内容' + this.cn,
allowBlank : false,
name : 'content' + this.cn,
id : 'content' + this.cn,
xtype : 'textfield'
});
f.remove(t);
f.add(c);
f.add(n);
f.doLayout();
},
scope : this
}],
items : [{
fieldLabel : '任务起始时间',
allowBlank : false,
editable : false,
name : 'start',
id : 'start',
xtype : 'datefield'
}, {
fieldLabel : '任务完成时间',
allowBlank : false,
editable : false,
name : 'end',
id : 'end',
xtype : 'datefield'
}, {
fieldLabel : '任务标题',
allowBlank : false,
name : 'content',
id : 'content',
xtype : 'textfield'
}, {
fieldLabel : '任务内容' + this.cn,
allowBlank : false,
name : 'content' + this.cn,
id : 'content' + this.cn,
xtype : 'textfield'
}, {
xtype : 'button',
id : 'tsb',
text : '发放任务',
align : 'right',
width : 80,
menu : [{
text : '常规任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=normal',
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
}
// }, {
// text : '个别任务',
// handler : function() {
// if (!Ext.getCmp('form').getForm().isValid()) {
// alert('请正确填写表单');
// return;
// }
//
//
// var sm = new Ext.grid.CheckboxSelectionModel();
// var store1 = new Ext.data.Store({
// proxy : new Ext.data.HttpProxy({
// url : 'customerManager.do?action=queryAll'
// }),
// reader : new Ext.data.JsonReader({
// root : 'rows',
// totalProperty : 'total',
// id : 'id',
// fields : ['id', 'name', 'username']
// })
// });
//
// var paging = new Ext.PagingToolbar({
// pageSize : 20,
// store : store1,
// displayInfo : true,
// displayMsg : '当前显示数据 {0} - {1} of {2}',
// emptyMsg : '没有数据'
// });
//
// var win = new Ext.Window({
// title : '客户经理',
// id : 'bind',
// layout : 'fit',
// border : false,
// modal : true,
// width : 500,
// height : 400,
// items : [new Ext.grid.GridPanel({
// id : 'grid1',
// loadMask : true,
//// tbar : [{
//// xtype : 'textfield',
//// id : 'searchName',
//// emptyText : '请输入客户经理名称...',
//// width : 150
//// }, {
//// text : '搜索',
//// width : 45,
//// xtype : 'button',
//// handler : function() {
////
//// }
//// }],
// store : store1,
// sm : sm,
// cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
// header : '客户经理名称',
// width : 200,
// dataIndex : 'name',
// align : 'center'
// }, {
// header : '客户经理用户名',
// width : 230,
// dataIndex : 'username',
// align : 'center'
// }]),
// bbar : paging
// })],
// buttons : [{
// text : '确定',
// handler : function() {
// var mrecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
// if (mrecords.length < 1) {
// alert('请选择要做任务的客户经理!');
// return;
// }
// var mids = '';
// for (var j = 0; j < mrecords.length; j++) {
// mids += ',' + mrecords[j].get('id');
// }
//
// Ext.getCmp('bind').close();
// Ext.getCmp('form').getForm().submit({
// waitTitle : '提示',
// waitMsg : '正在提交数据请稍后...',
// url : 'task.do?action=indevi',
// params : {
// mids : mids
// },
// method : 'post',
// success : function(form, action) {
// alert(action.result.myHashMap.msg);
// },
// failure : function(form, action) {
// alert(action.result.myHashMap.msg);
// }
// });
//
// }
// }, {
// text : '取消',
// handler : function() {
// Ext.getCmp('bind').close();
// }
// }]
// });
// win.show(Ext.getBody());
// store1.load({
// params : {
// start : 0,
// limit : 20
// }
// });
//
// }
}, {
text : '分组任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
var sm = new Ext.grid.CheckboxSelectionModel();
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customerGroup.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var win = new Ext.Window({
title : '客户分组',
id : 'bind',
layout : 'fit',
border : false,
modal : true,
width : 500,
height : 400,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
sm : sm,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
header : '客户分组名称',
width : 200,
dataIndex : 'name',
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var grecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (grecords.length < 1) {
alert('请选择客户分组!');
return;
}
var gids = '';
for (var j = 0; j < grecords.length; j++) {
gids += ',' + grecords[j].get('id');
}
Ext.getCmp('bind').close();
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=group',
params : {
gids : gids
},
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('bind').close();
}
}]
});
win.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20,
all : 0
}
});
}
}, {
text : '客户任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customer.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name', 'number', 'sell_number', 'store_name', 'level', 'phone_number', 'manager',
'backup_number', 'address', 'order_type', 'gps', 'last_visit_time']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var sm = new Ext.grid.CheckboxSelectionModel();
var win1 = new Ext.Window({
title : '选择客户',
id : 'chooseCustomer',
layout : 'fit',
border : false,
modal : true,
width : 800,
height : 600,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
sm : sm,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
header : '客户名称',
width : 100,
dataIndex : 'name',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户编号',
width : 130,
dataIndex : 'number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '专卖证号',
width : 130,
dataIndex : 'sell_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '店铺名称',
width : 200,
dataIndex : 'store_name',
sortable : true,
remoteSort : true,
align : 'left'
}, {
header : '客户级别',
width : 90,
dataIndex : 'level',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '电话号码',
width : 100,
dataIndex : 'phone_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户经理',
width : 120,
dataIndex : 'manager',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '备用号码',
width : 100,
dataIndex : 'backup_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '经营地址',
width : 240,
dataIndex : 'address',
sortable : true,
remoteSort : true,
align : 'left',
renderer : function(value, meta) {
meta.attr = 'title="' + value + '"';
return value;
}
}, {
header : '订货类型',
width : 60,
dataIndex : 'order_type',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : 'GPS(经度,纬度)',
width : 150,
dataIndex : 'gps',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '最近一次拜访时间',
width : 180,
dataIndex : 'last_visit_time',
sortable : true,
remoteSort : true,
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var crecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (crecords.length < 1) {
alert('请选择要拜访的客户!');
return;
}
var size = crecords.length;
var cids = "";
for (var i = 0; i < size; i++) {
cids += ',' + crecords[i].get('id');
}
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=customerTask',
params : {
cids : cids
},
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
Ext.getCmp('chooseCustomer').close();
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('chooseCustomer').close();
}
}]
});
win1.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20
}
});
}
}, {
text : '自定义任务',
handler : function() {
if (!Ext.getCmp('form').getForm().isValid()) {
alert('请正确填写表单');
return;
}
var cids = '';
var mid = '';
var win = new Ext.Window({
title : '自定义任务',
id : 'editWin',
layout : 'fit',
border : false,
modal : true,
width : 500,
height : 250,
items : [new Ext.form.FormPanel({
id : 'editForm',
frame : true,
bodyStyle : 'padding : 30px; 20px;',
defaults : {
msgTarget : 'under'
},
height : 'auto',
labelWidth : 80,
labelAlign : 'right',
items : [{
xtype : 'compositefield',
width : 500,
items : [{
fieldLabel : '客户名称',
xtype : 'textfield',
id : 'customer',
allowBlank : false,
width : 300
}, {
text : '浏览…',
xtype : 'button',
handler : function() {
// 选择客户
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customer.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name', 'number', 'sell_number', 'store_name', 'level', 'phone_number', 'manager',
'backup_number', 'address', 'order_type', 'gps', 'last_visit_time']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var sm = new Ext.grid.CheckboxSelectionModel();
var win1 = new Ext.Window({
title : '选择客户',
id : 'chooseCustomer',
layout : 'fit',
border : false,
modal : true,
width : 800,
height : 600,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
sm : sm,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), sm, {
header : '客户名称',
width : 100,
dataIndex : 'name',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户编号',
width : 130,
dataIndex : 'number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '专卖证号',
width : 130,
dataIndex : 'sell_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '店铺名称',
width : 200,
dataIndex : 'store_name',
sortable : true,
remoteSort : true,
align : 'left'
}, {
header : '客户级别',
width : 90,
dataIndex : 'level',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '电话号码',
width : 100,
dataIndex : 'phone_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '客户经理',
width : 120,
dataIndex : 'manager',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '备用号码',
width : 100,
dataIndex : 'backup_number',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '经营地址',
width : 240,
dataIndex : 'address',
sortable : true,
remoteSort : true,
align : 'left',
renderer : function(value, meta) {
meta.attr = 'title="' + value + '"';
return value;
}
}, {
header : '订货类型',
width : 60,
dataIndex : 'order_type',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : 'GPS(经度,纬度)',
width : 150,
dataIndex : 'gps',
sortable : true,
remoteSort : true,
align : 'center'
}, {
header : '最近一次拜访时间',
width : 180,
dataIndex : 'last_visit_time',
sortable : true,
remoteSort : true,
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var crecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (crecords.length < 1) {
alert('请选择要拜访的客户!');
return;
}
var size = crecords.length;
var cnames = '';
for (var i = 0; i < size; i++) {
cids += ',' + crecords[i].get('id');
cnames += ',' + crecords[i].get('name');
}
Ext.getCmp('customer').setValue(cnames.substring(1));
Ext.getCmp('chooseCustomer').close();
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('chooseCustomer').close();
}
}]
});
win1.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20
}
});
}
}]
}, {
xtype : 'compositefield',
width : 500,
items : [{
fieldLabel : '客户经理',
xtype : 'textfield',
id : 'manager',
allowBlank : false,
width : 300
}, {
text : '浏览…',
xtype : 'button',
handler : function() {
// 选择客户经理
var store1 = new Ext.data.Store({
proxy : new Ext.data.HttpProxy({
url : 'customerManager.do?action=queryAll'
}),
reader : new Ext.data.JsonReader({
root : 'rows',
totalProperty : 'total',
id : 'id',
fields : ['id', 'name', 'username', 'department', 'area']
})
});
var paging = new Ext.PagingToolbar({
pageSize : 20,
store : store1,
displayInfo : true,
displayMsg : '当前显示数据 {0} - {1} of {2}',
emptyMsg : '没有数据'
});
var win1 = new Ext.Window({
title : '选择客户经理',
id : 'bind',
layout : 'fit',
border : false,
modal : true,
width : 600,
height : 400,
items : [new Ext.grid.GridPanel({
id : 'grid1',
loadMask : true,
store : store1,
cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer({width:38}), {
header : '客户经理名称',
width : 130,
dataIndex : 'name',
align : 'center'
}, {
header : '用户名',
width : 130,
dataIndex : 'username',
align : 'center'
}, {
header : '部门',
width : 130,
dataIndex : 'department',
align : 'center'
}, {
header : '片区',
width : 130,
dataIndex : 'area',
align : 'center'
}]),
bbar : paging
})],
buttons : [{
text : '确定',
handler : function() {
var mrecords = Ext.getCmp('grid1').getSelectionModel().getSelections();
if (mrecords.length < 1) {
alert('请选择客户经理!');
return;
}
mid = mrecords[0].get('id');
var manager = mrecords[0].get('name');
if (mrecords[0].get('department') != "") {
manager = manager + "-" + mrecords[0].get('department');
}
if (mrecords[0].get('area') != "") {
manager = manager + "-" + mrecords[0].get('area');
}
Ext.getCmp('manager').setValue(manager);
Ext.getCmp('bind').close();
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('bind').close();
}
}]
});
win1.show(Ext.getBody());
store1.load({
params : {
start : 0,
limit : 20
}
});
}
}]
}],
buttons : [{
text : '确定',
handler : function() {
Ext.getCmp('editWin').close();
Ext.getCmp('form').getForm().submit({
waitTitle : '提示',
waitMsg : '正在提交数据请稍后...',
url : 'task.do?action=newCustomerTask',
params : {
mid : mid,
cids : cids,
},
method : 'post',
success : function(form, action) {
alert(action.result.myHashMap.msg);
},
failure : function(form, action) {
alert(action.result.myHashMap.msg);
}
});
}
}, {
text : '取消',
handler : function() {
Ext.getCmp('editWin').close();
}
}]
})]
});
win.show(Ext.getBody());
}
}]
}]
});
}
return panel;
}
};
| hairlun/customer-visit-web | WebRoot/task/index.js | JavaScript | apache-2.0 | 49,167 |
/*
~ Copyright (c) 2014 George Norman.
~ Licensed under the Apache License, Version 2.0 (the "License");
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ --------------------------------------------------------------
~ Renders <css-lab-about> tags - sharable among all projects.
~ --------------------------------------------------------------
*/
/**
* The <css-lab-about> tag renders a common introduction, displayed across all of the
* CSS Lab projects and pages. There can be only one Introduction section per page.
*<p>
* Example:
* <pre style="background:#eee; padding:6px;">
* <css-lab-about style="margin-top:12px;"/>
* </pre>
*
* @module cssLabAboutTag
*/
var cssLabAboutTag = (function(tzDomHelper, tzCustomTagHelper) {
"use strict";
// http://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript
var template =
['This page contains example code used for the <a href="http://www.thruzero.com/jcat3/apps/resources/resources.jsf?rid=css.overview">CSS Summary</a>',
'at <a href="http://www.thruzero.com/">ThruZero</a>. ',
'The example code (e.g., CSS and HTML) is defined with inline-templates and then rendered live, so it will always match the rendered example. '
].join('\n');
return {
getTagName: function() {
return "css-lab-about";
},
/**
* Render the first <css-lab-about> tag on the page - only one tag per page is supported.
*/
renderAll: function() {
tzCustomTagHelper.renderFirst(this);
},
/**
* Render the <css-lab-about> tag identified by the given tagId.
*
* @param tagId ID of the tag to render.
*/
renderTagById: function(tagId) {
tzCustomTagHelper.renderTagById(this, tagId);
},
/**
* Render the given aboutTagNode.
*
* @param aboutTagNode the node to retrieve the attributes from and then render the result to.
*/
renderTag: function(aboutTagNode) {
this.render(aboutTagNode);
},
/**
* Render the 'About Application' HTML, into the given containerNode.
*
* @param containerNode where to render the result.
*/
render: function(containerNode) {
containerNode.style.display = 'block';
//var template = tzCustomTagHelper.getTemplate(this.getTagName() + "Template"); // @-@:p1(geo) Experimental
tzCustomTagHelper.renderTagFromTemplate(containerNode, template, {});
}
}
}(tzDomHelperModule, tzCustomTagHelperModule));
| georgenorman/css-lab | src/js/tags/cssLabAbout.js | JavaScript | apache-2.0 | 2,522 |
/* eslint-disable local/html-template */
const documentModes = require('./document-modes');
const {AmpState, ampStateKey} = require('./amphtml-helpers');
const {html, joinFragments} = require('./html');
const jsModes = [
{
value: 'default',
description: `Unminified AMP JavaScript is served from the local server. For
local development you will usually want to serve unminified JS to test your
changes.`,
},
{
value: 'minified',
description: html`
Minified AMP JavaScript is served from the local server. This is only
available after running <code>amp dist --fortesting</code>
`,
},
{
value: 'cdn',
description: 'Minified AMP JavaScript is served from the AMP Project CDN.',
},
];
const stateId = 'settings';
const htmlEnvelopePrefixStateKey = 'htmlEnvelopePrefix';
const jsModeStateKey = 'jsMode';
const panelStateKey = 'panel';
const htmlEnvelopePrefixKey = ampStateKey(stateId, htmlEnvelopePrefixStateKey);
const panelKey = ampStateKey(stateId, panelStateKey);
const PanelSelectorButton = ({expression, type, value}) =>
html`
<button
class="settings-panel-button"
[class]="'settings-panel-button' + (${panelKey} != '${type}' ? '' : ' open')"
data-type="${type}"
tabindex="0"
on="tap: AMP.setState({
${stateId}: {
${panelStateKey}: (${panelKey} != '${type}' ? '${type}' : null),
}
})"
>
<span>${type}</span> <strong [text]="${expression}">${value}</strong>
</button>
`;
const PanelSelector = ({children, compact = false, key, name = null}) => html`
<amp-selector
layout="container"
name="${name || key}"
class="${compact ? 'compact ' : ''}"
on="select: AMP.setState({
${stateId}: {
${panelStateKey}: null,
${key}: event.targetOption,
}
})"
>
${joinFragments(children)}
</amp-selector>
`;
const PanelSelectorBlock = ({children, id, selected, value}) => html`
<div
class="selector-block"
${selected ? ' selected' : ''}
id="${id}"
option="${value}"
>
<div class="check-icon icon"></div>
${children}
</div>
`;
const HtmlEnvelopeSelector = ({htmlEnvelopePrefix}) =>
PanelSelector({
compact: true,
key: htmlEnvelopePrefixStateKey,
children: Object.entries(documentModes).map(([prefix, name]) =>
PanelSelectorBlock({
id: `select-html-mode-${name}`,
value: prefix,
selected: htmlEnvelopePrefix === prefix,
children: html`<strong>${name}</strong>`,
})
),
});
const JsModeSelector = ({jsMode}) =>
PanelSelector({
key: jsModeStateKey,
name: 'mode',
children: jsModes.map(({description, value}) =>
PanelSelectorBlock({
id: `serve-mode-${value}`,
value,
selected: jsMode === value,
children: html`
<strong>${value}</strong>
<p>${description}</p>
`,
})
),
});
const SettingsPanelButtons = ({htmlEnvelopePrefix, jsMode}) => html`
<div style="flex: 1">
<div class="settings-panel-button-container">
${PanelSelectorButton({
type: 'HTML',
expression: `${stateId}.documentModes[${htmlEnvelopePrefixKey}]`,
value: documentModes[htmlEnvelopePrefix],
})}
${PanelSelectorButton({
type: 'JS',
expression: `${stateId}.${jsModeStateKey}`,
value: jsMode,
})}
</div>
${SettingsPanel({htmlEnvelopePrefix, jsMode})}
</div>
`;
const SettingsSubpanel = ({children, type}) => html`
<div hidden [hidden]="${panelKey} != '${type}'">${children}</div>
`;
const SettingsPanel = ({htmlEnvelopePrefix, jsMode}) => html`
<div class="settings-panel" hidden [hidden]="${panelKey} == null">
${AmpState(stateId, {
documentModes,
[panelStateKey]: null,
[htmlEnvelopePrefixStateKey]: htmlEnvelopePrefix,
[jsModeStateKey]: jsMode,
})}
${SettingsSubpanel({
type: 'HTML',
children: html`
<h4>Select an envelope to serve HTML documents.</h4>
${HtmlEnvelopeSelector({htmlEnvelopePrefix})}
`,
})}
${SettingsSubpanel({
type: 'JS',
children: html`
<h4>Select the JavaScript binaries to use in served documents.</h4>
<form
action="/serve_mode_change"
action-xhr="/serve_mode_change"
target="_blank"
id="serve-mode-form"
>
${JsModeSelector({jsMode})}
</form>
`,
})}
</div>
`;
module.exports = {
SettingsPanel,
SettingsPanelButtons,
htmlEnvelopePrefixKey,
};
| jpettitt/amphtml | build-system/server/app-index/settings.js | JavaScript | apache-2.0 | 4,586 |
/**
*
* Web Starter Kit
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License
*
*/
'use strict';
// Include Gulp & Tools We'll Use
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var del = require('del');
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');
var reload = browserSync.reload;
// Clean Output Directory
gulp.task('clean', del.bind(null, ['./index.js', './assertRank.js', './specs.js']));
gulp.task('es6', ['clean'], function () {
return gulp.src(['./src/**/*.js'])
// .pipe($.sourcemaps.init({loadMaps: true}))
.pipe($['6to5']()).on('error', console.error.bind(console))
// .pipe($.sourcemaps.write())
.pipe(gulp.dest('.'))
.pipe($.size({title: 'es6'}))
})
gulp.task('browserify', ['es6'], function () {
return gulp.src(['./specs.js'])
.pipe($.browserify({debug: false}))
.pipe(gulp.dest('.'))
.pipe($.size({title: 'browserify'}))
})
// Watch Files For Changes & Reload
gulp.task('serve', ['browserify'], function () {
browserSync({
notify: false, browser: 'skip', ghostMode: false,
// Customize the BrowserSync console logging prefix
logPrefix: 'WSK',
port: 3010,
// Run as an https by uncommenting 'https: true'
// Note: this uses an unsigned certificate which on first access
// will present a certificate warning in the browser.
// https: true,
server: ['.', 'src']
});
gulp.watch(['gulpfile.js'], process.exit)
gulp.watch(['./src/**/*.{js,html}'], ['browserify', reload]);
});
gulp.task('default', ['es6'])
// Load custom tasks from the `tasks` directory
// try { require('require-dir')('tasks'); } catch (err) { console.error(err); }
| markuz-brasil/runtime-type-system | gulpfile.js | JavaScript | apache-2.0 | 2,272 |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-65704319-1', 'auto');
ga('send', 'pageview');
| sofiamoral/sofiamoral.github.io | js/custom.js | JavaScript | apache-2.0 | 391 |
//Declare app level module which depends on filters, and services
var SFApplicationAuth = angular.module('SFApplicationAuth.Auth',[]);
SFApplicationAuth.config(
[
'$stateProvider',
'$urlRouterProvider',
function (
$stateProvider,
$urlRouterProvider
) {
console.log("inciando bootstrap auth");
$stateProvider.state('auth', {
url: '/auth',
abstract: true,
templateUrl: 'modules/auth/partials/template.html',
data: {
isPublic: true
}
});
$stateProvider.state('auth.login', {
url: '/login',
templateUrl: 'modules/auth/partials/login.html',
controller: 'AuthController'
});
$stateProvider.state('auth.logout', {
url: '/logout',
controller: 'LogoutController'
});
$stateProvider.state('auth.reset-password', {
url: '/reset-password',
templateUrl: 'application/auth/partials/reset-password.html',
controller: 'AuthController'
});
}]);
SFApplicationAuth.run(['$rootScope', '$state', '$location', '$log', 'authFactory', function($rootScope, $state, $location, $log, authFactory) {
$log.log('Running Auth...');
$rootScope.$on('$stateChangeStart', function (event, toState, toParams, fromState, fromParams) {
$log.log('$stateChangeStart');
if( toState && ( "data" in toState ) === true && ( "isPublic" in toState.data ) === true && toState.data.isPublic == true ) {
$log.log( 'Public page...' );
} else if( toState && ( "data" in toState ) === true && ( ( "isPublic" in toState.data ) === false || ( "isPublic" in toState.data ) === true && toState.data.isPublic == false ) ) {
$log.log( 'Private page...' );
/**
* Check if has some webSession active and do the logout.
*/
if( ! authFactory.checkIsLogged() ) {
$log.error( 'You don\'t have permission to access this area.' );
/**
* Prevent Default action.
*/
event.preventDefault();
$log.log( 'Fazendo loggof' );
/**
* Redirect to login
*/
$state.go( 'auth.logout' );
}
}
});
$rootScope.$on('$stateChangeSuccess', function(next, current) {
$log.log('$stateChangeSuccess');
});
$rootScope.$on('$stateChangeError', function(
event,
toState,
toParams,
fromState,
fromParams,
rejection) {
$log.log('$stateChangeError');
});
$rootScope.$on('$stateUpdate', function(next, current) {
$log.log('$stateUpdate');
});
$rootScope.$on('$stateNotFound', function(event, unfoundState, fromState, fromParams){
$log.log('$stateNotFound');
$log.log(unfoundState.to); // "lazy.state"
$log.log(unfoundState.toParams); // {a:1, b:2}
$log.log(unfoundState.options); // {inherit:false} + default options
});
$rootScope.$on('$viewContentLoading', function(event, viewConfig){
$log.log('$viewContentLoading');
});
$rootScope.$on('$viewContentLoaded', function(event, viewConfig){
$log.log('$viewContentLoaded');
});
}]); | chacal88/sb-admin-angular | app/modules/auth/application/bootstrap.js | JavaScript | apache-2.0 | 2,840 |
const spinny = 'div.spinny';
exports.command = function navigateTo (url, expectSpinny = true) {
this.url('data:,'); // https://github.com/nightwatchjs/nightwatch/issues/1724
this.url(url);
if (expectSpinny) {
this.waitForElementVisible(spinny);
this.waitForElementNotVisible(spinny);
}
return this;
};
| wwitzel3/awx | awx/ui/test/e2e/commands/navigateTo.js | JavaScript | apache-2.0 | 341 |
import React from 'react';
import renderer from 'react-test-renderer';
import VideoQuestion from './VideoQuestion';
jest.mock('expo', () => ({
Video: 'Video'
}));
it('renders without crashing', () => {
const tree = renderer.create(
<VideoQuestion
video={require('../../assets/videos/placeholder.mp4')}
question="Wer ist eine Ananas?"
answers={[
'Ich bin eine Ananas',
'Du bist eine Ananas',
'Wir sind eine Ananas'
]}
/>
);
expect(tree).toMatchSnapshot();
});
| cognostics/serlo-abc | src/components/exercises/VideoQuestion.test.js | JavaScript | apache-2.0 | 526 |
"use strict";
const apisObject = {
"type": "object",
"required": false,
"patternProperties": {
"^[_a-z\/][_a-zA-Z0-9\/:]*$": { //pattern to match an api route
"type": "object",
"required": true,
"properties": {
"access": {"type": "boolean", "required": false},
}
}
}
};
const aclRoute = {
"type": "array",
"required": false,
"items":
{
"type": "object",
"required": false,
"properties": {
"access": {"type": "string", "required": false},
"apis": apisObject
}
}
};
const scope = {
"type": "object",
"patternProperties": {
"^[^\W\.]+$": {
"type": "object",
"required": false,
"patternProperties": {
".+": {
"type": "object",
"required": false,
"properties": {
"access": {"type": "boolean", "required": false},
"apisPermission": {
"type": "string", "enum": ["restricted"], "required": false
},
"get": aclRoute,
"post": aclRoute,
"put": aclRoute,
"delete": aclRoute,
"head": aclRoute,
"options": aclRoute,
"other": aclRoute,
"additionalProperties": false
},
"additionalProperties": false
}
},
"additionalProperties": false
},
},
"additionalProperties": false
};
module.exports = scope;
| soajs/soajs.dashboard | schemas/updateScopeAcl.js | JavaScript | apache-2.0 | 1,270 |
//
// https://github.com/Dogfalo/materialize/issues/634#issuecomment-113213629
// and
// https://github.com/noodny/materializecss-amd/blob/master/config.js
//
//
require([
'global',
'initial',
'animation',
'buttons',
'cards',
'carousel',
'character_counter',
'chips',
'collapsible',
'dropdown',
'forms',
'hammerjs',
'jquery.easing',
'jquery.hammer',
'jquery.timeago',
'leanModal',
'materialbox',
'parallax',
'picker',
'picker.date',
'prism',
'pushpin',
'scrollFire',
'scrollspy',
'sideNav',
'slider',
'tabs',
'toasts',
'tooltip',
'transitions',
'velocity'
],
function(Materialize) {
return Materialize;
}
);
| romeomaryns/ripple | gateway/src/main/resources/static/materialize-css.js | JavaScript | apache-2.0 | 680 |
/*
* Copyright 2020 Google LLC
*
* 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
*
* https://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.
*/
/**
* External dependencies
*/
import styled from 'styled-components';
import PropTypes from 'prop-types';
import { Popup } from '@googleforcreators/design-system';
import { __ } from '@googleforcreators/i18n';
/**
* Internal dependencies
*/
import { useCanvas, useConfig } from '../../../app';
import useElementsWithLinks from '../../../utils/useElementsWithLinks';
import { OUTLINK_THEME } from '../../../constants';
import DefaultIcon from './icons/defaultIcon.svg';
import ArrowIcon from './icons/arrowBar.svg';
const Wrapper = styled.div`
position: absolute;
display: flex;
align-items: center;
justify-content: flex-end;
flex-direction: column;
bottom: 0;
height: 20%;
width: 100%;
color: ${({ theme }) => theme.colors.standard.white};
z-index: 3;
`;
const Guideline = styled.div`
mix-blend-mode: difference;
position: absolute;
height: 1px;
bottom: 20%;
width: 100%;
background-image: ${({ theme }) =>
`linear-gradient(to right, ${theme.colors.standard.black} 50%, ${theme.colors.standard.white} 0%)`};
background-position: top;
background-size: 16px 0.5px;
background-repeat: repeat-x;
z-index: 3;
`;
// The CSS here is based on how it's displayed in the front-end, including static
// font-size, line-height, etc. independent of the viewport size -- it's not responsive.
const ArrowBar = styled(ArrowIcon)`
display: block;
cursor: pointer;
margin-bottom: 10px;
filter: drop-shadow(0px 2px 6px rgba(0, 0, 0, 0.3));
width: 20px;
height: 8px;
`;
const OutlinkChip = styled.div`
height: 36px;
display: flex;
position: relative;
padding: 10px 6px;
margin: 0 0 20px;
max-width: calc(100% - 64px);
border-radius: 30px;
place-items: center;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.15);
background: ${({ bgColor }) => bgColor};
`;
const TextWrapper = styled.span`
font-family: Roboto, sans-serif;
font-size: 16px;
line-height: 18px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
position: relative;
padding-inline-start: 6px;
padding-inline-end: 8px;
height: 16px;
letter-spacing: 0.3px;
font-weight: 700;
max-width: 210px;
color: ${({ fgColor }) => fgColor};
`;
const Tooltip = styled.div`
background-color: ${({ theme }) => theme.colors.standard.black};
color: ${({ theme }) => theme.colors.standard.white};
width: 200px;
padding: 8px;
font-size: 14px;
border-radius: 4px;
text-align: center;
`;
const LinkImage = styled.div`
height: 24px;
width: 24px;
vertical-align: middle;
background-size: cover;
background-repeat: no-repeat;
background-position: 50%;
border-radius: 50%;
background-image: url('${({ icon }) => icon}') !important;
`;
const spacing = { x: 8 };
const LIGHT_COLOR = '#FFFFFF';
const DARK_COLOR = '#000000';
function PageAttachment({ pageAttachment = {} }) {
const {
displayLinkGuidelines,
pageAttachmentContainer,
setPageAttachmentContainer,
} = useCanvas((state) => ({
displayLinkGuidelines: state.state.displayLinkGuidelines,
pageAttachmentContainer: state.state.pageAttachmentContainer,
setPageAttachmentContainer: state.actions.setPageAttachmentContainer,
}));
const { hasInvalidLinkSelected } = useElementsWithLinks();
const {
ctaText = __('Learn more', 'web-stories'),
url,
icon,
theme,
} = pageAttachment;
const { isRTL, styleConstants: { topOffset } = {} } = useConfig();
const bgColor = theme === OUTLINK_THEME.DARK ? DARK_COLOR : LIGHT_COLOR;
const fgColor = theme === OUTLINK_THEME.DARK ? LIGHT_COLOR : DARK_COLOR;
return (
<>
{(displayLinkGuidelines || hasInvalidLinkSelected) && <Guideline />}
<Wrapper role="presentation" ref={setPageAttachmentContainer}>
{url?.length > 0 && (
<>
<ArrowBar fill={bgColor} />
<OutlinkChip bgColor={bgColor}>
{icon ? (
<LinkImage icon={icon} />
) : (
<DefaultIcon fill={fgColor} width={24} height={24} />
)}
<TextWrapper fgColor={fgColor}>{ctaText}</TextWrapper>
</OutlinkChip>
{pageAttachmentContainer && hasInvalidLinkSelected && (
<Popup
isRTL={isRTL}
anchor={{ current: pageAttachmentContainer }}
isOpen
placement={'left'}
spacing={spacing}
topOffset={topOffset}
>
<Tooltip>
{__(
'Links can not reside below the dashed line when a page attachment is present. Your viewers will not be able to click on the link.',
'web-stories'
)}
</Tooltip>
</Popup>
)}
</>
)}
</Wrapper>
</>
);
}
PageAttachment.propTypes = {
pageAttachment: PropTypes.shape({
url: PropTypes.string,
ctaText: PropTypes.string,
}),
};
export default PageAttachment;
| GoogleForCreators/web-stories-wp | packages/story-editor/src/components/canvas/pageAttachment/index.js | JavaScript | apache-2.0 | 5,600 |
module.exports = function (config) {
'use strict';
config.set({
basePath: '../',
files: [
// Angular libraries.
'app/assets/lib/angular/angular.js',
'app/assets/lib/angular-ui-router/release/angular-ui-router.js',
'app/assets/lib/angular-bootstrap/ui-bootstrap.min.js',
'app/assets/lib/angular-mocks/angular-mocks.js',
'app/assets/lib/angular-bootstrap/ui-bootstrap-tpls.min.js',
'app/assets/lib/angular-busy/dist/angular-busy.min.js',
'app/assets/lib/angular-resource/angular-resource.min.js',
'app/assets/lib/angular-confirm-modal/angular-confirm.js',
// JS files.
'app/app.js',
'app/components/**/*.js',
'app/shared/*.js',
'app/shared/**/*.js',
'app/assets/js/*.js',
// Test Specs.
'tests/unit/*.js'
],
autoWatch: true,
frameworks: ['jasmine'],
browsers: ['Firefox', 'PhantomJS', 'Chrome'],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-phantomjs-launcher',
'karma-jasmine'
],
junitReporter: {
outputFile: 'test_out/unit.xml',
suite: 'unit'
}
});
};
| markvoelker/refstack | refstack-ui/tests/karma.conf.js | JavaScript | apache-2.0 | 1,354 |
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
import { get } from '@ember/object';
export default Route.extend({
access: service(),
catalog: service(),
scope: service(),
beforeModel() {
this._super(...arguments);
return get(this, 'catalog').fetchUnScopedCatalogs().then((hash) => {
this.set('catalogs', hash);
});
},
model(params) {
return get(this, 'catalog').fetchTemplates(params)
.then((res) => {
res.catalogs = get(this, 'catalogs');
return res;
});
},
resetController(controller, isExiting/* , transition*/) {
if (isExiting) {
controller.setProperties({
category: '',
catalogId: '',
projectCatalogId: '',
clusterCatalogId: '',
})
}
},
deactivate() {
// Clear the cache when leaving the route so that it will be reloaded when you come back.
this.set('cache', null);
},
actions: {
refresh() {
// Clear the cache so it has to ask the server again
this.set('cache', null);
this.refresh();
},
},
queryParams: {
category: { refreshModel: true },
catalogId: { refreshModel: true },
clusterCatalogId: { refreshModel: true },
projectCatalogId: { refreshModel: true },
},
});
| lvuch/ui | lib/global-admin/addon/multi-cluster-apps/catalog/route.js | JavaScript | apache-2.0 | 1,345 |
import Ember from 'ember';
const DELAY = 100;
export default Ember.Component.extend({
classNameBindings : ['inlineBlock:inline-block','clip:clip'],
tooltipService : Ember.inject.service('tooltip'),
inlineBlock : true,
clip : false,
model : null,
size : 'default',
ariaRole : ['tooltip'],
textChangedEvent : null,
showTimer : null,
textChanged: Ember.observer('textChangedEvent', function() {
this.show(this.get('textChangedEvent'));
}),
mouseEnter(evt) {
if ( !this.get('tooltipService.requireClick') )
{
let tgt = Ember.$(evt.currentTarget);
if (this.get('tooltipService.tooltipOpts')) {
this.set('tooltipService.tooltipOpts', null);
}
// Wait for a little bit of time so that the mouse can pass through
// another tooltip-element on the way to the dropdown trigger of a
// tooltip-action-menu without changing the tooltip.
this.set('showTimer', Ember.run.later(() => {
this.show(tgt);
}, DELAY));
}
},
show(node) {
if ( this._state === 'destroying' )
{
return;
}
let svc = this.get('tooltipService');
this.set('showTimer', null);
svc.cancelTimer();
let out = {
type : this.get('type'),
baseClass : this.get('baseClass'),
eventPosition : node.offset(),
originalNode : node,
model : this.get('model'),
template : this.get('tooltipTemplate'),
};
if ( this.get('isCopyTo') ) {
out.isCopyTo = true;
}
svc.set('tooltipOpts', out);
},
mouseLeave: function() {
if (!this.get('tooltipService.openedViaContextClick')) {
if ( this.get('showTimer') ) {
Ember.run.cancel(this.get('showTimer'));
}
else {
this.get('tooltipService').leave();
}
}
},
modelObserver: Ember.observer('model', 'textChangedEvent', function() {
let opts = this.get('tooltipService.tooltipOpts');
if (opts) {
this.set('tooltipService.tooltipOpts.model', this.get('model'));
}
})
});
| nrvale0/ui | app/components/tooltip-element/component.js | JavaScript | apache-2.0 | 2,144 |
/**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// MODULES //
var Readable = require( 'readable-stream' ).Readable;
var isPositiveNumber = require( '@stdlib/assert/is-positive-number' ).isPrimitive;
var isProbability = require( '@stdlib/assert/is-probability' ).isPrimitive;
var isError = require( '@stdlib/assert/is-error' );
var copy = require( '@stdlib/utils/copy' );
var inherit = require( '@stdlib/utils/inherit' );
var setNonEnumerable = require( '@stdlib/utils/define-nonenumerable-property' );
var setNonEnumerableReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
var setReadOnlyAccessor = require( '@stdlib/utils/define-read-only-accessor' );
var setReadWriteAccessor = require( '@stdlib/utils/define-read-write-accessor' );
var rnbinom = require( '@stdlib/random/base/negative-binomial' ).factory;
var string2buffer = require( '@stdlib/buffer/from-string' );
var nextTick = require( '@stdlib/utils/next-tick' );
var DEFAULTS = require( './defaults.json' );
var validate = require( './validate.js' );
var debug = require( './debug.js' );
// FUNCTIONS //
/**
* Returns the PRNG seed.
*
* @private
* @returns {(PRNGSeedMT19937|null)} seed
*/
function getSeed() {
return this._prng.seed; // eslint-disable-line no-invalid-this
}
/**
* Returns the PRNG seed length.
*
* @private
* @returns {(PositiveInteger|null)} seed length
*/
function getSeedLength() {
return this._prng.seedLength; // eslint-disable-line no-invalid-this
}
/**
* Returns the PRNG state length.
*
* @private
* @returns {(PositiveInteger|null)} state length
*/
function getStateLength() {
return this._prng.stateLength; // eslint-disable-line no-invalid-this
}
/**
* Returns the PRNG state size (in bytes).
*
* @private
* @returns {(PositiveInteger|null)} state size (in bytes)
*/
function getStateSize() {
return this._prng.byteLength; // eslint-disable-line no-invalid-this
}
/**
* Returns the current PRNG state.
*
* @private
* @returns {(PRNGStateMT19937|null)} current state
*/
function getState() {
return this._prng.state; // eslint-disable-line no-invalid-this
}
/**
* Sets the PRNG state.
*
* @private
* @param {PRNGStateMT19937} s - generator state
* @throws {Error} must provide a valid state
*/
function setState( s ) {
this._prng.state = s; // eslint-disable-line no-invalid-this
}
/**
* Implements the `_read` method.
*
* @private
* @param {number} size - number (of bytes) to read
* @returns {void}
*/
function read() {
/* eslint-disable no-invalid-this */
var FLG;
var r;
if ( this._destroyed ) {
return;
}
FLG = true;
while ( FLG ) {
this._i += 1;
if ( this._i > this._iter ) {
debug( 'Finished generating pseudorandom numbers.' );
return this.push( null );
}
r = this._prng();
debug( 'Generated a new pseudorandom number. Value: %d. Iter: %d.', r, this._i );
if ( this._objectMode === false ) {
r = r.toString();
if ( this._i === 1 ) {
r = string2buffer( r );
} else {
r = string2buffer( this._sep+r );
}
}
FLG = this.push( r );
if ( this._i%this._siter === 0 ) {
this.emit( 'state', this.state );
}
}
/* eslint-enable no-invalid-this */
}
/**
* Gracefully destroys a stream, providing backward compatibility.
*
* @private
* @param {(string|Object|Error)} [error] - error
* @returns {RandomStream} Stream instance
*/
function destroy( error ) {
/* eslint-disable no-invalid-this */
var self;
if ( this._destroyed ) {
debug( 'Attempted to destroy an already destroyed stream.' );
return this;
}
self = this;
this._destroyed = true;
nextTick( close );
return this;
/**
* Closes a stream.
*
* @private
*/
function close() {
if ( error ) {
debug( 'Stream was destroyed due to an error. Error: %s.', ( isError( error ) ) ? error.message : JSON.stringify( error ) );
self.emit( 'error', error );
}
debug( 'Closing the stream...' );
self.emit( 'close' );
}
/* eslint-enable no-invalid-this */
}
// MAIN //
/**
* Stream constructor for generating a stream of pseudorandom numbers drawn from a binomial distribution.
*
* @constructor
* @param {PositiveNumber} r - number of successes until experiment is stopped
* @param {Probability} p - success probability
* @param {Options} [options] - stream options
* @param {boolean} [options.objectMode=false] - specifies whether the stream should operate in object mode
* @param {(string|null)} [options.encoding=null] - specifies how `Buffer` objects should be decoded to strings
* @param {NonNegativeNumber} [options.highWaterMark] - specifies the maximum number of bytes to store in an internal buffer before ceasing to generate additional pseudorandom numbers
* @param {string} [options.sep='\n'] - separator used to join streamed data
* @param {NonNegativeInteger} [options.iter] - number of iterations
* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers
* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed
* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
* @param {PositiveInteger} [options.siter] - number of iterations after which to emit the PRNG state
* @throws {TypeError} `r` must be a positive number
* @throws {TypeError} `p` must be a probability
* @throws {TypeError} options argument must be an object
* @throws {TypeError} must provide valid options
* @throws {Error} must provide a valid state
* @returns {RandomStream} Stream instance
*
* @example
* var inspectStream = require( '@stdlib/streams/node/inspect-sink' );
*
* function log( chunk ) {
* console.log( chunk.toString() );
* }
*
* var opts = {
* 'iter': 10
* };
*
* var stream = new RandomStream( 20.0, 0.2, opts );
*
* stream.pipe( inspectStream( log ) );
*/
function RandomStream( r, p, options ) {
var opts;
var err;
if ( !( this instanceof RandomStream ) ) {
if ( arguments.length > 2 ) {
return new RandomStream( r, p, options );
}
return new RandomStream( r, p );
}
if ( !isPositiveNumber( r ) ) {
throw new TypeError( 'invalid argument. First argument must be a positive number. Value: `'+r+'`.' );
}
if ( !isProbability( p ) ) {
throw new TypeError( 'invalid argument. Second argument must be a probability. Value: `'+p+'`.' );
}
opts = copy( DEFAULTS );
if ( arguments.length > 2 ) {
err = validate( opts, options );
if ( err ) {
throw err;
}
}
// Make the stream a readable stream:
debug( 'Creating a readable stream configured with the following options: %s.', JSON.stringify( opts ) );
Readable.call( this, opts );
// Destruction state:
setNonEnumerable( this, '_destroyed', false );
// Cache whether the stream is operating in object mode:
setNonEnumerableReadOnly( this, '_objectMode', opts.objectMode );
// Cache the separator:
setNonEnumerableReadOnly( this, '_sep', opts.sep );
// Cache the total number of iterations:
setNonEnumerableReadOnly( this, '_iter', opts.iter );
// Cache the number of iterations after which to emit the underlying PRNG state:
setNonEnumerableReadOnly( this, '_siter', opts.siter );
// Initialize an iteration counter:
setNonEnumerable( this, '_i', 0 );
// Create the underlying PRNG:
setNonEnumerableReadOnly( this, '_prng', rnbinom( r, p, opts ) );
setNonEnumerableReadOnly( this, 'PRNG', this._prng.PRNG );
return this;
}
/*
* Inherit from the `Readable` prototype.
*/
inherit( RandomStream, Readable );
/**
* PRNG seed.
*
* @name seed
* @memberof RandomStream.prototype
* @type {(PRNGSeedMT19937|null)}
*/
setReadOnlyAccessor( RandomStream.prototype, 'seed', getSeed );
/**
* PRNG seed length.
*
* @name seedLength
* @memberof RandomStream.prototype
* @type {(PositiveInteger|null)}
*/
setReadOnlyAccessor( RandomStream.prototype, 'seedLength', getSeedLength );
/**
* PRNG state getter/setter.
*
* @name state
* @memberof RandomStream.prototype
* @type {(PRNGStateMT19937|null)}
* @throws {Error} must provide a valid state
*/
setReadWriteAccessor( RandomStream.prototype, 'state', getState, setState );
/**
* PRNG state length.
*
* @name stateLength
* @memberof RandomStream.prototype
* @type {(PositiveInteger|null)}
*/
setReadOnlyAccessor( RandomStream.prototype, 'stateLength', getStateLength );
/**
* PRNG state size (in bytes).
*
* @name byteLength
* @memberof RandomStream.prototype
* @type {(PositiveInteger|null)}
*/
setReadOnlyAccessor( RandomStream.prototype, 'byteLength', getStateSize );
/**
* Implements the `_read` method.
*
* @private
* @name _read
* @memberof RandomStream.prototype
* @type {Function}
* @param {number} size - number (of bytes) to read
* @returns {void}
*/
setNonEnumerableReadOnly( RandomStream.prototype, '_read', read );
/**
* Gracefully destroys a stream, providing backward compatibility.
*
* @name destroy
* @memberof RandomStream.prototype
* @type {Function}
* @param {(string|Object|Error)} [error] - error
* @returns {RandomStream} Stream instance
*/
setNonEnumerableReadOnly( RandomStream.prototype, 'destroy', destroy );
// EXPORTS //
module.exports = RandomStream;
| stdlib-js/stdlib | lib/node_modules/@stdlib/random/streams/negative-binomial/lib/main.js | JavaScript | apache-2.0 | 9,730 |
function f1(a) {
try {
throw "x";
} catch (arguments) {
console.log(arguments);
}
}
f1(3);
| csgordon/SJS | jscomp/tests/scope7.js | JavaScript | apache-2.0 | 123 |
// JavaScript Document
var flag1=true;
var flag2=true;
$(function () {
/*********************/
$.ajax({
type : 'POST',
dataType : 'json',
url : 'baseNeiName.do',
async : true,
cache : false,
error : function(request) {
bootbox.alert({
message : "请求异常",
size : 'small'
});
},
success : function(data) {
var i = 0;
for ( var item in data) {
$("#baselistid").after(
"<option value="+data[i].id+">"
+ data[i].name + "</option>");
i++;
}
}
});
/**************************/
/*########*/
$(document).on("click", "#Submit", function() {
var projectname=$("#projectname").val();
var name=$("#name").val();
var address=$("#address").val();
var budget=$("#budget").val();
budget=budget.trim();
var baselist=$("#baselist").val();
var reason=$("#reason").val();
var strmoney=/^[0-9]*$/.test(budget);
var money=budget.substring(1,0);
if(projectname==""){
bootbox.alert({
message : "请填写项目名称",
size : 'small'
});
return 0;
}
else if(name==""){
bootbox.alert({
message : "请填写报修人",
size : 'small'
});
return 0;
}
else if(address==""){
bootbox.alert({
message : "请填写具体位置",
size : 'small'
});
return 0;
}
else if(budget==""){
bootbox.alert({
message : "请填写预算金额",
size : 'small'
});
return 0;
}
else if(strmoney==false){
bootbox.alert({
message : "预算金额只能为数字",
size : 'small'
});
return 0;
}
else if(budget.length>1&&money==0){
bootbox.alert({
message : "请填写正确的预算金额格式,第一个数字不能为零",
size : 'small'
});
return 0;
}
else if(baselist=="请选择"){
bootbox.alert({
message : "请选择基地",
size : 'small'
});
return 0;
}
else if(reason==""){
bootbox.alert({
message : "请填写原因",
size : 'small'
});
return 0;
}
if (!flag1) {
bootbox.alert({
message: "上传资料仅限于rar,zip压缩包格式",
size: 'small'
});
$("#applyfile").val('');
return;
}
if (!flag2) {
bootbox.alert({
message: "上传资料大小不能大于10M",
size: 'small'
});
$("#applyfile").val('');
return;
}
/*************/
$("#applyform").submit();
/*************/
})
$('#applyfile').change(function() {
var filepath = $(this).val();
var file_size = this.files[0].size;
var size = file_size / 1024;
var extStart = filepath.lastIndexOf(".");
var ext = filepath.substring(extStart, filepath.length).toUpperCase();
if (ext != ".RAR" && ext != ".ZIP") {
bootbox.alert({
message: "上传资料仅限于rar,zip压缩包格式",
size: 'small'
});
$("#applyfile").val('');
flag1=false;
return;
}
if (size > 1024 * 10) {
bootbox.alert({
message: "上传资料大小不能大于10M",
size: 'small'
});
$("#applyfile").val('');
flag2=false;
return;
}
flag1=true;
flag2=true;
});
/*########*/
}); | pange123/PB_Management | 后台页面/WebRoot/js/myNeed/Repairpply.js | JavaScript | apache-2.0 | 3,500 |
/*
* Copyright 2019 The Project Oak Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
const showGreenIconForExtensionPages = {
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: {
hostEquals: chrome.runtime.id,
schemes: ['chrome-extension'],
pathEquals: '/index.html',
},
}),
],
actions: [new chrome.declarativeContent.SetIcon({ path: 'icon-green.png' })],
};
chrome.runtime.onInstalled.addListener(function () {
chrome.declarativeContent.onPageChanged.removeRules(undefined, function () {
chrome.declarativeContent.onPageChanged.addRules([
showGreenIconForExtensionPages,
]);
});
});
async function loadPageInASecureSandbox({ id: tabId }) {
const src = (
await new Promise((resolve) =>
chrome.tabs.executeScript(tabId, { file: 'getInnerHtml.js' }, resolve)
)
)?.[0];
// It's possible that the chrome extension cannot read the source code, either
// because it is served via a non-permitted scheme (eg `chrome-extension://`),
// or bc the user/adminstrator has denied this extension access to the page.
if (!src) {
chrome.notifications.create(undefined, {
type: 'basic',
title: 'Could not sandbox this page',
message: 'The extension does not have permission to modify this page.',
iconUrl: 'icon-red.png',
isClickable: false,
eventTime: Date.now(),
});
return;
}
const searchParams = new URLSearchParams({ src });
const url = `index.html?${searchParams.toString()}`;
chrome.tabs.update({ url });
}
chrome.browserAction.onClicked.addListener(loadPageInASecureSandbox);
| project-oak/oak | chrome_extension/background.js | JavaScript | apache-2.0 | 2,181 |
// lightbox_plus.js
// == written by Takuya Otani <[email protected]> ===
// == Copyright (C) 2006 SimpleBoxes/SerendipityNZ Ltd. ==
/*
Copyright (C) 2006 Takuya Otani/SimpleBoxes - http://serennz.cool.ne.jp/sb/
Copyright (C) 2006 SerendipityNZ - http://serennz.cool.ne.jp/snz/
This script is licensed under the Creative Commons Attribution 2.5 License
http://creativecommons.org/licenses/by/2.5/
basically, do anything you want, just leave my name and link.
*/
/*
Original script : Lightbox JS : Fullsize Image Overlays
Copyright (C) 2005 Lokesh Dhakar - http://www.huddletogether.com
For more information on this script, visit:
http://huddletogether.com/projects/lightbox/
*/
// ver. 20061027 - fixed a bug ( not work at xhml documents on Netscape7 )
// ver. 20061026 - fixed bugs
// ver. 20061010 - implemented image set feature
// ver. 20060921 - fixed a bug / added overall view
// ver. 20060920 - added flag to prevent mouse wheel event
// ver. 20060919 - fixed a bug
// ver. 20060918 - implemented functionality of wheel zoom & drag'n drop
// ver. 20060131 - fixed a bug to work correctly on Internet Explorer for Windows
// ver. 20060128 - implemented functionality of echoic word
// ver. 20060120 - implemented functionality of caption and close button
function WindowSize()
{ // window size object
this.w = 0;
this.h = 0;
return this.update();
}
WindowSize.prototype.update = function()
{
var d = document;
this.w =
(window.innerWidth) ? window.innerWidth
: (d.documentElement && d.documentElement.clientWidth) ? d.documentElement.clientWidth
: d.body.clientWidth;
this.h =
(window.innerHeight) ? window.innerHeight
: (d.documentElement && d.documentElement.clientHeight) ? d.documentElement.clientHeight
: d.body.clientHeight;
return this;
};
function PageSize()
{ // page size object
this.win = new WindowSize();
this.w = 0;
this.h = 0;
return this.update();
}
PageSize.prototype.update = function()
{
var d = document;
this.w =
(window.innerWidth && window.scrollMaxX) ? window.innerWidth + window.scrollMaxX
: (d.body.scrollWidth > d.body.offsetWidth) ? d.body.scrollWidth
: d.body.offsetWidt;
this.h =
(window.innerHeight && window.scrollMaxY) ? window.innerHeight + window.scrollMaxY
: (d.body.scrollHeight > d.body.offsetHeight) ? d.body.scrollHeight
: d.body.offsetHeight;
this.win.update();
if (this.w < this.win.w) this.w = this.win.w;
if (this.h < this.win.h) this.h = this.win.h;
return this;
};
function PagePos()
{ // page position object
this.x = 0;
this.y = 0;
return this.update();
}
PagePos.prototype.update = function()
{
var d = document;
this.x =
(window.pageXOffset) ? window.pageXOffset
: (d.documentElement && d.documentElement.scrollLeft) ? d.documentElement.scrollLeft
: (d.body) ? d.body.scrollLeft
: 0;
this.y =
(window.pageYOffset) ? window.pageYOffset
: (d.documentElement && d.documentElement.scrollTop) ? d.documentElement.scrollTop
: (d.body) ? d.body.scrollTop
: 0;
return this;
};
function LightBox(option)
{
var self = this;
self._imgs = [];
self._sets = [];
self._wrap = null;
self._box = null;
self._img = null;
self._open = -1;
self._page = new PageSize();
self._pos = new PagePos();
self._zoomimg = null;
self._expandable = false;
self._expanded = false;
self._funcs = {'move':null,'up':null,'drag':null,'wheel':null,'dbl':null};
self._level = 1;
self._curpos = {x:0,y:0};
self._imgpos = {x:0,y:0};
self._minpos = {x:0,y:0};
self._expand = option.expandimg;
self._shrink = option.shrinkimg;
self._resizable = option.resizable;
self._timer = null;
self._indicator = null;
self._overall = null;
self._openedset = null;
self._prev = null;
self._next = null;
self._hiding = [];
self._first = false;
return self._init(option);
}
LightBox.prototype = {
_init : function(option)
{
var self = this;
var d = document;
if (!d.getElementsByTagName) return;
if (Browser.isMacIE) return self;
var links = d.getElementsByTagName("a");
for (var i = 0; i < links.length; i++)
{
var anchor = links[i];
var num = self._imgs.length;
var rel = String(anchor.getAttribute("rel")).toLowerCase();
if (!anchor.getAttribute("href") || !rel.match('lightbox')) continue;
// initialize item
self._imgs[num] = {
src:anchor.getAttribute("href"),
w:-1,
h:-1,
title:'',
cls:anchor.className,
set:rel
};
if (anchor.getAttribute("title"))
self._imgs[num].title = anchor.getAttribute("title");
else if (anchor.firstChild
&& anchor.firstChild.getAttribute
&& anchor.firstChild.getAttribute("title"))
self._imgs[num].title = anchor.firstChild.getAttribute("title");
anchor.onclick = self._genOpener(num);
// set closure to onclick event
if (rel != 'lightbox')
{
if (!self._sets[rel]) self._sets[rel] = [];
self._sets[rel].push(num);
}
}
var body = d.getElementsByTagName("body")[0];
self._wrap = self._createWrapOn(body, option.loadingimg);
self._box = self._createBoxOn(body, option);
self._img = self._box.firstChild;
self._zoomimg = d.getElementById('actionImage');
return self;
},
_genOpener : function(num)
{
var self = this;
return function() {
self._show(num);
return false;
}
},
_createWrapOn : function(obj, imagePath)
{
var self = this;
if (!obj) return null;
// create wrapper object, translucent background
var wrap = document.createElement('div');
obj.appendChild(wrap);
wrap.id = 'overlay';
wrap.style.display = 'none';
wrap.style.position = 'fixed';
wrap.style.top = '0px';
wrap.style.left = '0px';
wrap.style.zIndex = '50';
wrap.style.width = '100%';
wrap.style.height = '100%';
if (Browser.isWinIE) wrap.style.position = 'absolute';
Event.register(wrap, "click", function(evt) {
self._close(evt);
});
// create loading image, animated image
var imag = new Image;
imag.onload = function() {
var spin = document.createElement('img');
wrap.appendChild(spin);
spin.id = 'loadingImage';
spin.src = imag.src;
spin.style.position = 'relative';
self._set_cursor(spin);
Event.register(spin, 'click', function(evt) {
self._close(evt);
});
imag.onload = function() {
};
};
if (imagePath != '') imag.src = imagePath;
return wrap;
},
_createBoxOn : function(obj, option)
{
var self = this;
if (!obj) return null;
// create lightbox object, frame rectangle
var box = document.createElement('div');
obj.appendChild(box);
box.id = 'lightbox';
box.style.display = 'none';
box.style.position = 'absolute';
box.style.zIndex = '60';
// create image object to display a target image
var img = document.createElement('img');
box.appendChild(img);
img.id = 'lightboxImage';
self._set_cursor(img);
Event.register(img, 'mouseover', function() {
self._show_action();
});
Event.register(img, 'mouseout', function() {
self._hide_action();
});
Event.register(img, 'click', function(evt) {
self._close(evt);
});
// create hover navi - prev
if (option.previmg)
{
var prevLink = document.createElement('img');
box.appendChild(prevLink);
prevLink.id = 'prevLink';
prevLink.style.display = 'none';
prevLink.style.position = 'absolute';
prevLink.style.left = '9px';
prevLink.style.zIndex = '70';
prevLink.src = option.previmg;
self._prev = prevLink;
Event.register(prevLink, 'mouseover', function() {
self._show_action();
});
Event.register(prevLink, 'click', function() {
self._show_next(-1);
});
}
// create hover navi - next
if (option.nextimg)
{
var nextLink = document.createElement('img');
box.appendChild(nextLink);
nextLink.id = 'nextLink';
nextLink.style.display = 'none';
nextLink.style.position = 'absolute';
nextLink.style.right = '9px';
nextLink.style.zIndex = '70';
nextLink.src = option.nextimg;
self._next = nextLink;
Event.register(nextLink, 'mouseover', function() {
self._show_action();
});
Event.register(nextLink, 'click', function() {
self._show_next(+1);
});
}
// create zoom indicator
var zoom = document.createElement('img');
box.appendChild(zoom);
zoom.id = 'actionImage';
zoom.style.display = 'none';
zoom.style.position = 'absolute';
zoom.style.top = '15px';
zoom.style.left = '15px';
zoom.style.zIndex = '70';
self._set_cursor(zoom);
zoom.src = self._expand;
Event.register(zoom, 'mouseover', function() {
self._show_action();
});
Event.register(zoom, 'click', function() {
self._zoom();
});
Event.register(window, 'resize', function() {
self._set_size(true);
});
// create close button
if (option.closeimg)
{
var btn = document.createElement('img');
box.appendChild(btn);
btn.id = 'closeButton';
btn.style.display = 'inline';
btn.style.position = 'absolute';
btn.style.right = '9px';
btn.style.top = '10px';
btn.style.zIndex = '80';
btn.src = option.closeimg;
self._set_cursor(btn);
Event.register(btn, 'click', function(evt) {
self._close(evt);
});
}
// caption text
var caption = document.createElement('span');
box.appendChild(caption);
caption.id = 'lightboxCaption';
caption.style.display = 'none';
caption.style.position = 'absolute';
caption.style.zIndex = '80';
// create effect image
/* if (!option.effectpos)
option.effectpos = {x:0,y:0};
else
{
if (option.effectpos.x == '') option.effectpos.x = 0;
if (option.effectpos.y == '') option.effectpos.y = 0;
}
var effect = new Image;
effect.onload = function()
{
var effectImg = document.createElement('img');
box.appendChild(effectImg);
effectImg.id = 'effectImage';
effectImg.src = effect.src;
if (option.effectclass) effectImg.className = option.effectclass;
effectImg.style.position = 'absolute';
effectImg.style.display = 'none';
effectImg.style.left = [option.effectpos.x,'px'].join('');;
effectImg.style.top = [option.effectpos.y,'px'].join('');
effectImg.style.zIndex = '90';
self._set_cursor(effectImg);
Event.register(effectImg,'click',function() { effectImg.style.display = 'none'; });
};
if (option.effectimg != '') effect.src = option.effectimg;*/
if (self._resizable)
{
var overall = document.createElement('div');
obj.appendChild(overall);
overall.id = 'lightboxOverallView';
overall.style.display = 'none';
overall.style.position = 'absolute';
overall.style.zIndex = '70';
self._overall = overall;
var indicator = document.createElement('div');
obj.appendChild(indicator);
indicator.id = 'lightboxIndicator';
indicator.style.display = 'none';
indicator.style.position = 'absolute';
indicator.style.zIndex = '80';
self._indicator = indicator;
}
return box;
},
_set_photo_size : function()
{
var self = this;
if (self._open == -1) return;
var targ = { w:self._page.win.w - 30, h:self._page.win.h - 30 };
var zoom = { x:15, y:15 };
var navi = { p:9, n:9, y:0 };
if (!self._expanded)
{ // shrink image with the same aspect
var orig = { w:self._imgs[self._open].w, h:self._imgs[self._open].h };
var ratio = 1.0;
if ((orig.w >= targ.w || orig.h >= targ.h) && orig.h && orig.w)
ratio = ((targ.w / orig.w) < (targ.h / orig.h)) ? targ.w / orig.w : targ.h / orig.h;
self._img.width = Math.floor(orig.w * ratio);
self._img.height = Math.floor(orig.h * ratio);
self._expandable = (ratio < 1.0) ? true : false;
if (self._resizable) self._expandable = true;
if (Browser.isWinIE) self._box.style.display = "block";
self._imgpos.x = self._pos.x + (targ.w - self._img.width) / 2;
self._imgpos.y = self._pos.y + (targ.h - self._img.height) / 2;
navi.y = Math.floor(self._img.height / 2) - 10;
self._show_caption(true);
self._show_overall(false);
}
else
{ // zoomed or actual sized image
var width = parseInt(self._imgs[self._open].w * self._level);
var height = parseInt(self._imgs[self._open].h * self._level);
self._minpos.x = self._pos.x + targ.w - width;
self._minpos.y = self._pos.y + targ.h - height;
if (width <= targ.w)
self._imgpos.x = self._pos.x + (targ.w - width) / 2;
else
{
if (self._imgpos.x > self._pos.x) self._imgpos.x = self._pos.x;
else if (self._imgpos.x < self._minpos.x) self._imgpos.x = self._minpos.x;
zoom.x = 15 + self._pos.x - self._imgpos.x;
navi.p = self._pos.x - self._imgpos.x - 5;
navi.n = width - self._page.win.w + self._imgpos.x + 25;
if (Browser.isWinIE) navi.n -= 10;
}
if (height <= targ.h)
{
self._imgpos.y = self._pos.y + (targ.h - height) / 2;
navi.y = Math.floor(self._img.height / 2) - 10;
}
else
{
if (self._imgpos.y > self._pos.y) self._imgpos.y = self._pos.y;
else if (self._imgpos.y < self._minpos.y) self._imgpos.y = self._minpos.y;
zoom.y = 15 + self._pos.y - self._imgpos.y;
navi.y = Math.floor(targ.h / 2) - 10 + self._pos.y - self._imgpos.y;
}
self._img.width = width;
self._img.height = height;
self._show_caption(false);
self._show_overall(true);
}
self._box.style.left = [self._imgpos.x,'px'].join('');
self._box.style.top = [self._imgpos.y,'px'].join('');
self._zoomimg.style.left = [zoom.x,'px'].join('');
self._zoomimg.style.top = [zoom.y,'px'].join('');
self._wrap.style.left = self._pos.x;
if (self._prev && self._next)
{
self._prev.style.left = [navi.p,'px'].join('');
self._next.style.right = [navi.n,'px'].join('');
self._prev.style.top = self._next.style.top = [navi.y,'px'].join('');
}
},
_show_overall : function(visible)
{
var self = this;
if (self._overall == null) return;
if (visible)
{
if (self._open == -1) return;
var base = 100;
var outer = { w:0, h:0, x:0, y:0 };
var inner = { w:0, h:0, x:0, y:0 };
var orig = { w:self._img.width , h:self._img.height };
var targ = { w:self._page.win.w - 30, h:self._page.win.h - 30 };
var max = orig.w;
if (max < orig.h) max = orig.h;
if (max < targ.w) max = targ.w;
if (max < targ.h) max = targ.h;
if (max < 1) return;
outer.w = parseInt(orig.w / max * base);
outer.h = parseInt(orig.h / max * base);
inner.w = parseInt(targ.w / max * base);
inner.h = parseInt(targ.h / max * base);
outer.x = self._pos.x + targ.w - base - 20;
outer.y = self._pos.y + targ.h - base - 20;
inner.x = outer.x - parseInt((self._imgpos.x - self._pos.x) / max * base);
inner.y = outer.y - parseInt((self._imgpos.y - self._pos.y) / max * base);
self._overall.style.left = [outer.x,'px'].join('');
self._overall.style.top = [outer.y,'px'].join('');
self._overall.style.width = [outer.w,'px'].join('');
self._overall.style.height = [outer.h,'px'].join('');
self._indicator.style.left = [inner.x,'px'].join('');
self._indicator.style.top = [inner.y,'px'].join('');
self._indicator.style.width = [inner.w,'px'].join('');
self._indicator.style.height = [inner.h,'px'].join('');
self._overall.style.display = 'block'
self._indicator.style.display = 'block';
}
else
{
self._overall.style.display = 'none';
self._indicator.style.display = 'none';
}
},
_set_size : function(onResize)
{
var self = this;
if (self._open == -1) return;
self._page.update();
self._pos.update();
var spin = self._wrap.firstChild;
if (spin)
{
var top = (self._page.win.h - spin.height) / 2;
if (self._wrap.style.position == 'absolute') top += self._pos.y;
spin.style.top = [top,'px'].join('');
spin.style.left = [(self._page.win.w - spin.width - 30) / 2,'px'].join('');
}
if (Browser.isWinIE)
{
self._wrap.style.width = [self._page.win.w,'px'].join('');
self._wrap.style.height = [self._page.win.h,'px'].join('');
self._wrap.style.top = [self._pos.y,'px'].join('');
}
if (onResize) self._set_photo_size();
},
_set_cursor : function(obj)
{
var self = this;
if (Browser.isWinIE && !Browser.isNewIE) return;
obj.style.cursor = 'pointer';
},
_current_setindex : function()
{
var self = this;
if (!self._openedset) return -1;
var list = self._sets[self._openedset];
for (var i = 0,n = list.length; i < n; i++)
{
if (list[i] == self._open) return i;
}
return -1;
},
_get_setlength : function()
{
var self = this;
if (!self._openedset) return -1;
return self._sets[self._openedset].length;
},
_show_action : function()
{
var self = this;
if (self._open == -1 || !self._expandable) return;
if (!self._zoomimg) return;
self._zoomimg.src = (self._expanded) ? self._shrink : self._expand;
self._zoomimg.style.display = 'inline';
var check = self._current_setindex();
if (check > -1)
{
if (check > 0) self._prev.style.display = 'inline';
if (check < self._get_setlength() - 1) self._next.style.display = 'inline';
}
},
_hide_action : function()
{
var self = this;
if (self._zoomimg) self._zoomimg.style.display = 'none';
if (self._open > -1 && self._expanded) self._dragstop(null);
if (self._prev) self._prev.style.display = 'none';
if (self._next) self._next.style.display = 'none';
},
_zoom : function()
{
var self = this;
var closeBtn = document.getElementById('closeButton');
if (self._expanded)
{
self._reset_func();
self._expanded = false;
if (closeBtn) closeBtn.style.display = 'inline';
}
else if (self._open > -1)
{
self._level = 1;
self._imgpos.x = self._pos.x;
self._imgpos.y = self._pos.y;
self._expanded = true;
self._funcs.drag = function(evt) {
self._dragstart(evt)
};
self._funcs.dbl = function(evt) {
self._close(null)
};
if (self._resizable)
{
self._funcs.wheel = function(evt) {
self._onwheel(evt)
};
Event.register(self._box, 'mousewheel', self._funcs.wheel);
}
Event.register(self._img, 'mousedown', self._funcs.drag);
Event.register(self._img, 'dblclick', self._funcs.dbl);
if (closeBtn) closeBtn.style.display = 'none';
}
self._set_photo_size();
self._show_action();
},
_reset_func : function()
{
var self = this;
if (self._funcs.wheel != null) Event.deregister(self._box, 'mousewheel', self._funcs.wheel);
if (self._funcs.move != null) Event.deregister(self._img, 'mousemove', self._funcs.move);
if (self._funcs.up != null) Event.deregister(self._img, 'mouseup', self._funcs.up);
if (self._funcs.drag != null) Event.deregister(self._img, 'mousedown', self._funcs.drag);
if (self._funcs.dbl != null) Event.deregister(self._img, 'dblclick', self._funcs.dbl);
self._funcs = {'move':null,'up':null,'drag':null,'wheel':null,'dbl':null};
},
_onwheel : function(evt)
{
var self = this;
var delta = 0;
evt = Event.getEvent(evt);
if (evt.wheelDelta) delta = event.wheelDelta / -120;
else if (evt.detail) delta = evt.detail / 3;
if (Browser.isOpera) delta = - delta;
var step =
(self._level < 1) ? 0.1
: (self._level < 2) ? 0.25
: (self._level < 4) ? 0.5
: 1;
self._level = (delta > 0) ? self._level + step : self._level - step;
if (self._level > 8) self._level = 8;
else if (self._level < 0.5) self._level = 0.5;
self._set_photo_size();
return Event.stop(evt);
},
_dragstart : function(evt)
{
var self = this;
evt = Event.getEvent(evt);
self._curpos.x = evt.screenX;
self._curpos.y = evt.screenY;
self._funcs.move = function(evnt) {
self._dragging(evnt);
};
self._funcs.up = function(evnt) {
self._dragstop(evnt);
};
Event.register(self._img, 'mousemove', self._funcs.move);
Event.register(self._img, 'mouseup', self._funcs.up);
return Event.stop(evt);
},
_dragging : function(evt)
{
var self = this;
evt = Event.getEvent(evt);
self._imgpos.x += evt.screenX - self._curpos.x;
self._imgpos.y += evt.screenY - self._curpos.y;
self._curpos.x = evt.screenX;
self._curpos.y = evt.screenY;
self._set_photo_size();
return Event.stop(evt);
},
_dragstop : function(evt)
{
var self = this;
evt = Event.getEvent(evt);
if (self._funcs.move != null) Event.deregister(self._img, 'mousemove', self._funcs.move);
if (self._funcs.up != null) Event.deregister(self._img, 'mouseup', self._funcs.up);
self._funcs.move = null;
self._funcs.up = null;
self._set_photo_size();
return (evt) ? Event.stop(evt) : false;
},
_show_caption : function(enable)
{
var self = this;
var caption = document.getElementById('lightboxCaption');
if (!caption) return;
if (caption.innerHTML.length == 0 || !enable)
{
caption.style.display = 'none';
}
else
{ // now display caption
caption.style.top = [self._img.height + 10,'px'].join('');
// 10 is top margin of lightbox
caption.style.left = '0px';
caption.style.width = [self._img.width + 20,'px'].join('');
// 20 is total side margin of lightbox
caption.style.display = 'block';
}
},
_toggle_wrap : function(flag)
{
var self = this;
self._wrap.style.display = flag ? "block" : "none";
if (self._hiding.length == 0 && !self._first)
{ // some objects may overlap on overlay, so we hide them temporarily.
var tags = ['select','embed','object'];
for (var i = 0,n = tags.length; i < n; i++)
{
var elem = document.getElementsByTagName(tags[i]);
for (var j = 0,m = elem.length; j < m; j++)
{ // check the original value at first. when alredy hidden, dont touch them
var check = elem[j].style.visibility;
if (!check)
{
if (elem[j].currentStyle)
check = elem[j].currentStyle['visibility'];
else if (document.defaultView)
check = document.defaultView.getComputedStyle(elem[j], '').getPropertyValue('visibility');
}
if (check == 'hidden') continue;
self._hiding.push(elem[j]);
}
}
self._first = true;
}
for (var i = 0,n = self._hiding.length; i < n; i++)
self._hiding[i].style.visibility = flag ? "hidden" : "visible";
},
_show : function(num)
{
var self = this;
var imag = new Image;
if (num < 0 || num >= self._imgs.length) return;
var loading = document.getElementById('loadingImage');
var caption = document.getElementById('lightboxCaption');
// var effect = document.getElementById('effectImage');
self._open = num;
// set opened image number
self._set_size(false);
// calc and set wrapper size
self._toggle_wrap(true);
if (loading) loading.style.display = 'inline';
imag.onload = function() {
if (self._imgs[self._open].w == -1)
{ // store original image width and height
self._imgs[self._open].w = imag.width;
self._imgs[self._open].h = imag.height;
}
/* if (effect)
{
effect.style.display = (!effect.className || self._imgs[self._open].cls == effect.className)
? 'block' : 'none';
}*/
if (caption)
try {
caption.innerHTML = self._imgs[self._open].title;
} catch(e) {
}
self._set_photo_size();
// calc and set lightbox size
self._hide_action();
self._box.style.display = "block";
self._img.src = imag.src;
self._img.setAttribute('title', self._imgs[self._open].title);
self._timer = window.setInterval(function() {
self._set_size(true)
}, 100);
if (loading) loading.style.display = 'none';
if (self._imgs[self._open].set != 'lightbox')
{
var set = self._imgs[self._open].set;
if (self._sets[set].length > 1) self._openedset = set;
if (!self._prev || !self._next) self._openedset = null;
}
};
self._expandable = false;
self._expanded = false;
imag.src = self._imgs[self._open].src;
},
_close_box : function()
{
var self = this;
self._open = -1;
self._openedset = null;
self._hide_action();
self._hide_action();
self._reset_func();
self._show_overall(false);
self._box.style.display = "none";
if (self._timer != null)
{
window.clearInterval(self._timer);
self._timer = null;
}
},
_show_next : function(direction)
{
var self = this;
if (!self._openedset) return self._close(null);
var index = self._current_setindex() + direction;
var targ = self._sets[self._openedset][index];
self._close_box();
self._show(targ);
},
_close : function(evt)
{
var self = this;
if (evt != null)
{
evt = Event.getEvent(evt);
var targ = evt.target || evt.srcElement;
if (targ && targ.getAttribute('id') == 'lightboxImage' && self._expanded) return;
}
self._close_box();
self._toggle_wrap(false);
}
};
Event.register(window, "load", function() {
var lightbox = new LightBox({
loadingimg:'lightbox/loading.gif',
expandimg:'lightbox/expand.gif',
shrinkimg:'lightbox/shrink.gif',
previmg:'lightbox/prev.gif',
nextimg:'lightbox/next.gif',
/* effectpos:{x:-40,y:-20},
effectclass:'effectable',*/
closeimg:'lightbox/close.gif',
resizable:true
});
});
| yusuke/samurai | site/lightbox/lightbox_plus.js | JavaScript | apache-2.0 | 29,978 |
// svgmap.js 0.2.0
//
// Copyright (c) 2014 jalal @ gnomedia
//
// 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.
//
var SvgMap = function (opts) {
/*global Snap:false, console:false */
'use strict';
console.log("SvgMap initializing");
var defaults = {
svgid: '',
mapurl: '',
mapid: '',
coordsurl: '',
hoverFill: '#fff',
strokeColor: '#000',
resultid: 'results'
};
var svgid = opts.svgid || defaults.svgid,
mapurl = opts.mapurl || defaults.mapurl,
mapid = opts.mapid || defaults.mapid,
coordsurl = opts.coordsurl || defaults.coordsurl,
strokeColor = opts.strokeColor || defaults.strokeColor,
hoverFill = opts.hoverFill || defaults.hoverFill,
resultid = opts.resultid || defaults.resultid;
var i, w, h, areas, pre;
var s = new Snap(svgid);
var group = s.group();
Snap.load(mapurl, function (f) {
i = f.select('image');
h = i.attr('height');
w = i.attr('width');
group.append(f);
s.attr({
viewBox: [0, 0, w, h]
});
var newmap = document.getElementById('newmap');
if (newmap) {
newmap.style.height = h + 'px';
newmap.style.maxWidth = w + 'px';
}
});
var shadow = new Snap(svgid);
areas = document.getElementsByTagName('area');
var area;
for (var j = areas.length - 1; j >= 0; j--) {
area = areas[j];
// console.log("Coord: " + area.coords);
var coords = area.coords.split(',');
var path = 'M ';
if (coords.length) {
for (var k = 0; k < coords.length; k += 2) {
if (!k) {pre = ''; } else {pre = ' L '; }
path += pre + coords[k] + ',' + coords[k + 1];
}
}
var p = new Snap();
var el = p.path(path);
el.attr({ id: area.title, fill: 'none', stroke: strokeColor, link: area.href, d: path, title: area.title});
el.hover(function () {
this.attr('fill', hoverFill);
}, function () {
this.attr('fill', 'transparent');
});
el.click(function () {
// console.log('click: ' + this.attr('id'));
hideAll();
show('Clicked: ' + this.attr('id'));
});
el.touchstart(function () {
console.log('touch: ' + this.attr('id'));
this.attr('fill', hoverFill);
hideAll();
show('Touched: ' + this.attr('id'));
});
el.touchend(function () {
this.attr('fill', 'transparent');
});
shadow.append(el);
}
function hideAll() {
var el = document.getElementById(resultid);
if (el) {el.style.display = "none"; }
// $(resultid).hide();
}
function show(txt) {
var el = document.getElementById(resultid);
if (el) {
el.style.display = "";
if (el.firstChild) {
el.removeChild(el.firstChild);
}
var t = document.createTextNode(txt);
el.appendChild(t);
}
}
};
| jalal/svgmap | js/svgmap.js | JavaScript | apache-2.0 | 3,661 |
(function () {
'use strict';
app.service('reportService', reportService);
function reportService($http, $window, $interval, timeAgo, restCall, queryService, dashboardFactory, ngAuthSettings, reportServiceUrl) {
var populateReport = function (report, url) {
function successCallback(response) {
if (response.data.data.length === 0) {
report.status = 'EMPTY'
} else {
report.status = 'SUCCESS';
report.data = response.data.data;
report.getTotal();
console.log(report);
}
}
function errorCallback(error) {
console.log(error);
this.status = 'FAILED';
}
restCall('GET', url, null, successCallback, errorCallback)
}
var getReport = function () {
return {
data: {},
searchParam : {
startdate: null,
enddate: null,
type: "ENTERPRISE",
generateexcel: false,
userid: null,
username: null
},
total : {
totalVendor: 0,
totalDelivery: 0,
totalPending: 0,
totalInProgress: 0,
totalCompleted: 0,
totalCancelled: 0,
totalProductPrice: 0,
totalDeliveryCharge: 0
},
getTotal: function () {
var itSelf = this;
itSelf.total.totalVendor = 0;
itSelf.total.totalDelivery = 0;
itSelf.total.totalPending = 0;
itSelf.total.totalInProgress = 0;
itSelf.total.totalCompleted = 0;
itSelf.total.totalCancelled = 0;
itSelf.total.totalProductPrice = 0;
itSelf.total.totalDeliveryCharge = 0;
angular.forEach(this.data, function (value, key) {
itSelf.total.totalVendor += 1;
itSelf.total.totalDelivery += value.TotalDelivery;
itSelf.total.totalPending += value.TotalPending;
itSelf.total.totalInProgress += value.TotalInProgress;
itSelf.total.totalCompleted += value.TotalCompleted;
itSelf.total.totalCancelled += value.TotalCancelled;
itSelf.total.totalProductPrice += value.TotalProductPrice;
itSelf.total.totalDeliveryCharge += value.TotalDeliveryCharge;
});
console.log(this.total)
},
getUrl: function () {
// FIXME: need to be refactored
if (this.searchParam.type === "BIKE_MESSENGER") {
return reportServiceUrl + "api/report?startdate="+this.searchParam.startdate+"&enddate="+this.searchParam.enddate+"&usertype="+this.searchParam.type;
}
return reportServiceUrl + "api/report?startdate="+this.searchParam.startdate+"&enddate="+this.searchParam.enddate+"&usertype="+this.searchParam.type;
},
getReport: function () {
var reportUrl = this.getUrl();
this.status = 'IN_PROGRESS';
populateReport(this, reportUrl);
},
goToReportJobs : function (user) {
console.log(user)
console.log(this.data)
if (this.searchParam.type === "BIKE_MESSENGER") {
$window.open("#/report/jobs?" + "startdate=" + this.searchParam.startdate + "&enddate="+ this.searchParam.enddate +
"&usertype=BIKE_MESSENGER" + "&userid=" + this.data[user].UserId, '_blank');
} else {
$window.open("#/report/jobs?" + "startdate=" + this.searchParam.startdate + "&enddate="+ this.searchParam.enddate + "&usertype=" + this.searchParam.type + "&username=" + user, '_blank');
}
},
exportExcel : function () {
var excelReportUrl = reportServiceUrl + "api/report?startdate="+this.searchParam.startdate+"&enddate="+this.searchParam.enddate+"&usertype="+this.searchParam.type + "&generateexcel=true";
$window.open(excelReportUrl, '_blank');
},
status : 'NONE'
}
}
return {
getReport: getReport
}
}
})();
| NerdCats/T-Rex | app/services/reportService.js | JavaScript | apache-2.0 | 3,588 |
var array = trace ( new Array());
var m = trace ( 0 );
var n = trace ( 3 );
var o = trace ( 5 );
var p = trace ( 7 );
array[0] = m;
array[1] = n;
array[2] = o;
array[3] = p;
var result = new Array();
// FOR-IN Schleife
for ( i in array ) {
result.push(i);
x = i;
z = 7;
}
var a = result;
var b = result[0];
var c = 7;
var d = x; | keil/TbDA | test/dependency_state/rule_forin.js | JavaScript | apache-2.0 | 360 |
'use strict'
/*eslint-env node */
exports.config = {
specs: [
'test/e2e/**/*.js'
],
baseUrl: 'http://localhost:9000',
chromeOnly: true
}
| musamusa/move | protractor.conf.js | JavaScript | apache-2.0 | 150 |
/**
* @license AngularJS v1.3.0-build.2690+sha.be7c02c
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
(function(window, angular, undefined) {'use strict';
/**
* @ngdoc module
* @name ngCookies
* @description
*
* # ngCookies
*
* The `ngCookies` module provides a convenient wrapper for reading and writing browser cookies.
*
*
* <div doc-module-components="ngCookies"></div>
*
* See {@link ngCookies.$cookies `$cookies`} and
* {@link ngCookies.$cookieStore `$cookieStore`} for usage.
*/
angular.module('ngCookies', ['ng']).
/**
* @ngdoc service
* @name $cookies
*
* @description
* Provides read/write access to browser's cookies.
*
* Only a simple Object is exposed and by adding or removing properties to/from this object, new
* cookies are created/deleted at the end of current $eval.
* The object's properties can only be strings.
*
* Requires the {@link ngCookies `ngCookies`} module to be installed.
*
* @example
*
* ```js
* function ExampleController($cookies) {
* // Retrieving a cookie
* var favoriteCookie = $cookies.myFavorite;
* // Setting a cookie
* $cookies.myFavorite = 'oatmeal';
* }
* ```
*/
factory('$cookies', ['$rootScope', '$browser', function ($rootScope, $browser) {
var cookies = {},
lastCookies = {},
lastBrowserCookies,
runEval = false,
copy = angular.copy,
isUndefined = angular.isUndefined;
//creates a poller fn that copies all cookies from the $browser to service & inits the service
$browser.addPollFn(function() {
var currentCookies = $browser.cookies();
if (lastBrowserCookies != currentCookies) { //relies on browser.cookies() impl
lastBrowserCookies = currentCookies;
copy(currentCookies, lastCookies);
copy(currentCookies, cookies);
if (runEval) $rootScope.$apply();
}
})();
runEval = true;
//at the end of each eval, push cookies
//TODO: this should happen before the "delayed" watches fire, because if some cookies are not
// strings or browser refuses to store some cookies, we update the model in the push fn.
$rootScope.$watch(push);
return cookies;
/**
* Pushes all the cookies from the service to the browser and verifies if all cookies were
* stored.
*/
function push() {
var name,
value,
browserCookies,
updated;
//delete any cookies deleted in $cookies
for (name in lastCookies) {
if (isUndefined(cookies[name])) {
$browser.cookies(name, undefined);
}
}
//update all cookies updated in $cookies
for(name in cookies) {
value = cookies[name];
if (!angular.isString(value)) {
value = '' + value;
cookies[name] = value;
}
if (value !== lastCookies[name]) {
$browser.cookies(name, value);
updated = true;
}
}
//verify what was actually stored
if (updated){
updated = false;
browserCookies = $browser.cookies();
for (name in cookies) {
if (cookies[name] !== browserCookies[name]) {
//delete or reset all cookies that the browser dropped from $cookies
if (isUndefined(browserCookies[name])) {
delete cookies[name];
} else {
cookies[name] = browserCookies[name];
}
updated = true;
}
}
}
}
}]).
/**
* @ngdoc service
* @name $cookieStore
* @requires $cookies
*
* @description
* Provides a key-value (string-object) storage, that is backed by session cookies.
* Objects put or retrieved from this storage are automatically serialized or
* deserialized by angular's toJson/fromJson.
*
* Requires the {@link ngCookies `ngCookies`} module to be installed.
*
* @example
*
* ```js
* function ExampleController($cookieStore) {
* // Put cookie
* $cookieStore.put('myFavorite','oatmeal');
* // Get cookie
* var favoriteCookie = $cookieStore.get('myFavorite');
* // Removing a cookie
* $cookieStore.remove('myFavorite');
* }
* ```
*/
factory('$cookieStore', ['$cookies', function($cookies) {
return {
/**
* @ngdoc method
* @name $cookieStore#get
*
* @description
* Returns the value of given cookie key
*
* @param {string} key Id to use for lookup.
* @returns {Object} Deserialized cookie value.
*/
get: function(key) {
var value = $cookies[key];
return value ? angular.fromJson(value) : value;
},
/**
* @ngdoc method
* @name $cookieStore#put
*
* @description
* Sets a value for given cookie key
*
* @param {string} key Id for the `value`.
* @param {Object} value Value to be stored.
*/
put: function(key, value) {
$cookies[key] = angular.toJson(value);
},
/**
* @ngdoc method
* @name $cookieStore#remove
*
* @description
* Remove given cookie
*
* @param {string} key Id of the key-value pair to delete.
*/
remove: function(key) {
delete $cookies[key];
}
};
}]);
})(window, window.angular);
| yawo/pepeto | code/client/js/node_modules/bower_components/angular-cookies/angular-cookies.js | JavaScript | apache-2.0 | 5,642 |
Subsets and Splits