commit
stringlengths 40
40
| subject
stringlengths 1
3.25k
| old_file
stringlengths 4
311
| new_file
stringlengths 4
311
| old_contents
stringlengths 0
26.3k
| lang
stringclasses 3
values | proba
float64 0
1
| diff
stringlengths 0
7.82k
|
---|---|---|---|---|---|---|---|
fe926d1b4f3428f33bc386365e15c7a689231c43
|
Fix relative paths for partials.
|
app/js/app/app.js
|
app/js/app/app.js
|
'use strict';
define(["rsvp", "foundation", "angular-ui-router", "app/responsive_video", "angular", "angular-resource", "app/controllers", "app/directives", "app/services", "app/filters"], function() {
window.Promise = RSVP.Promise;
window.Promise.defer = RSVP.defer;
var rv = require("app/responsive_video");
// Declare app level module which depends on filters, and services
angular.module('isaac', [
'ui.router',
'isaac.filters',
'isaac.services',
'isaac.directives',
'isaac.controllers'
])
.config(['$stateProvider', '$urlRouterProvider', '$locationProvider', 'apiProvider', function($stateProvider, $urlRouterProvider, $locationProvider, apiProvider) {
$urlRouterProvider.when("", "/");
$urlRouterProvider.otherwise(function($injector, $location) {
var $state = $injector.get("$state");
$state.go("404", {target: $location.url()});
});
var genericPageState = function(url, id) {
return {
url: url,
resolve: {
"page": ["api", function(api) {
return api.pages.get({id: id}).$promise;
}]
},
views: {
"header-panel": {
templateUrl: "partials/states/generic_page/header_panel.html",
controller: "GenericPageHeaderController",
},
"body": {
templateUrl: "partials/states/generic_page/body.html",
controller: "GenericPageBodyController",
}
}
};
}
var staticPageState = function(url, folder) {
return {
url: url,
views: {
"header-panel": {
templateUrl: "partials/states/" + folder + "/header_panel.html",
},
"body": {
templateUrl: "partials/states/" + folder + "/body.html"
},
},
}
}
$stateProvider
.state('home', staticPageState("/", "home"))
.state('about', genericPageState("/about", "about_us_index"))
.state('events', genericPageState("/events", "events_index"))
.state('contact', staticPageState("/contact", "contact"))
.state('random_content', {
url: "/content/:id",
resolve: {
"page": ["api", "$stateParams", function(api, $stateParams) {
return api.content.get({id: $stateParams.id}).$promise;
}]
},
views: {
"header-panel": {
templateUrl: "partials/states/generic_page/header_panel.html",
controller: ["$scope", "page", function($scope, page) {
$scope.title = "Content object: " + page.contentObject.id;
}],
},
"body": {
templateUrl: "partials/states/generic_page/body.html",
controller: ["$scope", "page", function($scope, page) {
$scope.doc = page.contentObject;
}],
}
}
})
.state('404', {
params: ["target"],
views: {
"header-panel": {
template: "<h1>Page not found</h1>",
},
"body": {
template: "Page not found: {{target}}",
controller: function($scope, $stateParams) {
$scope.target = $stateParams.target;
}
},
},
})
// Only use html5 mode if we are on a real server, which should respect .htaccess
$locationProvider.html5Mode(document.location.hostname != "localhost").hashPrefix("!");
// Here we configure the api provider with the server running the API. Don't need to do this if it's local.
apiProvider.server("http://isaac-dev.dtg.cl.cam.ac.uk");
}])
.run(['$rootScope', 'api', function($rootScope, api) {
/*
api.pages.get({id: "events_index"}).$promise.then(function(d) {
$rootScope.aboutPage = d.contentObject;
});*/
$rootScope.$on("$includeContentLoaded", function() {
console.log("Partial loaded. Reinitialising document.");
// Make all videos responsive
rv.updateAll();
$(document).foundation({
// Queries for retina images for data interchange
interchange:
{
named_queries :
{
small_retina : 'only screen and (min-width: 1px) and (-webkit-min-device-pixel-ratio: 2),'+
'only screen and (min-width: 1px) and (min--moz-device-pixel-ratio: 2),'+
'only screen and (min-width: 1px) and (-o-min-device-pixel-ratio: 2/1),'+
'only screen and (min-width: 1px) and (min-device-pixel-ratio: 2),'+
'only screen and (min-width: 1px) and (min-resolution: 192dpi),'+
'only screen and (min-width: 1px) and (min-resolution: 2dppx)',
medium_retina : 'only screen and (min-width: 641px) and (-webkit-min-device-pixel-ratio: 2),'+
'only screen and (min-width: 641px) and (min--moz-device-pixel-ratio: 2),'+
'only screen and (min-width: 641px) and (-o-min-device-pixel-ratio: 2/1),'+
'only screen and (min-width: 641px) and (min-device-pixel-ratio: 2),'+
'only screen and (min-width: 641px) and (min-resolution: 192dpi),'+
'only screen and (min-width: 641px) and (min-resolution: 2dppx)',
large_retina : 'only screen and (min-width: 1024px) and (-webkit-min-device-pixel-ratio: 2),'+
'only screen and (min-width: 1024px) and (min--moz-device-pixel-ratio: 2),'+
'only screen and (min-width: 1024px) and (-o-min-device-pixel-ratio: 2/1),'+
'only screen and (min-width: 1024px) and (min-device-pixel-ratio: 2),'+
'only screen and (min-width: 1024px) and (min-resolution: 192dpi),'+
'only screen and (min-width: 1024px) and (min-resolution: 2dppx)'
}
}
});
$(document).foundation('interchange', 'reflow');
});
}]);
/////////////////////////////////////
// Bootstrap AngularJS
/////////////////////////////////////
var root = $("html");
angular.bootstrap(root, ['isaac']);
});
|
JavaScript
| 0 |
@@ -1311,32 +1311,33 @@
templateUrl: %22
+/
partials/states/
@@ -1519,32 +1519,33 @@
templateUrl: %22
+/
partials/states/
@@ -1894,32 +1894,33 @@
templateUrl: %22
+/
partials/states/
@@ -2038,32 +2038,33 @@
templateUrl: %22
+/
partials/states/
@@ -2854,32 +2854,33 @@
templateUrl: %22
+/
partials/states/
@@ -3198,16 +3198,17 @@
teUrl: %22
+/
partials
|
aad68fc8901a91f5b8fc0a7927732ec80c196322
|
fix xhr problem in firefox os
|
app/js/jenkins.js
|
app/js/jenkins.js
|
(function(window, $) {
var query = {
jobs: 'api/json?tree=jobs[color,name,url]'
};
function Jenkins(url) {
this.url = url;
}
Jenkins.prototype.setUrl = function(url) {
this.url = url;
};
//async function for getting all jenkins job data
//callback(err, data)
Jenkins.prototype.getJobs = function(callback) {
$.ajax({url: this.url + query.jobs, dataType: 'json'}).done(function(data) {
console.log('get jenkins data: ', data);
if (callback) {
callback(null, data);
}
}).fail(function() {
console.log('request for jobs fails');
if (callback) {
callback('error', null);
}
});
};
window.Jenkins = Jenkins;
} (window, jQuery) );
|
JavaScript
| 0.000002 |
@@ -377,86 +377,324 @@
-$.ajax(%7Burl: this.url + query.jobs, data
+var xhr = new window.XMLHttpRequest(%7B%0A mozSystem: true%0A %7D);%0A%0A xhr.open('GET', this.url + query.jobs, true);%0A xhr.response
Type
-:
+ =
'json'
-%7D).done(function(data
+;%0A%0A xhr.onload = function(e) %7B%0A var err = null;%0A%0A if (xhr.status === 200 %7C%7C xhr.status === 400 %7C%7C xhr.status === 0
) %7B%0A
-%0A
+
@@ -693,32 +693,33 @@
%0A
+
console.log('get
@@ -719,134 +719,371 @@
og('
-get jenkins data: ', data);%0A%0A if (callback) %7B%0A callback(null, data);%0A %7D%0A%0A %7D).fail(
+xhr success');%0A %7D else %7B%0A err = 'error';%0A console.log('xhr failed: ', xhr.status);%0A %7D%0A%0A if (callback && typeof callback === 'function') %7B%0A setTimeout(function() %7B%0A callback(err, xhr.response);%0A %7D, 0);%0A %7D%0A %7D;%0A%0A xhr.ontimeout =
func
@@ -1087,21 +1087,21 @@
unction(
+e
) %7B%0A
-%0A
@@ -1121,59 +1121,79 @@
og('
-request for jobs fail
+xhr timeout to get job
s');%0A
-%0A
+
+%7D;%0A%0A
-if (callback
+ xhr.onerror = function(e
) %7B%0A
@@ -1208,34 +1208,36 @@
-
- callback('
+console.log('xhr
error
+:
',
-null
+e
);%0A
@@ -1235,37 +1235,35 @@
', e);%0A
- %7D
+%7D;%0A
%0A %7D);%0A
@@ -1255,17 +1255,25 @@
-%7D
+xhr.send(
);%0A %7D
|
bbd31885414fbced7695dfcd3df3f34eb6cf9e3b
|
Remove uname form files model
|
app/lib/models.js
|
app/lib/models.js
|
/* globals Models Status Random */
Models = { // eslint-disable-line
project: function () {
return {
name: '',
industry: '',
createdAt: '',
description: '',
owner: '',
contributors: [],
commands: [],
notes: [],
droneLog: [],
files: []
}
},
host: function () {
return {
projectId: '',
longIpv4Addr: 0,
ipv4: '',
mac: '',
hostnames: [],
os: '',
notes: [],
statusMessage: '',
tags: [],
status: Status.grey,
lastModifiedBy: '',
isFlagged: false,
files: []
}
},
authInterface: function () {
return {
projectId: '',
isMultifactor: true,
kind: '',
url: '',
description: ''
}
},
netblock: function () {
return {
projectId: '',
asn: '',
asnCountryCode: '',
asnCidr: '',
asnDate: '',
asnRegistry: '',
cidr: '',
abuseEmails: '',
miscEmails: '',
techEmails: '',
name: '',
city: '',
country: '',
postalCode: '',
created: '',
updated: '',
description: '',
handle: ''
}
},
os: function () {
return {
tool: '',
fingerprint: 'Unknown',
weight: 0
}
},
service: function () {
return {
projectId: '',
hostId: '',
port: 0,
protocol: 'tcp',
service: 'Unknown',
product: 'Unknown',
status: Status.grey,
isFlagged: false,
lastModifiedBy: '',
notes: [],
files: []
}
},
issue: function () {
return {
projectId: '',
title: '',
cvss: 0,
rating: '',
isConfirmed: false,
description: '',
evidence: '',
solution: '',
hosts: [],
pluginIds: [{
tool: 'Manual',
id: Random.id()
}],
cves: [],
references: [],
identifiedBy: [{
tool: 'Manual'
}],
notes: [],
isFlagged: false,
status: Status.grey,
lastModifiedBy: '',
files: []
}
},
issueHost: function () {
return {
ipv4: '',
port: 0,
protocol: ''
}
},
issueReference: function () {
return {
link: '',
name: ''
}
},
person: function () {
return {
projectId: '',
principalName: '',
samAccountName: '',
distinguishedName: '',
firstName: '',
middleName: '',
lastName: '',
displayName: '',
department: '',
description: '',
address: '',
emails: [],
phones: [],
references: [],
groups: [],
lastLogon: '',
lastLogoff: '',
loggedIn: []
}
},
personReference: function () {
return {
description: '',
username: '',
link: ''
}
},
note: function () {
return {
title: '',
content: '',
lastModifiedBy: ''
}
},
credential: function () {
return {
username: '',
password: '',
format: '',
hash: '',
host: '',
service: ''
}
},
webDirectory: function () {
return {
projectId: '',
hostId: '',
path: '',
port: 0,
responseCode: '',
lastModifiedBy: '',
isFlagged: false
}
},
file: function () {
return {
filename: '',
uname: '',
url: ''
}
}
}
|
JavaScript
| 0 |
@@ -3353,25 +3353,8 @@
'',%0A
- uname: '',%0A
|
37a8712ef07f98cd167ff3ca79c0a5c26f3efba8
|
Fix customSagas prop type (#361)
|
src/AdminGuesser.js
|
src/AdminGuesser.js
|
import React, { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import {
AdminContext,
AdminUI,
ComponentPropType,
Error as DefaultError,
Loading,
TranslationProvider,
defaultI18nProvider,
} from 'react-admin';
import { createHashHistory } from 'history';
import { createMuiTheme } from '@material-ui/core';
import ErrorBoundary from './ErrorBoundary';
import IntrospectionContext from './IntrospectionContext';
import ResourceGuesser from './ResourceGuesser';
import SchemaAnalyzerContext from './SchemaAnalyzerContext';
import { Layout } from './layout';
import introspectReducer from './introspectReducer';
const displayOverrideCode = (resources) => {
if (process.env.NODE_ENV === 'production') return;
let code =
'If you want to override at least one resource, paste this content in the <AdminGuesser> component of your app:\n\n';
resources.forEach((r) => {
code += `<ResourceGuesser name={"${r.name}"} />\n`;
});
console.info(code);
};
/**
* AdminResourcesGuesser automatically renders an `<AdminUI>` component for resources exposed by a web API documented with Hydra, OpenAPI or any other format supported by `@api-platform/api-doc-parser`.
* If child components are passed (usually `<ResourceGuesser>` or `<Resource>` components, but it can be any other React component), they are rendered in the given order.
* If no children are passed, a `<ResourceGuesser>` component is created for each resource type exposed by the API, in the order they are specified in the API documentation.
*/
export const AdminResourcesGuesser = ({
children,
includeDeprecated,
resources,
loading,
loadingPage: LoadingPage = Loading,
...rest
}) => {
if (loading) {
return <LoadingPage />;
}
let resourceChildren = children;
if (!resourceChildren && resources) {
const guessResources = includeDeprecated
? resources
: resources.filter((r) => !r.deprecated);
resourceChildren = guessResources.map((r) => (
<ResourceGuesser name={r.name} key={r.name} />
));
displayOverrideCode(guessResources);
}
return (
<AdminUI loading={LoadingPage} {...rest}>
{resourceChildren}
</AdminUI>
);
};
const defaultTheme = createMuiTheme({
palette: {
primary: {
contrastText: '#ffffff',
main: '#38a9b4',
},
secondary: {
main: '#288690',
},
},
});
const AdminGuesser = ({
// Props for SchemaAnalyzerContext
schemaAnalyzer,
// Props for AdminContext
dataProvider,
authProvider,
i18nProvider,
history,
customReducers = {},
customSagas,
initialState,
// Props for AdminResourcesGuesser
includeDeprecated = false,
// Props for AdminUI
customRoutes = [],
appLayout,
layout = Layout,
loginPage,
loading: loadingPage,
locale,
theme = defaultTheme,
// Other props
children,
...rest
}) => {
const [resources, setResources] = useState();
const [loading, setLoading] = useState(true);
const [, setError] = useState();
const [addedCustomRoutes, setAddedCustomRoutes] = useState([]);
const [introspect, setIntrospect] = useState(true);
if (!history) {
history = typeof window === 'undefined' ? {} : createHashHistory();
}
if (appLayout && process.env.NODE_ENV !== 'production') {
console.warn(
'You are using deprecated prop "appLayout", it was replaced by "layout", see https://github.com/marmelab/react-admin/issues/2918',
);
}
if (loginPage === true && process.env.NODE_ENV !== 'production') {
console.warn(
'You passed true to the loginPage prop. You must either pass false to disable it or a component class to customize it',
);
}
if (locale && process.env.NODE_ENV !== 'production') {
console.warn(
'You are using deprecated prop "locale". You must now pass the initial locale to your i18nProvider',
);
}
useEffect(() => {
if (typeof dataProvider.introspect !== 'function') {
throw new Error(
'The given dataProvider needs to expose an "introspect" function returning a parsed API documentation from api-doc-parser',
);
}
if (!introspect) {
return;
}
dataProvider
.introspect()
.then(({ data, customRoutes = [] }) => {
setResources(data.resources);
setAddedCustomRoutes(customRoutes);
setIntrospect(false);
setLoading(false);
})
.catch((error) => {
// Allow error to be caught by the error boundary
setError(() => {
throw error;
});
});
}, [introspect, dataProvider]);
return (
<IntrospectionContext.Provider
value={{
introspect: () => {
setLoading(true);
setIntrospect(true);
},
}}>
<SchemaAnalyzerContext.Provider value={schemaAnalyzer}>
<AdminContext
authProvider={authProvider}
dataProvider={dataProvider}
i18nProvider={i18nProvider}
history={history}
customReducers={{ introspect: introspectReducer, ...customReducers }}
customSagas={customSagas}
initialState={initialState}>
<AdminResourcesGuesser
includeDeprecated={includeDeprecated}
resources={resources}
customRoutes={[...addedCustomRoutes, ...customRoutes]}
loading={loading}
layout={appLayout || layout}
loginPage={loginPage}
loadingPage={loadingPage}
theme={theme}
{...rest}>
{children}
</AdminResourcesGuesser>
</AdminContext>
</SchemaAnalyzerContext.Provider>
</IntrospectionContext.Provider>
);
};
AdminGuesser.propTypes = {
dataProvider: PropTypes.oneOfType([PropTypes.object, PropTypes.func])
.isRequired,
authProvider: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
i18nProvider: PropTypes.oneOfType([PropTypes.object, PropTypes.func]),
history: PropTypes.object,
customReducers: PropTypes.object,
customSagas: PropTypes.object,
initialState: PropTypes.object,
schemaAnalyzer: PropTypes.object.isRequired,
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
theme: PropTypes.object,
includeDeprecated: PropTypes.bool,
customRoutes: PropTypes.array,
};
const AdminGuesserWithError = ({ error, ...props }) => (
<TranslationProvider i18nProvider={props.i18nProvider}>
<ErrorBoundary error={error}>
<AdminGuesser {...props} />
</ErrorBoundary>
</TranslationProvider>
);
AdminGuesserWithError.defaultProps = {
error: DefaultError,
i18nProvider: defaultI18nProvider,
};
AdminGuesserWithError.propTypes = {
error: ComponentPropType,
};
export default AdminGuesserWithError;
|
JavaScript
| 0 |
@@ -6014,30 +6014,29 @@
: PropTypes.
-object
+array
,%0A initialS
|
33331ba6d0e99c725c8c71d5b7af6180f55375bc
|
Update tests according to new API.
|
test/sixpack-test.js
|
test/sixpack-test.js
|
var mocha = require('mocha');
var assert = require('chai').assert;
var expect = require('chai').expect;
describe("Sixpack", function () {
it("should return an alternative for participate", function (done) {
var sixpack = require('../');
var session = new sixpack.Session;
session.participate("show-bieber", ["trolled", "not-trolled"], function(err, resp) {
if (err) throw err;
expect(resp.alternative.name).to.match(/trolled/);
done();
});
});
it("should return ok for participate with traffic_fraction", function (done) {
var sixpack = require('../');
var session = new sixpack.Session;
session.participate("show-bieber-fraction", ["trolled", "not-trolled"], 0.1, function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("ok");
done();
});
});
it("should return forced alternative for participate with force", function (done) {
var sixpack = require('../');
var session = new sixpack.Session;
session.participate("show-bieber", ["trolled", "not-trolled"], "trolled", function(err, resp) {
if (err) throw err;
expect(resp.alternative.name).to.equal("trolled");
session.participate("show-bieber", ["trolled", "not-trolled"], "not-trolled", function(err, resp) {
if (err) throw err;
expect(resp.alternative.name).to.equal("not-trolled");
done();
});
});
});
it("should return ok and forced alternative for participate with traffic_fraction and force", function (done) {
var sixpack = require('../');
var session = new sixpack.Session;
session.participate("show-bieber-fraction", ["trolled", "not-trolled"], 0.1, "trolled", function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("ok");
expect(resp.alternative.name).to.equal("trolled");
session.participate("show-bieber-fraction", ["trolled", "not-trolled"], 0.1, "not-trolled", function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("ok");
expect(resp.alternative.name).to.equal("not-trolled");
done();
});
});
});
it("should auto generate a client_id", function (done) {
var sixpack = require('../');
var session = new sixpack.Session;
expect(session.client_id.length).to.equal(36);
done();
});
it("should return ok for convert", function (done) {
var sixpack = require('../');
var session = new sixpack.Session("mike");
session.participate("show-bieber", ["trolled", "not-trolled"], function(err, resp) {
if (err) throw err;
session.convert("show-bieber", function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("ok");
done();
});
});
});
it("should return ok for multiple converts", function (done) {
var sixpack = require('../');
var session = new sixpack.Session("mike");
session.participate("show-bieber", ["trolled", "not-trolled"], function(err, alt) {
if (err) throw err;
session.convert("show-bieber", function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("ok");
session.convert("show-bieber", function(err, alt) {
if (err) throw err;
expect(resp.status).to.equal("ok");
done();
});
});
});
});
it("should not return ok for convert with new client_id", function (done) {
var sixpack = require('../');
var session = new sixpack.Session("unknown_idizzle")
session.convert("show-bieber", function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("failed");
done();
});
});
it("should not return ok for convert with new experiment", function (done) {
var sixpack = require('../');
var session = new sixpack.Session("mike");
session.convert("show-blieber", function(err, resp) {
// TODO should this be an err?
if (err) throw err;
expect(resp.status).to.equal("failed");
done();
});
});
it("should return ok for convert with kpi", function (done) {
var sixpack = require('../');
var session = new sixpack.Session("mike");
session.convert("show-bieber", "justin-shown", function(err, resp) {
if (err) throw err;
expect(resp.status).to.equal("ok");
done();
});
});
it("should not allow bad experiment names", function (done) {
var sixpack = require('../');
var session = new sixpack.Session();
session.participate("%%", ["trolled", "not-trolled"], function(err, alt) {
assert.equal(alt, null);
expect(err).instanceof(Error);
done();
});
});
it("should not allow bad alternative names", function (done) {
var sixpack = require('../');
var session = new sixpack.Session();
session.participate("show-bieber", ["trolled"], function(err, alt) {
assert.equal(alt, null);
expect(err).instanceof(Error);
session.participate("show-bieber", ["trolled", "%%"], function(err, alt) {
assert.equal(alt, null);
expect(err).instanceof(Error);
done();
});
});
});
it("should work without using the simple methods", function (done) {
var sixpack = require('../');
var session = new sixpack.Session();
session.convert("testing", function(err, res) {
if (err) throw err;
expect(res.status).equal("failed");
session.participate("testing", ["one", "two"], function(err, res) {
if (err) throw err;
var alt1 = res.alternative.name;
var old_id = session.client_id;
session.client_id = sixpack.generate_client_id();
session.convert("testing", function(err, res) {
if (err) throw err;
expect(res.status).equal("failed");
session.participate("testing", ["one", "two"], function(err, res) {
if (err) throw err;
session.client_id = old_id;
session.participate("testing", ["one", "two"], function(err, res) {
if (err) throw err;
expect(res.alternative.name).to.equal(alt1);
done();
});
});
});
});
});
});
});
|
JavaScript
| 0 |
@@ -2711,38 +2711,51 @@
sixpack.Session(
+%7Bclient_id:
%22mike%22
+%7D
);%0A sessi
@@ -3219,38 +3219,51 @@
sixpack.Session(
+%7Bclient_id:
%22mike%22
+%7D
);%0A sessi
@@ -3935,16 +3935,28 @@
Session(
+%7Bclient_id:
%22unknown
@@ -3964,16 +3964,17 @@
idizzle%22
+%7D
)%0A
@@ -4306,38 +4306,51 @@
sixpack.Session(
+%7Bclient_id:
%22mike%22
+%7D
);%0A sessi
@@ -4712,22 +4712,35 @@
Session(
+%7Bclient_id:
%22mike%22
+%7D
);%0A
|
14590f18de93b90390e238f1845b7a6e20055cec
|
Update sitetest.js
|
test/svr/sitetest.js
|
test/svr/sitetest.js
|
//import namespace
var WebSvr = require("./../../websvr/websvr.js");
//Start the WebSvr, runnting at parent folder, default port is 8054, directory browser enabled;
//Trying at: http://localhost:8054
var webSvr = new WebSvr({
root: "./",
//enable https
https: true,
//default port of https
httpsPort: 8443,
httpsOpts: {
key: require("fs").readFileSync("svr/cert/privatekey.pem"),
cert: require("fs").readFileSync("svr/cert/certificate.pem")
},
//Change the default locations of tmp session and upload files
//session file stored here, must be end with "/"
sessionDir: "tmp/session/",
//tempary upload file stored here, must be end with "/"
uploadDir: "tmp/upload/",
listDir: true,
debug: true
});
webSvr.start();
/*
General filter: parse the post data / session before all request
parse: parse the post data and stored in req.body;
session: init the session and stored in req.session;
*/
webSvr.filter(function(req, res) {
//TODO: Add greeting words in filter
//res.write("Hello WebSvr!<br/>");
//Link to next filter
req.filter.next();
}, {parse:true, session:true});
/*
Session Filter: protect web/* folder => (validation by session);
*/
webSvr.filter(/web\/[\w\.]+/, function(req, res) {
//It's not index.htm/login.do, do the session validation
if (req.url.indexOf("index.htm") < 0 && req.url.indexOf("login.do") < 0) {
req.session.get("username", function(val) {
console.log("session username:", val);
!val && res.end("You must login, first!");
});
}
//Link to next filter
req.filter.next();
});
/*
Handler: login.do => (validate the username & password)
username: admin
password: 12345678
*/
webSvr.session("login.do", function(req, res) {
var querystring = require("querystring");
//TODO: Add an parameter to auto-complete querystring.parse(req.body);
var qs = querystring.parse(req.body);
if (qs.username == "admin" && qs.password == "12345678") {
//Put key/value pair in session
//TODO: Support put JSON object directly
req.session.set("username", qs.username, function(session) {
//res.writeHead(200, {"Content-Type": "text/html"});
//res.writeFile("/web/setting.htm");
//TODO: Error handler of undefined methods
console.log(session);
res.redirect("/web/setting.htm");
});
} else {
res.writeHead(401);
res.end("Wrong username/password");
}
});
/*
Uploader: upload.do => (receive handler)
*/
webSvr.file("upload.do", function(req, res) {
res.writeHead(200, {"Content-Type": "text/plain"});
//Upload file is stored in req.files
//form fields is stored in req.body
res.write(JSON.stringify(req.body));
res.end(JSON.stringify(req.files));
});
/*
Redirect: redirect request, try at: http://localhost:8054/redirect
*/
webSvr.url("redirect", function(req, res) {
res.redirect("/svr/websvr.all.js");
});
/*
Template: render template with params
*/
webSvr.url("template.node", function(req, res) {
res.writeHead(200, {"Content-Type": "text/html"});
//render template with session: { "username" : "admin" }
req.session.get(function(session) {
res.render(req, session);
});
});
/*
Simple redirect API:
*/
//Mapping "combine" to tool/Combine.js, trying at: http://localhost:8054/combine
webSvr.url("combine", ["svr/tool/Combine.js"]);
//Mapping "hello" to a string, trying at http://localhost:8054/hello
webSvr.url("hello", "Hello WebSvr!");
//Mapping "post" and parse the post in the request, trying at: http://localhost:8054/post.htm
webSvr.post("post.htm", function(req, res) {
res.writeHead(200, {"Content-Type": "text/html"});
//With session support: "{session: true}"
res.write("You username is " + req.session.get("username"));
res.write('<form action="" method="post"><input name="input" /></form><br/>');
res.end('Received : ' + req.body);
}, {session: true});
|
JavaScript
| 0 |
@@ -1424,24 +1424,143 @@
o%22) %3C 0) %7B%0D%0A
+ //Once session is get initialized%0D%0A //TODO: Make sure next req.session.get() will not load session file again.%0D%0A
req.sess
@@ -1698,24 +1698,14 @@
);%0D%0A
+%0D%0A
-%7D);%0D%0A %7D%0D%0A%0D%0A
//
@@ -1717,32 +1717,36 @@
to next filter%0D%0A
+
req.filter.nex
@@ -1747,24 +1747,76 @@
er.next();%0D%0A
+ %7D);%0D%0A%0D%0A %7D else %7B%0D%0A req.filter.next();%0D%0A %7D%0D%0A
%7D);%0D%0A%0D%0A%0D%0A/*%0D
@@ -3393,24 +3393,69 @@
session) %7B%0D%0A
+ //TODO: Change to req.render(session); %0D%0A
res.rend
|
f89722b1ffbd13cf0a559a42adbd12093da61302
|
fix for profile image domain
|
filter-people.js
|
filter-people.js
|
var _ = require('lodash'),
rp = require('request-promise'),
argv = require('minimist')(process.argv.slice(2)),
jsontr = require('./json-transform.js'),
LdapClient = require('promised-ldap')
var items = require('./people.json');
var transform = {
uuid: {
props: {value:String}
},
changed: {
props: {value:Number}
},
body: {
props: {value: String}
},
field_computing_id: {
newName: "computingId",
props: {value: String}
},
field_image: {
props: {
alt:String, width:Number, height:Number, url:String,
target_uuid: {type: String, newName: "uuid"}
}
},
field_job_title: {
newName: "jobTitle",
props: {value:String}
},
field_linkedin: {
newName: "linkedin",
props: {value:String}
},
field_orcid_id: {
newName: "field_orcid_id",
props: {value:String}
},
field_preferred_pronouns: {
newName: "pronouns",
props: {value:String}
},
field_primary_office_location: {
newName: "officeLocation",
props: {value:String}
},
field_primary_phone: {
newName: "phone",
props: {value:String}
},
field_professional_profile: {
newName:"profile",
props: {value:String}
},
field_twitter: {
newName:"twitter",
props: {value:String}
},
field_website: {
newName:"site",
props: {value:String}
},
field_library: {
newName:"library",
props: {
target_uuid: {type: String, newName: "uuid"}
}
},
field_address: {
newName:"address",
props: {value:String}
},
field_ask_me_about: {
newName:"askMeAbout",
props: {value:String}
},
field_cv: {
newName:"cv",
props: {uri:String}
},
field_email_alias: {
newName:"emailAlias",
props: {value:String}
},
field_employee_preferred_name: {
newName:"preferredName",
props: {value:String}
},
field_languages_spoken: {
newName:"languages",
props:{value:String}
},
field_research_guides: {
newName:"guides",
props:{uri:String}
},
field_subject_specialties: {
newName:"specialties",
props:{value:String}
},
field_schedule: {
newName:"schedule",
props: {uri:String}
},
field_private: {
newName:"private",
prop: {value:Boolean}
}
};
function stripEmpty(o) {
for(k in o) {
var v = o[k]
if (v==="" || v===null || v===undefined || (v && v.length==0))
delete o[k]
}
return o
}
var clean = function(item) {
return item?
Array.isArray(item)?
item.join(', '):
item.replace(/^E0:/,''):
"";
}
function capFL(string) {
if (string)
return string.charAt(0).toUpperCase() + string.slice(1);
else return string;
}
var tweekPerson = function(person){
var p = {
fullName: person.displayName,
address: clean(person.physicalDeliveryOfficeName),
computingId: person.uid,
email: person.mailForwardingAddress,
nickName: person.eduPersonNickname,
jobTitle: clean(person.title),
// displayName: person.displayName,
displayName: capFL(person.givenName) + " " + capFL(person.sn),
phone: clean(person.telephoneNumber).replace(/^\+1 /g,''),
fax: clean(person.facsimileTelephoneNumber).replace(/^\+1 /g,''),
firstName: capFL(person.givenName),
lastName: capFL(person.sn),
middleName: person.initials
};
return stripEmpty(p);
};
async function getPeopleFromLdap(){
var client = new LdapClient({url: 'ldap://ldap.virginia.edu'});
var base = "ou=People,o=University of Virginia,c=US";
var staff = await client.search(base, {filter:"(|(ou=E0:LB-Univ Librarian-General*)(ou=E0:LB-Organizational Dev)(ou=E0:LB-Central Svcs*)(ou=E0:LB-User Svcs*)(&(ou=E0:LB-Info Technology)(!(uvaPersonFoundationName=Judge Advocate General School))))", scope:'sub'});
// var staff = await client.search(base, {filter:"ou=E0:LB-Central Svcs", scope:'sub'});
return staff.entries.map(s=>{return tweekPerson(s.object)});
}
async function doIt(){
var peopleFromDrupal = jsontr.transform(items,transform).reduce(function(o,val){ o[val.computingId]=stripEmpty(val); return o; },{});
var peopleFromLdap = await getPeopleFromLdap();
// Merge the peopleFromLdap with peopleFromDrupal with drupal having priority priority for same keys
//var result = peopleFromLdap.map((uid)=>Object.assign(peopleFromLdap[uid], peopleFromDrupal[uid]))
peopleFromLdap.forEach(p=>{
if (peopleFromDrupal[p.computingId]) {
p = Object.assign(p, peopleFromDrupal[p.computingId]);
}
});
var people = peopleFromLdap.filter(p=>(!p.private || (Object.keys(p.private).length === 0 && p.private.constructor === Object)));
var t = await rp({uri:'https://uvalib-api.firebaseio.com/teams.json',json:true});
people.forEach(p=>{
p.teams = t.filter(t=>(t.members)?t.members.includes(p.computingId):false).map(t=>t.uuid);
});
return people;
}
doIt().then(function(result){
console.log(JSON.stringify(result))
process.exit()})
.catch(function(e){console.log(e); process.exit(1)});
|
JavaScript
| 0 |
@@ -4803,16 +4803,175 @@
.uuid);%0A
+ if (p.field_image && p.field_image.url) p.field_image.url = p.field_image.url.replace(%22drupal.lib.virginia.edu/sites/default%22,%22www.library.virginia.edu%22);%0A
%7D);%0A%0A
|
7c45139c470038475354cb1323d7e7d6ad0c131a
|
Move script init to bottom of file.
|
app/renderMain.js
|
app/renderMain.js
|
'use strict';
const electron = require('electron');
const {ipcRenderer} = electron;
const childProcess = require('child_process');
const orbProcess = childProcess.spawn('orb');
orbProcess.stdout.on('data', d => console.log('Data received from orb: ' + d));
orbProcess.stderr.on('data', d => console.log('Err received from orb: ' + d));
orbProcess.on('close', code => console.log('Orb closed with code ' + code));
orbProcess.on('error', (e) => console.log('Error: ' + e));
// orbProcess.kill();
// TODO: Cache 'quickKeyReferences - actions which don't need to be sent to
// model before completion. These can be queried from the model upon process start/buffer creation.
const editorRoot = document.getElementById('editor-root');
const editor = new EditorController(orbProcess);
// This is top-level.
function EditorController(orbProcess) {
this.activeBufferController = null;
this.bufferControllers = [];
document.body.addEventListener('keydown', this.onKeyDown);
orbProcess.stdout.on('data', this.handleModelMessage);
orbProcess.stderr.on('data', this.handleModelError);
orbProcess.on('close', this.handleOrbClose);
orbProcess.on('error', this.handleOrbError);
}
EditorController.prototype.onKeyDown = function(e) {
console.log('KeyDown: ' + e.keyCode);
const key = String.fromCodePoint(e.keyCode); // TODO: Fix. It seems Mozilla discourages use of this.
this.orbProcess.stdin.write(JSON.stringify({
type: 'KEY_DOWN',
key: key
}));
};
EditorController.prototype.handleModelMessage = function(d) {
const message = JSON.parse(d);
this.handleAction(message);
};
EditorController.prototype.handleModelError = function(e) {
};
EditorController.prototype.handleOrbClose = function(code) {
};
EditorController.prototype.handleOrbError = function(code) {
};
EditorController.prototype.handleAction = function(action) {
switch (action.type) {
default:
throw new Error('Not implemented.');
}
};
function BufferController(view) {
this.view = view;
this.isActive = false;
}
BufferController.prototype.setActive = function(on) {
this.isActive = on;
};
BufferController.prototype.handleAction = function(action) {
switch (action.type) {
case 'MOVE_CURSOR_LEFT':
case 'MOVE_CURSOR_RIGHT':
case 'MOVE_CURSOR_UP':
case 'MOVE_CURSOR_DOWN':
}
};
// This is really a BufferView if we use consistent terminology.
// It's not top level, but it's not just the editable text field either...
function EditorView(domNode) {
console.log('EditorView created.');
this.domNode = domNode;
this.gutterView = null;
this.bufferView = null;
}
function BufferView(domNode) {
console.log('BufferView created.');
this.domNode = domNode;
}
BufferView.prototype.appendLine = function(text) {
const span = document.createElement('span');
span.innerHTML = text;
span.setAttribute('class', 'line');
this.domNode.appendChild(span);
};
BufferView.prototype.changeLine = function(num, text) {
};
BufferView.prototype.insertLine = function(num, text) {
};
BufferView.prototype.removeLine = function(num) {
};
function GutterView(domNode) {
console.log('GutterView created.');
this.domNode = domNode;
}
GutterView.prototype.hide = function() {
};
GutterView.prototype.show = function() {
};
function TabCollectionView(domNode) {
console.log('TabCollectionView created.');
this.domNode = domNode;
}
TabCollectionView.prototype.addTabView = function(view) {
};
TabCollectionView.prototype.removeTabView = function(name) {
};
function TabView(domNode) {
console.log('TabView created.');
this.domNode = domNode;
}
TabView.prototype.setName = function(name) {
};
function CursorView(domNode) {
console.log('CursorView created.');
this.domNode = domNode;
}
CursorView.prototype.moveLeft = function(delta) {
};
CursorView.prototype.moveRight = function(delta) {
};
CursorView.prototype.moveDown = function(delta) {
};
CursorView.prototype.moveUp = function(delta) {
};
|
JavaScript
| 0 |
@@ -130,664 +130,8 @@
);%0A%0A
-const orbProcess = childProcess.spawn('orb'); %0A%0AorbProcess.stdout.on('data', d =%3E console.log('Data received from orb: ' + d));%0AorbProcess.stderr.on('data', d =%3E console.log('Err received from orb: ' + d));%0AorbProcess.on('close', code =%3E console.log('Orb closed with code ' + code));%0AorbProcess.on('error', (e) =%3E console.log('Error: ' + e)); %0A%0A// orbProcess.kill();%0A%0A// TODO: Cache 'quickKeyReferences - actions which don't need to be sent to%0A// model before completion. These can be queried from the model upon process start/buffer creation. %0A%0Aconst editorRoot = document.getElementById('editor-root');%0Aconst editor = new EditorController(orbProcess); %0A%0A
// T
@@ -309,16 +309,23 @@
eydown',
+ (e) =%3E
this.on
@@ -331,16 +331,19 @@
nKeyDown
+(e)
);%0A o
@@ -643,23 +643,18 @@
+ e.key
-Code
);
-
%0A con
@@ -688,20 +688,16 @@
nt(e.key
-Code
); // TO
@@ -3461,28 +3461,684 @@
= function(delta) %7B%0A %0A%7D;%0A
+%0Aconst orbProcess = childProcess.spawn('orb'); %0A%0AorbProcess.stdout.on('data', d =%3E console.log('Data received from orb: ' + d));%0AorbProcess.stderr.on('data', d =%3E console.log('Err received from orb: ' + d));%0AorbProcess.on('close', code =%3E console.log('Orb closed with code ' + code));%0AorbProcess.on('error', (e) =%3E console.log('Error: ' + e)); %0A%0A// orbProcess.kill();%0A%0A// TODO: Cache 'quickKeyReferences - actions which don't need to be sent to%0A// model before completion. These can be queried from the model upon process start/buffer creation. %0A%0Aconst editorRoot = document.getElementById('editor-root');%0Aconst editor = new EditorController(orbProcess); %0A
|
e762c400ce3910f7d1b3d67d98e69c737653885f
|
Move result serialization out of editor
|
app/serializer.js
|
app/serializer.js
|
function serialize (individual) {
return JSON.stringify({fitness: individual.fitness, individual: individual.map(serializeGene)});
}
function serializeGene (gene) {
return {
func: (gene.f || gene).toString(),
args: serializeArgs(gene.args)
};
}
function serializeArgs (args) {
if (args === undefined) { return args };
return Object.keys(args)
.map(key => serializeArgument(key, args[key]))
.reduce((serializedArguments, argument) => Object.assign(serializedArguments, argument), {});
}
function serializeArgument (argument, value) {
if (typeof value === 'function') {
return {[argument]: serializeGene(value)};
}
return {[argument]: value};
};
function deserialize (str) {
const deserializedResult = JSON.parse(str);
const individual = deserializedResult.individual.map(deserializeGene);
individual.fitness = deserializedResult.fitness;
return individual;
}
function deserializeGene (serializedGene) {
const serializedFunction = serializedGene.func;
const startArgs = serializedFunction.indexOf('(') + 1;
const startBody = serializedFunction.indexOf('{') + 1;
const endArgs = serializedFunction.indexOf(')');
const endBody = serializedFunction.lastIndexOf('}');
const args = serializedFunction.substring(startArgs, endArgs);
const body = serializedFunction.substring(startBody, endBody);
const f = new Function(args, body);
const deserializedArgs = deserializeArguments(serializedGene.args);
const wrapper = (entity, api, currentFrame) => {
return f(entity, api, Object.assign(deserializedArgs, {currentFrame}));
};
wrapper.f = f;
wrapper.args = deserializedArgs;
return wrapper;
}
function deserializeArguments (args) {
if (args === undefined) {
return {};
}
return Object.keys(args)
.map(argument => deserializeArgument(argument, args[argument]))
.reduce((deserializedArguments, argument) => Object.assign(deserializedArguments, argument), {});
}
function deserializeArgument (argument, value) {
if (value.func === undefined) {
return {[argument]: value};
}
return {[argument]: deserializeGene(value)};
}
module.exports = {
serialize,
deserialize
};
|
JavaScript
| 0.000001 |
@@ -2124,16 +2124,707 @@
e)%7D;%0A%7D%0A%0A
+serialize.results = (results) =%3E %7B%0A return JSON.stringify(Object.keys(results).map(participant =%3E %7B%0A return serializeResult(participant, results%5Bparticipant%5D);%0A %7D).reduce((serializedResults, result) =%3E Object.assign(serializedResults, result), %7B%7D));%0A%7D%0A%0Afunction serializeResult (participant, individuals) %7B%0A return %7B%5Bparticipant%5D: individuals.map(serialize)%7D;%0A%7D%0A%0Adeserialize.results = (str) =%3E %7B%0A const results = JSON.parse(str);%0A%0A return Object.keys(results).map(participant =%3E %7B%0A const individuals = results%5Bparticipant%5D;%0A%0A return %7B%5Bparticipant%5D: individuals.map(deserialize)%7D;%0A %7D).reduce((deserializedResults, result) =%3E Object.assign(deserializedResults, result), %7B%7D);%0A%7D%0A%0A
module.e
|
211eb92e2efcc8826b68dc1422c04f986257f955
|
Remove log
|
src/utils/data3d/get-texture-keys.js
|
src/utils/data3d/get-texture-keys.js
|
import traverseData3d from './traverse.js'
export default function getTextureKeys(data3d, options) {
// API
var options = options || {}
var filter = options.filter
// internals
var cache = {}
// internals
traverseData3d.materials(data3d, function(material) {
var filteredResult, attr, type, format, value
for (var i = 0, l = ATTRIBUTES.length; i < l; i++) {
attr = ATTRIBUTES[i]
value = material[attr]
// apply filter function if specified in options
if (filter) {
// provide info on type and format of texture to the filter function
type = ATTRIBUTE_TO_TYPE[attr]
format = ATTRIBUTE_TO_FORMAT[attr]
value = filter(value, type, format, material, data3d)
}
if (value) cache[value] = true
}
})
console.log(Object.keys(cache))
return Object.keys(cache)
}
// constants
var ATTRIBUTES = [
'mapDiffuse',
'mapDiffusePreview',
'mapDiffuseSource',
// specular
'mapSpecular',
'mapSpecularPreview',
'mapSpecularSource',
// normal
'mapNormal',
'mapNormalPreview',
'mapNormalSource',
// alpha
'mapAlpha',
'mapAlphaPreview',
'mapAlphaSource'
]
var ATTRIBUTE_TO_TYPE = {
// diffuse
mapDiffuse: 'diffuse',
mapDiffusePreview: 'diffuse',
mapDiffuseSource: 'diffuse',
// specular
mapSpecular: 'specular',
mapSpecularPreview: 'specular',
mapSpecularSource: 'specular',
// normal
mapNormal: 'normal',
mapNormalPreview: 'normal',
mapNormalSource: 'normal',
// alpha
mapAlpha: 'alpha',
mapAlphaPreview: 'alpha',
mapAlphaSource: 'alpha'
}
var ATTRIBUTE_TO_FORMAT = {
// loRes
mapDiffusePreview: 'loRes',
mapSpecularPreview: 'loRes',
mapNormalPreview: 'loRes',
mapAlphaPreview: 'loRes',
// source
mapDiffuseSource: 'source',
mapSpecularSource: 'source',
mapNormalSource: 'source',
mapAlphaSource: 'source',
// dds
mapDiffuse: 'dds',
mapSpecular: 'dds',
mapNormal: 'dds',
mapAlpha: 'dds'
}
|
JavaScript
| 0.000001 |
@@ -790,41 +790,8 @@
%7D)%0A
- console.log(Object.keys(cache))
%0A r
|
62ec1bd091171b96afdcc8c6d0f8bf8240aac08e
|
optimize destructor of decorator-pool
|
packages/decorator-pool/src/index.js
|
packages/decorator-pool/src/index.js
|
const PooledClass = require('./PooledClass');
const poolers = [
undefined,
PooledClass.oneArgumentPooler,
PooledClass.twoArgumentPooler,
PooledClass.fourArgumentPooler,
PooledClass.fiveArgumentPooler
];
const pool = module.exports = ({capacity, pooler, guard}) => (Klass, key, descriptor) => {
if (descriptor) return descriptor;
if (!isPositiveInteger(capacity)) capacity = undefined;
if (typeof pooler !== 'function') pooler = poolers[Klass.length];
Klass.poolSize = capacity;
PooledClass.addPoolingTo(Klass, pooler);
if (typeof guard === 'function') {
const release = Klass.release;
Klass.release = function (instance) {
if (Reflect.apply(guard, Klass, [instance, Klass]))
Reflect.apply(release, Klass, [instance]);
};
}
if (typeof Klass.prototype.destructor !== 'function') {
// TODO: should interrupt the decoration here, or at least give out a warning ?
Klass.prototype.destructor = standardDestructor;
}
return Klass;
};
Object.assign(pool, PooledClass);
function standardDestructor() {
Object.keys(this).forEach((k) => {
this[k] = null;
});
}
function isPositiveInteger(num) {
return num === (num | 0) && num > 0;
}
|
JavaScript
| 0.000002 |
@@ -748,26 +748,34 @@
%7D;%0A%09%7D%0A%0A%09
-if (typeof
+const destructor =
Klass.p
@@ -797,108 +797,205 @@
ctor
- !== 'function') %7B%0A%09%09// TODO: should interrupt the decoration here, or at least give out a warning ?
+;%0A%09if (typeof destructor === 'function') %7B%0A%09%09Klass.prototype.destructor = function () %7B%0A%09%09%09Reflect.apply(destructor, this, arguments);%0A%09%09%09Reflect.apply(standardDestructor, this, %5B%5D);%0A%09%09%7D;%0A%09%7D else %7B
%0A%09%09K
|
a933e01e1982c9fc35eda5146ecba4fe9ed179c4
|
work on ui/interaction
|
app/scripts/ui.js
|
app/scripts/ui.js
|
(function() {
'use strict';
var relvis = window.relvis = window.relvis || {};
var info = '';
var graphTouchCoord = {};
var node;
function redraw() { //{{{1
/*
var ctx = relvis.canvas.getContext('2d');
ctx.fillStyle = '#fff';
ctx.fillRect(0, 0, 500, 10);
ctx.font = '10px sans-serif';
ctx.fillStyle = '#000';
ctx.fillText(info + ' ' + Date.now(), 10, 10);
*/
}
function showStatus(text) { //{{{1
info = text;
}
relvis.initUI = function() { //{{{1
relvis.addEventListener('tapstart', function(e) { //{{{2
node = (e.node || {});
graphTouchCoord = relvis.toGraphCoord(e);
showStatus('tapstart ' + JSON.stringify({
pos: graphTouchCoord,
x: e.x,
y: e.y,
node: node.label
}));
node.fixed = true;
relvis.fixedViewport = true;
relvis.requestRedraw();
});
relvis.addEventListener('tapmove', function(e) { //{{{2
var coord = relvis.toGraphCoord(e);
var dpos = relvis.xy.sub(coord, graphTouchCoord);
showStatus('tapmove' + JSON.stringify({
dpos: dpos,
x: e.x,
y: e.y,
node: node.label
}));
relvis.xy.assign(node, relvis.xy.add(node, dpos));
relvis.xy.assign(node, coord);
node.px = node.x;
node.py = node.y;
graphTouchCoord = relvis.toGraphCoord(e);
relvis.requestRedraw();
relvis.layoutGraph();
});
relvis.addEventListener('tapend', function(e) { //{{{2
showStatus('tapend' + JSON.stringify({
x: e.x,
y: e.y,
node: node.label
}));
node.fixed = false;
relvis.fixedViewport = false;
relvis.requestRedraw();
relvis.layoutGraph();
});
relvis.addEventListener('tapclick', function(e) { //{{{2
showStatus('tapclick' + JSON.stringify({
x: e.x,
y: e.y,
node: node.label
}));
if (!node.id) {
location.hash = '';
relvis.hideCanvasOverlay();
} else {
if (relvis.getType() === 'cir') {
var ids = relvis.getIds();
var pos = ids.indexOf(node.id);
if (pos === -1) {
ids.push(node.id);
} else {
ids.splice(pos, 1);
}
relvis.setIds(ids);
} else {
relvis.clickHandle({
visualisation: relvis.getType(),
id: node.id
});
}
}
});
relvis.addEventListener('redraw', redraw); //{{{2
};
})(); //{{{1
|
JavaScript
| 0 |
@@ -1716,32 +1716,367 @@
outGraph();%0A
+ console.log('tapend');%0A /*%0A if (relvis.getType() === 'cir') %7B%0A var ids = relvis.getIds();%0A var pos = ids.indexOf(node.id);%0A if (pos === -1) %7B%0A ids.push(node.id);%0A %7D else %7B%0A ids.splice(pos, 1);%0A %7D%0A relvis.setIds(ids);%0A %7D %0A */%0A
%7D);%0A
relvis.a
@@ -2055,32 +2055,32 @@
*/%0A %7D);%0A
-
relvis.addEv
@@ -2116,32 +2116,59 @@
ion(e) %7B //%7B%7B%7B2%0A
+ console.log('here');%0A
showStatus
@@ -2371,298 +2371,8 @@
e %7B%0A
- if (relvis.getType() === 'cir') %7B%0A var ids = relvis.getIds();%0A var pos = ids.indexOf(node.id);%0A if (pos === -1) %7B%0A ids.push(node.id);%0A %7D else %7B%0A ids.splice(pos, 1);%0A %7D%0A relvis.setIds(ids);%0A %7D else %7B%0A
@@ -2467,16 +2467,16 @@
node.id%0A
+
@@ -2481,26 +2481,16 @@
%7D);%0A
- %7D%0A
%7D%0A
|
13c989f3f96bad6ee96fe9835af5fa1595fafdc0
|
use absolute references to build artifacts in netlfy builds
|
packages/frontend/webpack.config.js
|
packages/frontend/webpack.config.js
|
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const glob = require('glob');
const TerserPlugin = require('terser-webpack-plugin');
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
const outDir = path.resolve(__dirname, 'public');
const babelConfig = require('../../babel.config.js');
module.exports = (env, opts) => {
const options = opts || {};
return {
entry: {
app: ['./src/index.js', ...glob.sync('./src/**/*.styl')],
},
output: {
path: outDir,
pathinfo: true,
filename: 'static/[name].bundle.js',
publicPath: '/',
},
devServer: {
historyApiFallback: true,
contentBase: [path.join(__dirname, 'src/assets')],
compress: true,
port: 9001,
proxy: {
'/api': 'http://localhost:3896',
},
},
module: {
rules: [
{
oneOf: [
{
test: /\.html$/,
use: [
{
loader: 'babel-loader',
options: babelConfig,
},
{
loader: 'vue-template-loader',
options: {
transformAssetUrls: {
// The key should be an element name
// The value should be an attribute name or an array of attribute names
img: 'src',
},
},
},
],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: babelConfig,
},
},
{
test: /\.(styl|css)$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'stylus-loader',
].filter(Boolean),
},
{ test: /\.pug$/, loader: 'pug-loader' },
{
test: /\.svg$/,
loader: 'svg-inline-loader',
},
{
loader: require.resolve('file-loader'),
exclude: [/\.js$/, /\.html$/, /\.json$/],
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
},
],
},
],
},
optimization: {
minimize: options.mode === 'production',
minimizer: [
new TerserPlugin({
cache: false,
terserOptions: {
compress: false,
mangle: false,
},
parallel: true,
sourceMap: true,
extractComments: true,
}),
],
},
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
filename: '[name].css',
chunkFilename: '[id].css',
}),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/index.pug',
}),
new CopyWebpackPlugin(
[
{
from: '**/*',
to: outDir,
},
],
{ context: './src/assets' },
),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
reportFilename: 'bundle-stats.html',
openAnalyzer: false,
}),
],
// resolve: {
// alias: {
// vue$: 'vue/dist/vue.esm.js',
// },
// },
};
};
|
JavaScript
| 0 |
@@ -734,18 +734,224 @@
-publicPath
+// if on netlify, use netlify's absolute url%0A // https://docs.netlify.com/configure-builds/environment-variables/#deploy-urls-and-metadata%0A publicPath: process.env.DEPLOY_URL ? %60$%7Bprocess.env.DEPLOY_URL%7D/%60
: '/
|
a4adae58d75fb2a348f25dbc096125a5a57f468a
|
Add annotations about API.Camera module
|
Resources/lib/API.Camera.js
|
Resources/lib/API.Camera.js
|
/*
* Copyright (c) 2014 by Center Open Middleware. All Rights Reserved.
* Titanium Appcelerator 3.2.0GA
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
"use strict";
/* FYI: http://docs.appcelerator.com/titanium/3.0/#!/api/Titanium.Media*/
var Camera = (function() {
var CALL_FAILURE = "call failed: ";
var TiError = function TiError (msg) {
this.name = "TiError";
this.message = msg;
};
TiError.prototype = new Error();
/** It will return the result of function called.
* @private
* @param {String} funcName : The function name. */
var returnFunctionWithoutParams = function returnFunctionWithoutParams(funcName){
var result;
try {
result = Ti.Media[funcName].apply(Ti.Media[funcName]);
} catch (e) {
throw new TiError(funcName + " " + CALL_FAILURE + e.message);
}
return result;
};
/** It will return the result of function called.
* @private
* @param {String} funcName : The function name.
* @param {String} params : An array of params. */
var returnFunctionWithParams = function returnFunctionWithParams(funcName, params){
var result;
var paramsIsArray = params instanceof Array;
if (!paramsIsArray) {
throw new TypeError("returnFunction call failed. 'params' is not an Array.");
}
try {
result = Ti.Media[funcName].apply(Ti.Media[funcName], params);
} catch (e) {
throw new TiError(funcName + " " + CALL_FAILURE + e.message);
}
return result;
};
/** It returns the result of Ti.Media native call.
* @private
* @param {String} funcName : The function name.
* @param {String} params : An array of params.
* @return Object : Native result. */
var returnFunction = function returnFunction(funcName, params){
var result;
if (!params) {
result = returnFunctionWithoutParams(funcName);
} else {
result = returnFunctionWithParams(funcName, params);
}
return result;
};
/** It calls Ti.Media native method.
* @private
* @param {String} funcName : The function name.
* @param {String} params : An array of params. */
var process = function process (funcName, params) {
try {
if (!params) {
Ti.Media[funcName].apply(Ti.Media[funcName]);
} else {
var paramsIsArray = params instanceof Array;
if (!paramsIsArray) {
throw new TypeError("returnFunction call failed. 'params' is not an Array.");
}
Ti.Media[funcName].apply(Ti.Media[funcName], params);
}
} catch (e) {
throw new TiError(funcName + " " + CALL_FAILURE + e.message);
}
};
var self = {};
/** Gets the value of the availableCameras property.
* @return {Number[]} : CAMERA_FRONT, CAMERA_REAR or both*/
self.getAvailableCameras = function getAvailableCameras() {
return returnFunction("getAvailableCameras");
};
/** Gets the value of the isCameraSupported property.
* @return {Boolean} */
self.isCameraSupported = function isCameraSupported() {
return returnFunction("getIsCameraSupported");
};
/** Opens the photo gallery image picker.
* @param {PhotoGalleryOptionsType} options : Photo gallery options as
* described in PhotoGalleryOptionsType. */
self.openPhotoGallery = function openPhotoGallery(options) {
// TODO
// process("openPhotoGallery", [options]);
};
/** Shows the camera. The native camera controls are displayed. A photo can
* be taken and it will returned in callback first parameter.
* @param {Function} callback
* @param {Object} [options] */
self.showCamera = function showCamera(callback, options) {
var key;
var showCameraOptions = {
success: function (e) {
if (e.mediaType === Titanium.Media.MEDIA_TYPE_PHOTO) {
callback({
status: "SUCCESS",
data: Ti.Utils.base64encode(e.media).toString()
});
}
},
error: function (e) {
callback({
status: "ERROR"
});
},
cancel: function (e) {
callback({
status: "CANCEL"
});
},
allowEditing: false,
autoHide: false,
saveToPhotoGallery: false,
mediaTypes: [Ti.Media.MEDIA_TYPE_PHOTO]
};
if (options) {
for (key in options) {
if (options.hasOwnProperty(key)) {
showCameraOptions[key] = options[key];
}
}
}
Ti.Media.showCamera(showCameraOptions);
};
/** Takes a screen shot of the visible UI on the device. This method is
* asynchronous. The screenshot is returned in the callback argument. The
* callback argument's media property contains the screenshot image as a
* Blob object.
* @param {Function} callback
* @return {Object} */
self.takeScreenshot = function takeScreenshot(callback) {
//TODO
};
return self;
}());
module.exports = Camera;
|
JavaScript
| 0 |
@@ -2967,24 +2967,178 @@
%7D%0A %7D;%0A%0A
+ /** It allows to take pictures from native camera.%0A * @author Santiago Blanco%0A * @version 1.0.0%0A * @alias API.Camera%0A * @namespace */%0A
var self
|
1db6c279a5c942a39cf8278dee74ff4fb0e9ef31
|
check if file content is set before storing in localStorage
|
tour/static/js/controllers.js
|
tour/static/js/controllers.js
|
/* Copyright 2012 The Go Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
'use strict';
/* Controllers */
angular.module('tour.controllers', []).
// Navigation controller
controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n', 'run', 'fmt', 'editor', 'analytics', 'storage',
function($scope, $routeParams, $location, toc, i18n, run, fmt, editor, analytics, storage) {
var lessons = [];
toc.lessons.then(function(v) {
lessons = v;
$scope.gotoPage($scope.curPage);
// Store changes on the current file to local storage.
$scope.$watch(function() {
var f = file();
return f && f.Content;
}, function(val) {
storage.set(file().Hash, val);
});
});
$scope.toc = toc;
$scope.lessonId = $routeParams.lessonId;
$scope.curPage = parseInt($routeParams.pageNumber);
$scope.curFile = 0;
$scope.job = null;
$scope.nextPageClick = function(event) {
event.preventDefault();
$scope.nextPage();
};
$scope.prevPageClick = function(event) {
event.preventDefault();
$scope.prevPage();
};
$scope.nextPage = function() {
$scope.gotoPage($scope.curPage + 1);
};
$scope.prevPage = function() {
$scope.gotoPage($scope.curPage - 1);
};
$scope.gotoPage = function(page) {
var l = $routeParams.lessonId;
if (page >= 1 && page <= lessons[$scope.lessonId].Pages.length) {
$scope.curPage = page;
} else {
l = (page < 1) ? toc.prevLesson(l) : toc.nextLesson(l);
if (l === '') { // If there's not previous or next
$location.path('/list');
return;
}
page = (page < 1) ? lessons[l].Pages.length : 1;
}
$location.path('/' + l + '/' + page);
$scope.openFile($scope.curFile);
analytics.trackView();
};
$scope.openFile = function(file) {
$scope.curFile = file;
editor.paint();
};
function log(mode, text) {
$('.output.active').html('<pre class="' + mode + '">' + text + '</pre>');
}
function clearOutput() {
$('.output.active').html('');
}
function file() {
return lessons[$scope.lessonId].Pages[$scope.curPage - 1].Files[$scope.curFile];
}
$scope.run = function() {
log('info', i18n.l('waiting'));
var f = file();
$scope.job = run(f.Content, $('.output.active > pre')[0], {
path: f.Name
}, function() {
$scope.job = null;
$scope.$apply();
});
};
$scope.kill = function() {
if ($scope.job !== null) $scope.job.Kill();
};
$scope.format = function() {
log('info', i18n.l('waiting'));
fmt(file().Content, editor.imports).then(
function(data) {
if (data.data.Error !== '') {
log('stderr', data.data.Error);
return;
}
clearOutput();
file().Content = data.data.Body;
},
function(error) {
log('stderr', error);
});
};
$scope.reset = function() {
file().Content = file().OrigContent;
};
}
]);
|
JavaScript
| 0.00001 |
@@ -843,16 +843,25 @@
+ if (val)
storage
|
9922c34372411c7f06c807e37e43d1ddd7e9568a
|
fix setter option support in reset
|
backbonebase.js
|
backbonebase.js
|
(function(root, factory) {
// Set up BaseView appropriately for the environment. Start with AMD.
if (typeof define === 'function' && define.amd) {
define(['underscore', 'jquery', 'backbone', 'exports'], function(_, $, Backbone, exports) {
// Export global even in AMD case in case this script is loaded with
// others that may still expect a global Backbone.
root.BackboneBase = factory(root, exports, _, $, Backbone);
});
// Next for Node.js or CommonJS. jQuery may not be needed as a module.
} else if (typeof exports !== 'undefined') {
var _ = require('underscore'),
$ = require('jquery'),
Backbone = require('backbone');
factory(root, exports, _, $, Backbone);
// Finally, as a browser global.
} else {
root.BackboneBase = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$), root.Backbone);
}
}(this, function(root, BackboneBase, _, $, Backbone) {
// Create local refernces to array method we'll want to use later.
var array = [];
var slice = array.slice;
// Current version of the library.
BackboneBase.VERSION = '0.0.0';
var View = BackboneBase.View = Backbone.View.extend({
constructor: function(options) {
options || (options = {});
_.extend(this, _.pick(options, viewOptions));
this.children = options.children || {};
this.setTemplate(this.template || '');
Backbone.View.apply(this, arguments);
},
_ensureElement: function() {
var el = this.el,
mid = _.result(this, 'mid'),
attributes = {};
Backbone.View.prototype._ensureElement.apply(this, arguments);
if (el) {
return;
}
attributes['data-cid'] = this.cid;
if (mid) {
attributes['data-mid'] = mid;
this.$el.addClass(this.toClassName(mid));
}
this.$el.attr(attributes);
},
toClassName: function(className) {
return className.match(/-?[_a-zA-Z]+[_a-zA-Z0-9-]*/g, '').join('-').replace(/[\/\_]/g, '-').toLowerCase();
},
remove: function() {
Backbone.View.prototype.remove.apply(this, arguments);
this.invoke('remove');
},
compileTemplate: function(str) {
return _.template(str)
},
renderTemplate: function() {
var interpolated = this.ctemplate.apply(null, arguments);
this.trigger('render:template', this, interpolated, arguments);
return interpolated;
},
renderTemplateDefer: function() {
_.defer.apply(null, [this.renderTemplate.bind(this)].concat(Array.prototype.slice.call(arguments)));
},
renderTemplateDebounce: function() {
if (!this._renderTemplateDebounce) {
this._renderTemplateDebounce = _.debounce(this.renderTemplate.bind(this));
}
this._renderTemplateDebounce.apply(this, arguments);
},
setTemplate: function(template) {
this.ctemplate = this.compileTemplate(template);
this.template = template;
},
traverse: function(iteratee, options) {
options || (options = {});
var view = options.view || this;
view.each(function(child) {
iteratee.call(this, view, child);
this.traverse(iteratee, {view: child});
}, this);
}
});
//List of view options to be merged as properties.
var viewOptions = ['template', 'mid'];
// Mix in each Underscore method as a proxy to `View#children`.
var viewMethods = ['each', 'where', 'findWhere', 'invoke', 'pluck', 'size', 'keys', 'values', 'pairs', 'pick', 'omit', 'defaults', 'clone', 'tap', 'has', 'propertyOf', 'isEmpty'];
_.each(viewMethods, function(method) {
if (!_[method]) {
return;
}
View.prototype[method] = function() {
var args = slice.call(arguments);
args.unshift(this.children);
return _[method].apply(_, args);
};
});
var Model = BackboneBase.Model = Backbone.Model.extend({
constructor: function(attributes, options) {
options || (options = {});
_.extend(this, _.pick(options, modelOptions));
Backbone.Model.apply(this, arguments);
},
getter: function(attr) {
var getters = _.result(this, 'getters');
if (getters) {
var method = getters[attr];
if (!_.isFunction(method)) {
method = this[method];
}
if (method) {
return method(attr, this.attributes[attr]);
}
}
return Backbone.Model.prototype.get.apply(this, arguments);
},
setter: function(key, val, options) {
var attr, attrs, setters, unset;
if (key == null) {
return this;
}
if (typeof key === 'object') {
attrs = key;
options = val;
} else {
(attrs = {})[key] = val;
}
options || (options = {});
if (!options.unset) {
var setters = _.result(this, 'setters');
for (attr in attrs) {
if (setters) {
var method = setters[attr];
if (!_.isFunction(method)) {
method = this[method];
}
if (method) {
attrs[attr] = method(attr, attrs[attr]);
}
}
}
}
return Backbone.Model.prototype.set.call(this, attrs, options);
},
reset: function(attrs, options) {
options || (options={});
this.clear({silent: true});
this[(options.setters) ? 'setters': 'set'](attrs, options);
return this;
}
});
var modelOptions = ['setters', 'getters'];
return BackboneBase;
}));
|
JavaScript
| 0 |
@@ -6307,17 +6307,16 @@
s.setter
-s
) ? 'set
@@ -6318,17 +6318,16 @@
'setter
-s
': 'set'
|
19836f1ba8fd191d4f3b426f5f30fed47c5e8080
|
fix setGiorno
|
src/JF/CalendarBundle/Resources/public/js/index.js
|
src/JF/CalendarBundle/Resources/public/js/index.js
|
$(document).ready(function() {
sanitizeDate([$('.auto_date')]);
$("#mydatepicker").datepicker({
dateFormat: 'dd-mm-yy',
closeText: 'Chiudi',
prevText: 'Perc.',
nextText: 'Prox.',
currentText: 'Oggi',
monthNames: ['Gennaio', 'Febbraio', 'Marzo', 'Aprile', 'Maggio', 'Giugno', 'Luglio', 'Agosto', 'Settembre', 'Ottobre', 'Novembre', 'Dicembre'],
monthNamesShort: ['Gen', 'Feb', 'Mar', 'Apr', 'Mag', 'Giu', 'Lug', 'Ago', 'Set', 'Ott', 'Nov', 'Dic'],
dayNames: ['Lunedì', 'Martedì', 'Mercoledì', 'Giovedì', 'Venerdì', 'Sabato', 'Domenica'],
dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mer', 'Gio', 'Ven', 'Sab'],
dayNamesMin: ['D', 'L', 'Ma', 'Me', 'G', 'V', 'S'],
firstDay: 1,
weekHeader: "S",
onSelect: function(date) {
date = Date.create(date, 'it');
$.post(Routing.generate('calendario_personale_giorno', {giorno: date.getDate(), mese: date.getMonth() + 1, anno: date.getFullYear()}), {}, function(data) {
setGiorno(giorni);
$('#daily').html(data);
});
},
onChangeMonthYear: function(year, month) {
$.post(Routing.generate('calendario_personale_json', {mese: month, anno: year}), {}, function(data) {
giorni = data;
setGiorno(giorni);
$('#daily').html('');
});
}
});
setGiorno(giorni);
$('.ads').click(function() {
$('#evento_intero').val($(this).html());
if ($('#evento_intero').val() === 'Sì') {
$('#ad').show();
} else {
$('#ad').hide();
}
$('.ads').toggle();
});
});
function setGiorno(giorni) {
$.each(giorni, function(giorno, val) {
console.log(giorno);
$('.calendar td').find('a').each(function() {
$this = $(this);
if (parseInt($this.html()) === parseInt(giorno)) {
$.each(val.tipo, function(label, v) {
$this.after('<div class="nscal ' + v.css + '" title="' + label + ': ' + v.n + ' event' + (v.n === 1 ? 'o' : 'i') + '">' + v.n + '</div>');
});
$this.after('<div class="ncal">' + val.tot + '</div>');
}
});
});
}
function aggiungiEvento() {
$('#bt_aggiungi_evento').hide();
$('#wait_aggiungi_evento').show();
var form = $('#aggiungi_evento');
$.post(Routing.generate('calendar_aggiungi_evento'), form.serialize(), function(out) {
$.post(Routing.generate('calendario_personale_json', {mese: out.month, anno: out.year}), {}, function(data) {
giorni = data;
setGiorno(giorni);
$('#daily').html('');
});
$.fancybox.close();
if($('#evento_intero').val() === 'Sì'){
$('.ads').toggle();
}
form[0].reset();
$('#ad').show();
$('#bt_aggiungi_evento').show();
$('#wait_aggiungi_evento').hide();
});
}
function autoupdateCalendario() {
$('#tab_cal').find('.autoupdate').change(function() {
_autoupdate($(this));
});
$('.star').click(function() {
evidenziaEvento($(this).attr('evento'));
});
$('a.fancybox').each(function() {
if ($(this).attr('href').startsWith('#')) {
$(this).fancybox({
hideOnOverlayClick: false,
transitionIn: 'elastic',
padding: 3,
margin: 0
});
} else {
$(this).fancybox({
type: 'ajax',
hideOnOverlayClick: false,
transitionIn: 'elastic',
padding: 3,
margin: 0
});
}
});
}
|
JavaScript
| 0.000001 |
@@ -1970,24 +1970,100 @@
(giorno)) %7B%0A
+ $td = $this.closest('td');%0A $td.html($this);%0A
@@ -2382,32 +2382,33 @@
%7D);%0A %7D);%0A%7D
+
%0A%0Afunction aggiu
|
e3f53e6a9bad3ecd4da7c05cfafffd722b598d7e
|
add new `eslint-plugin-react` rules
|
packages/eslint-config-react/base.js
|
packages/eslint-config-react/base.js
|
module.exports = {
extends: ['prettier/react'],
plugins: ['react'],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
},
settings: {
'import/extensions': ['.js', 'jsx'],
},
rules: {
'class-methods-use-this': [
'error',
{
exceptMethods: [
'render',
'getInitialState',
'getDefaultProps',
'getChildContext',
'componentWillMount',
'componentDidMount',
'componentWillReceiveProps',
'shouldComponentUpdate',
'componentWillUpdate',
'componentDidUpdate',
'componentWillUnmount',
],
},
],
'jsx-quotes': ['error', 'prefer-double'],
'no-unused-expressions': ['error', {allowShortCircuit: true}],
// https://github.com/yannickcr/eslint-plugin-react
'react/boolean-prop-naming': 'off',
'react/button-has-type': 'error',
'react/default-props-match-prop-types': 'error',
'react/destructuring-assignment': 'off', // TODO: decide on what option to use
'react/display-name': 'error',
'react/forbid-component-props': 'off',
'react/forbid-dom-props': 'off',
'react/forbid-elements': 'off',
'react/forbid-foreign-prop-types': 'off',
'react/forbid-prop-types': ['error', {forbid: ['any', 'array', 'object']}],
'react/jsx-boolean-value': ['error', 'never'],
'react/jsx-child-element-spacing': 'off', // TODO: remove once `eslint-config-prettier` adds this
'react/jsx-curly-brace-presence': ['error', 'never'],
'react/jsx-filename-extension': ['error', {extensions: ['.jsx']}],
'react/jsx-handler-names': [
'off',
{eventHandlerPrefix: 'handle', eventHandlerPropPrefix: 'on'},
],
'react/jsx-key': 'error',
// TODO: disable `ignoreRefs` and`allowArrowFunctions` options
'react/jsx-no-bind': [
'error',
{ignoreRefs: true, allowArrowFunctions: true, allowBind: false},
],
'react/jsx-no-comment-textnodes': 'error',
'react/jsx-no-duplicate-props': ['error', {ignoreCase: true}],
'react/jsx-no-literals': 'off',
'react/jsx-no-target-blank': 'error',
'react/jsx-no-undef': 'error',
'react/jsx-one-expression-per-line': 'off',
'react/jsx-pascal-case': ['error', {allowAllCaps: true, ignore: []}],
'react/jsx-sort-default-props': 'off',
'react/jsx-sort-prop-types': 'off', // deprecated in favor of react/jsx-sort-props
'react/jsx-sort-props': 'off',
'react/jsx-uses-react': 'error',
'react/jsx-uses-vars': 'error',
'react/no-access-state-in-setstate': 'error',
'react/no-array-index-key': 'error',
'react/no-children-prop': 'error',
'react/no-comment-textnodes': 'off', // deprecated in favor of react/jsx-no-comment-textnodes
'react/no-danger-with-children': 'error',
'react/no-danger': 'error',
'react/no-deprecated': 'error',
'react/no-did-mount-set-state': 'error',
'react/no-did-update-set-state': 'error',
'react/no-direct-mutation-state': 'error',
'react/no-find-dom-node': 'error',
'react/no-is-mounted': 'error',
'react/no-multi-comp': ['error', {ignoreStateless: true}],
'react/no-redundant-should-component-update': 'error',
'react/no-render-return-value': 'error',
'react/no-set-state': 'off',
'react/no-string-refs': 'error',
'react/no-this-in-sfc': 'error',
'react/no-typos': 'error',
'react/no-unescaped-entities': 'error',
'react/no-unknown-property': 'error',
'react/no-unused-prop-types': 'off',
'react/no-unused-state': 'error',
'react/no-will-update-set-state': 'error',
'react/prefer-es6-class': ['error', 'always'],
'react/prefer-stateless-function': 'error',
'react/prop-types': [
'off',
{ignore: [], customValidators: [], skipUndeclared: false},
],
'react/react-in-jsx-scope': 'error',
'react/require-default-props': ['error', {forbidDefaultForRequired: true}],
'react/require-extension': 'off', // deprecated in favor of import/extensions
'react/require-optimization': 'off',
'react/require-render-return': 'error',
'react/self-closing-comp': 'error',
'react/sort-comp': [
'error',
{
order: [
'type-annotations',
'static-methods',
'instance-variables',
'lifecycle',
'/^handle.+$/',
'/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/',
'everything-else',
'/^render.+$/',
'render',
],
},
],
'react/sort-prop-types': 'off', // we don't use prop-types
'react/style-prop-object': 'error',
'react/void-dom-elements-no-children': 'error',
},
};
|
JavaScript
| 0.000001 |
@@ -1926,32 +1926,66 @@
false%7D,%0A %5D,%0A
+ 'react/jsx-max-depth': 'off',%0A
'react/jsx-n
|
c7eee2ac5c7cfac0f3401b9400d2d21e14c6de22
|
Disable prettier in oss-compat (#2553)
|
packages/eslint-config/oss-compat.js
|
packages/eslint-config/oss-compat.js
|
/*
MIT License
Copyright (c) 2021 Looker Data Sciences, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
module.exports = {
extends: ['@looker/eslint-config', '@looker/eslint-config/license-header'],
rules: {
camelcase: 'off',
'import/order': 'off',
'sort-keys-fix/sort-keys-fix': 'off',
},
}
|
JavaScript
| 0 |
@@ -1256,24 +1256,56 @@
er': 'off',%0A
+ 'prettier/prettier': 'off',%0A
'sort-ke
|
b843c316f5557c06532393abcf1187b16f5a469b
|
Format progress-demo.js
|
src/MaterialForms.Demo.ShipScript/progress-demo.js
|
src/MaterialForms.Demo.ShipScript/progress-demo.js
|
'use strict';
const forms = require('MaterialForms');
const timer = require('timer');
const result = forms.task(function (progress) {
for (var i = 0; i <= 100; i++) {
if (progress.cancelled) {
// Check if cancellation has been requested
return false;
}
if (i === 50) {
progress.message = 'Almost finished...';
}
// Report current progress (out of 100)
progress(i);
timer.block(50);
}
// Returns this value to the caller of forms.task()
return true;
}, { message: 'Working', cancel: 'CANCEL' } );
if (result) {
forms.alert("Completed successfully!");
} else {
forms.alert("Canceled!");
}
|
JavaScript
| 0.000001 |
@@ -128,19 +128,21 @@
ress) %7B%0A
-%09%0A%09
+%0A
for (var
@@ -166,17 +166,20 @@
i++) %7B%0A
-%09
+
if (
@@ -256,19 +256,28 @@
quested%0A
-%09%09%09
+
return f
@@ -286,17 +286,27 @@
se;%0A
-%09%09%7D%0A%09%09%0A%09%09
+ %7D%0A%0A
if (
@@ -321,11 +321,20 @@
) %7B%0A
-%09%09%09
+
prog
@@ -374,16 +374,23 @@
.';%0A
-%09%09%7D%0A%09%09%0A%09
+ %7D%0A%0A
@@ -429,18 +429,24 @@
of 100)%0A
-%09%09
+
progress
@@ -454,10 +454,16 @@
i);%0A
-%09%09
+
time
@@ -479,12 +479,14 @@
0);%0A
-%09
+
%7D%0A
-%09
%0A
@@ -538,17 +538,20 @@
.task()%0A
-%09
+
return t
@@ -555,17 +555,16 @@
n true;%0A
-%09
%0A%7D, %7B me
@@ -599,17 +599,16 @@
ANCEL' %7D
-
);%0A%0Aif (
@@ -617,17 +617,20 @@
sult) %7B%0A
-%09
+
forms.al
@@ -674,9 +674,12 @@
e %7B%0A
-%09
+
form
|
14fdc7b86e9c1eebc93c8ea822690ef91778155d
|
correct retry strategies from external API requests
|
app_client/app.js
|
app_client/app.js
|
(function(){
// Current version: 1.0.0
// TODO: Actualizar help
// TODO: I - Projects
// TODO: II - Other productivity measurements: Patents, outreach, startups, prizes, datasets, boards, theses
// TODO: III - Dashboards (visualization of indicators)
// TODO: (Check if this doesn't happen!!!) When adding from ORCID check if the publication was not already added by someone
// TODO: (future) Add automatic PDF generator
// TODO: (future) easier administration - Delete user from all tables
var config = function ($routeProvider, $locationProvider) {
$routeProvider
.when('/', {
templateUrl: 'login/login.view.html',
controller: 'loginCtrl',
controllerAs: 'vm'
})
.when('/person', {
templateUrl: 'person/person.view.html',
controller: 'personCtrl',
controllerAs: 'vm'
})
.when('/team', {
templateUrl: 'team/team.view.html',
controller: 'teamCtrl',
controllerAs: 'vm'
})
.when('/pre-register/:username/:password', {
templateUrl: 'pre-register/pre-register.view.html',
controller: 'preRegCtrl',
controllerAs: 'vm'
})
.when('/unit', {
templateUrl: 'unit/unit.view.html',
controller: 'unitCtrl',
controllerAs: 'vm'
})
.when('/manager', {
templateUrl: 'manager/manager.view.html',
controller: 'managerCtrl',
controllerAs: 'vm'
})
.when('/registration', {
templateUrl: 'registration/registration.view.html',
controller: 'registrationCtrl',
controllerAs: 'vm'
})
.when('/help', {
templateUrl: 'help/help.view.html',
controller: 'helpCtrl',
controllerAs: 'vm'
})
.otherwise({redirectTo: '/'});
$locationProvider.html5Mode(true);
};
angular.module('managementApp', ['ngMaterial','ngRoute', 'ngMessages','ngMdIcons','ngFileUpload','uiCropper'])
// comment this config when debugging
.config(['$compileProvider', function ($compileProvider) {
$compileProvider.debugInfoEnabled(false);
$compileProvider.commentDirectivesEnabled(false);
$compileProvider.cssClassDirectivesEnabled(false);
}])
.config(['$routeProvider', '$locationProvider', config])
.config(function($mdDateLocaleProvider) {
$mdDateLocaleProvider.formatDate = function(date) {
if (date === null || date === undefined) return null;
return moment.tz(date, 'Europe/Lisbon').format('YYYY-MM-DD');
};
$mdDateLocaleProvider.parseDate = function(dateString) {
if (dateString === null || dateString === undefined) return null;
var m = moment.tz(dateString, 'Europe/Lisbon');
return m.isValid() ? m.format('YYYY-MM-DD') : null;
};
})
.config(function($mdAriaProvider) {$mdAriaProvider.disableWarnings();})
;
})();
|
JavaScript
| 0 |
@@ -79,17 +79,17 @@
/ TODO:
-I
+1
- Proje
@@ -105,18 +105,17 @@
/ TODO:
-II
+2
- Other
@@ -221,11 +221,9 @@
DO:
-III
+3
- D
|
49f1c552d88b49e0bf40f291515e93f91e194c5f
|
fix fela-image onclick
|
packages/fela/src/image/container.js
|
packages/fela/src/image/container.js
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import LazyLoad from 'react-lazy-load';
import { createComponent } from 'react-fela';
import { ContentLoaderStyles } from '../loader';
const containerStyle = ({
ratio,
width,
minWidth,
maxWidth,
minHeight,
maxHeight,
rounded,
}) => ({
position: 'relative',
overflow: 'hidden',
width,
minWidth,
maxWidth,
minHeight,
maxHeight,
borderRadius: rounded && '50%',
onBefore: {
display: 'block',
content: '""',
width: '100%',
paddingTop: `${ratio * 100}%`,
},
'> img': {
center: true,
},
});
const Container = createComponent(
containerStyle,
'div',
({ ratio, rounded, ...p }) => Object.keys(p)
);
const LazyContainer = createComponent(
({ visible, ...rest }) => ({
...containerStyle(rest),
...(!visible ? ContentLoaderStyles : {}),
}),
({ onVisible, ...p }) => <LazyLoad {...p} onContentVisible={onVisible} />,
({ ratio, rounded, visible, ...p }) => Object.keys(p)
);
class ImageContainer extends Component {
state = { visible: false };
render() {
const {
className,
children,
width,
ratio,
rounded,
lazy,
...containerProps
} = this.props;
const { visible } = this.state;
if (!lazy) {
return (
<Container
{...containerProps}
className={className}
width={width}
ratio={ratio}
rounded={rounded}
>
{children}
</Container>
);
}
return (
<LazyContainer
{...containerProps}
className={className}
width={width}
ratio={ratio}
rounded={rounded}
visible={visible}
onVisible={() => this.setState({ visible: true })}
>
{children}
</LazyContainer>
);
}
}
ImageContainer.displayName = 'Image.Container';
ImageContainer.propTypes = {
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
ratio: PropTypes.number.isRequired,
lazy: PropTypes.bool,
rounded: PropTypes.bool,
};
ImageContainer.defaultProps = {
lazy: true,
rounded: false,
};
export default ImageContainer;
|
JavaScript
| 0 |
@@ -899,67 +899,168 @@
le,
-...p %7D) =%3E %3CLazyLoad %7B...p%7D onContentVisible=%7BonVisible%7D /%3E
+onClick, children, ...p %7D) =%3E%0A (%3Cdiv onClick=%7BonClick%7D%3E%0A %3CLazyLoad %7B...p%7D onContentVisible=%7BonVisible%7D%3E%0A %7Bchildren%7D%0A %3C/LazyLoad%3E%0A %3C/div%3E)
,%0A
|
0544899bc595ebca543bd41905ef924bd8cb2c35
|
Use sass loader (#68)
|
packages/pack/webpack/css.loader.js
|
packages/pack/webpack/css.loader.js
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const postcssPresetEnv = require('postcss-preset-env');
const DESIGN_SYSTEM_THEME = /.*theme\.scss$/;
// Set up the variables to the design system so that files are resolved properly.
const PREPEND_SASS = `
$path-images: "~design-system/assets/img/shared/";
`;
const getSassLoaders = (isProduction) => {
const postcssPlugins = isProduction
? [
postcssPresetEnv({
autoprefixer: {
flexbox: 'no-2009'
},
stage: 3
})
]
: [];
return [
'css-loader',
// To get rid of "You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing."
postcssPlugins.length
? {
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: postcssPlugins,
sourceMap: isProduction
}
}
: undefined,
{
loader: 'fast-sass-loader',
options: {
data: PREPEND_SASS
}
}
].filter(Boolean);
};
module.exports = ({ isProduction }) => {
const sassLoaders = getSassLoaders(isProduction);
const miniLoader = {
loader: MiniCssExtractPlugin.loader,
options: {
hmr: !isProduction
}
};
return [
{
test: /\.css$/,
use: [
miniLoader,
{
loader: 'css-loader',
options: {
importLoaders: 1
}
}
],
sideEffects: true
},
{
test: /\.scss$/,
exclude: DESIGN_SYSTEM_THEME,
use: [miniLoader, ...sassLoaders],
sideEffects: true
},
{
test: DESIGN_SYSTEM_THEME,
// Prevent loading the theme in <style>, we want to load it as a raw string
use: [...sassLoaders]
}
];
};
|
JavaScript
| 0.000001 |
@@ -1113,13 +1113,8 @@
r: '
-fast-
sass
@@ -1162,17 +1162,27 @@
-d
+additionalD
ata: PRE
|
e7e0b5fa45119c6286528d8c13f6fbeeb863184f
|
add buffercount utility
|
projects/OG-Web/web-engine/prototype/scripts/lib/Four.buffercount.js
|
projects/OG-Web/web-engine/prototype/scripts/lib/Four.buffercount.js
|
/**
* Copyright 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
* Please see distribution for license.
*/
(function () {
if (!window.Four) window.Four = {};
/**
* Scales an Array of numbers to a new range
* @param {Array} arr Array to be scaled
* @param {Number} range_min New minimum range
* @param {Number} range_max New maximum range
* @returns {Array}
*/
window.Four.scale = function (arr, range_min, range_max) {
var min = Math.min.apply(null, arr), max = Math.max.apply(null, arr);
return arr.map(function (val) {return ((val - min) / (max - min) * (range_max - range_min) + range_min);});
};
})();
|
JavaScript
| 0.000001 |
@@ -198,220 +198,72 @@
*
-Scales an Array of numbers to a new range%0A * @param %7BArray%7D arr Array to be scaled%0A * @param %7BNumber%7D range_min New minimum range%0A * @param %7BNumber%7D range_max New maximum range%0A * @returns %7BArray%7D
+If Webgl inspector, query the dom and log out the active buffers
%0A
@@ -287,13 +287,19 @@
our.
-scale
+buffercount
= f
@@ -311,228 +311,228 @@
on (
-arr, range_min, range_max) %7B%0A var min = Math.min.apply(null, arr), max = Math.max.apply(null, arr);%0A return arr.map(function (val) %7Breturn ((val - min) / (max - min) * (range_max - range_min) + range_min);%7D
+) %7B%0A var live_buffer = '.buffer-item.listing-item', deleted_buffer = '.buffer-item.listing-item.buffer-item-deleted';%0A if ($(live_buffer).length) console.log($(live_buffer).length - $(deleted_buffer).length
);%0A
|
461281865ccd7521f25b2d4e893eb55c036f56dc
|
Remove deferred as not needed
|
static/js/crowdsource.interceptor.js
|
static/js/crowdsource.interceptor.js
|
/**
* Date: 1/9/15
* Author: Shirish Goyal
*/
(function () {
'use strict';
angular
.module('crowdsource.interceptor', [])
.factory('AuthHttpResponseInterceptor', AuthHttpResponseInterceptor);
AuthHttpResponseInterceptor.$inject = ['$location', '$log', '$injector', '$q'];
function AuthHttpResponseInterceptor($location, $log, $injector, $q) {
return {
responseError: function (rejection) {
if (rejection.status === 403) {
if (rejection.hasOwnProperty('data')
&& rejection.data.hasOwnProperty('detail')
&& (rejection.data.detail.indexOf("Authentication credentials were not provided") != -1)
) {
var $http = $injector.get('$http');
var Authentication = $injector.get('Authentication');
if (!Authentication.isAuthenticated()) {
$location.path('/login');
}else{
deferred.resolve(data);
}
}
}
return $q.reject(rejection);
}
}
}
})();
|
JavaScript
| 0 |
@@ -998,95 +998,8 @@
');%0A
- %7Delse%7B%0A deferred.resolve(data);%0A
|
84cea4426a18caeb5f86583d6077be7440aded3b
|
patch publish
|
static/js/project/controllers/project.controller.js
|
static/js/project/controllers/project.controller.js
|
(function () {
'use strict';
angular
.module('crowdsource.project.controllers')
.controller('ProjectController', ProjectController);
ProjectController.$inject = ['$location', '$scope', '$mdToast', 'Project', '$routeParams',
'Upload', 'helpersService', '$timeout', '$mdDialog'];
/**
* @namespace ProjectController
*/
function ProjectController($location, $scope, $mdToast, Project, $routeParams, Upload, helpersService, $timeout, $mdDialog) {
var self = this;
self.save = save;
self.deleteProject = deleteProject;
self.publish = publish;
self.removeFile = removeFile;
self.project = {
"pk": null
};
self.upload = upload;
self.doPrototype = doPrototype;
self.didPrototype = false;
self.showPrototypeDialog = showPrototypeDialog;
activate();
function activate() {
self.project.pk = $routeParams.projectId;
Project.retrieve(self.project.pk, 'project').then(
function success(response) {
self.project = response[0];
},
function error(response) {
$mdToast.showSimple('Could not get project.');
}
).finally(function () {
});
}
function doPrototype() {
self.didPrototype = true;
}
function publish(e){
var fieldsFilled = self.project.price && self.project.repetition>0
&& self.project.templates[0].template_items.length;
if(self.project.is_prototype && !self.didPrototype && fieldsFilled) {
if(self.project.batch_files[0]) {
self.num_rows = self.project.batch_files[0].number_of_rows;
} else {
self.num_rows = 1;
}
showPrototypeDialog(e);
} else if(fieldsFilled && (!self.didPrototype || self.num_rows)){
if(!self.num_rows && self.project.batch_files.length > 0) {
var num_rows = self.project.batch_files[0].number_of_rows;
} else {
var num_rows = self.num_rows || 0;
}
var request_data = {'status': 2, 'num_rows': num_rows};
Project.update(self.project.id, request_data, 'project').then(
function success(response) {
$location.path('/my-projects');
},
function error(response) {
$mdToast.showSimple('Could not update project status.');
}
).finally(function () {});
} else {
if(!self.project.price){
$mdToast.showSimple('Please enter task price ($/task).');
}
else if(!self.project.repetition){
$mdToast.showSimple('Please enter number of workers per task.');
}
else if(!self.project.templates[0].template_items.length){
$mdToast.showSimple('Please add at least one item to the template.');
} else if(!self.didPrototype || self.num_rows) {
$mdToast.showSimple('Please enter the number of tasks');
}
return;
}
}
var timeouts = {};
var timeout;
$scope.$watch('project.project', function (newValue, oldValue) {
if (!angular.equals(newValue, oldValue) && self.project.id && oldValue.pk==undefined) {
var request_data = {};
var key = null;
if(!angular.equals(newValue['name'], oldValue['name']) && newValue['name']){
request_data['name'] = newValue['name'];
key = 'name';
}
if(!angular.equals(newValue['price'], oldValue['price']) && newValue['price']){
request_data['price'] = newValue['price'];
key = 'price';
}
if(!angular.equals(newValue['repetition'], oldValue['repetition']) && oldValue['repetition']){
request_data['repetition'] = newValue['repetition'];
key = 'repetition';
}
if (angular.equals(request_data, {})) return;
if(timeouts[key]) $timeout.cancel(timeouts[key]);
timeouts[key] = $timeout(function() {
Project.update(self.project.id, request_data, 'project').then(
function success(response) {
},
function error(response) {
$mdToast.showSimple('Could not update project data.');
}
).finally(function () {
});
}, 2048);
}
}, true);
function save(){
}
$scope.$on("$destroy", function () {
Project.syncLocally(self.currentProject);
});
function upload(files) {
if (files && files.length) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
Upload.upload({
url: '/api/file/',
//fields: {'username': $scope.username},
file: file
}).progress(function (evt) {
var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
// console.log('progress: ' + progressPercentage + '% ' + evt.config.file.name);
}).success(function (data, status, headers, config) {
Project.attachFile(self.project.id, {"batch_file": data.id}).then(
function success(response) {
self.project.batch_files.push(data);
},
function error(response) {
$mdToast.showSimple('Could not upload file.');
}
).finally(function () {
});
}).error(function (data, status, headers, config) {
$mdToast.showSimple('Error uploading spreadsheet.');
})
}
}
}
function deleteProject(){
Project.deleteInstance(self.project.id).then(
function success(response) {
$location.path('/my-projects');
},
function error(response) {
$mdToast.showSimple('Could not delete project.');
}
).finally(function () {
});
}
function removeFile(pk){
Project.deleteFile(self.project.id, {"batch_file": pk}).then(
function success(response) {
self.project.batch_files = []; // TODO in case we have multiple splice
},
function error(response) {
$mdToast.showSimple('Could not remove file.');
}
).finally(function () {
});
}
function showPrototypeDialog($event) {
var parent = angular.element(document.body);
$mdDialog.show({
clickOutsideToClose: true,
scope: $scope,
preserveScope: true,
parent: parent,
targetEvent: $event,
templateUrl: '/static/templates/project/prototype.html',
locals: {
project: self.project,
num_rows: self.num_rows
},
controller: DialogController
});
function DialogController($scope, $mdDialog) {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
}
}
}
})();
|
JavaScript
| 0 |
@@ -1996,49 +1996,8 @@
lled
- && (!self.didPrototype %7C%7C self.num_rows)
)%7B%0A
@@ -2018,26 +2018,8 @@
if(
-!self.num_rows &&
self
@@ -2195,25 +2195,8 @@
ws =
- self.num_rows %7C%7C
0;%0A
|
d1372b1672cfba0e78f2f4bb17b72e650cb33885
|
fix eslint issues
|
packages/kitsu-core/rollup.config.js
|
packages/kitsu-core/rollup.config.js
|
import babel from 'rollup-plugin-babel'
import minify from 'rollup-plugin-babel-minify'
import local from 'rollup-plugin-local-resolve'
import pkg from './package.json'
let external = [
...Object.keys(pkg.dependencies),
'babel-runtime/regenerator',
'babel-runtime/helpers/asyncToGenerator',
'babel-runtime/helpers/typeof'
]
let globals = {
'babel-runtime/regenerator': '_regeneratorRuntime',
'babel-runtime/helpers/asyncToGenerator': '_asyncToGenerator',
'babel-runtime/helpers/typeof': '_typeof'
}
let plugins = [
minify({ comments: false, mangle: true }),
local()
]
let pluginsMain = [
babel({ exclude: [ '*.json', 'node_modules/**/*' ], runtimeHelpers: true }),
...plugins
]
let pluginsNode = [
babel({
babelrc: false,
exclude: [ '*.json', 'node_modules/**/*' ],
runtimeHelpers: true,
presets: [ [ 'env', { targets: { node: 6 }, modules: false } ], 'stage-0' ],
plugins: [ [ 'transform-runtime', { polyfill: false, regenerator: true } ]
]
}),
...plugins
]
let pluginsLegacy = [
babel({
exclude: [ '*.json', 'node_modules/**/*' ],
runtimeHelpers: true,
presets: [ [ 'env', { targets: { browsers: ['last 10 years'], node: 6 }, modules: false } ], 'stage-0' ]
}),
...plugins
]
export default [
{
input: 'src/index.js',
external,
plugins: pluginsMain,
output: [
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
globals
},
{
file: pkg.module,
format: 'es',
sourcemap: true,
globals
}
]
},
{
// Node-only bundle
input: 'src/index.js',
external,
plugins: pluginsNode,
output: [
{
file: 'node/index.js',
format: 'cjs',
sourcemap: true,
globals
},
{
file: 'node/index.mjs',
format: 'es',
sourcemap: true,
globals
}
]
},
{
// Legacy IE10+ bundle
input: 'src/index.js',
external,
plugins: pluginsLegacy,
output: {
file: 'legacy/index.js',
format: 'umd',
name: 'Kitsu',
sourcemap: true,
globals
}
}
]
|
JavaScript
| 0.000015 |
@@ -1161,16 +1161,17 @@
wsers: %5B
+
'last 10
@@ -1177,16 +1177,17 @@
0 years'
+
%5D, node:
|
6cc063241a40dc04226e95a62523728a379ea58f
|
Use pixelRatio 2
|
rendering/cases/circle-style/main.js
|
rendering/cases/circle-style/main.js
|
import Circle from '../../../src/ol/style/Circle.js';
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import Point from '../../../src/ol/geom/Point.js';
import Stroke from '../../../src/ol/style/Stroke.js';
import Style from '../../../src/ol/style/Style.js';
import VectorLayer from '../../../src/ol/layer/Vector.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import View from '../../../src/ol/View.js';
const ellipse = new Feature(new Point([-50, -50]));
ellipse.setStyle(
new Style({
image: new Circle({
radius: 30,
scale: [1, 0.5],
stroke: new Stroke({
color: '#00f',
width: 3,
}),
}),
})
);
const vectorSource = new VectorSource();
vectorSource.addFeatures([
new Feature({
geometry: new Point([-50, 50]),
radius: 10,
}),
new Feature({
geometry: new Point([50, -50]),
radius: 20,
}),
new Feature({
geometry: new Point([50, 50]),
radius: 30,
}),
ellipse,
]);
const style = new Style({
image: new Circle({
radius: 1,
stroke: new Stroke({
color: '#00f',
width: 3,
}),
}),
});
new Map({
pixelRatio: 1,
layers: [
new VectorLayer({
source: vectorSource,
style: function (feature) {
style.getImage().setRadius(feature.get('radius'));
return style;
},
}),
],
target: 'map',
view: new View({
center: [0, 0],
resolution: 1,
}),
});
render();
|
JavaScript
| 0 |
@@ -1180,17 +1180,17 @@
lRatio:
-1
+2
,%0A laye
|
9b05839fbe89093268e2cd0e6beb5151c23edd47
|
update TreeSelectExamples
|
examples/containers/app/modules/field/TreeSelectExamples.js
|
examples/containers/app/modules/field/TreeSelectExamples.js
|
import React, {Component} from 'react';
import Widget from 'src/Widget';
import WidgetHeader from 'src/WidgetHeader';
import TreeSelect from 'src/TreeSelect';
import RaisedButton from 'src/RaisedButton';
import Dialog from 'src/Dialog';
import PropTypeDescTable from 'components/PropTypeDescTable';
import doc from 'examples/assets/propTypes/TreeSelect.json';
import 'scss/containers/app/modules/field/TreeSelectExamples.scss';
class TreeSelectExamples extends Component {
constructor(props) {
super(props);
this.data = {
id: '0',
text: 'Root',
desc: 'Root',
title: 'Root',
children: [{
id: '00',
text: 'Children 0 - 0',
desc: 'Children 0 - 0',
title: 'Children 0 - 0'
}, {
id: '01',
text: 'Children 0 - 1',
desc: 'Children 0 - 1',
title: 'Children 0 - 1',
children: [{
id: '010',
text: 'Children 0 - 1 - 0',
desc: 'Children 0 - 1 - 0',
title: 'Children 0 - 1 - 0'
}, {
id: '011',
text: 'Children 0 - 1 - 1',
desc: 'Children 0 - 1 - 1',
title: 'Children 0 - 1 - 1'
}, {
id: '012',
text: 'Children 0 - 1 - 2',
desc: 'Children 0 - 1 - 2',
title: 'Children 0 - 1 - 2'
}]
}, {
id: '02',
text: 'Children 0 - 2',
desc: 'Children 0 - 2',
title: 'Children 0 - 2'
}]
};
this.state = {
TreeSelectVisible: {}
};
}
show = id => {
const {TreeSelectVisible} = this.state;
TreeSelectVisible[id] = true;
this.setState({
TreeSelectVisible
});
};
hide = id => {
const {TreeSelectVisible} = this.state;
TreeSelectVisible[id] = false;
this.setState({
TreeSelectVisible
});
};
changeHandler = value => {
console.log(value);
};
render() {
const {TreeSelectVisible} = this.state;
return (
<div className="example tree-select-examples">
<h2 className="examples-title">Tree Select</h2>
<p>
<span>Tree Select</span>
can fully display the hierarchy, and has interactive functions such as
expansion, withdrawal and selection.
</p>
<h2 className="example-title">Examples</h2>
<Widget>
<WidgetHeader className="example-header"
title="Basic"/>
<div className="widget-content">
<div className="example-content">
<div className="examples-wrapper">
<p><code>Tree Select</code> simple example.</p>
<TreeSelect data={this.data}
value={{
id: '010',
text: 'Children 0 - 1 - 0',
desc: 'Children 0 - 1 - 0'
}}
onChange={this.changeHandler}/>
</div>
</div>
</div>
</Widget>
<Widget>
<WidgetHeader className="example-header"
title="Multi Select"/>
<div className="widget-content">
<div className="example-content">
<div className="examples-wrapper">
<TreeSelect selectMode={TreeSelect.SelectMode.MULTI_SELECT}
data={this.data}
autoClose={false}
isSelectRecursive={true}
collapsedIconCls="far fa-plus-square"
expandedIconCls="far fa-minus-square"
checkboxUncheckedIconCls="far fa-circle"
checkboxCheckedIconCls="fas fa-check-circle"
checkboxIndeterminateIconCls="fas fa-minus-circle"
useFilter={true}
tip="TreeSelect Example"
onChange={this.changeHandler}/>
</div>
</div>
</div>
</Widget>
<Widget>
<WidgetHeader className="example-header"
title="In Dialog"/>
<div className="widget-content">
<div className="example-content">
<div className="examples-wrapper">
<RaisedButton className="trigger-button dialog-button"
value="Show Dialog"
onClick={() => this.show(1)}/>
<Dialog className="tree-select-dialog"
visible={TreeSelectVisible[1]}
onRender={this.dialogRenderHandler}
onRequestClose={() => this.hide(1)}>
<div className="popover-dialog-content-scroller">
<TreeSelect selectMode={TreeSelect.SelectMode.MULTI_SELECT}
data={this.data}
autoClose={false}
isSelectRecursive={true}
collapsedIconCls="far fa-plus-square"
expandedIconCls="far fa-minus-square"
checkboxUncheckedIconCls="far fa-circle"
checkboxCheckedIconCls="fas fa-check-circle"
checkboxIndeterminateIconCls="fas fa-minus-circle"
useFilter={true}
parentEl={document.querySelector('.tree-select-dialog .dialog-content')}
tip="TreeSelect Example"
onChange={this.changeHandler}/>
</div>
</Dialog>
</div>
</div>
</div>
</Widget>
<h2 className="example-title">Properties</h2>
<PropTypeDescTable data={doc}/>
</div>
);
}
};
export default TreeSelectExamples;
|
JavaScript
| 0 |
@@ -5977,16 +5977,121 @@
de(1)%7D%3E%0A
+ %7B%0A dialogContentEl =%3E%0A
@@ -6164,24 +6164,32 @@
-scroller%22%3E%0A
+
@@ -6320,32 +6320,40 @@
+
+
data=%7Bthis.data%7D
@@ -6345,32 +6345,40 @@
ata=%7Bthis.data%7D%0A
+
@@ -6475,32 +6475,40 @@
+
+
isSelectRecursiv
@@ -6508,32 +6508,40 @@
ecursive=%7Btrue%7D%0A
+
@@ -6658,32 +6658,40 @@
+
expandedIconCls=
@@ -6756,32 +6756,40 @@
+
+
checkboxUnchecke
@@ -6805,32 +6805,40 @@
%22far fa-circle%22%0A
+
@@ -6962,32 +6962,40 @@
+
+
checkboxIndeterm
@@ -7073,32 +7073,40 @@
+
useFilter=%7Btrue%7D
@@ -7098,32 +7098,40 @@
seFilter=%7Btrue%7D%0A
+
@@ -7181,70 +7181,32 @@
l=%7Bd
-ocument.querySelector('.tree-select-dialog .dialog-content')%7D%0A
+ialogContentEl%7D%0A
@@ -7322,32 +7322,40 @@
+
onChange=%7Bthis.c
@@ -7362,32 +7362,40 @@
hangeHandler%7D/%3E%0A
+
@@ -7413,32 +7413,70 @@
%3C/div%3E%0A
+ %7D%0A
|
d19a0feb10b945a14e5bc0da69d3b47eea6fd47a
|
Load all default mastic polyfills in server
|
packages/mastic-node-server/start.js
|
packages/mastic-node-server/start.js
|
const mastic = require('./server.js');
const { promise } = require('mastic-polyfills/bundles');
const server = mastic({
polyfills: [promise]
});
server.listen();
|
JavaScript
| 0 |
@@ -42,19 +42,15 @@
nst
-%7B promise %7D
+bundles
= r
@@ -126,17 +126,67 @@
ls:
-%5Bpromis
+Object.keys(bundles).map(bundleName =%3E bundles%5BbundleNam
e%5D
+)
%0A%7D);
|
15970782a0b8b5f3ae91d0f7e31bca4e5f07f865
|
add gallery back to show
|
packages/vx-demo/components/show.js
|
packages/vx-demo/components/show.js
|
import React from 'react';
import cx from 'classnames';
import { withScreenSize } from '@vx/responsive';
import Page from '../components/page';
import Codeblock from '../components/codeblocks/Codeblock';
import Gallery from '../components/gallery';
export default withScreenSize(
({
screenWidth,
screenHeight,
children,
title,
component,
shadow = false,
events = false,
margin = { top: 0, left: 0, right: 0, bottom: 80 },
description
}) => {
const padding = 40;
let width = screenWidth - padding;
if (width > 800) width = 800;
const height = width * 0.6;
return (
<Page title={title}>
<div className="container">
<div style={{ width: width }}>
<h1>{title}</h1>
</div>
<div
className={cx(
{
shadow: !!shadow
},
title.split(' ').join('-'),
'chart'
)}
>
{React.createElement(component, {
width,
height,
margin,
events
})}
</div>
{description && React.createElement(description, { width, height })}
{children && (
<div style={{ width: width }}>
<h2>Code</h2>
</div>
)}
{children && (
<div className="code" style={{ width: width }}>
<Codeblock>{children}</Codeblock>
</div>
)}
</div>
{false && (
<div style={{ marginTop: '40px' }}>
<Gallery />
</div>
)}
<style jsx>{`
.container {
display: flex;
flex-direction: column;
align-items: center;
overflow: hidden;
}
.container h1 {
margin-top: 15px;
line-height: 0.9em;
letter-spacing: -0.03em;
}
.container h2 {
margin-top: 15px;
margin-bottom: 5px;
}
.chart {
border-radius: 14px;
}
.shadow {
border-radius: 14px;
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.1);
}
`}</style>
</Page>
);
}
);
|
JavaScript
| 0 |
@@ -1524,30 +1524,8 @@
iv%3E%0A
- %7Bfalse && (%0A
@@ -1574,18 +1574,16 @@
-
%3CGallery
@@ -1598,28 +1598,15 @@
-
%3C/div%3E%0A
- )%7D%0A
|
af63eca555c48e4acee2400d8c18fdc695772878
|
Implement loader resolution and installation
|
packages/webpack-npm/src/index.js
|
packages/webpack-npm/src/index.js
|
'use strict'
/* @flow */
import NPM from 'motion-npm'
import { getRootDirectory } from './helpers'
import type { Installer$Config } from './types'
class Installer {
locks: Set<string>;
config: Installer$Config;
installID: number;
constructor(config: Installer$Config = {}) {
config.save = Boolean(typeof config.save !== 'undefined' ? config.save : true)
this.locks = new Set()
this.config = config
this.installID = 0
}
apply(compiler: Object) {
compiler.resolvers.loader.plugin('module', (result, next) => {
this.resolveLoader(compiler, result, next)
})
compiler.resolvers.normal.plugin('module', (result, next) => {
this.resolveNormal(compiler, result, next)
})
}
resolveLoader(compiler: Object, result: Object, next: Function): void {
let { path: modulePath, request: moduleName } = result
if (!moduleName.match(/\-loader$/)) {
moduleName += '-loader'
}
const npm = new NPM({rootDirectory: getRootDirectory(modulePath)})
npm.isInstalled(moduleName).then(function(status) {
if (status) {
next()
return
}
this.installPackage(npm, moduleName).then(next)
})
}
resolveNormal(compiler: Object, result: Object, next: Function): void {
const { path: modulePath, request: moduleName } = result
if (modulePath.match('node_modules')) {
next()
return
}
if (this.locks.has(moduleName)) {
next()
return
}
this.locks.add(moduleName)
compiler.resolvers.normal.resolve(modulePath, moduleName, (error, filePath) => {
if (!error) {
next()
return
}
this.locks.delete(moduleName)
const npm = new NPM({rootDirectory: getRootDirectory(modulePath)})
npm.isInstalled(moduleName).then(status => {
if (status) {
next()
return
}
this.installPackage(npm, moduleName).then(next)
})
})
}
installPackage(npm: NPM, moduleName: string): Promise {
const id = ++this.installID
if (this.config.onStarted) {
this.config.onStarted(id, [[moduleName, 'x.x.x']])
}
return npm.install(moduleName, this.config.save).then(() => {
if (this.config.onProgress) {
this.config.onProgress(id, moduleName, null)
}
}, error => {
if (this.config.onProgress) {
this.config.onProgress(id, moduleName, error)
}
}).then(() => {
if (this.config.onComplete) {
this.config.onComplete(id)
}
})
}
}
module.exports = Installer
|
JavaScript
| 0 |
@@ -547,124 +547,146 @@
-this.resolveLoader(compiler, result, next)
+let %7B path: modulePath, request: moduleName %7D = result%0A if (!moduleName.match(/%5C-loader$/)) %7B
%0A
-%7D)%0A
-compiler.resolvers.normal.plugin('module', (result, next) =%3E %7B
+moduleName += '-loader'%0A %7D
%0A
@@ -696,30 +696,34 @@
this.resolve
-Normal
+Dependency
(compiler, r
@@ -725,113 +725,128 @@
er,
-result, next)%0A %7D)%0A %7D%0A resolveLoader(compiler: Object
+modulePath, moduleName, next, true)%0A %7D)%0A compiler.resolvers.normal.plugin('module'
,
+(
result
-: Object, next: Function): void
+, next) =%3E
%7B%0A
-le
+ cons
t %7B
@@ -902,319 +902,162 @@
+
if (
-!
module
-Name
+Path
.match(
-/%5C-loader$/)) %7B%0A moduleName += '-loader'%0A %7D%0A const npm = new NPM(%7BrootDirectory: getRootDirectory(modulePath)%7D)%0A npm.isInstalled(moduleName).then(function(status) %7B%0A if (status) %7B%0A next()%0A return%0A %7D%0A this.installPackage(npm, moduleName).then(next
+'node_modules')) %7B%0A next()%0A return%0A %7D%0A this.resolveDependency(compiler, modulePath, moduleName, next, false
)%0A
@@ -1078,14 +1078,18 @@
olve
-Normal
+Dependency
(com
@@ -1107,184 +1107,88 @@
ct,
-result: Object, next: Function): void %7B%0A const %7B path: modulePath, request: moduleName %7D = result%0A if (modulePath.match('node_modules')) %7B%0A next()%0A return%0A %7D
+modulePath: string, moduleName: string, next: Function, loader: boolean): void %7B
%0A
@@ -1281,24 +1281,73 @@
moduleName)%0A
+ const keyName = loader ? 'loader' : 'normal'%0A
compiler
@@ -1356,23 +1356,25 @@
esolvers
-.normal
+%5BkeyName%5D
.resolve
@@ -1417,24 +1417,60 @@
ePath) =%3E %7B%0A
+ this.locks.delete(moduleName)%0A
if (!e
@@ -1520,44 +1520,8 @@
%7D%0A%0A
- this.locks.delete(moduleName)%0A
|
8a2681aaeb5a33307af3f978d26a886026e09d21
|
Statements and expressions
|
intro/script.js
|
intro/script.js
|
// Functions
function calculateAge(yearOfBirth) {
var age = 2017 - yearOfBirth;
//console.log(age);
return age;
}
//var ageMora = calculateAge(1990);
//var ageEmma = calculateAge(1988);
//var ageRamas = calculateAge(1993);
//var ageWilly = calculateAge(1995);
//var ageBerto = calculateAge(1997);
function yearsUntilRetirement(name, year){
var age = calculateAge(year);
var retirement = 65 - age;
if(retirement >= 0){
console.log(name + ' retires in ' + retirement + ' years');
} else{
console.log(name + ' is already retired');
}
return retirement;
}
yearsUntilRetirement('Alejo', 1955);
yearsUntilRetirement('Bertha', 1958);
yearsUntilRetirement('Hibran', 1986);
yearsUntilRetirement('Emma', 1988);
yearsUntilRetirement('Mora', 1990);
yearsUntilRetirement('Berto', 1997);
|
JavaScript
| 0.998598 |
@@ -1,837 +1,187 @@
//
-Functions%0A%0Afunction calculateAge(yearOfBirth) %7B%0A var age = 2017 - yearOfBirth;%0A //console.log(age);%0A return age;
+Statements and expressions%0A%0Afunction someFun(par)%7B%0A //code
%0A%7D%0A%0A
-//
var
-ageMora = calculateAge(1990);%0A//var ageEmma = calculateAge(1988);%0A//var ageRamas = calculateAge(1993);%0A//var ageWilly = calculateAge(1995);%0A//var ageBerto = calculateAge(1997);%0A%0A%0Afunction yearsUntilRetirement(name, year)%7B%0A var age = calculateAge(year);%0A var retirement = 65 - age;%0A %0A if(retirement %3E= 0)%7B%0A console.log(name + ' retires in ' + retirement + ' years');%0A %7D else%7B%0A console.log(name + ' is already retired');%0A %7D%0A return retirement;%0A%7D%0A%0A%0AyearsUntilRetirement('Alejo', 1955);%0AyearsUntilRetirement('Bertha', 1958);%0AyearsUntilRetirement('Hibran', 1986);%0AyearsUntilRetirement('Emma', 1988);%0AyearsUntilRetirement('Mora', 1990);%0AyearsUntilRetirement('Berto', 1997);%0A
+someFun = function(par)%7B%0A //code%0A%7D%0A%0A//expression%0A3+4;%0Avar x = 3;%0A%0A//statements %0Aif(x=== 5)%7B%0A //do something%0A%7D
|
215b6d2cb4eda8427a00044c9f5c91b048de7750
|
Update autoIncrement.test.js
|
features/autoIncrement/core/autoIncrement.test.js
|
features/autoIncrement/core/autoIncrement.test.js
|
var assert = require('assert');
var _ = require('lodash');
/**
* When `autoIncrement` is set to `true` on an attribute and no value is provided for it a
* new unique value will be assigned by the adapter before the record is created. It is
* guaranteed that the adapter will assign a unique value not present on any existing record.
* The values assigned automatically will not necessarily be sequential, which accommodates
* the use of UUIDs. If a value for the attribute is present in the data provided for a new
* record it will be saved as-is without any guarantee of uniqueness. The `autoIncrement`
* option has no effect when updating existing records. The feature flag is `autoIncrement`.
*/
describe('autoIncrement attribute feature', function() {
/////////////////////////////////////////////////////
// TEST SETUP
////////////////////////////////////////////////////
var Offshore = require('offshore');
var defaults = { migrate: 'alter' };
var offshore;
var AutoIncFixture = require('./../support/autoInc.fixture.js');
var AutoIncModel;
before(function(done) {
offshore = new Offshore();
offshore.loadCollection(AutoIncFixture);
done();
});
beforeEach(function(done) {
var connections = { autoIncConn: _.clone(Connections.test) };
Adapter.teardown('autoIncConn', function adapterTeardown(){
offshore.initialize({ adapters: { wl_tests: Adapter }, connections: connections, defaults: defaults }, function(err, ontology) {
if(err) return done(err);
AutoIncModel = ontology.collections['autoinc'];
done();
});
});
});
afterEach(function(done) {
if(!Adapter.hasOwnProperty('drop')) {
offshore.teardown(done);
} else {
AutoIncModel.drop(function(err1) {
offshore.teardown(function(err2) {
return done(err1 || err2);
});
});
}
});
/////////////////////////////////////////////////////
// TEST METHODS
////////////////////////////////////////////////////
var testName = '.create() test autoInc unique values';
var lastIds;
it('should auto generate unique values', function(done) {
var records = [];
for(var i=0; i<10; i++) {
records.push({ name: 'ai_' + i, type: testName });
}
AutoIncModel.create(records, function(err) {
if (err) return done(err);
AutoIncModel.find({where : { type: testName }, sort : {name : 1}}, function(err, records) {
if (err) return done(err);
assert.ifError(err);
assert.equal(records.length, 10, 'Expecting 10 records, but got '+records.length);
assert(records[0].id);
assert.equal(records[0].name, 'ai_0');
assert(records[0].normalField === null || records[0].normalField === undefined);
var ids = lastIds = _.pluck(records, 'id');
assert.equal(ids.length, 10);
assert.equal(_.unique(ids).length, 10, 'Generated ids are not unique: '+ids.join(', '));
done();
});
});
});
it('should auto generate unique values even when values have been set', function(done) {
// Create some initial records with auto inc values already set. Type matches are ensured by using the
// values generated in the previous test, also ensuring that if there is a fixed sequence of values being
// used the first values are already taken.
var records = [];
for(var i=0; i<5; i++) {
records.push({ id: lastIds[i], name: 'ai_' + i, normalField: 10, type: testName });
}
AutoIncModel.create(records, function(err) {
if (err) return done(err);
AutoIncModel.find({where : { type: testName }, sort : {name : 1}}, function(err, records) {
if (err) return done(err);
assert.ifError(err);
assert.equal(records.length, 5, 'Expecting 5 records, but got '+records.length);
assert.equal(records[0].name, 'ai_0');
assert.equal(records[0].normalField, 10);
var ids = _.pluck(records, 'id');
assert.equal(ids.length, 5)
assert.equal(_.unique(ids).length, 5)
// Create another set of records without auto inc values set. The generated values should be
// unique, even when compared to those set explicitly.
var records = [];
for(var i=5; i<10; i++) {
records.push({ name: 'ai_' + i, type: testName });
}
AutoIncModel.create(records, function(err) {
if (err) return done(err);
AutoIncModel.find({where : { type: testName }, sort : {name : 1}}, function(err, records) {
if (err) return done(err);
assert.ifError(err);
assert.equal(records.length, 10, 'Expecting 10 records, but got '+records.length);
assert.equal(records[0].name, 'ai_0');
assert(records[5].id);
assert.equal(records[5].name, 'ai_5');
var ids = _.pluck(records, 'id');
assert.equal(ids.length, 10);
assert.equal(_.unique(ids).length, 10, 'Preset and generated ids are not unique: '+ids.join(', '));
done();
});
});
});
});
});
});
|
JavaScript
| 0 |
@@ -2801,29 +2801,27 @@
lastIds = _.
-pluck
+map
(records, 'i
@@ -3953,37 +3953,35 @@
var ids = _.
-pluck
+map
(records, 'id');
@@ -4888,13 +4888,11 @@
= _.
-pluck
+map
(rec
|
8eb1aa8f140c48781bbb6af8101d011f16d80b5d
|
support to pass mediaType for product image
|
sprd/data/ImageService.js
|
sprd/data/ImageService.js
|
define(['js/core/Component', 'underscore'], function (Component, _) {
var exceptionSizes = [120, 178],
PRODUCT = "product",
COMPOSITION = "composition";
var ImageService = Component.inherit('sprd.data.ImageService', {
defaults: {
subDomainCount: 10,
endPoint: '//image.spreadshirt.net/image-server/v1',
gateway: '/image-server/v1',
detectWebP: true,
supportsWebP: false
},
ctor: function() {
this.callBase();
if (this.$.detectWebP) {
var self = this;
var image = new Image();
image.onerror = function() {
self.set("supportsWebP", false);
};
image.onload = function() {
self.set("supportsWebP", image.width == 1);
};
image.src = 'data:image/webp;base64,UklGRiwAAABXRUJQVlA4ICAAAAAUAgCdASoBAAEAL/3+/3+CAB/AAAFzrNsAAP5QAAAAAA==';
}
},
virtualProductImage: function(product, vpString, viewId, options) {
return this.buildUrl([
'products',
vpString,
'views',
viewId
], ImageService.getImageSizeParameter(options), parseInt(product ? product.$.id : 0));
},
productImage: function (productId, viewId, appearanceId, type, options) {
var params = ImageService.getImageSizeParameter(options);
if (appearanceId) {
params.appearanceId = appearanceId;
}
return this.buildUrl([
type === PRODUCT ? "products" : "compositions",
productId,
"views",
viewId
],
params,
parseInt(productId || 0) + parseInt(viewId || 0) + parseInt(appearanceId || 0));
},
productTypeImage: function (productTypeId, viewId, appearanceId, options) {
return this.buildUrl(['productTypes', productTypeId, 'views', viewId, 'appearances', appearanceId],
ImageService.getImageSizeParameter(options), parseInt(productTypeId || 0) + parseInt(viewId || 0) + parseInt(appearanceId || 0));
},
productTypeSizeImage: function (productTypeId, options) {
return this.buildUrl(["productTypes", productTypeId, "variants", "size"], ImageService.getImageSizeParameter(options), productTypeId);
},
designImage: function (designId, options) {
options = options || {};
var parameter = ImageService.getImageSizeParameter(options) || {};
var printColors = options.printColors;
if (printColors) {
for (var i = 0; i < printColors.length; i++) {
parameter["colors[" + i + "]"] = printColors[i];
}
}
if (options.version) {
parameter.version = options.version;
}
var cacheId = options.cacheId || (designId || "").replace(/^.*?(\d+).*/, "$1");
return this.buildUrl(['designs', designId], parameter, cacheId);
},
appearanceImage: function (appearanceId, options) {
return this.buildUrl(['appearances', appearanceId], ImageService.getImageSizeParameter(options), appearanceId);
},
printColorImage: function (printColorId, options) {
return this.buildUrl(['printColors', printColorId], ImageService.getImageSizeParameter(options), printColorId);
},
emptyImage: function () {
return "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
},
fontUrl: function (font, extension) {
extension = extension || "woff" || "svg#font";
return ImageService.buildUrl([this.$.gateway,'fontFamilies', font.getFontFamily().$.id, 'fonts', font.$.id + "." + extension]);
},
buildUrl: function (url, parameter, cacheId) {
var imgServer,
subDomainCount = this.$.subDomainCount;
if (!isNaN(parseInt(cacheId))) {
// use the full qualified endpoint
imgServer = this.$.endPoint;
imgServer = imgServer.replace(/(\/\/image)\./, '$1' + (cacheId % subDomainCount) + ".");
} else {
imgServer = this.$.gateway;
}
url = url || [];
url.unshift(imgServer);
if (this.$.supportsWebP) {
parameter = parameter || {};
parameter.mediaType = parameter.mediaType || "webp";
}
return ImageService.buildUrl(url, parameter);
}
});
ImageService.exceptionalSizes = [120, 178];
ImageService.normalizeImageSize = function (size) {
if (_.indexOf(exceptionSizes, size) === -1) {
// normalize size
size = Math.ceil(size / 50) * 50;
}
// keep range
return Math.max(50, Math.min(1200, size));
};
ImageService.getImageSizeParameter = function (options) {
options = options || {};
var ret = {};
if (options.width) {
ret.width = ImageService.normalizeImageSize(options.width);
}
if (options.height) {
ret.height = ImageService.normalizeImageSize(options.height);
}
return ret;
};
ImageService.buildUrl = function (url, parameter) {
var queryString = ImageService.buildQueryString(parameter);
return url.join('/') + (queryString ? '?' + queryString : '');
};
ImageService.buildQueryString = function (parameter) {
var ret = [];
for (var key in parameter) {
if (parameter.hasOwnProperty(key)) {
ret.push(key + '=' + encodeURIComponent(parameter[key]));
}
}
if (ret.length) {
return ret.join('&');
}
};
ImageService.ProductImageType = {
PRODUCT: PRODUCT,
COMPOSITION: COMPOSITION
};
return ImageService;
});
|
JavaScript
| 0 |
@@ -1605,32 +1605,139 @@
;%0A %7D%0A
+%0A if (options.mediaType) %7B%0A params.mediaType = options.mediaType;%0A %7D%0A%0A
retu
|
15627e5c103ce18bc808e5993e1f6f7ce779d7dd
|
Remove some dead code
|
collections/boards.js
|
collections/boards.js
|
Boards = new Mongo.Collection('boards');
// ALLOWS
Boards.allow({
insert: Meteor.userId,
update: allowIsBoardAdmin,
remove: allowIsBoardAdmin,
fetch: ['members']
});
// We can't remove a member if it is the last administrator
Boards.deny({
update: function(userId, doc, fieldNames, modifier) {
if (! _.contains(fieldNames, 'members'))
return false;
// We only care in case of a $pull operation, ie remove a member
if (! _.isObject(modifier.$pull && modifier.$pull.members))
return false;
// If there is more than one admin, it's ok to remove anyone
var nbAdmins = _.filter(doc.members, function(member) {
return member.isAdmin;
}).length;
if (nbAdmins > 1)
return false;
// If all the previous conditions where verified, we can't remove
// a user if it's an admin
var removedMemberId = modifier.$pull.members.userId;
return !! _.findWhere(doc.members, {
userId: removedMemberId,
isAdmin: true
});
},
fetch: ['members']
})
// HELPERS
Boards.helpers({
lists: function() {
return Lists.find({ boardId: this._id, archived: false }, { sort: { sort: 1 }});
},
activities: function() {
return Activities.find({ boardId: this._id }, { sort: { createdAt: -1 }});
} ,
absoluteUrl: function() {
return Router.path("Board", { boardId: this._id, slug: this.slug });
}
});
// METHODS
Meteor.methods({
removeCardMember: function(_id) {
check(_id, String);
CardMembers.update({ memberId: _id }, {
$set: {
approved: false
}
});
}
});
// HOOKS
Boards.before.insert(function(userId, doc) {
// XXX We need to improve slug management. Only the id should be necessary
// to identify a board in the code.
// XXX If the board title is updated, the slug should also be updated.
// In some cases (Chinese and Japanese for instance) the `getSlug` function
// return an empty string. This is causes bugs in our application so we set
// a default slug in this case.
doc.slug = getSlug(doc.title) || 'board';
doc.createdAt = new Date();
doc.archived = false;
doc.members = [{
userId: userId || doc.userId,
isAdmin: true
}];
// Handle labels
var defaultLabels = ['green', 'yellow', 'orange', 'red', 'purple', 'blue'];
doc.labels = [];
_.each(defaultLabels, function(val) {
doc.labels.push({
_id: Random.id(6),
name: '',
color: val
});
});
});
Boards.before.update(function(userId, doc, fieldNames, modifier) {
if (! _.isObject(modifier.$set))
modifier.$set = {};
modifier.$set.modifiedAt = new Date();
});
isServer(function() {
// Let MongoDB ensure that a member is not included twice in the same board
Meteor.startup(function() {
Boards._collection._ensureIndex({
'_id': 1,
'members.userId': 1
}, { unique: true });
});
// Genesis: the first activity of the newly created board
Boards.after.insert(function(userId, doc) {
Activities.insert({
type: 'board',
activityTypeId: doc._id,
activityType: "createBoard",
boardId: doc._id,
userId: userId || doc.userId
});
});
// If the user remove one label from a board, we cant to remove reference of
// this label in any card of this board.
Boards.after.update(function(userId, doc, fieldNames, modifier) {
if (! _.contains(fieldNames, 'labels') ||
! modifier.$pull ||
! modifier.$pull.labels ||
! modifier.$pull.labels._id)
return;
var removedLabelId = modifier.$pull.labels._id;
Cards.update(
{ boardId: doc._id },
{
$pull: {
labels: removedLabelId
}
},
{ multi: true }
);
});
// Add a new activity if we add or remove a member to the board
Boards.after.update(function(userId, doc, fieldNames, modifier) {
if (! _.contains(fieldNames, 'members'))
return;
// Say hello to the new member
if (modifier.$push && modifier.$push.members) {
var memberId = modifier.$push.members.userId;
Activities.insert({
type: 'member',
activityType: "addBoardMember",
boardId: doc._id,
userId: userId,
memberId: memberId
});
}
// Say goodbye to the former member
if (modifier.$pull && modifier.$pull.members) {
var memberId = modifier.$pull.members.userId;
Activities.insert({
type: 'member',
activityType: "removeBoardMember",
boardId: doc._id,
userId: userId,
memberId: memberId
});
}
});
});
|
JavaScript
| 0.00075 |
@@ -1507,239 +1507,8 @@
);%0A%0A
-// METHODS%0AMeteor.methods(%7B%0A removeCardMember: function(_id) %7B%0A check(_id, String);%0A CardMembers.update(%7B memberId: _id %7D, %7B%0A $set: %7B%0A approved: false%0A %7D%0A %7D);%0A %7D%0A%7D);%0A%0A
// H
|
bddc07e4b6cea617190650a5a13771c3f33618cf
|
Update docs
|
packages/shared/lib/fetch/helpers.js
|
packages/shared/lib/fetch/helpers.js
|
/**
* Create an API error.
* @param {String} name - Name of error
* @param {Object} response - Full response object
* @param {Object} [data] - JSON data received
* @param {Object} config - Config used
* @returns {Error}
*/
export const createApiError = ({ response, data, config, name }) => {
const { statusText, status } = response;
const error = new Error(statusText);
error.name = name;
error.response = response;
error.status = status;
error.data = data;
error.config = config;
return error;
};
/**
* Append query parameters to a URL.
* This is to support URLs which already have query parameters.
* @param {String} url
* @param {Object} params
*/
const appendQueryParams = (url, params) => {
Object.keys(params).forEach((key) => {
const value = params[key];
if (typeof value === 'undefined') {
return;
}
url.searchParams.append(key, value);
});
};
/**
* Create a URL from a string and query parameters object.
* @param {String} urlString
* @param {Object} params
* @returns {URL}
*/
export const createUrl = (urlString, params = {}) => {
const url = new URL(urlString);
appendQueryParams(url, params);
return url;
};
/**
* Merge headers for the request.
* @param {Object} configHeaders
* @param {Object} restConfig
* @param {Object} headers
* @returns {Object}
*/
export const mergeHeaders = ({ headers: configHeaders, ...restConfig }, headers) => ({
...restConfig,
headers: {
...configHeaders,
...headers
}
});
/**
* Check the status of the response, and throw if needed.
* @param {Object} response - Full response
* @param {Object} config - Used config
* @returns {Promise}
*/
export const checkStatus = (response, config) => {
const { status } = response;
if (status >= 200 && status < 300) {
return response;
}
return response
.json()
.catch(() => {})
.then((data) => {
throw createApiError({ name: 'StatusCodeError', response, data, config });
});
};
/**
* Get the date header if it exists, and set the latest servertime in pmcrypto.
* @param {Object} headers - Full headers from the response
* @returns {Date}
*/
export const getDateHeader = (headers) => {
const dateHeader = headers.get('date');
if (!dateHeader) {
return;
}
const newServerTime = new Date(dateHeader);
if (Number.isNaN(+newServerTime)) {
return;
}
return newServerTime;
};
/**
* Create FormData from an object
* @param {Object} data
* @returns {FormData}
*/
export const serializeFormData = (data) => {
const formData = new FormData();
Object.keys(data).forEach((key) => {
formData.append(key, data[key]);
});
return formData;
};
/**
* Serialize data and create the body and headers needed.
* @param {Object} data
* @param {String} input
* @returns {Object}
*/
export const serializeData = (data, input) => {
if (!data) {
return {};
}
if (input === 'json') {
return {
body: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
}
};
}
if (input === 'form') {
return {
body: serializeFormData(data)
};
}
return {};
};
|
JavaScript
| 0.000001 |
@@ -2127,51 +2127,8 @@
ists
-, and set the latest servertime in pmcrypto
.%0A *
|
2cccfeb9478a482ab0e254ccf33e19f8a32efbd8
|
Fix simple typo, shure -> sure
|
test/test_require.js
|
test/test_require.js
|
describe('require tests', function () {
var bag = new window.Bag({ stores: [ 'localstorage' ] });
beforeEach(function () {
return bag.clear();
});
after(function () {
return bag.clear();
});
it('require cached fail', function () {
return bag.require({ url: 'fixtures/require_text.txt', cached: true })
.then(
function () { throw new Error('This should fail'); },
function (err) { assert.ok(err); });
});
it('require text', function () {
return bag.require('fixtures/require_text.txt')
.then(function (data) {
assert.strictEqual(data, 'lorem ipsum');
});
});
it('require cached ok', function () {
var url = 'fixtures/require_text.txt';
return bag.require(url)
// hack cache content
.then(function () {
return bag.get(url);
})
.then(function (val) {
val.data = 'tandrum aver';
return bag.set(url, val);
})
.then(function () {
// require & make sure data is from cache
return bag.require({ url: url, cached: true });
})
.then(function (data) {
assert.strictEqual(data, 'tandrum aver');
});
});
it('inject JS', function () {
window.test_inc = 0;
return bag.require('fixtures/require_increment.js')
.then(function () {
assert.strictEqual(window.test_inc, 1);
});
});
it('inject JS from cache', function () {
window.test_inc = 0;
return bag.require('fixtures/require_increment.js')
.then(function () {
return bag.require({ url: 'fixtures/require_increment.js', cached: true });
})
.then(function () {
assert.strictEqual(window.test_inc, 2);
});
});
it('use the same `unique`', function () {
var url = 'fixtures/require_const.js';
return bag.require({ url: url, unique: 123 })
.then(function () {
assert.strictEqual(window.test_const, 5);
})
// hack cache content
.then(function () {
return bag.get(url);
})
.then(function (val) {
val.data = 'window.test_const = 10;';
return bag.set(url, val);
})
.then(function () {
// now make shure that data fetched from cache
return bag.require({ url: url, unique: 123 });
})
.then(function () {
assert.strictEqual(window.test_const, 10);
});
});
it('use different `unique`', function () {
var url = 'fixtures/require_const.js';
return bag.require({ url: url, unique: 123 })
.then(function () {
assert.strictEqual(window.test_const, 5);
})
// hack cache content
.then(function () {
return bag.get(url);
})
.then(function (val) {
val.data = 'window.test_const = 10;';
return bag.set(url, val);
})
.then(function () {
// now make shure that data fetched from server again
return bag.require({ url: url, unique: 456 });
})
.then(function () {
assert.strictEqual(window.test_const, 5);
});
});
it('require not existing file', function () {
return bag.require('./not_existing')
.then(null, function (err) { assert.ok(err); });
});
it('use external validator `isValidItem()`', function () {
bag.isValidItem = function () { return false; };
var url = 'fixtures/require_const.js';
return bag.require(url)
.then(function () {
assert.strictEqual(window.test_const, 5);
})
// hack cache content
.then(function () {
return bag.get(url);
})
.then(function (val) {
val.data = 'window.test_const = 10;';
return bag.set(url, val);
})
.then(function () {
// make shure that data fetched from cache,
// because invalidated by external validator
return bag.require(url);
})
.then(function () {
assert.strictEqual(window.test_const, 5);
});
});
it('test execution order', function () {
return bag.require([ 'fixtures/require_const.js', 'fixtures/require_const2.js' ])
.then(function () {
assert.strictEqual(window.test_const, 100);
});
});
it('add/replace handler', function () {
var b = new window.Bag();
var handled = false;
b.addHandler('application/javascript', function () { handled = true; });
return b.require('fixtures/require_const.js')
.then(function () { assert.ok(handled); });
});
it('remove mime-type handler', function () {
var b = new window.Bag();
b.removeHandler('application/javascript');
window.test_const = 0;
return b.require('fixtures/require_const.js')
.then(function () {
assert.strictEqual(window.test_const, 0);
});
});
it('force bypass cache (`live`=true)', function () {
var url = 'fixtures/require_const.js';
return bag.require(url)
.then(function () {
assert.strictEqual(window.test_const, 5);
})
// hack cache content
.then(function () {
return bag.get(url);
})
.then(function (val) {
val.data = 'window.test_const = 10;';
return bag.set(url, val);
})
.then(function () {
// make shure that data fetched from cache,
// because invalidated by external validator
return bag.require({ url: url, live: true });
})
.then(function () {
assert.strictEqual(window.test_const, 5);
});
});
});
|
JavaScript
| 0.000002 |
@@ -2201,33 +2201,32 @@
// now make s
-h
ure that data fe
@@ -2234,32 +2234,32 @@
ched from cache%0A
+
return b
@@ -2878,25 +2878,24 @@
/ now make s
-h
ure that dat
@@ -3749,33 +3749,32 @@
// make s
-h
ure that data fe
@@ -5226,32 +5226,32 @@
n(function () %7B%0A
+
// make
@@ -5251,17 +5251,16 @@
/ make s
-h
ure that
|
1f0c1602f7972a72eb8b1f0b50574352e85af170
|
fix console log
|
src/Umbraco.Web.UI.Client/gulp/util/processLess.js
|
src/Umbraco.Web.UI.Client/gulp/util/processLess.js
|
var config = require('../config');
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var less = require('gulp-less');
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
var cleanCss = require("gulp-clean-css");
var rename = require('gulp-rename');
module.exports = function(files, out) {
var processors = [
autoprefixer,
cssnano({zindex: false})
];
console.log("LESS: ", files, " -> ", config.root + config.targets.js + out)
var task = gulp.src(files)
.pipe(less())
.pipe(cleanCss())
.pipe(postcss(processors))
.pipe(rename(out))
.pipe(gulp.dest(config.root + config.targets.css));
return task;
};
|
JavaScript
| 0.000002 |
@@ -497,9 +497,10 @@
ets.
-j
+cs
s +
|
78c93f457eea02a11196c29912f573dbe0cc760c
|
Fix js
|
collections/orders.js
|
collections/orders.js
|
Orders = new Mongo.Collection('orders');
Orders.helpers({
contact: function() {
return Contacts.findOne(this.contactId);
}
});
Orders.allow({
insert: function(userId) {
if (userId) {
return true;
}
},
update: function(userId) {
if (userId) {
return true;
}
}
});
var Schemas = {};
var OrderedResource = new SimpleSchema({
state: {
type: String,
regEx: /(ordered|sold)/,
optional: true
},
resourceId: {
type: String
}
});
Schemas.Order = new SimpleSchema({
createdAt: {
type: Date,
label: 'Date',
autoValue: function() {
return new Date();
}
},
contactedAt: {
type: Date,
label: 'Contact Date',
optional: true
},
state: {
type: String,
defaultValue: 'created',
regEx: /(created|completed|contacted|canceled|sold)/
},
orderedResources: {
type: [OrderedResource]
},
contactId: {
type: String,
optional: true
},
phone: {
type: String,
label: 'Phone',
optional: true
},
humanId: {
type: String,
label: 'Number'
}
});
Orders.attachSchema(Schemas.Order);
if (Meteor.isServer) {
Meteor.publish('orders', function () {
if (this.userId) {
return Orders.find({});
}
});
} else {
Template.orders.helpers({
settings: function () {
return {
collection: Orders.find(),
fields: [
{key: 'humanId', label: 'Number'},
'state',
{
key:'createdAt',
label: 'Created',
fn: function(value) {
if (value instanceof Date) {
return moment(value).calendar();
} else {
return 'Never';
}
}
},
{
key:'contactedAt',
label: 'Contacted',
fn: function(value) {
if (value instanceof Date) {
return moment(value).calendar();
} else {
return 'Never';
}
}
},
'phone',
{
key: 'contactId',
label: 'note',
fn: function(value, object) {
return object.contact()?.note;
}
},
{
key: 'contactId',
label: 'name',
fn: function(value, object) {
return object.contact()?.name;
}
},
{
key: '_id',
label: 'action',
fn: function(value) {
return new Spacebars.SafeString('<a class="btn btn-success" href="#" role="button">Call</a>');
}
}
]
};
}
});
}
|
JavaScript
| 0.000014 |
@@ -2210,17 +2210,36 @@
ontact()
-?
+ && object.contact()
.note;%0A
@@ -2416,9 +2416,28 @@
ct()
-?
+ && object.contact()
.nam
|
70038b3cee89a5729e8a670887ddebf56dc15f4f
|
fix utils module ref
|
src/plugin/modules/panelWidget.js
|
src/plugin/modules/panelWidget.js
|
/*global
define
*/
/*jslint
browser: true,
white: true
*/
define([
'kb/common/html',
'kb/widget/widgetSet',
'./utils'
],
function (html, WidgetSet, utils) {
'use strict';
function renderBSCollapsiblePanel(config) {
var div = html.tag('div'),
span = html.tag('span'),
h4 = html.tag('h4'),
panelId = html.genId(),
headingId = html.genId(),
collapseId = html.genId();
return div({class: 'panel-group kb-widget', id: panelId, role: 'tablist', 'aria-multiselectable': 'true'}, [
div({class: 'panel panel-default'}, [
div({class: 'panel-heading', role: 'tab', id: headingId}, [
h4({class: 'panel-title'}, [
span({'data-toggle': 'collapse', 'data-parent': '#' + panelId, 'data-target': '#' + collapseId, 'aria-expanded': 'false', 'aria-controls': collapseId, class: 'collapsed', style: {cursor: 'pointer'}}, [
span({class: 'fa fa-' + config.icon + ' fa-rotate-90', style: {'margin-left': '10px', 'margin-right': '10px'}}),
config.title
])
])
]),
div({class: 'panel-collapse collapse', id: collapseId, role: 'tabpanel', 'aria-labelledby': 'provHeading'}, [
div({class: 'panel-body'}, [
config.content
])
])
])
]);
}
function widget(config) {
var mount, container, runtime = config.runtime,
widgetSet = WidgetSet.make({runtime: runtime}),
rendered;
function renderPanel() {
var div = html.tag('div');
return div({class: 'kbase-view kbase-dataview-view container-fluid', 'data-kbase-view': 'dataview'}, [
div({class: 'row'}, [
div({class: 'col-sm-12'}, [
div({id: widgetSet.addWidget('kb_dataview_download')})
]),
div({class: 'col-sm-12'}, [
div({id: widgetSet.addWidget('kb_dataview_copy')})
]),
div({class: 'col-sm-12'}, [
div({id: widgetSet.addWidget('kb_dataview_overview')}),
renderBSCollapsiblePanel({
title: 'Data Provenance and Reference Network',
icon: 'sitemap',
content: div({id: widgetSet.addWidget('kb_dataview_provenance')})
}),
div({id: widgetSet.addWidget('kb_dataview_dataObjectVisualizer')})
])
])
]);
}
function init(config) {
rendered = renderPanel();
return widgetSet.init(config);
}
function attach(node) {
mount = node;
container = document.createElement('div');
mount.appendChild(container);
container.innerHTML = rendered;
return widgetSet.attach(node);
}
function start(params) {
return utils.getObjectInfo(runtime, params)
.then(function (objectInfo) {
runtime.send('ui', 'setTitle', 'Data View for ' + objectInfo.name);
return objectInfo;
})
.then(function (objectInfo) {
params.objectInfo = objectInfo;
return widgetSet.start(params);
return objectInfo;
})
.then(function (objectInfo) {
runtime.send('ui', 'addButton', {
name: 'downloadObject',
label: 'Download',
style: 'default',
icon: 'download',
toggle: true,
params: {
ref: objectInfo.ref
},
callback: function () {
runtime.send('downloadWidget', 'toggle');
}
});
runtime.send('ui', 'addButton', {
name: 'copyObject',
label: 'Copy',
style: 'default',
icon: 'copy',
toggle: true,
params: {
ref: objectInfo.ref
},
callback: function () {
runtime.send('copyWidget', 'toggle');
}
});
});
}
function run(params) {
return widgetSet.run(params);
}
function stop() {
return widgetSet.stop();
}
function detach() {
return widgetSet.detach()
.finally(function () {
if (mount && container) {
mount.removeChild(container);
container.innerHTML = '';
}
});
}
return {
init: init,
attach: attach,
start: start,
run: run,
stop: stop,
detach: detach
};
}
return {
make: function (config) {
return widget(config);
}
};
});
|
JavaScript
| 0.000001 |
@@ -119,17 +119,40 @@
',%0A '
-.
+plugins/dataview/modules
/utils'%0A
|
068d55da2cb17f7df69a96749f89d454d2b7bfeb
|
Add orderBy helper
|
packages/shared/lib/helpers/array.js
|
packages/shared/lib/helpers/array.js
|
export const range = (start = 0, end = 1, step = 1) => {
const result = [];
for (let index = start; index < end; index += step) {
result.push(index);
}
return result;
};
export const chunk = (list = [], size = 1) => {
return list.reduce((res, item, index) => {
if (index % size === 0) {
res.push([]);
}
res[res.length - 1].push(item);
return res;
}, []);
};
export const compare = (a, b) => {
if (a > b) {
return 1;
}
if (a < b) {
return -1;
}
return 0;
};
export const uniqueBy = (array, comparator) => {
const seen = new Set();
return array.filter((value) => {
const computed = comparator(value);
const hasSeen = seen.has(computed);
if (!hasSeen) {
seen.add(computed);
}
return !hasSeen;
});
};
export const unique = (array) => uniqueBy(array, (x) => x);
/**
* Returns a new array with the item moved to the new position.
* @param {Array} array List of items
* @param {number} from Index of item to move. If negative, it will begin that many elements from the end.
* @param {number} to Index of where to move the item. If negative, it will begin that many elements from the end.
* @return {Array} New array with the item moved to the new position
*/
export const move = (list = [], from, to) => {
const copy = list.slice();
copy.splice(to < 0 ? copy.length + to : to, 0, copy.splice(from, 1)[0]);
return copy;
};
/**
* Remove an item from an array.
* @param {Array} arr
* @param {Object} item The item to remove
* @returns {Array} copy of the updated array.
*/
export const remove = (arr, item) => {
const i = arr.indexOf(item);
if (i === -1) {
return arr;
}
const result = arr.slice();
result.splice(i, 1);
return result;
};
/**
* Returns difference of two array of strings
* @param {Array} arr1
* @param {Array} arr2
* @returns {Array} diff
*/
export const diff = (arr1, arr2) => arr1.filter((a) => !arr2.includes(a));
/**
* Groups elements in an array by a provided comparison function. E.g. `[1, 1, 2, 3, 3] => [[1, 1], [2], [3, 3]]`
* @param {(a, b) => boolean} compare fn whose result tells if elements belong to the same group
* @param {Array} arr
*/
export const groupWith = (compare, arr = []) => {
const { groups } = arr.reduce(
({ groups, remaining }, a) => {
const group = remaining.filter((b) => compare(a, b));
return group.length
? {
groups: [...groups, group],
remaining: remaining.filter((b) => !compare(a, b))
}
: { groups, remaining };
},
{ groups: [], remaining: arr }
);
return groups;
};
/**
* Returns the item that has minimum value as determined by fn property selector function. E.g.: `minBy(({ a }) => a, [{a: 4}, {a: 2}, {a: 5}])` returns `{a: 2}`
* @param {(a) => number} fn object property selector
* @param {Array} arr array to search in
*/
export const minBy = (fn, arr = []) => arr.reduce((min, item) => (fn(item) < fn(min) ? item : min), arr[0]);
|
JavaScript
| 0.000019 |
@@ -3181,12 +3181,649 @@
), arr%5B0%5D);%0A
+%0A/**%0A * Order collection of object by a specific key%0A * @param %7BArray%3CObject%3E%7D collection%0A * @param %7BString%7D key%0A * @returns %7BArray%7D new collection%0A */%0Aexport const orderBy = (collection = %5B%5D, key = '') =%3E %7B%0A if (!key) %7B%0A throw new Error('%22key%22 needs to be defined when using %22orderBy%22');%0A %7D%0A const mapped = collection.map((item, index) =%3E (%7B index, item %7D));%0A mapped.sort((a, b) =%3E %7B%0A if (a.item%5Bkey%5D %3E b.item%5Bkey%5D) %7B%0A return 1;%0A %7D%0A if (a.item%5Bkey%5D %3C b.item%5Bkey%5D) %7B%0A return -1;%0A %7D%0A return 0;%0A %7D);%0A return mapped.map((%7B index %7D) =%3E collection%5Bindex%5D);%0A%7D;%0A
|
62c2a6452a46ea2a830c8d50da07afd175cc4470
|
update to use newer @sentry/browser package
|
tutor/src/models/app/raven.js
|
tutor/src/models/app/raven.js
|
import Raven from 'raven-js';
import { first } from 'lodash';
const isProd = (process.env.NODE_ENV === 'production');
const isMathJaxUrl = /mathjax/;
const isMathjax = (crumb) => ('xhr' === crumb.category && isMathJaxUrl.test(crumb.data.url));
const RavenErrorLogging = {
boot() {
if (!isProd) { return; }
Raven.config('https://[email protected]/10', {
tags: {
environment: first(window.location.host.split('.')),
},
breadcrumbCallback(crumb) {
if (isMathjax(crumb)) { return false; }
return crumb;
},
}).install();
},
setUser(user) {
Raven.setUserContext({
id: user.account_uuid,
});
},
captureException(error, xtra) {
if (!isProd) {
console.warn(error); // eslint-disable-line no-console
}
Raven.captureException(error, xtra);
},
};
export default RavenErrorLogging;
|
JavaScript
| 0 |
@@ -4,28 +4,41 @@
ort
-Raven from 'raven-js
+* as Sentry from '@sentry/browser
';%0Ai
@@ -330,21 +330,52 @@
-Raven.config(
+Sentry.init(%7B%0A debug: true,%0A dsn:
'htt
@@ -435,27 +435,9 @@
10',
- %7B
%0A
- tags: %7B%0A
@@ -501,36 +501,30 @@
-%7D,%0A breadcrumbCallback(
+beforeBreadcrumb(bread
crum
@@ -550,16 +550,21 @@
Mathjax(
+bread
crumb))
@@ -576,13 +576,12 @@
urn
-false
+null
; %7D%0A
@@ -595,16 +595,21 @@
return
+bread
crumb;%0A
@@ -626,18 +626,8 @@
%7D)
-.install()
;%0A
@@ -656,36 +656,62 @@
-Raven.setUserContext(%7B%0A
+Sentry.configureScope(scope =%3E %7B%0A scope.setUser(%7B
id:
@@ -728,17 +728,20 @@
unt_uuid
-,
+ %7D);
%0A %7D);
@@ -871,21 +871,22 @@
%7D%0A
-Raven
+Sentry
.capture
@@ -915,16 +915,141 @@
;%0A %7D,%0A%0A
+ log(msg) %7B%0A if (!isProd) %7B console.info(msg); %7D // eslint-disable-line no-console%0A Sentry.captureMessage(msg);%0A %7D,%0A%0A
%7D;%0A%0A%0Aexp
|
ea0e208ad997feaf2fa0307a7d80a7c1aca7788d
|
update rooms.es6 with object literals + template strings
|
collections/rooms.es6
|
collections/rooms.es6
|
Rooms = new Meteor.Collection('rooms'); // jshint ignore:line
Meteor.methods({
'joinRoom': function (id) {
check(id, String);
var room = Rooms.findOne({_id: id});
var userId = Meteor.userId();
if (!room) {
throw new Meteor.Error("room missing");
}
if (!userId) {
throw new Meteor.Error("user not logged in");
}
if (room.isPrivate && !_.contains(room.invited, userId) && room.ownerId !== userId) {
throw new Meteor.Error("you are not allowed in this room");
}
if (!_.contains(room.users, userId)) {
Rooms.update({_id: room._id}, {$addToSet: {users: userId}});
RoomInvitations.update({invitedUser: userId, roomId:room._id, active:true}, {
$set: {
didAccept: true,
completedTime: new Date(),
active: false
}
},{multi:true});
}
return room._id;
},
'getDirectMessageRoom': function(targetUserId){
check(targetUserId, String);
var users = [targetUserId, Meteor.userId()];
var currentRoom = Rooms.findOne({users:{$all:users}, direct: true});
if(!currentRoom) {
return Rooms.insert({
name: null,
topic: null,
isPrivate: true,
ownerId: null,
invited: users,
users: users,
moderators: users,
direct: true
});
}
return currentRoom._id;
},
'leaveRoom': function (id) {
var room = Rooms.findOne({_id: id});
var userId = Meteor.userId();
if (!room) {
throw new Meteor.Error("Room invalid");
}
if (room.ownerId === userId) {
throw new Meteor.Error("You can't leave a room you own. Sorry bub.");
}
Rooms.update({_id: room._id}, {$pull: {users: userId}});
return room._id;
},
'setCurrentRoom': function (roomId) {
check(roomId, String);
var room = Rooms.findOne({_id: roomId});
if (!room) {
throw new Meteor.Error("Can not find room with id " + roomId);
}
if (!_.contains(room.users, Meteor.userId())) {
Meteor.call('joinRoom', room._id, function (err, id) {
if (err) {
throw new Meteor.Error("User not allowed in to join this room.");
}
});
}
Meteor.users.update({_id: Meteor.userId()}, {$set: {"status.currentRoom": roomId}});
},
'createRoom': function (roomStub) {
check(roomStub, Schemas.createRoom);
var roomName = roomStub.name;
var roomNameRegex = new RegExp("^" + roomName + "$", "i"); // case insensitivity
if (!Schemas.regex.room.test(roomName)) {
throw new Meteor.Error("room name must be alphanumeric");
}
if (Rooms.findOne({name: roomNameRegex})) {
throw new Meteor.Error("room exists");
}
if (!Meteor.userId()) {
throw new Meteor.Error("Must be logged in");
}
Rooms.insert({
name: roomName,
topic: "",
isPrivate: false,
ownerId: Meteor.userId(),
invited: [Meteor.userId()],
users: [Meteor.userId()],
moderators: [Meteor.userId()]
});
},
'kickUserFromRoom': function (targetUserId, targetRoomId) {
check(targetUserId, String);
check(targetRoomId, String);
var targetUser = Meteor.users.findOne(targetUserId);
var room = Rooms.findOne(targetRoomId);
if (!room) {
throw new Meteor.Error("Room could not be found.");
}
if (!targetUser) {
throw new Meteor.Error("User could not be found.");
}
if (room.ownerId !== Meteor.userId() && !_(room.moderators).contains(Meteor.userId())) {
throw new Meteor.Error("You do not have permission to kick in this room.");
}
if (!_(room.users).contains(targetUser._id)) {
throw new Meteor.Error("Room does not contain target user.");
}
if (room.ownerId === targetUser._id) {
throw new Meteor.Error("Can not kick the owner of a room.");
}
Rooms.update({_id: room._id}, {$pull: {users: targetUser._id}});
},
'setRoomPrivacy': function (targetRoomId, isPrivate) {
check(targetRoomId, String);
check(isPrivate, Boolean);
var room = Rooms.findOne(targetRoomId);
var user = Meteor.user();
if (!room) {
throw new Meteor.Error("Room could not be found.");
}
if (room.ownerId !== user._id) {
throw new Meteor.Error("you must be owner");
}
var updateQuery = {$set:{isPrivate: isPrivate}};
if (isPrivate) {
updateQuery.$addToSet = {invited: {$each:room.users}};
}
Rooms.update({_id: room._id}, updateQuery);
}
});
|
JavaScript
| 0 |
@@ -77,25 +77,24 @@
s(%7B%0A
-'
joinRoom
': funct
@@ -81,36 +81,24 @@
joinRoom
-': function
(id) %7B%0A
@@ -999,17 +999,16 @@
%7D,%0A
-'
getDirec
@@ -1019,27 +1019,16 @@
sageRoom
-': function
(targetU
@@ -1580,17 +1580,16 @@
%7D,%0A
-'
leaveRoo
@@ -1589,28 +1589,16 @@
eaveRoom
-': function
(id) %7B%0A
@@ -1997,17 +1997,16 @@
%7D,%0A
-'
setCurre
@@ -2007,36 +2007,24 @@
tCurrentRoom
-': function
(roomId) %7B%0A
@@ -2151,33 +2151,33 @@
ew Meteor.Error(
-%22
+%60
Can not find roo
@@ -2190,18 +2190,18 @@
id
-%22 +
+$%7B
roomId
+%7D%60
);%0A
@@ -2594,17 +2594,16 @@
%7D,%0A
-'
createRo
@@ -2604,28 +2604,16 @@
eateRoom
-': function
(roomStu
@@ -3421,17 +3421,16 @@
%7D,%0A
-'
kickUser
@@ -3437,28 +3437,16 @@
FromRoom
-': function
(targetU
@@ -4402,17 +4402,16 @@
%7D,%0A
-'
setRoomP
@@ -4420,20 +4420,8 @@
vacy
-': function
(tar
|
3f039a3f0dde6549f86bee86c9c4c9bf027f3733
|
remove old peers
|
render.js
|
render.js
|
const dgram = require('dgram')
const os = require('os')
const dragDrop = require('drag-drop')
const client = dgram.createSocket('udp4')
const server = dgram.createSocket('udp4')
const PORT = 4321
const MC = '224.0.0.1'
function send (o) {
const message = Buffer.from(JSON.stringify(o))
client.send(message, 0, message.length, PORT, MC)
}
//
// Advertise a message
//
setInterval(() => {
send({
event: 'join',
name: os.hostname(),
platform: os.platform()
})
console.log('sending')
}, 1500)
const registry = {}
function getPictureData (src, cb) {
const reader = new window.FileReader()
reader.onerror = err => cb(err)
reader.onload = e => cb(null, e.target.result)
reader.readAsDataURL(src)
}
dragDrop('.drop', (files) => {
console.log(files)
})
//
// Create a tcp server
//
function joined (msg, rinfo) {
//
// If the peer is already rendered, just return
//
const selector = `[data-name="${msg.name}"]`
if (document.querySelector(selector)) return
const peers = document.querySelector('#peers')
const peer = document.createElement('div')
peer.className = 'peer'
peer.setAttribute('data-name', msg.name)
peer.setAttribute('data-ip', rinfo.address)
peer.setAttribute('data-platform', msg.platform)
peer.textContent = msg.name
peers.appendChild(peer)
// remove inital empty message when finding peers
const selectorEmptyState = document.querySelector('#empty-message')
selectorEmptyState.parentNode.removeChild(selectorEmptyState)
console.log(msg, rinfo)
}
function parted (msg) {
const selector = `[data-name="${msg.name}"]`
const peer = document.querySelector(selector)
if (peer) peer.parentNode.removeChild(peer)
}
function cleanUp () {
for (var key in registry) {
if (registry[key] && Date.now() - registry[key] > 5e4) {
parted(key)
registry[key] = null
}
}
}
server.on('error', (err) => {
server.close()
})
server.on('message', (msg, rinfo) => {
msg = JSON.parse(msg)
if (!registry[msg.name] && msg.event === 'join') {
joined(msg, rinfo)
}
registry[msg.name] = Date.now()
})
server.on('listening', () => {
console.log(`Listening on ${PORT}`)
})
server.bind(PORT)
setInterval(cleanUp, 5e4)
|
JavaScript
| 0.999183 |
@@ -468,16 +468,39 @@
atform()
+,%0A ctime: Date.now()
%0A %7D)%0A
@@ -1457,16 +1457,40 @@
sage')%0A
+ if (selectorEmptyState)
selecto
@@ -1544,16 +1544,16 @@
yState)%0A
-
%0A conso
@@ -1610,32 +1610,37 @@
nst selector = %60
+.peer
%5Bdata-name=%22$%7Bms
@@ -1795,24 +1795,107 @@
registry) %7B%0A
+ console.log(Date.now() - registry%5Bkey%5D.ctime, Date.now(), registry%5Bkey%5D.ctime)%0A
if (regi
@@ -1907,16 +1907,17 @@
key%5D &&
+(
Date.now
@@ -1938,14 +1938,22 @@
key%5D
- %3E 5e4
+.ctime) %3E 1500
) %7B%0A
@@ -1965,19 +1965,29 @@
parted(
+registry%5B
key
+%5D
)%0A
@@ -2237,26 +2237,19 @@
name%5D =
-Date.now()
+msg
%0A%7D)%0A%0Aser
@@ -2362,9 +2362,10 @@
Up,
-5e4
+1500
)%0A
|
d5e4c7438cd911b486d6f8d546ede45e6dc9c136
|
Remove commented debug statement
|
js/browser/panelManager.js
|
js/browser/panelManager.js
|
jsio('from common.javascript import Singleton, bind, map');
jsio('import common.ItemReference');
jsio('import browser.ItemReferenceView');
jsio('import browser.css as css');
jsio('import browser.events as events');
jsio('import browser.dom as dom');
jsio('import browser.dimensions as dimensions');
jsio('import browser.Animation');
jsio('import browser.UIComponent');
jsio('import browser.panels.ItemPanel');
var logger = logging.getLogger(jsio.__path);
css.loadStyles(jsio.__path);
exports = Singleton(browser.UIComponent, function(supr) {
this.createContent = function() {
this.addClassName('PanelManager');
this._offset = 0;
this._panelsByItem = {};
this._panelsByIndex = [];
this._panelWidth = 300;
this._panelMargin = 30;
this._panelAnimationDuration = 650;
this._panelAnimation = new browser.Animation(bind(this, '_animatePanels'),
this._panelAnimationDuration);
this.__defineSetter__('_focusIndex', function(newFocusIndex){
if (typeof newFocusIndex != 'number') { debugger; }
this.__focusIndex = newFocusIndex;
})
this.__defineGetter__('_focusIndex', function(newFocusIndex){
return this.__focusIndex;
})
}
this.setOffset = function(offset) { this._offset = offset; }
this.showItem = function(item) {
// debugger;
if (this._panelsByItem[item]) {
this.focusPanel(this._panelsByItem[item]);
} else {
this._blurFocusedPanel();
this._focusIndex = this._addPanel(item);
this.focusPanel(this._panelsByIndex[this._focusIndex]);
}
}
this.focus = function() {
this.focusPanel(this._panelsByIndex[this._focusIndex]);
}
this.focusPanel = function(panel) {
if (!panel) { return; }
this._blurFocusedPanel();
this._focusIndex = this._getPanelIndex(panel);
panel.focus();
this._positionPanels();
this._publish('PanelFocused', panel);
}
this._blurFocusedPanel = function() {
if (!this._panelsByIndex[this._focusIndex]) { return; }
this._panelsByIndex[this._focusIndex].blur();
delete this._focusIndex;
}
this.focusPanelIndex = function(index) {
if (!this._panelsByIndex[index]) { return; }
this.focusPanel(this._panelsByIndex[index]);
}
this.focusLastPanel = function() { this.focusPanelIndex(this._panelsByIndex.length - 1); }
this.focusNextPanel = function() {
var nextIndex = this._focusIndex + 1
if (nextIndex == this._panelsByIndex.length) { nextIndex = 0; }
this.focusPanel(this._panelsByIndex[nextIndex]);
}
this.focusPreviousPanel = function() {
var previousIndex = this._focusIndex - 1;
if (previousIndex < 0) { previousIndex = this._panelsByIndex.length - 1 }
this.focusPanel(this._panelsByIndex[previousIndex]);
}
this.hasPanels = function() { return !!this._panelsByIndex.length; }
this.removePanel = function(panel) {
var panelIndex = this._getPanelIndex(panel);
this._panelsByIndex.splice(panelIndex, 1);
delete this._panelsByItem[panel.getItem()];
dom.remove(panel.getElement());
if (panelIndex == this._focusIndex) {
// panelIndex will now refer to panel on the right of removed panel
if (panelIndex > this._panelsByIndex.length) { panelIndex -= 1; }
this.focusPanel(this._panelsByIndex[panelIndex]);
}
this._positionPanels();
}
this.layout = function(size) {
dom.setStyle(this._element, size);
this._positionPanels();
}
this._getPanelIndex = function(panel) {
for (var i=0; i < this._panelsByIndex.length; i++) {
if (panel != this._panelsByIndex[i]) { continue; }
return i;
}
}
this._addPanel = function(item) {
if (this._panelsByItem[item]) { return this._panelsByItem[item]; }
var panel = new browser.panels.ItemPanel(this, item);
panel.isNew = true;
var middleIndex = Math.floor(this._panelsByIndex.length / 2);
var delayShow = this.hasPanels();
this._panelsByIndex.splice(middleIndex, 0, panel);
this._panelsByItem[item] = panel;
if (delayShow) {
panel.hide();
setTimeout(bind(panel, 'show'), this._panelAnimationDuration);
}
return middleIndex;
}
this._positionPanels = function() {
if (!this._panelsByIndex.length) { return; }
var managerSize = dimensions.getDimensions(this._element);
// debugger;
var centerPanel = this._panelsByIndex[this._focusIndex];
var centerPanelOffset = Math.max(this._offset, managerSize.width / 2 - this._panelWidth / 2);
this._layoutPanel(centerPanel, centerPanelOffset, managerSize, centerPanel.isNew);
delete centerPanel.isNew;
this._layoutPanels(1, centerPanelOffset + this._panelWidth + this._panelMargin, managerSize);
this._layoutPanels(-1, centerPanelOffset - this._panelWidth - this._panelMargin, managerSize);
this._panelAnimation.animate();
}
this._layoutPanels = function(direction, offset, managerSize) {
// var stackedPanelWidth = 23;
// var panelLabelWidth = stackedPanelWidth + 4;
// var remainingWidth =
// var stackPanels = false;
var startIndex = this._focusIndex + direction;
for (var i = startIndex, panel; panel = this._panelsByIndex[i]; i += direction) {
this._layoutPanel(panel, offset, managerSize);
offset += (this._panelWidth + this._panelMargin) * direction;
// var remainingPanels = numPanels - i - 1;
// if (offset + panelWidth + panelLabelWidth + (remainingPanels * stackedPanelWidth) > managerSize.width) {
// stackPanels = true;
// }
// if (stackPanels) {
// var fromRight = remainingPanels * stackedPanelWidth;
// panel.targetOffset = managerSize.width - panelWidth - panelLabelWidth - fromRight;
// } else {
// }
}
}
this._layoutPanel = function(panel, targetOffset, managerSize, snapToPosition) {
panel.prependTo(this._element);
panel.currentOffset = snapToPosition ? targetOffset : panel.getDimensions().left - managerSize.left;
panel.targetOffset = targetOffset;
panel.layout({ width: this._panelWidth, height: managerSize.height });
}
this._animatePanels = function(n) {
for (var i=0, panel; panel = this._panelsByIndex[i]; i++) {
var diff = panel.targetOffset - panel.currentOffset;
panel.layout({ left: panel.currentOffset + (diff * n) });
}
}
})
|
JavaScript
| 0 |
@@ -4132,31 +4132,16 @@
ment);%0A%0A
-%09%09// debugger;%0A
%09%09var ce
|
c2f1aa87af65cf209d16ede7b7d07bd77111537e
|
Remove extra function argument
|
render.js
|
render.js
|
module.exports = render
var diff = require('./')
var get = require('keyarray-get')
var splitStrings = require('./split-strings')
var splitWords= require('./split-words')
var treeify = require('./treeify-patch')
function render(a, b) {
var editTree = treeify(diff(a, b, splitStrings))
return renderForm([ ], a, editTree.content) }
function renderForm(path, form, editTree) {
var original = form.content.reduce(
function(returned, element, index) {
if (typeof element === 'string') {
returned.push(renderText(element))
return returned }
else if (element.hasOwnProperty('form')) {
var childPath = path.concat(index)
var childEditTree = get(editTree, childPath, [ ])
return returned.concat(
renderForm(childPath, element, childEditTree)) }
else {
return returned.concat(element) } },
[ ])
var editsHere = get(
editTree,
path.concat('edits'),
[ ])
return editsHere
.reduce(
function(returned, element) {
var op = element.op
var path = element.path
var contentElementIndex = getNth(returned, path[0], true)
var contentElement = returned[contentElementIndex]
var splitIndex
if (op === 'remove') {
if (path.length === 2) {
getNth(contentElement.splits, path[1]).del = true }
else {
contentElement.del = true } }
else if (op === 'add') {
if (path.length === 2) {
splitIndex = getNth(contentElement.splits, path[1], true)
contentElement.splits.splice(
splitIndex, 0,
{ text: element.value, ins: true }) }
else {
if (element.value.hasOwnProperty('splits')) {
var rendered = renderSplits(element.value.splits)
rendered.ins = true
returned.splice(contentElementIndex, 0, rendered) }
else {
element.value.ins = true
returned.splice(contentElementIndex, 0, element.value) } } }
else if (op === 'replace') {
if (path.length === 2) {
splitIndex = getNth(contentElement.splits, path[1], true)
var split = contentElement.splits[splitIndex]
split.del = true
contentElement.splits.splice(
splitIndex, 0, { text: element.value, ins: true }) }
else {
element.value.ins = true
contentElement.del = true
returned.splice(contentElementIndex, 0, element.value) } }
return original },
original) }
function renderText(text, edits) {
return renderSplits(splitWords(text)) }
function renderSplits(splits) {
return {
splits: splits.map(function(split) {
return { text: split } }) } }
function getNth(elements, target, returnIndex) {
var length = elements.length
var count = 0
for (var index = 0; index < length; index++) {
var element = elements[index]
if (!element.hasOwnProperty('del')) {
if (count === target) {
return ( returnIndex ? index : element ) }
count++ } }
return ( index + 1 ) }
|
JavaScript
| 0.000024 |
@@ -2617,15 +2617,8 @@
text
-, edits
) %7B%0A
|
f2a03601945bcdd23a3c7a196f9254e5545bf736
|
Put new panels to the left of the currently focused panel
|
js/browser/panelManager.js
|
js/browser/panelManager.js
|
jsio('from common.javascript import Singleton, bind, map');
jsio('import common.ItemReference');
jsio('import browser.ItemReferenceView');
jsio('import browser.css as css');
jsio('import browser.events as events');
jsio('import browser.dom as dom');
jsio('import browser.dimensions as dimensions');
jsio('import browser.Animation');
jsio('import browser.UIComponent');
jsio('import browser.panels.ItemPanel');
var logger = logging.getLogger(jsio.__path);
css.loadStyles(jsio.__path);
exports = Singleton(browser.UIComponent, function(supr) {
this.createContent = function() {
this.addClassName('PanelManager');
this._focusIndex = 0;
this._offset = 0;
this._panelsByItem = {};
this._panelsByIndex = [];
this._panelWidth = 300;
this._panelMargin = 30;
this._panelAnimationDuration = 650;
this._panelAnimation = new browser.Animation(bind(this, '_animatePanels'),
this._panelAnimationDuration);
}
this.setOffset = function(offset) { this._offset = offset; }
this.showItem = function(item) {
if (this._panelsByItem[item]) {
this.focusPanel(this._panelsByItem[item]);
} else {
this._blurFocusedPanel();
this._addPanel(item);
this.focusPanel(this._panelsByIndex[this._focusIndex]);
}
}
this.focus = function() {
this.focusPanel(this._panelsByIndex[this._focusIndex]);
}
this.focusPanel = function(panel) {
if (!panel) { return; }
this._blurFocusedPanel();
this._focusIndex = this._getPanelIndex(panel);
panel.focus();
this._positionPanels();
this._publish('PanelFocused', panel);
}
this._blurFocusedPanel = function() {
if (!this._panelsByIndex[this._focusIndex]) { return; }
this._panelsByIndex[this._focusIndex].blur();
}
this.focusPanelIndex = function(index) {
if (!this._panelsByIndex[index]) { return; }
this.focusPanel(this._panelsByIndex[index]);
}
this.focusLastPanel = function() { this.focusPanelIndex(this._panelsByIndex.length - 1); }
this.focusNextPanel = function() {
var nextIndex = this._focusIndex + 1
if (nextIndex == this._panelsByIndex.length) { nextIndex = 0; }
this.focusPanel(this._panelsByIndex[nextIndex]);
}
this.focusPreviousPanel = function() {
var previousIndex = this._focusIndex - 1;
if (previousIndex < 0) { previousIndex = this._panelsByIndex.length - 1 }
this.focusPanel(this._panelsByIndex[previousIndex]);
}
this.hasPanels = function() { return !!this._panelsByIndex.length; }
this.removePanel = function(panel) {
var panelIndex = this._getPanelIndex(panel);
this._panelsByIndex.splice(panelIndex, 1);
delete this._panelsByItem[panel.getItem()];
dom.remove(panel.getElement());
if (panelIndex == this._focusIndex) {
// panelIndex will now refer to panel on the right of removed panel
if (panelIndex >= this._panelsByIndex.length) { panelIndex -= 1; }
this.focusPanel(this._panelsByIndex[panelIndex]);
}
this._positionPanels();
}
this.layout = function(size) {
dom.setStyle(this._element, size);
this._positionPanels();
}
this._getPanelIndex = function(panel) {
for (var i=0; i < this._panelsByIndex.length; i++) {
if (panel != this._panelsByIndex[i]) { continue; }
return i;
}
}
this._addPanel = function(item) {
if (this._panelsByItem[item]) { return this._panelsByItem[item]; }
var panel = new browser.panels.ItemPanel(this, item);
panel.isNew = true;
var middleIndex = Math.floor(this._panelsByIndex.length / 2);
var delayShow = this.hasPanels();
this._panelsByIndex.splice(middleIndex, 0, panel);
this._panelsByItem[item] = panel;
if (delayShow) {
panel.hide();
setTimeout(bind(panel, 'show'), this._panelAnimationDuration);
}
return middleIndex;
}
this._positionPanels = function() {
if (!this._panelsByIndex.length) { return; }
var managerSize = dimensions.getDimensions(this._element);
var centerPanel = this._panelsByIndex[this._focusIndex];
var centerPanelOffset = Math.max(this._offset, managerSize.width / 2 - this._panelWidth / 2);
this._layoutPanel(centerPanel, centerPanelOffset, managerSize, centerPanel.isNew);
delete centerPanel.isNew;
this._layoutPanels(1, centerPanelOffset + this._panelWidth + this._panelMargin, managerSize);
this._layoutPanels(-1, centerPanelOffset - this._panelWidth - this._panelMargin, managerSize);
this._panelAnimation.animate();
}
this._layoutPanels = function(direction, offset, managerSize) {
// var stackedPanelWidth = 23;
// var panelLabelWidth = stackedPanelWidth + 4;
// var remainingWidth =
// var stackPanels = false;
var startIndex = this._focusIndex + direction;
for (var i = startIndex, panel; panel = this._panelsByIndex[i]; i += direction) {
this._layoutPanel(panel, offset, managerSize);
offset += (this._panelWidth + this._panelMargin) * direction;
// var remainingPanels = numPanels - i - 1;
// if (offset + panelWidth + panelLabelWidth + (remainingPanels * stackedPanelWidth) > managerSize.width) {
// stackPanels = true;
// }
// if (stackPanels) {
// var fromRight = remainingPanels * stackedPanelWidth;
// panel.targetOffset = managerSize.width - panelWidth - panelLabelWidth - fromRight;
// } else {
// }
}
}
this._layoutPanel = function(panel, targetOffset, managerSize, snapToPosition) {
panel.prependTo(this._element);
panel.currentOffset = snapToPosition ? targetOffset : panel.getDimensions().left - managerSize.left;
panel.targetOffset = targetOffset;
panel.layout({ width: this._panelWidth, height: managerSize.height });
}
this._animatePanels = function(n) {
for (var i=0, panel; panel = this._panelsByIndex[i]; i++) {
var diff = panel.targetOffset - panel.currentOffset;
panel.layout({ left: panel.currentOffset + (diff * n) });
}
}
})
|
JavaScript
| 0 |
@@ -3366,72 +3366,8 @@
ue;%0A
-%09%09var middleIndex = Math.floor(this._panelsByIndex.length / 2);%0A
%09%09va
@@ -3427,22 +3427,27 @@
.splice(
-middle
+this._focus
Index, 0
@@ -3602,33 +3602,8 @@
%09%09%7D%0A
-%09%09%0A%09%09return middleIndex;%0A
%09%7D%0A%09
|
822c5e6fc4a380f2fff555623dbed26d5bd53e5c
|
enforce CLI upgrade
|
ionic.config.js
|
ionic.config.js
|
// Ionic CLI is no longer responsible for building your web assets, and now
// relies on gulp hooks instead. This file was used for exposing web build
// configuration and is no longer necessary.
// If this file is executed when running ionic commands, then an update to the
// CLI is needed.
//
// If your version of the Ionic CLI is beta.21 or greater, you can delete this file.
console.log('\nFrom ionic.config.js:');
console.log('\nPlease update your version of the Ionic CLI:');
console.log(' npm install -g ionic@beta\n');
|
JavaScript
| 0.000007 |
@@ -521,12 +521,29 @@
c@beta%5Cn');%0A
+process.exit(1);%0A
|
5e53d57b091162ff77b694b62a40f5a073aed8c2
|
Fix case-sensitive issue with Yandex search engine provider (was causing a test case failure)
|
js/data/searchProviders.js
|
js/data/searchProviders.js
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = { "providers" :
[
{
"name" : "Amazon",
"base" : "https://www.amazon.com",
"image" : "https://www.amazon.com/favicon.ico",
"search" : "https://www.amazon.com/exec/obidos/external-search/?field-keywords={searchTerms}&mode=blended",
"autocomplete" : "https://completion.amazon.com/search/complete?method=completion&q={searchTerms}&search-alias=aps&client=amazon-search-ui&mkt=1",
"shortcut" : ":a"
},
{
"name" : "Bing",
"base" : "https://www.bing.com",
"image" : "https://www.bing.com/favicon.ico",
"search" : "https://www.bing.com/search?q={searchTerms}",
"autocomplete" : "https://api.bing.com/osjson.aspx?query={searchTerms}&language={language}&form=OSDJAS",
"shortcut" : ":b"
},
{
"name" : "DuckDuckGo",
"base" : "https://duckduckgo.com",
"image" : "https://duckduckgo.com/favicon.ico",
"search" : "https://duckduckgo.com/?q={searchTerms}&t=brave",
"autocomplete" : "https://ac.duckduckgo.com/ac/?q={searchTerms}&type=list",
"shortcut" : ":d"
},
{
"name" : "GitHub",
"base" : "https://github.com/search",
"image" : "https://assets-cdn.github.com/favicon.ico",
"search" : "https://github.com/search?q={searchTerms}",
"shortcut" : ":gh"
},
{
"name" : "Google",
"base" : "https://www.google.com",
"image" : "https://www.google.com/favicon.ico",
"search" : "https://www.google.com/search?q={searchTerms}",
"autocomplete" : "https://suggestqueries.google.com/complete/search?client=chrome&q={searchTerms}",
"shortcut" : ":g"
},
{
"name" : "Stack Overflow",
"base" : "https://stackoverflow.com/search",
"image" : "https://cdn.sstatic.net/sites/stackoverflow/img/favicon.ico",
"search" : "https://stackoverflow.com/search?q={searchTerms}",
"shortcut" : ":s"
},
{
"name" : "Mozilla Developer Network (MDN)",
"base": "https://developer.mozilla.org/search",
"image" : "https://developer.cdn.mozilla.net/static/img/favicon32.png",
"search" : "https://developer.mozilla.org/search?q={searchTerms}",
"shortcut" : ":m"
},
{
"name" : "Twitter",
"base" : "https://twitter.com",
"image" : "https://twitter.com/favicon.ico",
"search" : "https://twitter.com/search?q={searchTerms}&source=desktop-search",
"shortcut" : ":t"
},
{
"name" : "Wikipedia",
"base" : "https://en.wikipedia.org",
"image" : "https://en.wikipedia.org/favicon.ico",
"search" : "https://en.wikipedia.org/wiki/Special:Search?search={searchTerms}",
"shortcut" : ":w"
},
{
"name" : "Yahoo",
"base" : "https://search.yahoo.com",
"image" : "https://search.yahoo.com/favicon.ico",
"search" : "https://search.yahoo.com/search?p={searchTerms}&fr=opensearch",
"autocomplete": "https://search.yahoo.com/sugg/os?command={searchTerms}&output=fxjson&fr=opensearch",
"shortcut" : ":y"
},
{
"name" : "Youtube",
"base" : "https://www.youtube.com",
"image" : "https://www.youtube.com/favicon.ico",
"search" : "https://www.youtube.com/results?search_type=search_videos&search_query={searchTerms}&search_sort=relevance&search_category=0&page=",
"autocomplete": "https://suggestqueries.google.com/complete/search?output=chrome&client=chrome&hl=it&q={searchTerms}&ds=yt",
"shortcut" : ":yt"
},
{
"name" : "StartPage",
"base" : "https://www.startpage.com",
"image" : "https://www.startpage.com/graphics/favicon/sp-favicon-16x16.png",
"search" : "https://www.startpage.com/do/dsearch?query={searchTerms}&cat=web&pl=opensearch",
"autocomplete": "https://www.startpage.com/cgi-bin/csuggest?query={searchTerms}&limit=10&format=json",
"shortcut" : ":sp"
},
{
"name" : "Infogalactic",
"base" : "https://infogalactic.com",
"image" : "https://infogalactic.com/favicon.ico",
"search" : "https://infogalactic.com/w/index.php?title=Special:Search&search={searchTerms}",
"autocomplete": "https://infogalactic.com/w/api.php?action=opensearch&search={searchTerms}&namespace=0",
"shortcut" : ":i"
},
{
"name" : "Wolfram Alpha",
"base" : "https://www.wolframalpha.com",
"image" : "https://www.wolframalpha.com/favicon.ico?v=2",
"search" : "https://www.wolframalpha.com/input/?i={searchTerms}",
"shortcut" : ":wa"
},
{
"name" : "Semantic Scholar",
"base" : "https://www.semanticscholar.org",
"image" : "https://www.semanticscholar.org/img/favicon.png",
"search" : "https://www.semanticscholar.org/search?q={searchTerms}",
"shortcut" : ":ss"
},
{
"name" : "Qwant",
"base" : "https://www.qwant.com/",
"image" : "https://www.qwant.com/favicon.ico",
"search" : "https://www.qwant.com/?q={searchTerms}&client=brave",
"autocomplete": "https://api.qwant.com/api/suggest/?q={searchTerms}&client=brave",
"shortcut" : ":q"
},
{
"name" : "Yandex",
"base" : "https://yandex.com",
"image" : "https://yastatic.net/islands-icons/_/6jyHGXR8-HAc8oJ1bU8qMUQQz_g.ico",
"search" : "https://yandex.com/search/?text={searchTerms}&clid={platformClientId}",
"shortcut" : ":ya",
"platformClientId": {
"win32": 2274777,
"darwin": 2274776,
"linux": 2274778
}
}
]
}
|
JavaScript
| 0.000055 |
@@ -5438,29 +5438,29 @@
/6jy
-HGXR8-HAc8oJ1bU8qMUQQ
+hgxr8-hac8oj1bu8qmuqq
z_g.
|
ffae67dc997076640d1d7914f160736e998b4535
|
Remove dead comments from commandsModule
|
extensions/ohif-cornerstone-extension/src/commandsModule.js
|
extensions/ohif-cornerstone-extension/src/commandsModule.js
|
import cornerstone from 'cornerstone-core';
import cornerstoneTools from 'cornerstone-tools';
// TODO: Just emit the tool's name?
// TODO: Let local context handle the active tool propogation to redux?
// import { redux } from 'ohif-core';
// import store from './../store/';
// const { setToolActive } = redux.actions;
const actions = {
rotateViewport: ({ viewports, rotation }) => {
const enabledElement = _getActiveViewportEnabledElement(
viewports.viewportSpecificData,
viewports.activeViewportIndex
);
if (enabledElement) {
let viewport = cornerstone.getViewport(enabledElement);
viewport.rotation += rotation;
cornerstone.setViewport(enabledElement, viewport);
}
},
flipViewportHorizontal: ({ viewports }) => {
const enabledElement = _getActiveViewportEnabledElement(
viewports.viewportSpecificData,
viewports.activeViewportIndex
);
if (enabledElement) {
let viewport = cornerstone.getViewport(enabledElement);
viewport.hflip = !viewport.hflip;
cornerstone.setViewport(enabledElement, viewport);
}
},
flipViewportVertical: ({ viewports }) => {
const enabledElement = _getActiveViewportEnabledElement(
viewports.viewportSpecificData,
viewports.activeViewportIndex
);
if (enabledElement) {
let viewport = cornerstone.getViewport(enabledElement);
viewport.vflip = !viewport.vflip;
cornerstone.setViewport(enabledElement, viewport);
}
},
scaleViewport: ({ viewports, direction }) => {
const enabledElement = _getActiveViewportEnabledElement(
viewports.viewportSpecificData,
viewports.activeViewportIndex
);
const step = direction * 0.15;
if (enabledElement) {
if (step) {
let viewport = cornerstone.getViewport(enabledElement);
viewport.scale += step;
cornerstone.setViewport(enabledElement, viewport);
} else {
cornerstone.fitToWindow(enabledElement);
}
}
},
resetViewport: ({ viewports }) => {
const enabledElement = _getActiveViewportEnabledElement(
viewports.viewportSpecificData,
viewports.activeViewportIndex
);
if (enabledElement) {
cornerstone.reset(enabledElement);
}
},
invertViewport: ({ viewports }) => {
const enabledElement = _getActiveViewportEnabledElement(
viewports.viewportSpecificData,
viewports.activeViewportIndex
);
if (enabledElement) {
let viewport = cornerstone.getViewport(enabledElement);
viewport.invert = !viewport.invert;
cornerstone.setViewport(enabledElement, viewport);
}
},
// This has a weird hard dependency on the tools that are available as toolbar
// buttons. You can see this in `ohif-core/src/redux/reducers/tools.js`
// the `toolName` needs to equal the button's `command` property.
// NOTE: It would be nice if `hotkeys` could set this, instead of creating a command per tool
setCornerstoneToolActive: ({ toolName }) => {
console.warn(toolName);
cornerstoneTools.setToolActive(toolName, { mouseButtonMask: 1 });
// store.dispatch(setToolActive(toolName));
},
updateViewportDisplaySet: ({ direction }) => {
// TODO
console.warn('updateDisplaySet: ', direction);
},
clearAnnotations: () => {
console.warn('clearAnnotations: not yet implemented');
// const toolState =
// cornerstoneTools.globalImageIdSpecificToolStateManager.toolState;
// if (!toolState) return;
// Object.keys(toolState).forEach(imageId => {
// if (!cornerstoneImageId || cornerstoneImageId === imageId)
// delete toolState[imageId];
// });
}
};
const definitions = {
rotateViewportCW: {
commandFn: actions.rotateViewport,
storeContexts: ['viewports'],
options: { rotation: 90 }
},
rotateViewportCCW: {
commandFn: actions.rotateViewport,
storeContexts: ['viewports'],
options: { rotation: -90 }
},
invertViewport: {
commandFn: actions.invertViewport,
storeContexts: ['viewports'],
options: {}
},
flipViewportVertical: {
commandFn: actions.flipViewportVertical,
storeContexts: ['viewports'],
options: {}
},
flipViewportHorizontal: {
commandFn: actions.flipViewportHorizontal,
storeContexts: ['viewports'],
options: {}
},
scaleUpViewport: {
keys: '',
commandFn: actions.scaleViewport,
storeContexts: ['viewports'],
options: { direction: 1 }
},
scaleDownViewport: {
keys: '',
commandFn: actions.scaleViewport,
storeContexts: ['viewports'],
options: { direction: -1 }
},
fitViewportToWindow: {
commandFn: actions.scaleViewport,
storeContexts: ['viewports'],
options: { direction: 0 }
},
resetViewport: {
commandFn: actions.resetViewport,
storeContexts: ['viewports'],
options: {}
},
// TODO: Clear Annotations
// TODO: Next/Previous image
// TODO: First/Last image
// Next/Previous series/DisplaySet
nextViewportDisplaySet: {
commandFn: actions.updateViewportDisplaySet,
storeContexts: [],
options: { direction: 1 }
},
previousViewportDisplaySet: {
commandFn: actions.updateViewportDisplaySet,
storeContexts: [],
options: { direction: -1 }
},
// TOOLS
setZoomTool: {
commandFn: actions.setCornerstoneToolActive,
storeContexts: [],
options: { toolName: 'Zoom' }
},
setToolActive: {
commandFn: actions.setCornerstoneToolActive,
storeContexts: [],
options: {}
}
};
/**
* Grabs `dom` reference for the enabledElement of
* the active viewport
*/
function _getActiveViewportEnabledElement(viewports, activeIndex) {
const activeViewport = viewports[activeIndex] || {};
return activeViewport.dom;
}
export default {
actions,
definitions
};
|
JavaScript
| 0 |
@@ -92,237 +92,8 @@
';%0A%0A
-// TODO: Just emit the tool's name?%0A// TODO: Let local context handle the active tool propogation to redux?%0A%0A// import %7B redux %7D from 'ohif-core';%0A// import store from './../store/';%0A%0A// const %7B setToolActive %7D = redux.actions;%0A%0A
cons
@@ -2419,337 +2419,125 @@
// T
-his has a weird hard dependency on the tools that are available as toolbar%0A // buttons. You can see this in %60ohif-core/src/redux/reducers/tools.js%60%0A // the %60toolName%60 needs to equal the button's %60command%60 property.%0A // NOTE: It would be nice if %60hotkeys%60 could set this, instead of creating a command per tool%0A setCornerstone
+ODO: this is receiving %60evt%60 from %60ToolbarRow%60. We could use it to have%0A // better mouseButtonMask sets.%0A set
Tool
@@ -2556,32 +2556,55 @@
oolName %7D) =%3E %7B%0A
+ if (!toolName) %7B%0A
console.warn
@@ -2608,18 +2608,63 @@
arn(
+'No
tool
-Name);
+name provided to setToolActive command');%0A %7D
%0A
@@ -2734,56 +2734,8 @@
%7D);%0A
- // store.dispatch(setToolActive(toolName));%0A
%7D,
@@ -4846,136 +4846,8 @@
OLS%0A
- setZoomTool: %7B%0A commandFn: actions.setCornerstoneToolActive,%0A storeContexts: %5B%5D,%0A options: %7B toolName: 'Zoom' %7D%0A %7D,%0A
se
@@ -4891,19 +4891,8 @@
.set
-Cornerstone
Tool
|
767fe1d699731dea7a0a8cdf4a9d82288b84703d
|
Revert "Set show to avoid falsy value"
|
NavigationReact/sample/native/web/SceneNavigator.js
|
NavigationReact/sample/native/web/SceneNavigator.js
|
import {Motion} from 'react-motion';
import React, {Component} from 'react';
class SceneNavigator extends Component{
constructor(props) {
super(props);
var {state, data, url} = props.stateNavigator.stateContext;
this.state = {scenes: {[url]: state.renderScene(data)}};
}
componentDidMount() {
var {stateNavigator} = this.props;
stateNavigator.onNavigate((oldState, state, data, asyncData) => {
this.setState((prevState) => {
var {url, crumbs} = stateNavigator.stateContext;
var scenes = {[url]: state.renderScene(data, asyncData)};
for(var i = 0; i < crumbs.length; i++) {
scenes[crumbs[i].url] = prevState.scenes[crumbs[i].url];
}
return {scenes};
});
});
}
render() {
var {oldState, state, data, url, crumbs} = this.props.stateNavigator.stateContext;
var {getDefaultStyle, getStyle, interpolateStyle} = this.props;
var scenes = crumbs.map(crumb => ({...crumb, show: false}))
.concat({state, data, url, show: true})
.map(({state, data, url, show}) =>
<Motion key={url} defaultStyle={getDefaultStyle(state, data)}
style={getStyle(show, state, data)}>
{(interpolatingStyle) =>
<div style={interpolateStyle(interpolatingStyle, show, state, data)}>
{this.state.scenes[url]}
</div>
}
</Motion>);
return <div>{scenes}</div>;
}
}
export default SceneNavigator;
|
JavaScript
| 0 |
@@ -1051,61 +1051,8 @@
umbs
-.map(crumb =%3E (%7B...crumb, show: false%7D))%0A
.con
@@ -1248,16 +1248,18 @@
etStyle(
+!!
show, st
@@ -1390,16 +1390,18 @@
gStyle,
+!!
show, st
|
9bbc9585a82a1daced7b58c4ad5ebd574c176853
|
revert to master TL.Media.Wistia.js
|
source/js/media/types/TL.Media.Wistia.js
|
source/js/media/types/TL.Media.Wistia.js
|
/* TL.Media.Wistia
Produces Wistia Display
================================================== */
TL.Media.Wista = TL.Media.extend({
includes: [TL.Events],
/* Load the media
================================================== */
_loadMedia: function() {
var api_url,
self = this;
// Create Dom element
this._el.content_item = TL.Dom.create("div", "tl-media-item tl-media-iframe tl-media-wistia tl-media-shadow", this._el.content);
// Get Media ID
this.media_id = this.data.url.split(/video\/|\/\/vimeo\.com\//)[1].split(/[?&]/)[0];
// API URL
api_url = "https://player.vimeo.com/video/" + this.media_id + "?api=1&title=0&byline=0&portrait=0&color=ffffff";
this.player = TL.Dom.create("iframe", "", this._el.content_item);
// Media Loaded Event
this.player.addEventListener('load', function(e) {
self.onMediaLoaded();
});
this.player.width = "100%";
this.player.height = "100%";
this.player.frameBorder = "0";
this.player.src = api_url;
this.player.setAttribute('allowfullscreen', '');
this.player.setAttribute('webkitallowfullscreen', '');
this.player.setAttribute('mozallowfullscreen', '');
// After Loaded
this.onLoaded();
},
// Update Media Display
_updateMediaDisplay: function() {
this._el.content_item.style.height = TL.Util.ratio.r16_9({w:this._el.content_item.offsetWidth}) + "px";
},
_stopMedia: function() {
try {
this.player.contentWindow.postMessage(JSON.stringify({method: "pause"}), "https://player.vimeo.com");
}
catch(err) {
trace(err);
}
}
});
|
JavaScript
| 0 |
@@ -16,33 +16,8 @@
tia%0A
-%09Produces Wistia Display%0A
====
@@ -80,16 +80,17 @@
dia.Wist
+i
a = TL.M
@@ -103,17 +103,16 @@
xtend(%7B%0A
-%09
%0A%09includ
@@ -128,17 +128,16 @@
vents%5D,%0A
-%09
%0A%09/*%09Loa
@@ -478,53 +478,62 @@
it(/
-video
+https?:
%5C/
-%7C
%5C/
-%5C/vimeo%5C.com%5C//)%5B1%5D.split(/%5B?&%5D/)%5B0
+(.+)?(wistia%5C.com%7Cwi%5C.st)%5C/medias%5C/(.*)/)%5B3
%5D;%0A%0A
@@ -566,121 +566,126 @@
http
-s
://
-player.vimeo.com/video/%22 + this.media_id + %22?api=1&title=0&byline=0&portrait=0&color=ffffff%22;%0A%0A%09%09
+fast.wistia.com/embed/iframe/%22 + this.media_id + %22?version=v1&controlsVisibleOnLoad=true&playerColor=aae3d8%22;%0A%0A
this
@@ -747,18 +747,20 @@
item);%0A%0A
-%09%09
+
// Media
@@ -1359,17 +1359,16 @@
+ %22px%22;%0A
-%0A
%09%7D,%0A%0A%09_s
@@ -1390,17 +1390,16 @@
ion() %7B%0A
-%0A
%09%09try %7B%0A
@@ -1541,16 +1541,15 @@
r);%0A%09%09%7D%0A
-%0A
%09%7D%0A%7D);%0A
|
6ebadf36929856521f3bf35e6a5ccbd7ba33342f
|
better error printing
|
archives/index.js
|
archives/index.js
|
'use strict';
var moment = require('moment-timezone'),
request = require('request');
function getBranchName() {
if (process.env.NODE_ENV === 'production') {
return 'master'
} else {
return 'staging'
}
}
function getFilename(type) {
var prefix = '';
if (type === 'events') {
prefix = 'events/events/v1';
} else {
prefix = 'repos/repos/v1';
}
return prefix + '_archive_' + moment().format('YYYY_MM_DD_HHmmss') + '.json';
}
function getCommitMessage(type) {
return 'data: ' + type + ' archive on ' + moment().format('DD MMM YYYY h:mm a');
}
function storeToArchives(type, callback) {
var url = 'https://webuild.sg/api/v1/' + type;
request(url, function(err, msg, response) {
if (err) {
console.error('We Build SG API reading Error:');
console.log(err);
console.log(msg);
callback(err);
}
var filename = getFilename(type),
uri = 'https://api.github.com/repos/webuildsg/archives/contents/' + filename,
token = new Buffer(process.env.BOT_TOKEN.toString()).toString('base64'),
content = new Buffer(response).toString('base64'),
body = {
'message': getCommitMessage(type),
'committer': {
'name': 'We Build SG Bot',
'email': '[email protected]'
},
'content': content,
'branch': getBranchName(type)
}
request({
method: 'PUT',
uri: uri,
headers: {
'Accept': 'application/vnd.github.v3+json',
'Content-Type': 'application/json',
'User-Agent': 'We Build SG Archives',
'Authorization': 'Basic ' + token
},
body: JSON.stringify(body)
},
function(error) {
if (error) {
return console.error('upload failed:', error);
}
callback('Uploaded ' + filename + ' to Github webuildsg/archives/' + type + ' in branch ' + getBranchName(type));
})
});
}
function update(callback) {
var count = 0;
storeToArchives('repos', function(message) {
console.log(message);
count++;
if (count > 1) {
callback(null);
}
})
storeToArchives('events', function(message) {
console.log(message);
count++;
if (count > 1) {
callback(null);
}
})
}
exports.getBranchName = getBranchName;
exports.getFilename = getFilename;
exports.getCommitMessage = getCommitMessage;
exports.storeToArchives = storeToArchives;
exports.update = update;
|
JavaScript
| 0.998587 |
@@ -1672,24 +1672,34 @@
nction(error
+, response
) %7B%0A if
@@ -1721,53 +1721,49 @@
-return console.error('upload failed:', error)
+callback(error, response);%0A return
;%0A
@@ -1768,31 +1768,35 @@
%7D%0A
+%0A
-callback(
+var reply =
'Uploade
@@ -1889,19 +1889,48 @@
me(type)
+;%0A callback(null, reply
);%0A
+%0A
%7D)%0A
@@ -1985,119 +1985,109 @@
= 0
-;%0A%0A storeToArchives('repos', function(message) %7B%0A console.log(message);%0A count++;%0A%0A if (count %3E 1) %7B%0A
+,%0A registerCallback = function(error, reply) %7B%0A if (error) %7B%0A console.error(reply);%0A
@@ -2101,79 +2101,47 @@
ack(
-null
+error
);%0A
-%7D%0A %7D)%0A%0A storeToArchives('events', function(message) %7B%0A
+ return;%0A %7D%0A%0A
+
cons
@@ -2152,22 +2152,22 @@
log(
-message
+reply
);%0A
+
coun
@@ -2172,16 +2172,18 @@
unt++;%0A%0A
+
if (
@@ -2197,24 +2197,26 @@
1) %7B%0A
+
callback(nul
@@ -2223,16 +2223,18 @@
l);%0A
+
%7D%0A
%7D)%0A%7D
@@ -2229,17 +2229,111 @@
%7D%0A
-%7D
+ %7D%0A%0A storeToArchives('repos', registerCallback);%0A storeToArchives('events', registerCallback
)%0A%7D%0A%0Aexp
|
edd648146bc11d6a05c631c081bced3e17f13f3f
|
Update setstatus.js
|
commands/setstatus.js
|
commands/setstatus.js
|
const Discord = require('discord.js')
const config = require('../config.json')
exports.run = (client, message, args) => {
let embed = new Discord.RichEmbed()
.setAuthor(message.guild, client.user.displayAvatarURL')
.setDescription('**This command sets the status of the bot.**')
.setFooter(`This message has been sent from the ${message.guild} server.`)
.setColor('#f00000')
.addField('')
if(message.author.id !== config.ownerID) return;
message.channel.send(embed)
}
|
JavaScript
| 0.000002 |
@@ -214,17 +214,16 @@
vatarURL
-'
)%0A .set
|
bb815c1e1f153a2c4828a7ec2fbee71ed4ca1afa
|
Add drilldown JS events
|
js/foundation.drilldown.js
|
js/foundation.drilldown.js
|
!function(Foundation, $) {
'use strict';
/**
* Creates a new instance of Drilldown.
* @class
* @fires Drilldown#init
* @param {jQuery} element - jQuery object to make into a drilldown menu.
* @param {Object} options - Overrides to the default plugin settings.
*/
function Drilldown(element, options) {
this.$element = element;
this.options = $.extend(this.defaults, options || {});
console.log(this.defaults);
this.$container = $();
this.$currentMenu = this.$element;
this._init();
/**
* Fires when the plugin has been successfuly initialized.
* @event Drilldown#init
*/
this.$element.trigger('init.zf.drilldown');
}
Drilldown.prototype.defaults = {
backButton: '<li><a class="js-drilldown-back">Back</a></li>'
}
/**
* Initializes the Drilldown by creating a container to wrap the menu bar in, and initializing all submenus.
* @private
*/
Drilldown.prototype._init = function() {
this.$container = $('<div class="js-drilldown"></div>');
this.$container.css('width', this.$element.css('width'));
this.$element.wrap(this.$container);
this._prepareMenu(this.$element, true);
}
/**
* Scans a menu bar for any sub menu bars inside of it. This is a recursive function, so when a sub menu is found, this method will be called on that sub menu.
* @private
* @param {jQuery} $elem - Menu to scan for sub menus.
* @param {Boolean} root - If true, the menu being scanned is at the root level.
*/
Drilldown.prototype._prepareMenu = function($elem, root) {
var _this = this;
// Create a trigger to move up the menu. This is not used on the root-level menu, because it doesn't need a back button.
if (!root) {
var $backButton = $(_this.options.backButton);
$backButton.click(function() {
_this.backward();
});
$elem.prepend($backButton);
}
// Look for sub-menus inside the current one
$elem.children('li').each(function() {
var $submenu = $(this).children('[data-submenu]');
// If it exists...
if ($submenu.length) {
$submenu.addClass('js-drilldown-sub');
// Create a trigger to move down the menu
$(this).children('a').click(function() {
_this.forward($submenu);
return false;
});
// We have to go deeper
_this._prepareMenu($submenu, false);
}
});
}
/**
* Moves down the drilldown by activating the menu specified in `$target`.
* @param {jQuery} $target - Sub menu to activate.
*/
Drilldown.prototype.forward = function($target) {
$target.addClass('js-drilldown-active');
this.$currentMenu = $target;
}
/**
* Moves up the drilldown by deactivating the current menu.
*/
Drilldown.prototype.backward = function() {
this.$currentMenu.removeClass('js-drilldown-active');
this.$currentMenu = this.$currentMenu.parents('[data-drilldown], [data-submenu]');
}
Foundation.plugin('drilldown', Drilldown);
}(Foundation, jQuery)
|
JavaScript
| 0 |
@@ -411,40 +411,8 @@
%7B%7D);
-%0A console.log(this.defaults);
%0A%0A
@@ -2479,16 +2479,46 @@
arget%60.%0A
+ * @fires Drilldown#forward%0A
* @pa
@@ -2562,16 +2562,16 @@
tivate.%0A
-
*/%0A
@@ -2697,16 +2697,189 @@
$target;
+%0A%0A /**%0A * Fires when the menu is done moving forwards.%0A * @event Drilldown#forward%0A */%0A this.$element.trigger('forward.zf.drilldown', %5Bthis.$currentMenu%5D);
%0A %7D%0A%0A
@@ -2940,24 +2940,55 @@
rrent menu.%0A
+ * @fires Drilldown#backward%0A
*/%0A Dril
@@ -3077,32 +3077,32 @@
ldown-active');%0A
-
this.$curren
@@ -3171,16 +3171,192 @@
menu%5D');
+%0A%0A /**%0A * Fires when the menu is done moving backwards.%0A * @event Drilldown#backward%0A */%0A this.$element.trigger('backward.zf.drilldown', %5Bthis.$currentMenu%5D);
%0A %7D%0A%0A
|
b0b53642d48ca34e9b1df783161a9e2b6399b0fa
|
Fix for Catalan Translation
|
js/i18n/grid.locale-cat.js
|
js/i18n/grid.locale-cat.js
|
;(function($){
/**
* jqGrid Catalan Translation
* Traducció jqGrid en Catatà per Faserline, S.L.
* http://www.faserline.com
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
**/
$.jgrid = {
defaults : {
recordtext: "Mostrant {0} - {1} de {2}",
emptyrecords: "Sense registres que mostrar",
loadtext: "Carregant...",
pgtext : "Page {0} of {1}"
},
search : {
caption: "Cerca...",
Find: "Cercar",
Reset: "Buidar",
odata : ['equal', 'not equal', 'less', 'less or equal','greater','greater or equal', 'begins with','does not begin with','is in','is not in','ends with','does not end with','contains','does not contain'],
groupOps: [ { op: "AND", text: "tot" }, { op: "OR", text: "qualsevol" } ],
matchText: " match",
rulesText: " rules"
},
edit : {
addCaption: "Afegir registre",
editCaption: "Modificar registre",
bSubmit: "Guardar",
bCancel: "Cancelar",
bClose: "Tancar",
saveData: "Les dades han canviat. Guardar canvis?",
bYes : "Yes",
bNo : "No",
bExit : "Cancel",
msg: {
required:"Camp obligatori",
number:"Introdueixi un nombre",
minValue:"El valor ha de ser major o igual que ",
maxValue:"El valor ha de ser menor o igual a ",
email: "no és una direcció de correu vàlida",
integer: "Introdueixi un valor enter",
date: "Introdueixi una data correcta ",
url: "no és una URL vàlida. Prefix requerit ('http://' or 'https://')",
nodefined : " is not defined!",
novalue : " return value is required!",
customarray : "Custom function should return array!",
customfcheck : "Custom function should be present in case of custom checking!"
}
},
view : {
caption: "Veure registre",
bClose: "Tancar"
},
del : {
caption: "Eliminar",
msg: "¿Desitja eliminar els registres seleccionats?",
bSubmit: "Eliminar",
bCancel: "Cancelar"
},
nav : {
edittext: " ",
edittitle: "Modificar fila seleccionada",
addtext:" ",
addtitle: "Agregar nova fila",
deltext: " ",
deltitle: "Eliminar fila seleccionada",
searchtext: " ",
searchtitle: "Cercar informació",
refreshtext: "",
refreshtitle: "Refrescar taula",
alertcap: "Avís",
alerttext: "Seleccioni una fila",
viewtext: " ",
viewtitle: "Veure fila seleccionada"
},
// setcolumns module
col : {
caption: "Mostrar/ocultar columnes",
bSubmit: "Enviar",
bCancel: "Cancelar"
},
errors : {
errcap : "Error",
nourl : "No s'ha especificat una URL",
norecords: "No hi ha dades per processar",
model : "Les columnes de noms són diferents de les columnes del model"
},
formatter : {
integer : {thousandsSeparator: ".", defaultValue: '0'},
number : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, defaultValue: '0,00'},
currency : {decimalSeparator:",", thousandsSeparator: ".", decimalPlaces: 2, prefix: "", suffix:"", defaultValue: '0,00'},
date : {
dayNames: [
"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds",
"Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"
],
monthNames: [
"Gen", "Febr", "Març", "Abr", "Maig", "Juny", "Jul", "Ag", "Set", "Oct", "Nov", "Des",
"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
],
AmPm : ["am","pm","AM","PM"],
S: function (j) {return j < 11 || j > 13 ? ['st', 'nd', 'rd', 'th'][Math.min((j - 1) % 10, 3)] : 'th'},
srcformat: 'Y-m-d',
newformat: 'd-m-Y',
masks : {
ISO8601Long:"Y-m-d H:i:s",
ISO8601Short:"Y-m-d",
ShortDate: "n/j/Y",
LongDate: "l, F d, Y",
FullDateTime: "l, F d, Y g:i:s A",
MonthDay: "F d",
ShortTime: "g:i A",
LongTime: "g:i:s A",
SortableDateTime: "Y-m-d\\TH:i:s",
UniversalSortableDateTime: "Y-m-d H:i:sO",
YearMonth: "F, Y"
},
reformatAfterEdit : false
},
baseLinkUrl: '',
showAction: 'show',
target: '',
checkbox : {disabled:true},
idName : 'id'
}
};
})(jQuery);
|
JavaScript
| 0 |
@@ -431,18 +431,20 @@
: %22P
-age
+%C3%A0gina
%7B0%7D
-of
+de
%7B1%7D
|
c999283417f89d870d779d62087184791f4aafff
|
Fix hackernews css in firefox
|
js/news.ycombinator.com.js
|
js/news.ycombinator.com.js
|
// Collapse comments on HN
// Mostly copied from https://github.com/Igglyboo/hn_collapse
(function () {
'use strict';
var comments = document.getElementsByClassName('athing');
if(comments.length === 0){
return;
}
var lastCommentIndex = 0;
// Some pages have a submission title that is also a .athing that we do not need to process
if (comments[0].getElementsByClassName('title').length !== 0) {
lastCommentIndex = 1;
}
for (var i = comments.length - 1; i >= lastCommentIndex; i--) {
var currentComment = comments[i];
var currentCommentHeader = currentComment.getElementsByClassName('comhead')[0];
var currentCommentBody = currentComment.getElementsByClassName('default')[0];
var collapseTag = document.createElement('a');
// Need to use indentation to figure out how far down in the tree it is since the comments are actually flat
currentComment.dataset.indentation = currentComment.querySelector('.ind img').width;
// Use hidden by to figure out what parent collapsed a certain comment so we don't end up with trees
// that go expanded -> collapsed -> expanded
currentComment.dataset.hiddenBy = -1;
collapseTag.textContent = ' [-] ';
collapseTag.className = 'collapse';
collapseTag.onclick = getCollapseFunction(currentComment, currentCommentBody);
currentCommentHeader.insertBefore(collapseTag, currentCommentHeader.firstChild);
}
function getCollapseFunction(comment, commentBody) {
return function () {
var alreadyHidden = commentBody.classList.contains('hidden');
if (alreadyHidden) {
commentBody.classList.remove('hidden');
this.textContent = ' [-] ';
} else {
commentBody.classList.add('hidden');
this.textContent = ' [+] '
}
var parentIndentation = parseInt(comment.dataset.indentation);
var nextElementSibling = comment.nextElementSibling;
while (nextElementSibling !== null) {
var nextIndentation = parseInt(nextElementSibling.dataset.indentation);
if (nextIndentation > parentIndentation) {
var nextHiddenBy = parseInt(nextElementSibling.dataset.hiddenBy);
if(nextHiddenBy === parentIndentation || nextHiddenBy === -1) {
if (alreadyHidden) {
nextElementSibling.classList.remove('hidden');
nextElementSibling.dataset.hiddenBy = -1;
} else {
nextElementSibling.classList.add('hidden');
nextElementSibling.dataset.hiddenBy = parentIndentation;
}
}
nextElementSibling = nextElementSibling.nextElementSibling;
} else {
break;
}
}
}
}
})();
|
JavaScript
| 0.998245 |
@@ -115,16 +115,280 @@
trict';%0A
+%0A // This makes sure we're on a comment page. Otherwise dotjs in firefox%0A // will not load the css because the JS fails to load%0A var commentTree = document.getElementsByClassName(%22comment-tree%22);%0A if (commentTree.length === 0) %7B%0A return;%0A %7D%0A%0A
var
|
133593eb65add8e36f7f99e1eacdfa24c7b414f6
|
remove unused path import in pluginapi.js
|
js/rendererjs/pluginapi.js
|
js/rendererjs/pluginapi.js
|
// pluginapi.js: Sia-UI plugin API interface exposed to all plugins.
// This is injected into every plugin's global namespace.
import Siad from 'sia.js'
import Path from 'path'
import { remote } from 'electron'
const dialog = remote.dialog
const mainWindow = remote.getCurrentWindow()
const config = remote.getGlobal('config')
Siad.configure(config.siad)
window.SiaAPI = {
call: Siad.call,
config: config,
hastingsToSiacoins: Siad.hastingsToSiacoins,
siacoinsToHastings: Siad.siacoinsToHastings,
openFile: (options) => dialog.showOpenDialog(mainWindow, options),
saveFile: (options) => dialog.showSaveDialog(mainWindow, options),
showMessage: (options) => dialog.showMessageBox(mainWindow, options),
showError: (options) => dialog.showErrorBox(options.title, options.content),
}
|
JavaScript
| 0 |
@@ -150,32 +150,8 @@
js'%0A
-import Path from 'path'%0A
impo
|
ce545ee9b46923a11474ef4a8408f5836b01ffe6
|
Update num: 1478205175034
|
Gruntfile.js
|
Gruntfile.js
|
// Gruntfile.js
// our wrapper function (required by grunt and its plugins)
// all configuration goes inside this function
//var exec = require('exec');
var exec = require('child_process').exec
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
// ===========================================================================
// CONFIGURE GRUNT ===========================================================
// ===========================================================================
grunt.initConfig({
// get the configuration info from package.json ----------------------------
// this way we can use things like name and version (pkg.name)
pkg: grunt.file.readJSON('package.json'),
browserify: {
dist: {
files: {
'assets/js/bundle.js': ['source/js/app.js']
}
}
},
sass: {
options: {
sourceMap: false
},
dist: {
files: {
'assets/css/styles.css': 'source/sass/styles.sass'
}
}
},
watch: {
scripts: {
files: ['source/**/*.js', 'source/**/*.sass', '**/*.html'],
tasks: ['build'],
options: {
debounceDelay: 250,
},
},
},
callback:{}
});
grunt.registerTask('callback', 'A sample task that logs stuff.', function() {
exec('git add . && git commit -m "Update num: ' + Date.now() + ' "',
function(err, out, code) {
if (err instanceof Error)
throw err;
grunt.log.writeln(err);
grunt.log.writeln(out);
process.exit(code);
});
});
grunt.event.on('callback', function(action, filepath, target) {
console.log('foi callback')
});
// ===========================================================================
// LOAD GRUNT PLUGINS ========================================================
// ===========================================================================
// we can only load these if they are in our package.json
// make sure you have run npm install so our app can find these
grunt.registerTask('build', ['browserify', 'sass', 'callback']);
};
|
JavaScript
| 0.000145 |
@@ -120,14 +120,8 @@
ion%0A
-//var
exec
@@ -140,16 +140,18 @@
exec');%0A
+//
var exec
@@ -1521,55 +1521,28 @@
-grunt.log.writeln(err);%0A grunt.log
+process.stdout
.write
-ln
(out
|
5683477aa68a6df6a84a2104317015becf57db36
|
Set the default task to 'all' (lint and run tests)
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mochaccino');
grunt.loadNpmTasks('grunt-release');
grunt.initConfig({
clean: ['build'],
jshint: {
all: ['lib/**/*.js', 'tasks/**'],
// see http://jshint.com/docs/
options: {
camelcase: true,
curly: true,
eqeqeq: true,
forin: true,
immed: true,
indent: 2,
noempty: true,
quotmark: 'single',
undef: true,
globals: {
'require': false,
'module': false,
'process': false,
'__dirname': false,
'console': false
},
unused: true,
browser: true,
strict: true,
trailing: true,
maxdepth: 2,
newcap: false
}
},
mochaccino: {
// this provides coverage for both unit and integration tests
cov: {
files: [
{ src: 'test/unit/*.test.js' },
{ src: 'test/integration/*.test.js' }
],
reporter: 'html-cov',
reportDir: 'build'
},
unit: {
files: { src: 'test/unit/*.test.js' },
reporter: 'dot'
},
// integration tests
int: {
files: { src: 'test/integration/*.test.js' },
reporter: 'dot'
}
},
release: {
options: {
// manage add/commit/push manually
add: false,
commit: false,
push: false,
bump: false,
tag: true,
pushTags: true,
npm: true,
folder: '.',
tagName: '<%= version %>',
tagMessage: 'Version <%= version %>'
}
}
});
grunt.registerTask('test', 'mochaccino:unit');
grunt.registerTask('test-int', 'mochaccino:int');
grunt.registerTask('cov', 'mochaccino:cov');
grunt.registerTask('lint', 'jshint');
grunt.registerTask('all', [
'jshint',
'mochaccino:unit',
'mochaccino:int'
]);
grunt.registerTask('default', 'test');
};
|
JavaScript
| 0.000001 |
@@ -2051,19 +2051,18 @@
ault', '
-test
+all
');%0A%7D;%0A
|
6ab258e6209fced04278f23078a0997285106d47
|
add mongo handler integration tests to grun task
|
Gruntfile.js
|
Gruntfile.js
|
/*
== STANDARD HEADER ==
Gruntfile for message-api
*/
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: ['lib/**/*.js', 'test/**/*.js']
},
docco: {
docs: {
src: ['lib/**/*.js', './*.md'],
dest: ['docs'],
options: {
layout: 'linear',
output: 'docs'
}
}
},
shell: {
addlicense: {
// this may not be the best way to do this dependency, but this isn't
// a task we're going to run that often.
command: 'python ../central/tools/addLicense.py "*/*.js"',
options: {
async: false,
execOptions: {
cwd: './lib/'
}
}
},
startMongo: {
command: [
'mongod',
'mongo'
].join('&&'),
options: {
async: false,
failOnError: false
}
},
startAPI: {
// load config and start app at same time
command: [
'source config/env.sh',
'node lib/index.js'
].join('&&'),
options: {
async: false
}
}
},
mochaTest: {
unit: {
options: {
reporter: 'spec'
},
src: ['test/groups_api_tests.js']
},
integration: {
options: {
reporter: 'spec'
},
src: ['test/groups_api_integration_tests.js']
}
}
});
// Load the plugins
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-docco2');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.loadNpmTasks('grunt-mocha-test');
// Default task(s).
grunt.registerTask('default', ['mochaTest']);
// Standard tasks
grunt.registerTask('unit-test', ['mochaTest:unit']);
grunt.registerTask('integration-test', ['mochaTest:integration']);
grunt.registerTask('all-test', ['mochaTest:unit','mochaTest:integration']);
grunt.registerTask('start-mongo', ['shell:startMongo']);
grunt.registerTask('start-api', ['shell:startAPI']);
};
|
JavaScript
| 0 |
@@ -2316,16 +2316,57 @@
ests.js'
+,'test/mongoHandler_integration_tests.js'
%5D %0A
|
a822836aac0e800254a8a3f41c702f7282ddf1a1
|
add build command
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
/**
* Project configuration
*/
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* Minifies and uglifies javascript scripts
*/
uglify: {
my_target: {
files: {
'dist/var/public/assets/scripts/libraries.min.js': ['var/public/bower/jquery/dist/jquery.min.js',
'var/public/bower/bootstrap/dist/js/bootstrap.min.js',
'var/public/bower/particles.js/particles.js'],
'dist/var/public/assets/scripts/bootstrap.min.js': ['var/public/assets/scripts/bootstrap.js']
}
}
},
/**
* Minifies stylesheets
*/
cssmin: {
target: {
files: [
// Library stylesheets
{
'./dist/var/public/assets/stylesheets/libraries.min.css': [
'./var/public/bower/components-font-awesome/css/font-awesome.min.css',
'./var/public/bower/bootstrap/dist/css/bootstrap.min.css',
'./var/public/bower/bootstrap/dist/css/bootstrap-theme.min.css'
]
},
// Bootstrap stylesheets
{
expand: true,
cwd: 'var/public/assets/stylesheets/',
src: ['*.css'],
dest: 'dist/var/public/assets/stylesheets/',
ext: '.min.css'
},
// Specific page stylesheets
{
expand: true,
cwd: 'var/public/assets/stylesheets/pages/',
src: ['**/*.css'],
dest: 'dist/var/public/assets/stylesheets/pages/',
ext: '.min.css'
}
]
}
},
/**
* Copies project assets
*/
copy: {
main: {
files: [
// Project fonts, images videos and configurations
{
expand: true,
src: [
'var/public/assets/fonts/*',
'var/public/assets/images/**',
'var/public/assets/videos/**',
'var/public/assets/particles.json'
],
dest: 'dist/', filter: 'isFile'
},
// Font Awesome 4.7.0 deployment
{
expand: true,
cwd: 'var/public/bower/components-font-awesome/fonts/',
src: ['*'],
dest: 'dist/var/public/assets/fonts/',
filter: 'isFile'
},
// Particles.json deployment
{
expand: true,
src: [
'var/public/assets/particles.json'
],
dest: 'dist/', filter: 'isFile'
}
]
}
},
/**
* HTML deployment with changing links
*/
processhtml: {
dist: {
files: {
'dist/index.html': ['index.php']
}
}
},
/**
* FTP deployment
*
*/
'ftp-deploy': {
build: {
auth: {
host: 'ftp.strato.com',
port: 21,
authKey: 'key1'
},
src: 'dist/',
dest: '/'
}
}
});
/**
* Load tasks
*/
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-processhtml');
grunt.loadNpmTasks('grunt-ftp-deploy');
// Default tasks
grunt.registerTask('default', []);
/**
* Deploy to a server
*/
grunt.registerTask('deploy', "Deploys to a FTP server server", [
'uglify',
'cssmin',
'copy',
'processhtml',
'ftp-deploy']
);
};
|
JavaScript
| 0.000003 |
@@ -4301,24 +4301,182 @@
ult', %5B%5D);%0A%0A
+%0A /**%0A * Builds%0A */%0A grunt.registerTask('build', %22Builds%22, %5B%0A 'uglify',%0A 'cssmin',%0A 'copy',%0A 'processhtml'%5D%0A );%0A%0A
/**%0A
|
81e55634204c80392d6514557e0dc394536862c4
|
Fix comments
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
'use strict';
// Force use of Unix newlines
grunt.util.linefeed = '\n';
// Configuration
grunt.initConfig({
// Metadata
pkg: grunt.file.readJSON('package.json'),
wuzzle: {
less: 'src/wuzzle.less',
css: 'dist/wuzzle.css',
cssMin: 'dist/wuzzle.min.css',
banner: '/*! Wuzzle <%= pkg.version %> | <%= pkg.license %> License | http//git.io/wuzzle */\n'
},
// Tasks
clean: {
dist: ['dist']
},
less: {
dist: {
files: {
'<%= wuzzle.css %>': '<%= wuzzle.less %>'
}
},
distMin: {
options: {
cleancss: true,
report: 'min'
},
files: {
'<%= wuzzle.cssMin %>': '<%= wuzzle.css %>'
}
}
},
csscomb: {
sort: {
options: {
sortOrder: '.csscomb.json'
},
files: {
'<%= wuzzle.css %>': ['<%= wuzzle.css %>']
}
}
},
usebanner: {
dist: {
options: {
position: 'top',
banner: '<%= wuzzle.banner %>'
},
files: {
src: [
'<%= wuzzle.css %>',
'<%= wuzzle.cssMin %>'
]
}
}
},
watch: {
less: {
files: 'src/*.less',
tasks: ['less', 'csscomb', 'usebanner']
}
}
});
// These plugins provide necessary tasks
require('load-grunt-tasks')(grunt, {scope: 'devDependencies'});
// Default task
grunt.registerTask('default', ['clean', 'less', 'csscomb', 'usebanner']);
};
|
JavaScript
| 0 |
@@ -212,16 +212,29 @@
son'),%0A%0A
+ // Paths%0A
wuzz
@@ -459,16 +459,30 @@
// Tasks
+ configuration
%0A cle
@@ -1419,21 +1419,20 @@
//
-These
+Load
plugins
pro
@@ -1431,32 +1431,8 @@
gins
- provide necessary tasks
%0A r
|
3ae8435189066751c2523b9507d3b4adda0cf870
|
remove dev zone from locations as they can be derived
|
extractors/xenoblade-chronicles-2/src/entities/Locations.js
|
extractors/xenoblade-chronicles-2/src/entities/Locations.js
|
const { readFile } = require('@frontiernav/filesystem')
const path = require('path')
const _ = require('lodash')
const log = require('pino')({ prettyPrint: true }).child({ name: path.basename(__filename, '.js') })
const { getAllRaw, getAllRawByName } = require('./gimmicks')
const getAllRawNamesById = _.memoize(async () => {
const content = await readFile(path.resolve(__dirname, '../../data/database/common_ms/fld_landmark.json'))
return _(JSON.parse(content)).keyBy('id').value()
})
const categoryMap = {
0: 'Landmark',
1: 'Secret Area',
2: 'Location'
}
const developmentZoneMap = {
0: 'Argentum',
1: 'Gormott',
2: 'Uraya',
3: 'Mor Ardain',
4: 'Tantal',
5: 'Letheria',
6: 'Indol'
}
const toLandmark = _.memoize(async raw => {
const rawNamesById = await getAllRawNamesById()
const rawName = rawNamesById[raw.MSGID]
if (!rawName || !rawName.name) {
throw new Error(`Landmark[${raw.name}] has no name.`)
}
const name = rawName.name
const devZone = raw.get_DPT ? developmentZoneMap[raw.developZone] : ''
const category = categoryMap[raw.category]
return {
name: `${name} (${devZone || category})`,
display_name: name,
category: category, // TODO: map to location category
development_zone: devZone, // TODO: map to region
exp: raw.getEXP,
sp: raw.getSP,
dp: raw.get_DPT
}
}, raw => raw.name)
exports.getByName = async ({ name }) => {
const allRawByName = await getAllRawByName({ type: 'FLD_LandmarkPop' })
const raw = allRawByName[`${name}`]
if (!raw) {
throw new Error(`Landmark[${name}] not found`)
}
return toLandmark(raw)
}
exports.getAll = async () => {
const allRaw = await getAllRaw('FLD_LandmarkPop')
return Promise
.all(
allRaw.map(raw => (
toLandmark(raw)
.catch(e => {
log.warn(e)
return null
})
))
)
.then(results => results.filter(r => !!r))
}
|
JavaScript
| 0 |
@@ -1231,62 +1231,8 @@
ory%0A
- development_zone: devZone, // TODO: map to region%0A
|
608d89e299f981c10a1db13eb6af9b334b9ce48f
|
Update Grunt to run qunitnode on default task
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function( grunt ) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON( 'package.json' ),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= pkg.homepage ? " * " + pkg.homepage + "\\n" : "" %>' +
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
dest: 'dist/<%= pkg.name %>.js',
src: [
'src/Dexter.js',
'src/Dexter.fakeXHR.js'
]
}
},
uglify: {
options: {
banner: '<%= banner %>',
codegen: { ascii_only: true },
sourceMap: true
},
dist: {
dest: 'dist/<%= pkg.name %>.min.js',
src: '<%= concat.dist.dest %>'
}
},
qunit: {
options: {
timeout: 30000,
'--web-security': 'no',
coverage: {
src: [ 'src/**/*.js' ],
instrumentedFiles: 'build/temp',
htmlReport: 'build/report/coverage',
lcovReport: 'build/report/lcov',
linesThresholdPct: 80
}
},
all: [ 'test/*.html' ]
},
qunitnode: {
all: [
'test/unit/environment.js',
'test/unit/spy.js',
'test/unit/fake.js',
'test/unit/timer.js',
'test/unit/restore.js'
]
},
coveralls: {
options: {
force: true
},
all: {
// LCOV coverage file relevant to every target
src: 'build/report/lcov/lcov.info'
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [ 'Gruntfile.js', 'src/**/*.js', 'test/**/*.js' ]
},
jscs: {
src: '<%= jshint.all %>',
options: {
preset: 'jquery'
}
},
mdoc: {
options: {
baseTitle: 'DexterJS',
indexContentPath: 'README.md'
},
docs: {
files: {
'docs/html': 'docs'
}
}
},
watch: {
options: {
atBegin: true
},
files: [
'Gruntfile.js',
'src/**/*.js',
'test/**/*.js'
],
tasks: 'default'
}
});
[
'grunt-contrib-concat',
'grunt-contrib-jshint',
'grunt-contrib-uglify',
'grunt-contrib-watch',
'grunt-coveralls',
'grunt-jscs-checker',
'grunt-qunitnode',
'grunt-qunit-istanbul'
].forEach( function( task ) {
grunt.loadNpmTasks( task );
});
grunt.registerMultiTask( 'mdoc', function() {
var opts = this.options(),
mdoc = require( 'mdoc' );
this.files.forEach( function( file ) {
opts.inputDir = file.src[ 0 ];
opts.outputDir = file.dest;
mdoc.run( opts );
});
});
// Default task.
grunt.registerTask( 'default', 'jshint jscs qunit concat uglify'.split( ' ' ) );
};
|
JavaScript
| 0 |
@@ -2584,16 +2584,26 @@
s qunit
+qunitnode
concat u
|
d3412748f98c78e99da6a96d590d1609b8b90626
|
Extracting paths into an object
|
Gruntfile.js
|
Gruntfile.js
|
/*
* grunt-contrib-i18next
* http://gruntjs.com/
*
* Copyright (c) 2013 Ignacio Rivas
* Licensed under the MIT license.
*/
module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
pkg: '<json:package.json>',
jshint: {
all: [
'Gruntfile.js',
'tasks/*.js',
'<%= nodeunit.tests %>'
],
options: {
jshintrc: '.jshintrc'
}
},
// Before generating any new files, remove any previously-created files.
clean: {
test: ['tmp']
},
// Unit tests.
nodeunit: {
tests: ['test/*_test.js']
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
// Whenever the "test" task is run, first lint the files and clean the "tmp"
// dir, then run this plugin's task(s), then test the result.
grunt.registerTask('test', ['jshint', 'clean', 'copy', 'nodeunit']);
// By default, run all tests.
grunt.registerTask('default', ['test']);
};
|
JavaScript
| 0.999987 |
@@ -175,16 +175,145 @@
rict';%0A%0A
+ var Path = %7B%0A TESTS: 'test/*_test.js',%0A LOCALES: 'test/sample/**/locales',%0A BUILD_PATH: 'test/sample/languages'%0A %7D;%0A%0A
// Pro
@@ -677,24 +677,130 @@
p'%5D%0A %7D,%0A%0A
+ i18next: %7B%0A locales:%7B%0A src: %5BPath.LOCALES%5D,%0A dest: Path.BUILD_PATH%0A %7D%0A %7D,%0A%0A
// Unit
@@ -836,32 +836,26 @@
tests: %5B
-'test/*_test.js'
+Path.TESTS
%5D%0A %7D%0A
|
a21d013a58a3cb5c9ad580d9d3997306297780bb
|
Remove redundant parameters.
|
Gruntfile.js
|
Gruntfile.js
|
/* eslint indent: [ "warn", 2 ] */
// Generated on 2014-06-19 using generator-angular-fullstack 1.4.3
'use strict';
// Webpack config is exported as a function
var webpackConfig = require('./webpack.config');
var webpackDevelopmentConfig = webpackConfig(process.env, { mode: 'development' });
var webpackProductionConfig = webpackConfig(process.env, { mode: 'production' });
// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'
module.exports = function (grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Define the configuration for all the tasks
grunt.initConfig({
express: {
options: {
port: process.env.PORT || 9000
},
dev: {
options: {
script: 'server.js',
debug: true
}
}
},
open: {
server: {
url: 'http://localhost:<%= express.options.port %>'
}
},
watch: {
jsTest: {
files: ['test/spec/**/*.js'],
tasks: ['karma']
},
gruntfile: {
files: ['Gruntfile.js']
},
express: {
files: [
'server.js',
'index.js',
'backend/**/*.js',
'app/js/constant/**/*.js',
],
tasks: ['express:dev', 'wait'],
options: {
livereload: true,
nospawn: true // Without this option specified express won't be reloaded
}
},
},
webpack: {
prod: Object.assign(webpackProductionConfig, {
mode: 'production',
}),
dev: Object.assign(webpackDevelopmentConfig, {
mode: 'development',
keepalive: false,
})
},
// @see https://github.com/webpack/docs/wiki/usage-with-grunt
// @see https://github.com/webpack/webpack-with-common-libs/blob/master/Gruntfile.js
'webpack-dev-server': {
options: {
webpack: Object.assign(webpackDevelopmentConfig, {
mode: 'development',
}),
// TODO Parameterize via env for Docker / local
host: '0.0.0.0',
},
start: {
keepalive: false,
webpack: {
mode: 'development'
}
}
},
// Debugging with node inspector
'node-inspector': {
custom: {
options: {
'web-host': 'localhost'
}
}
},
// Use nodemon to run server in debug mode with an initial breakpoint
nodemon: {
debug: {
script: 'server.js',
options: {
nodeArgs: ['--debug-brk'],
env: {
PORT: process.env.PORT || 9000
},
callback: function (nodemon) {
nodemon.on('log', function (event) {
console.log(event.colour);
});
// opens browser on initial server start
nodemon.on('config:update', function () {
setTimeout(function () {
require('open')('http://localhost:8080/debug?port=5858');
}, 500);
});
}
}
}
},
// Run some tasks in parallel to speed up the build process
concurrent: {
debug: {
tasks: [
'nodemon',
'node-inspector'
],
options: {
logConcurrentOutput: true
}
},
},
// Test settings
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true
}
},
env: {
test: {
NODE_ENV: 'test'
}
},
});
grunt.loadNpmTasks('grunt-webpack');
// Used for delaying livereload until after server has restarted
grunt.registerTask('wait', function () {
grunt.log.ok('Waiting for server reload…');
var done = this.async();
setTimeout(function () {
grunt.log.writeln('Done waiting!');
done();
}, 500);
});
grunt.registerTask('serve', function (target) {
if (target === 'debug') {
return grunt.task.run([
'concurrent:debug'
]);
}
var tasks = [
'webpack:dev',
'express:dev',
'webpack-dev-server:start',
'open',
'watch'
];
// Remove "open" task
if (true === grunt.option('no-open')) {
tasks.splice(tasks.indexOf('open'), 1);
}
grunt.task.run(tasks);
});
grunt.registerTask('test', [
'karma'
]);
grunt.registerTask('default', [
'webpack:prod',
'test',
]);
};
|
JavaScript
| 0.000011 |
@@ -1678,30 +1678,16 @@
prod:
-Object.assign(
webpackP
@@ -1706,48 +1706,8 @@
fig,
- %7B%0A mode: 'production',%0A %7D),
%0A
@@ -1760,37 +1760,8 @@
, %7B%0A
- mode: 'development',%0A
@@ -2016,30 +2016,16 @@
ebpack:
-Object.assign(
webpackD
@@ -2045,53 +2045,8 @@
fig,
- %7B%0A mode: 'development',%0A %7D),
%0A
@@ -2143,24 +2143,24 @@
start: %7B%0A
+
keep
@@ -2177,67 +2177,8 @@
se,%0A
- webpack: %7B%0A mode: 'development'%0A %7D%0A
|
196a9632d625c02993d8060f1125ec805c131f45
|
Update controllerTest.js
|
src/backend/rest/subscriber/test/controllerTest.js
|
src/backend/rest/subscriber/test/controllerTest.js
|
var assert = require('assert');
var msg = require('../msg.js');
var subController = require('../controller.js');
var testAdapter = require('./testAdapter.js');
var events = require('../../../events.js');
var controller = subController(testAdapter);
//-----------------------------------------------------------------------------
// Registration Controller Tests
describe('===> Testing Register subscriber controller: \n', function(){
it('Register Subscriber success', function(done){
var testId = 'testerID';
var data = {email: '[email protected]', password: 'tester10'};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result), JSON.stringify({value:{},tunnel:{}}));
done();
});
controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
});
it('Missing Email Test', function(done){
var testId = 'testerID1';
var data = {email: '', password: 'tester'};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result), JSON.stringify(msg.missingEmail()));
done();
});
controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
});
it('Bad Email Test', function(done){
var testId = 'testerID2';
var data = {email: 'a_terrible_email', password: 'tester'};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result),
JSON.stringify(msg.badEmail(data.email)));
done();
});
controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
});
it('Missing Password Test', function(done){
var testId = 'testerID3';
var data = {email: '[email protected]', password: ''};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result),
JSON.stringify(msg.missingPwd()));
done();
});
controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
});
it('Bad Password Test', function(done){
var testId = 'testerID4';
var data = {email: '[email protected]', password: '2short'};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result),
JSON.stringify(msg.badPwd()));
done();
});
controller.module.noauth.register('POST', {}, data, '127.0.0.1', testId);
});
});
// ----------------------------------------------------------------------------
// Verification Test
describe('===> Testing Verify subscriber controller: \n', function(){
it('Bad Token Test', function(done){
var testId = 'testerID1';
var data = {};
var params = {temp: 0, token: 'not36characters'};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result),
JSON.stringify(msg.badVerificationToken()));
done();
});
controller.module.noauth.verify('POST', params, data, '127.0.0.1', testId);
});
it('Missing Token Test', function(done){
var testId = 'testerID2';
var data = {};
var params = {temp: 0, token: ''};
events.Emitter.once(testId, function(result){
assert.equal(JSON.stringify(result),
JSON.stringify(msg.missingVerificationToken()));
done();
});
controller.module.noauth.verify('POST', params, data, '127.0.0.1', testId);
});
});
|
JavaScript
| 0.000001 |
@@ -2520,43 +2520,70 @@
s =
-%7Btemp: 0, token: 'not36characters'%7D
+%5B'doesnt_matter_only_looking_for_params1', 'an_invalid_token'%5D
;%0A%09%09
@@ -2930,28 +2930,54 @@
s =
-%7Btemp: 0, token: ''%7D
+%5B'doesnt_matter_only_looking_for_params1', ''%5D
;%0A%09%09
|
4b57cf199a17387e7cce42066a0df87d14a9337c
|
add 'plus' artifact with toCase.js in it
|
Gruntfile.js
|
Gruntfile.js
|
'use strict';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('bower.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
clean: {
files: ['dist']
},
concat: {
options: {
banner: '<%= banner %>',
stripBanners: true
},
dist: {
src: ['src/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
},
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: 'dist/<%= pkg.name %>.min.js'
},
},
qunit: {
files: ['test/**/*.html']
},
jshint: {
gruntfile: {
options: {
jshintrc: '.jshintrc'
},
src: 'Gruntfile.js'
},
src: {
options: {
jshintrc: 'src/.jshintrc'
},
src: ['src/**/*.js']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/**/*.js']
},
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
src: {
files: '<%= jshint.src.src %>',
tasks: ['jshint:src', 'qunit']
},
test: {
files: '<%= jshint.test.src %>',
tasks: ['jshint:test', 'qunit']
},
},
jasmine: {
all: 'src**/*.js',
options: {}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-notify');
// Default task.
grunt.registerTask('default', ['jshint', 'clean', 'concat', 'qunit', 'uglify']);
grunt.registerTask('test', ['jasmine']);
};
|
JavaScript
| 0.000001 |
@@ -770,32 +770,157 @@
%25%3E.js'%0A %7D,%0A
+ plus: %7B%0A src: %5B'src/%3C%25= pkg.name %25%3E.js', 'src/toCase.js'%5D,%0A dest: 'dist/%3C%25= pkg.name %25%3E.plus.js'%0A %7D%0A
%7D,%0A uglif
@@ -1081,32 +1081,144 @@
in.js'%0A %7D,%0A
+ plus: %7B%0A src: '%3C%25= concat.plus.dest %25%3E',%0A dest: 'dist/%3C%25= pkg.name %25%3E.plus.min.js'%0A %7D,%0A
%7D,%0A qunit
|
707a52e4dc9d36a47e31f12cd106f61f5e6227af
|
Add languages to destination dir on grunt build
|
Gruntfile.js
|
Gruntfile.js
|
Configuration = require('./app/helpers/Configuration');
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
files: ['app/**/*.js', 'web/**/*.js']
},
jscs: {
main: ['app/**/*.js', 'web/**/*.js']
},
requirejs: {
compile: {
options: {
baseUrl: "web",
name: "../bower_components/almond/almond",
include: [ 'main' ],
optimize: 'none',
out: "dist/app.js"
}
}
},
jadeUsemin: {
vendor: {
options: {
tasks: {
js: ['concat']
}
},
files: [{
src: 'app/views/index-development.jade'
}]
}
},
vows: {
all: {
options: {
color: true,
isolate: true
},
src: [ 'specs/**/*.tests.js' ]
}
},
mongodb_fixtures: {
dev: {
options: {
connection: Configuration.get('tests.mongodbUrl')
},
files: {
src: ['fixtures']
}
}
},
ngtemplates: {
app: {
cwd: 'web',
src: [ 'partials/**/*.html' ],
dest: 'dist/app.js',
options: {
append: true,
prefix: '/',
htmlmin: {
collapseBooleanAttributes: false,
collapseWhitespace: true,
removeAttributeQuotes: true,
removeEmptyAttributes: false,
removeRedundantAttributes: false,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true
},
bootstrap: function(module, script) {
return 'window.addTemplatesToCache = function ($templateCache) { ' + script + ' };';
}
}
}
},
uglify: {
options: {
mangle: false
},
app: {
files: {
'dist/app.min.js': [ 'dist/app.js' ]
}
}
},
less: {
production: {
options: {
cleancss: true
},
files: {
"dist/resources/stylesheets/styles.css": "web/resources/stylesheets/styles.less"
}
}
},
copy: {
dist: {
files: [
{ expand: true, cwd: 'web/resources', src: [ '**' ], dest: 'dist/resources' },
{
expand: true,
cwd: 'bower_components/jquery-ui/themes/smoothness',
src: [ '**' ],
dest: 'dist/resources/jquery-ui'
}
]
},
release: {
files: [
{
expand: true,
src: [
'app/**',
'dist/**',
'node_modules/**',
'README.md',
'configurationSchema.js',
'app.js',
'config.js',
'package.json'
],
dest: 'release'
}
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-angular-templates');
grunt.loadNpmTasks('grunt-jscs-checker');
grunt.loadNpmTasks('grunt-vows');
grunt.loadNpmTasks('grunt-jade-usemin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadTasks('./tasks');
grunt.registerTask('codestyling', [ 'jshint', 'jscs' ]);
grunt.registerTask('testing', [ 'run_server', 'load_fixture_images', 'vows' ]);
grunt.registerTask('build', [
'jadeUsemin:vendor',
'requirejs:compile',
'ngtemplates:app',
'uglify:app',
'less:production',
'copy:dist'
]);
grunt.registerTask('release', [
'build',
'copy:release'
]);
};
|
JavaScript
| 0.000001 |
@@ -2315,24 +2315,113 @@
sources' %7D,%0A
+ %7B expand: true, cwd: 'web/languages', src: %5B '**' %5D, dest: 'dist/languages' %7D,%0A
%7B%0A
|
a2bc8d88902b02c5bf87c7c2ab3c11904187090f
|
Update Gruntfile.js
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '',
process: function(src, filepath) {
return '// file:' + filepath + '\n' + src;
}
},
all: {
src: ['src/log.js', // logging system
'src/stream.js', // simple stream parser
'src/DataStream.js', // bit/byte/string read operations
'src/DataStream-write.js', // bit/byte/string write operations
'src/DataStream-map.js', // bit/byte/string other operations
'src/buffer.js', // multi-buffer datastream
'src/descriptor.js', // MPEG-4 descriptor parsing
'src/box.js', // core code for box definitions
'src/box-parse.js', // basic box parsing code
'src/parsing/sampleentries/sampleentry.js', // box-specific parsing code
'src/parsing/**/*.js', // box-specific parsing code
'src/box-codecs.js', // core code for box definitions
'src/box-write.js', // box writing code
'src/writing/**/*.js', // box-specific writing code
'src/box-unpack.js', // box code for sample manipulation
'src/text-mp4.js', // text-based track manipulations
'src/isofile.js', // basic file level operations (parse, get boxes)
'src/isofile-advanced-parsing.js', // file level advanced parsing operations (incomplete boxes, mutliple buffers ...)
'src/isofile-advanced-creation.js', // file level advanced operations to create files from scratch
'src/isofile-sample-processing.js', // file level sample processing operations (sample table, get, ...)
'src/isofile-item-processing.js', // item processing operations (sample table, get, ...)
'src/isofile-write.js', // file level write operations (segment creation ...)
'src/box-print.js', // simple print
'src/mp4box.js' // application level operations (data append, sample extraction, segmentation, ...)
],
dest: 'dist/<%= pkg.name %>.all.js'
},
simple: {
src: ['src/log-simple.js',
'src/stream.js',
'src/box.js',
'src/box-parse.js',
'src/parsing/emsg.js',
'src/parsing/styp.js',
'src/parsing/ftyp.js',
'src/parsing/mdhd.js',
'src/parsing/mfhd.js',
'src/parsing/mvhd.js',
'src/parsing/sidx.js',
'src/parsing/ssix.js',
'src/parsing/tkhd.js',
'src/parsing/tfhd.js',
'src/parsing/tfdt.js',
'src/parsing/trun.js',
'src/isofile.js',
'src/box-print.js',
'src/mp4box.js'
],
dest: 'dist/<%= pkg.name %>.simple.js'
},
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
sourceMap: true
},
all: {
files: {
'dist/<%= pkg.name %>.all.min.js': ['<%= concat.all.dest %>']
}
},
simple: {
files: {
'dist/<%= pkg.name %>.simple.min.js': ['<%= concat.simple.dest %>']
}
},
},
jshint: {
files: [
'Gruntfile.js',
'src/**/*.js',
'test/**/*.js',
// Exclude the following from lint
'!test/lib*/**/*.js',
'!test/mp4/**/*.js',
'!test/trackviewers/**/*.js',
'!test/coverage/**/*.js',
],
options: {
// options here to override JSHint defaults
eqeqeq: false,
asi: true,
//verbose: true,
loopfunc: true,
eqnull: true,
reporterOutput: "",
globals: {
}
}
},
watch: {
files: ['<%= jshint.files %>'],
tasks: ['default']
},
karma: {
unit: {
configFile: 'karma.conf.js'
}
},
bump: {
options: {
files: ['package.json'],
pushTo: 'origin'
}
},
coveralls: {
options: {
coverageDir: 'test/coverage/',
force: true
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-karma-coveralls');
grunt.loadNpmTasks('grunt-bump');
grunt.registerTask('all', [ 'concat:all', 'uglify:all']);
grunt.registerTask('simple', [ 'concat:simple', 'uglify:simple']);
grunt.registerTask('default', [ 'jshint', 'all', 'simple']);
grunt.registerTask('test', ['default', 'karma', 'coveralls']);
};
|
JavaScript
| 0 |
@@ -5147,30 +5147,8 @@
ult'
-, 'karma', 'coveralls'
%5D);%0A
|
2a18989a09c80bf468cad9b9202425ce8bccedbf
|
add version to gruntfile
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function (grunt) {
var coreFile = 'Erika.js';
var resourceFiles = [coreFile, 'Core/*.js', 'utils/*.js', 'dom/*.js'];
var allFiles = ['Gruntfile.js', coreFile, 'Core/*.js', 'utils/*.js', 'dom/*.js'];
var devDir = 'dev/';
var tmpDir = 'tmp/';
var banner = '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> \n* BY Xian Li<[email protected]>*/';
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: banner
},
build: {
// src: 'src/<%= pkg.name %>.js',
// dest: 'build/<%= pkg.name %>.min.js'
files: {
'prod/erika-core.min.js': resourceFiles
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish')
},
build: allFiles
},
copy: {
main: {
files: [
{
expand: true,
src: resourceFiles,
dest: tmpDir,
filter: 'isFile'
},
],
},
},
concat: {
options: {
stripBanners: true,
banner: banner,
},
dist: {
src: [tmpDir + '**'],
dest: devDir + coreFile,
},
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('default', ['jshint', 'uglify']);
grunt.registerTask('build', ['jshint', 'copy', 'concat']);
grunt.registerTask('build-dev', ['jshint', 'copy']);
};
|
JavaScript
| 0.000001 |
@@ -268,24 +268,64 @@
r = 'tmp/';%0A
+ var version = '%3C%25= pkg.version %25%3E';%0A
var bann
|
3b557e0d580e71cab69cb2007917a8fa09a91e30
|
remove jshint stylish
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
var pkg = require('./package.json'),
buildTime = new Date();
grunt.initConfig({
outputName: 'scrollview',
replace: {
build: {
files: [{
src: ['src/scrollview.js'],
dest: '<%= outputName %>.js'
}],
options: {
patterns: [{
json: pkg
}, {
json: {
date: buildTime.toISOString(),
year: buildTime.getFullYear()
}
}]
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: ['<%= outputName %>.js']
},
uglify: {
min: {
options: {
preserveComments: 'some'
},
files : {
'<%= outputName %>.min.js' : ['<%= outputName %>.js']
}
}
},
yuidoc : {
compile: {
name: pkg.name,
description: pkg.description,
version: pkg.version,
url: pkg.homepage,
options: {
ignorePaths: ['src/', 'example', 'docs', 'node_modules'],
paths: '.',
outdir: 'docs/'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
grunt.registerTask('default', ['replace', 'jshint', 'uglify', 'yuidoc']);
};
|
JavaScript
| 0.000035 |
@@ -786,61 +786,8 @@
trc'
-,%0A reporter: require('jshint-stylish')
%0A
|
687efd5bbf3eaa48ac4cb944dbd77f5dc1043f34
|
Update the branch to work with toolkit on develop branch
|
examples/main.js
|
examples/main.js
|
// jshint browser:true, jquery: true
// jshint varstmt: true
import rethink from 'runtime-browser/bin/rethink';
import {getTemplate, serialize} from '../src/utils/utils';
import config from '../config.json';
window.KJUR = {};
let domain = config.domain;
let runtimeLoader;
console.log('Configuration file:', config);
rethink.install(config).then(function(result) {
runtimeLoader = result;
console.log('Installed:', result);
return getListOfHyperties(domain);
}).then(function(hyperties) {
let $dropDown = $('#hyperties-dropdown');
hyperties.forEach(function(key) {
let $item = $(document.createElement('li'));
let $link = $(document.createElement('a'));
// create the link features
$link.html(key);
$link.css('text-transform', 'none');
$link.attr('data-name', key);
$link.on('click', loadHyperty);
$item.append($link);
$dropDown.append($item);
});
$('.preloader-wrapper').remove();
$('.card .card-action').removeClass('center');
$('.hyperties-list-holder').removeClass('hide');
}).catch(function(reason) {
console.error(reason);
});
function getListOfHyperties(domain) {
let hypertiesURL = 'https://catalogue.' + domain + '/.well-known/hyperty/';
if (config.development) {
hypertiesURL = 'https://' + domain + '/.well-known/hyperty/Hyperties.json';
}
return new Promise(function(resolve, reject) {
$.ajax({
url: hypertiesURL,
success: function(result) {
let response = [];
if (typeof result === 'object') {
Object.keys(result).forEach(function(key) {
response.push(key);
});
} else if (typeof result === 'string') {
response = JSON.parse(result);
}
resolve(response);
},
fail: function(reason) {
reject(reason);
notification(reason, 'warn');
}
});
});
}
function loadHyperty(event) {
event.preventDefault();
let hypertyName = $(event.currentTarget).attr('data-name');
let hypertyPath = 'hyperty-catalogue://catalogue.' + domain + '/.well-known/hyperty/' + hypertyName;
if (config.development) {
hypertyPath = 'hyperty-catalogue://' + domain + '/.well-known/hyperty/' + hypertyName;
}
let $el = $('.main-content .notification');
addLoader($el);
runtimeLoader.requireHyperty(hypertyPath).then(hypertyDeployed).catch(hypertyFail);
}
function hypertyDeployed(hyperty) {
let $el = $('.main-content .notification');
removeLoader($el);
// Add some utils
serialize();
let $mainContent = $('.main-content').find('.row');
let template = '';
let script = '';
switch (hyperty.name) {
case 'Connector':
template = 'connector/Connector';
script = 'connector/demo.js';
break;
case 'GroupChatManager':
template = 'group-chat-manager/ChatManager';
script = 'group-chat-manager/demo.js';
break;
case 'HelloWorldObserver':
template = 'hello-world/helloWorld';
script = 'hello-world/helloObserver.js';
break;
case 'HelloWorldReporter':
template = 'hello-world/helloWorld';
script = 'hello-world/helloReporter.js';
break;
case 'SurveyReporter':
template = 'survey/surveyReporter';
script = 'survey/surveyReporter.js';
break;
case 'SurveyObserver':
template = 'survey/surveyObserver';
script = 'survey/surveyObserver.js';
break;
case 'GroupChat':
template = 'group-chat/groupChat';
script = 'group-chat/groupChat.js';
break;
case 'NotificationsReporter':
template = 'notifications/notificationsReporter';
script = 'notifications/notificationsReporter.js';
break;
case 'NotificationsObserver':
template = 'notifications/notificationsObserver';
script = 'notifications/notificationsObserver.js';
break;
case 'Location':
template = 'location/location';
script = 'location/location.js';
break;
case 'RoomClient':
template = 'room-ui/roomClient';
script = 'room-ui/roomClient.js';
break;
case 'RoomServer':
template = 'room-ui/roomServer';
script = 'room-ui/roomServer.js';
break;
case 'UserStatus':
template = 'user-status/UserStatus';
script = 'user-status/user-status.js';
break;
case 'BraceletSensorObserver':
template = 'bracelet/bracelet';
script = 'bracelet/BraceletSensorObserver.js';
break;
}
if (!template) {
throw Error('You must need specify the template for your example');
}
getTemplate(template, script).then(function(template) {
let html = template();
$mainContent.html(html);
if (typeof hypertyLoaded === 'function') {
hypertyLoaded(hyperty);
} else {
let msg = 'If you need pass the hyperty to your template, create a function called hypertyLoaded';
console.info(msg);
notification(msg, 'warn');
}
});
}
function hypertyFail(reason) {
console.error(reason);
notification(reason, 'error');
}
function addLoader(el) {
let html = '<div class="preloader preloader-wrapper small active">' +
'<div class="spinner-layer spinner-blue-only">' +
'<div class="circle-clipper left">' +
'<div class="circle"></div></div><div class="gap-patch"><div class="circle"></div>' +
'</div><div class="circle-clipper right">' +
'<div class="circle"></div></div></div></div>';
el.addClass('center');
el.append(html);
}
function removeLoader(el) {
el.find('.preloader').remove();
el.removeClass('center');
}
function notification(msg, type) {
let $el = $('.main-content .notification');
let color = type === 'error' ? 'red' : 'black';
removeLoader($el);
$el.append('<span class="' + color + '-text">' + msg + '</span>');
}
// runtimeCatalogue.getHypertyDescriptor(hyperty).then(function(descriptor) {
// console.log(descriptor);
// }).catch(function(reason) {
// console.error('Error: ', reason);
// });
|
JavaScript
| 0 |
@@ -80,27 +80,30 @@
om '
-runtime-browser/bin
+../resources/factories
/ret
|
d578787e71daaa0404dc84bd91ba6c996dc5eebc
|
Fix Hilbert order encoding bug
|
Source/Core/HilbertOrder.js
|
Source/Core/HilbertOrder.js
|
import Check from "./Check.js";
/**
* Hilbert Order helper functions.
* @see {@link https://en.wikipedia.org/wiki/Hilbert_curve}
*
* @namespace HilbertOrder
*/
var HilbertOrder = {};
/**
* Computes the Hilbert index from 2D coordinates.
*
* @param {Number} level The level of the curve
* @param {Number} x The X coordinate
* @param {Number} y The Y coordinate
* @returns {Number} The Hilbert index.
*/
HilbertOrder.encode2D = function (level, x, y) {
//>>includeStart('debug', pragmas.debug);
Check.typeOf.number("level", level);
Check.typeOf.number("x", x);
Check.typeOf.number("y", y);
//>>includeEnd('debug');
var n = 2 ** level;
var rx;
var ry;
var s;
var d;
for (s = n / 2; s > 0; s /= 2) {
rx = (x & s) > 0;
ry = (y & s) > 0;
d += s * s * ((3 * rx) ^ ry);
rotate(n, x, y, rx, ry);
}
return d;
};
/**
* @private
*/
function rotate(n, x, y, rx, ry) {
if (ry === 0) {
if (rx === 1) {
x = n - 1 - x;
y = n - 1 - y;
}
var temp = x;
x = y;
y = temp;
}
}
export default HilbertOrder;
|
JavaScript
| 0.000037 |
@@ -645,18 +645,26 @@
n =
-2 **
+Math.pow(2,
level
+)
;%0A
@@ -697,16 +697,20 @@
%0A var d
+ = 0
;%0A%0A for
|
0432fba33aa46e7db05896efd1e24c163a779b87
|
define blog through of params object
|
example/index.js
|
example/index.js
|
/**
* Module dependencies.
*/
var express = require('express');
var WPOAuth = require('../');
/**
* Get setting data
*/
var setting = require('./setting.json');
/**
* Create a WPOAuth instance
*/
var wpoauth = WPOAuth(setting);
// setup middleware
var pub = __dirname + '/public';
var app = express();
app.use(express.static(pub));
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
// homepage route
app.get('/', function(req, res){
res.render('home', {
setting: setting,
url: wpoauth.urlToConnect()
});
});
// connect response route
// grab code query param
app.get('/connect/res', function(req, res){
var code = req.query.code;
res.render('ready', { code: code });
});
// access token route
app.get('/get_token/:code', function(req, res){
// pass the code into setting parameters
wpoauth.setCode(req.params.code);
// request access token
wpoauth.requestAccessToken(function(err, data){
if (err) return res.render('error', err);
res.render('ok', data);
});
});
app.listen(3000);
console.log('WPOAuth app started on port 3000');
|
JavaScript
| 0.000001 |
@@ -539,16 +539,84 @@
Connect(
+%7B%0A blog: 'retrofocs.wordpress.com',%0A scope: 'global'%0A %7D
)%0A %7D);%0A
|
a272275b2e6f1e0fbef77db028769a48e88d755b
|
Update main.js
|
data/main.js
|
data/main.js
|
/*@pjs preload="data/images/logo1.png";*/
var sketchProc=function(processingInstance){ with (processingInstance){
//Setup
var wi = window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;
var he = window.innerHeight ||
document.documentElement.clientHeight ||
document.body.clientHeight;
size(wi*0.9,he*0.9);
frameRate(60);
setup = function() {
mainfont = createFont("Times New Roman");
logo = loadImage("data/images/logo1.png");
keys = [];
page = 0;
chapter1 = [];
m = false;
bw = width/8;
bh = width/16;
prim = color(15,15,15);
sec = color(100,30,30);
tert = color(150,150,150);
loadpanels = function(name,number,target) {
for (i = 0; i < number; i ++) {
target[i] = loadImage("data/images/panels"+name+i+".png");
}
};
buttons = {
start:{x:width*(3/4),y:height/2,w:bw,h:bh,text:"Start"},
next:{x:width*(3/4),y:height*(4/5),w:bw,h:bh,text:"Next"},
};
displaypanel = function(img,x,y) {
imageMode(CENTER);
pushMatrix();
translate(x,y);
scale(0.001*height,0.001*height);
image(img,0,0);
popMatrix();
};
button = function(con) {
bux = con.x
buy = con.y
buw = con.w
buh = con.h
butext = con.text
con.pressed = false;
if (mouseX>bux&&mouseX<bux+buw && mouseY>buy&&mouseY<buy+buh) {
fill(prim);
} else {
fill(sec);
}
stroke(prim);
strokeWeight(buh/10);
rect(bux,buy,buw,buh,buh/3);
if (mouseX>bux&&mouseX<bux+buw && mouseY>buy&&mouseY<buy+buh) {
fill(sec);
} else {
fill(prim);
}
textFont(mainfont,buh/2);
textAlign(CENTER,CENTER);
text(butext,bux+buw/2,buy+buh/2);
if (mouseX>bux&&mouseX<bux+buw && mouseY>buy&&mouseY<buy+buh && m) {
con.pressed = true;
}
return con.pressed;
};
loadpanels("chap1",0,chapter1);
pages = [
function() {
background(55,55,55)
displaypanel(logo,width/4,height/2)
button(buttons.start)
if (buttons.start.pressed==true) {
page += 1
}
},
function() {
background(55,55,55)
button(buttons.next)
if (buttons.next.pressed) {
page += 1
}
},
];
};
draw = function() {
pages[page]();
};
keyPressed = function() {
keys[keyCode] = true;
};
keyReleased = function() {
keys[keyCode] = false;
};
mousePressed = function() {
m = true;
};
mouseReleased = function() {
m = false;
};
}};
|
JavaScript
| 0.000001 |
@@ -464,29 +464,24 @@
loadImage(%22
-data/
images/logo1
|
a441848f22a460a462280c885e4cf53b8eed672b
|
Remove img task from grunt build
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
// load all tasks from package.json
require('load-grunt-config')(grunt);
require('time-grunt')(grunt);
/**
* TASKS
*/
// build everything ready for a commit
grunt.registerTask('build', ['img', 'css', 'js']);
// just CSS
grunt.registerTask('css', ['sass', 'cssmin']);
// just images
grunt.registerTask('img', ['responsive_images:retina', 'exec:evenizer', 'responsive_images:regular', 'sprite', 'imagemin']);
// just javascript (babel must go before we add the wrapper, to keep it's generated methods inside, so not globals)
grunt.registerTask('js', ['eslint', 'template:jsAddVersion', 'babel', 'concat', 'uglify', 'replace']);
// build examples
grunt.registerTask('examples', ['template']);
// Travis CI
grunt.registerTask('travis', ['jasmine']);
// bump version number in 3 files, rebuild js to update headers, then commit, tag and push
grunt.registerTask('version', ['bump-only', 'js', 'bump-commit', 'shell:publish']);
};
|
JavaScript
| 0 |
@@ -234,23 +234,16 @@
uild', %5B
-'img',
'css', '
|
1ce8eb01a738ddfdc0f5f77db81d75ec4967ee08
|
Update main.js
|
data/main.js
|
data/main.js
|
/*@pjs preload="data/images/logo1.png";*/
var sketchProc=function(processingInstance){ with (processingInstance){
//Setup
var wi = window.innerWidth ||
document.documentElement.clientWidth ||
document.body.clientWidth;
var he = window.innerHeight ||
document.documentElement.clientHeight ||
document.body.clientHeight;
size(wi*0.9,he*0.9);
frameRate(60);
setup = function() {
mainfont = createFont("Times New Roman");
logo = loadImage("data/images/logo1.png");
keys = [];
page = 0;
chapter1 = [];
m = false;
md = false;
flevel = 255;
bw = width/8;
bh = width/16;
prim = color(15,15,15);
sec = color(100,30,30);
tert = color(150,150,150);
backg = color(55,55,55);
fade = function() {
flevel -= 10;
fill(55,55,55,flevel);
noStroke();
rectMode(CORNER);
rect(-1,-1,width+1,height+1);
};
loadpanels = function(name,number,target) {
for (i = 0; i < number;) {
target[i] = loadImage("data/images/panels/"+name+i+".png");
i ++;
}
};
buttons = {
start:{x:width*(3/4),y:height/2,w:bw,h:bh,text:"Enter"},
next:{x:width*(6/7),y:height*(1/2),w:bw,h:bh,text:"Next"},
prev:{x:width*(1/7),y:height*(1/2),w:bw,h:bh,text:"Previous"},
};
displaypanel = function(img,x,y) {
imageMode(CENTER);
pushMatrix();
translate(x,y);
scale(0.001*height,0.001*height);
image(img,0,0);
popMatrix();
};
button = function(con) {
bux = con.x
buy = con.y
buw = con.w
buh = con.h
butext = con.text
con.pressed = false;
rectMode(CENTER);
if (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2) {
fill(prim);
} else {
fill(sec);
}
stroke(prim);
strokeWeight(buh/10);
rect(bux,buy,buw,buh,buh/3);
if (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2) {
fill(sec);
} else {
fill(prim);
}
textFont(mainfont,buh/2);
textAlign(CENTER,CENTER);
text(butext,bux,buy);
if ((mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2 && m) || (mouseX>bux-buw/2&&mouseX<bux+buw/2 && mouseY>buy-buh/2&&mouseY<buy+buh/2 && md)) {
con.pressed = true;
return con.pressed;
}
return con.pressed;
};
loadpanels("chap1/",1,chapter1);
standardbuttons = function() {
button(buttons.next);
if (buttons.next.pressed) {
page += 1;
flevel = 255;
};
button(buttons.prev);
if (buttons.prev.pressed) {
page -= 1;
flevel = 255;
};
};
pages = [
function() {
background(backg)
displaypanel(logo,width/4,height/2)
button(buttons.start)
if (buttons.start.pressed==true) {
page += 1
}
},
function() {
background(backg)
displaypanel(chapter1[0],width/2,height/2);
standardbuttons();
fade();
},
];
};
keyPressed = function() {
keys[keyCode] = true;
};
keyReleased = function() {
keys[keyCode] = false;
};
mousePressed = function() {
m = true;
md = true;
};
mouseReleased = function() {
m = false;
md = true;
};
draw = function() {
md = false;
pages[page]();
fill(0,0,0);
text(md,width/2,height/2);
};
}};
|
JavaScript
| 0.000001 |
@@ -592,9 +592,9 @@
dth/
-8
+5
;%0A%09b
@@ -604,17 +604,17 @@
width/1
-6
+0
;%0A%09prim
|
071e8393f2061805dd9478e26a3b594d2c810f80
|
Append the strind inside html, debug easy
|
example/index.js
|
example/index.js
|
fallback.load({
css: 'index.css',
JSON: '//cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.min.js',
jQuery: [
'//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.FAIL_ON_PURPOSE.min.js',
'//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jquery/1.9.0/jquery.min.js'
],
'jQuery.ui': [
'//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js',
'//js/loader.js?i=vendor/jquery-ui.min.js'
]
}, {
// Only load jQuery UI after jQuery itself has loaded!
shim: {
'jQuery.ui': ['jQuery']
}
}, function(success, failed) {
console.log('fallback.load: Inline Callback');
pre = '\nSuccess!\n-------\n' + JSON.stringify(success, null, 4);
pre += '\n\n\n\nFailed!\n-------\n' + JSON.stringify(failed, null, 4);
$('body').prepend('<pre style="display: none">' + pre + '</pre>');
$('pre').show(1500, function() { $('strong').show(500).css('display', 'block'); });
});
fallback.ready(['jQuery'], function() {
// jQuery Completed
console.log('fallback.ready: jQuery Completed');
});
fallback.ready(['jQuery.ui'], function() {
// jQuery UI Completed
console.log('fallback.ready: jQuery UI Completed');
});
fallback.ready(['jQuery', 'jQuery.ui'], function() {
// jQuery + jQuery UI Completed
console.log('fallback.ready: jQuery + jQuery UI Completed');
});
fallback.ready(function() {
// All Completed
console.log('fallback.ready: ALL Completed');
$('body').append('<strong style="display: none; color: green">EXECUTE MY CODE NOW! ;-)</strong>');
});
|
JavaScript
| 0.000001 |
@@ -1064,37 +1064,45 @@
Completed%0A%09
-console.log('
+$('body').append('%3Cp%3E
fallback.rea
@@ -1113,32 +1113,36 @@
jQuery Completed
+%3C/p%3E
');%0A%7D);%0A%0Afallbac
@@ -1198,37 +1198,45 @@
Completed%0A%09
-console.log('
+$('body').append('%3Cp%3E
fallback.rea
@@ -1250,32 +1250,36 @@
ery UI Completed
+%3C/p%3E
');%0A%7D);%0A%0Afallbac
@@ -1354,37 +1354,45 @@
Completed%0A%09
-console.log('
+$('body').append('%3Cp%3E
fallback.rea
@@ -1419,24 +1419,28 @@
UI Completed
+%3C/p%3E
');%0A%7D);%0A%0Afal
|
62853eaa60c48b4af27bfb01881a7a1804ba02e6
|
Build default for CI test run
|
Gruntfile.js
|
Gruntfile.js
|
require('shelljs/global');
var timer = require("grunt-timer");
/**
* CartoDB UI assets generation
*/
module.exports = function(grunt) {
if (timer) timer.init(grunt);
var ROOT_ASSETS_DIR = './public/assets/';
var ASSETS_DIR = './public/assets/<%= pkg.version %>';
// use grunt --environment production
var env = './config/grunt_' + (grunt.option('environment') || 'development') + '.json';
if (grunt.file.exists(env)) {
env = grunt.file.readJSON(env)
} else {
throw grunt.util.error(env +' file is missing! See '+ env +'.sample for how it should look like');
}
var aws = {};
if (grunt.file.exists('./lib/build/grunt-aws.json')) {
aws = grunt.file.readJSON('./lib/build/grunt-aws.json');
}
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
aws: aws,
env: env,
gitrev: exec('git rev-parse HEAD', { silent:true }).output.replace('\n', ''),
assets_dir: ASSETS_DIR,
root_assets_dir: ROOT_ASSETS_DIR,
browserify_modules: {
src: 'lib/assets/javascripts/cartodb',
tests: {
dest: '.grunt/browserify_modules_tests.js'
}
},
// Concat task
concat: require('./lib/build/tasks/concat').task(),
// JST generation task
jst: require('./lib/build/tasks/jst').task(),
// Compass files generation
compass: require('./lib/build/tasks/compass').task(),
// Copy assets (stylesheets, javascripts, images...)
copy: require('./lib/build/tasks/copy').task(grunt),
// Watch actions
watch: require('./lib/build/tasks/watch.js').task(),
// Clean folders before other tasks
clean: require('./lib/build/tasks/clean').task(),
// Jasmine tests
jasmine: require('./lib/build/tasks/jasmine.js').task(),
s3: require('./lib/build/tasks/s3.js').task(),
uglify: require('./lib/build/tasks/uglify.js').task(),
browserify: require('./lib/build/tasks/browserify.js').task(),
availabletasks: require('./lib/build/tasks/availabletasks.js').task()
});
// $ grunt availabletasks
grunt.loadNpmTasks('grunt-available-tasks');
// Load Grunt tasks
require('load-grunt-tasks')(grunt);
require('./lib/build/tasks/manifest').register(grunt, ASSETS_DIR);
// builds cdb
grunt.registerTask('cdb', "builds cartodb.js", function() {
var done = this.async();
require("child_process").exec('make update_cdb', function (error, stdout, stderr) {
if (error) {
grunt.log.fail('cartodb.js not updated (due to '+ stdout +", "+ stderr +")");
} else {
grunt.log.ok('cartodb.js updated');
}
done();
});
});
grunt.registerTask('invalidate', "invalidate cache", function() {
var done = this.async();
var cmd = grunt.template.process("curl -H 'Fastly-Key: <%= aws.FASTLY_API_KEY %>' -X POST 'https://api.fastly.com/service/<%= aws.FASTLY_CARTODB_SERVICE %>/purge_all'");
console.log(cmd);
require("child_process").exec(cmd, function(error, stdout, stderr) {
if (!error) {
grunt.log.ok('CDN invalidated (fastly) -> ' + stdout);
} else {
grunt.log.error('CDN not invalidated (fastly)');
}
done();
});
});
grunt.registerTask('config', "generates assets config for current configuration", function() {
// Set assets url for static assets in our app
var config = grunt.template.process("cdb.config.set('assets_url', '<%= env.http_path_prefix %>/assets/<%= pkg.version %>');");
config += grunt.template.process("\nconsole.log('cartodbui v<%= pkg.version %> sha1: <%= gitrev %>');");
grunt.file.write("lib/build/app_config.js", config);
});
grunt.registerTask('check_release', "checks release can be done", function() {
if (env === 'development') {
grunt.log.error("you can't release running development enviorment");
return false;
}
grunt.log.ok("************************************************");
grunt.log.ok(" you are going to deploy to " + env );
grunt.log.ok("************************************************");
});
grunt.event.on('watch', function(action, filepath) {
// configure copy vendor to only run on changed file
var cfg = grunt.config.get('copy.vendor');
if (filepath.indexOf(cfg.cwd) !== -1) {
grunt.config('copy.vendor.src', filepath.replace(cfg.cwd, ''));
} else {
grunt.config('copy.vendor.src', []);
}
// configure copy app to only run on changed file
var files = grunt.config.get('copy.app.files');
for (var i = 0; i < files.length; ++i) {
var cfg = grunt.config.get('copy.app.files.' + i);
if (filepath.indexOf(cfg.cwd) !== -1) {
grunt.config('copy.app.files.' + i + '.src', filepath.replace(cfg.cwd, ''));
} else {
grunt.config('copy.app.files.' + i + '.src', []);
}
}
});
grunt.registerTask('setConfig', 'Set a config property', function(name, val) {
grunt.config.set(name, val);
});
grunt.registerTask('test', ['config', 'concat:js', 'jst', 'jasmine']);
grunt.registerTask('css', ['copy:vendor', 'copy:app', 'compass', 'concat:css']);
grunt.registerTask('js', ['cdb', 'browserify', 'concat:js', 'jst']);
grunt.registerTask('default', ['clean', 'config', 'js', 'css', 'manifest']);
grunt.registerTask('minimize', ['default', 'copy:js', 'uglify']);
grunt.registerTask('release', ['check_release', 'minimize', 's3', 'invalidate']);
grunt.registerTask('dev', 'Typical task for frontend development (watch JS/CSS changes)',
['setConfig:env.browserify_watch:true', 'browserify', 'watch']);
};
|
JavaScript
| 0 |
@@ -5246,35 +5246,124 @@
-%5B'config', 'concat:js', 'js
+'(CI env) Re-build JS files and run all tests. ' +%0A 'For manual testing use %60grunt jasmine%60 directly', %5B'defaul
t',
|
4494968ca802dacb433010c4e5cab539261d3056
|
fix gruntfile
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
'loopback_auto': {
'db_autoupdate': {
options: {
dataSource: 'db',
app: './server/server',
config: './server/model-config',
method: 'autoupdate'
}
}
});
// Load the plugin
grunt.loadNpmTasks('grunt-loopback-auto');
grunt.registerTask('default', ['loopback_auto']);
};
|
JavaScript
| 0.000005 |
@@ -270,16 +270,22 @@
%7D%0A
+ %7D%0A
%7D);%0A
@@ -302,17 +302,16 @@
e plugin
-
%0A grunt
|
811bfcf1bed1a463a49cf39c5e8d450e1c7d5d56
|
change name of instrumental project key to indicate which key is required
|
exampleConfig.js
|
exampleConfig.js
|
/*
Example StatsD configuration for sending metrics to Instrumental.
See the offical Statsd exampleConfig.js for more StatsD options.
*/
{
port: 8125
, backends: ["statsd-instrumental-backend" ]
, debug: false
, instrumental: {
key: "INSTRUMENTAL_API_KEY", // REQUIRED
secure: true, // OPTIONAL (boolean), whether or not to use secure protocol to connect to Instrumental, default true
verify_cert: true, // OPTIONAL (boolean), should we attempt to verify the server certificate before allowing communication, default true
timeout: 10000, // OPTIONAL (integer), number of milliseconds to wait for establishing a connection to Instrumental before giving up, default 10s
}
}
|
JavaScript
| 0.000001 |
@@ -236,28 +236,25 @@
y: %22
-INSTRUMENTAL
+PROJECT
_API_
+TO
KE
-Y
+N
%22, /
|
1ee72c64b461a7c09556392e30c09cc1e63ddfda
|
Create d3fc.bundle(.min).js
|
Gruntfile.js
|
Gruntfile.js
|
/* global module, require */
module.exports = function(grunt) {
'use strict';
require('time-grunt')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
metaJsFiles: [
'Gruntfile.js'
],
componentsJsFiles: [
'src/*/**/*.js'
],
componentsCssFiles: [
'src/**/*.css'
],
testJsFiles: [
'tests/**/*Spec.js'
],
visualTestJsFiles: [
'visual-tests/**/*.js',
'!visual-tests/assets/**/*.js'
],
ourJsFiles: [
'<%= meta.metaJsFiles %>',
'<%= meta.componentsJsFiles %>',
'<%= meta.testJsFiles %>',
'<%= meta.visualTestJsFiles %>'
]
},
assemble: {
site: {
options: {
assets: 'site/dist',
data: ['package.json', 'site/src/_config.yml'],
partials: 'site/src/_includes/*.hbs',
layoutdir: 'site/src/_layouts',
layout: 'default',
layoutext: '.hbs',
helpers: ['handlebars-helpers']
},
files: [
{
expand: true,
cwd: 'site/src',
src: ['**/*.md', '*.md', '**/*.hbs', '*.hbs', '!_*/*'],
dest: 'site/dist'
}
]
}
},
concat: {
options: {
sourceMap: false
},
site: {
src: [
'node_modules/css-layout/dist/css-layout.js',
'node_modules/d3/d3.js',
'node_modules/svg-innerhtml/svg-innerhtml.js',
'dist/d3fc.js',
'node_modules/jquery/dist/jquery.js',
'node_modules/bootstrap/js/collapse.js',
'site/src/lib/init.js'
],
dest: 'site/dist/scripts.js'
}
},
connect: {
options: {
useAvailablePort: true
},
visualTests: {
options: {
base: 'visual-tests'
}
},
site: {
options: {
base: 'site/dist'
}
}
},
copy: {
visualTests: {
files: [
{
expand: true,
cwd: 'node_modules/bootstrap/dist/',
src: ['**'],
dest: 'visual-tests/assets/bootstrap/'
},
{
src: [
'node_modules/css-layout/dist/css-layout.js',
'dist/d3fc.js',
'dist/d3fc.css',
'node_modules/jquery/dist/jquery.js',
'node_modules/d3/d3.js',
'node_modules/seedrandom/seedrandom.min.js'],
dest: 'visual-tests/assets/',
flatten: true,
expand: true
}
]
},
site: {
files: [
{
expand: true,
cwd: 'site/src/',
src: ['**/*', '!_*', '!**/*.hbs', '!**/*.md', '!**/*.yml'],
dest: 'site/dist/'
}
]
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
sourceMap: true
},
components: {
files: {
'dist/d3fc.min.js': ['dist/d3fc.js']
}
},
site: {
files: {
'site/dist/scripts.js': 'site/dist/scripts.js'
}
}
},
concat_css: {
options: {},
components: {
src: ['<%= meta.componentsCssFiles %>'],
dest: 'dist/d3fc.css'
}
},
cssmin: {
components: {
files: [{
expand: true,
cwd: 'dist/',
src: ['d3fc.css'],
dest: 'dist/',
ext: '.min.css'
}]
}
},
watch: {
components: {
files: [
'<%= meta.componentsJsFiles %>',
'<%= meta.testJsFiles %>',
'<%= meta.componentsCssFiles %>'
],
tasks: ['components']
},
visualTests: {
files: [
'<%= meta.componentsJsFiles %>',
'<%= meta.testJsFiles %>',
'<%= meta.componentsCssFiles %>',
'visual-tests/**/*',
'!visual-tests/assets/**/*'
],
tasks: ['components', 'visualTests']
},
site: {
files: [
'<%= meta.metaJsFiles %>',
'site/src/**/*'
],
tasks: ['site']
},
options: {
livereload: true,
atBegin: true
}
},
eslint: {
components: {
src: ['<%= meta.componentsJsFiles %>']
},
test: {
src: ['<%= meta.testJsFiles %>']
},
visualTests: {
src: ['<%= meta.visualTestJsFiles %>']
}
},
jasmine_nodejs: {
options: {
reporters: {
console: {
verbosity: false
}
}
},
test: {
specs: '<%= meta.testJsFiles %>'
}
},
clean: {
components: ['dist/*', '!dist/README.md'],
visualTests: ['visual-tests/assets'],
site: ['site/dist']
},
version: {
defaults: {
src: ['dist/d3fc.js']
}
},
less: {
site: {
files: {
'site/dist/styles.css': 'site/src/style/styles.less'
}
}
},
rollup: {
components: {
files: {
'dist/d3fc.js': ['src/fc.js']
},
options: {
external: ['css-layout', 'd3', 'svg-innerhtml'],
format: 'umd',
moduleName: 'fc'
}
}
}
});
require('jit-grunt')(grunt);
grunt.registerTask('components', [
'eslint:components', 'clean:components', 'rollup:components', 'version',
'concat_css:components', 'cssmin:components', 'eslint:test', 'jasmine_nodejs:test'
]);
grunt.registerTask('visualTests', [
'eslint:visualTests', 'clean:visualTests', 'copy:visualTests'
]);
grunt.registerTask('visualTests:serve', ['connect:visualTests', 'watch:visualTests']);
grunt.registerTask('site', ['clean:site', 'copy:site', 'concat:site', 'less:site', 'assemble:site']);
grunt.registerTask('site:serve', ['connect:site', 'watch:site']);
grunt.registerTask('ci', ['components', 'uglify:components', 'site', 'uglify:site']);
grunt.registerTask('default', ['watch:components']);
};
|
JavaScript
| 0.000001 |
@@ -1725,36 +1725,42 @@
%7D,%0A
-site
+components
: %7B%0A
@@ -1808,34 +1808,13 @@
les/
-css-layout/dist/css-layout
+d3/d3
.js'
@@ -1841,37 +1841,58 @@
'node_modules/
-d3/d3
+css-layout/dist/css-layout
.js',%0A
@@ -1974,32 +1974,195 @@
'dist/d3fc.js'
+%0A %5D,%0A dest: 'dist/d3fc.bundle.js'%0A %7D,%0A site: %7B%0A src: %5B%0A 'dist/d3fc.bundle.js'
,%0A
@@ -4279,32 +4279,104 @@
%5B'dist/d3fc.js'%5D
+,%0A 'dist/d3fc.bundle.min.js': %5B'dist/d3fc.bundle.js'%5D
%0A
@@ -7585,16 +7585,37 @@
ersion',
+ 'concat:components',
%0A
|
e10c2b53c1eeecce823bb710dfa0f492a3489752
|
Remove spaces at end of line
|
Gruntfile.js
|
Gruntfile.js
|
/*
* (C) Copyright 2014 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library 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.
*
*/
module.exports = function(grunt)
{
var DIST_DIR = 'dist';
var pkg = grunt.file.readJSON('package.json');
var bower =
{
TOKEN: process.env.TOKEN,
repository: 'git://github.com/Kurento/<%= pkg.name %>-bower.git'
};
// Project configuration.
grunt.initConfig(
{
pkg: pkg,
bower: bower,
// Plugins configuration
clean:
{
generated_code: DIST_DIR,
generated_doc: '<%= jsdoc.all.dest %>'
},
// Generate documentation
jsdoc:
{
all:
{
src: [
'README.md',
'lib/**/*.js',
'node_modules/kurento-client-core/lib/**/*.js',
'node_modules/kurento-client-elements/lib/**/*.js',
'node_modules/kurento-client-filters/lib/**/*.js',
'test/*.js'
],
dest: 'doc/jsdoc'
}
},
// Generate browser versions and mapping debug file
browserify:
{
require:
{
src: '<%= pkg.main %>',
dest: DIST_DIR+'/<%= pkg.name %>_require.js'
},
standalone:
{
src: '<%= pkg.main %>',
dest: DIST_DIR+'/<%= pkg.name %>.js',
options:
{
bundleOptions: {
standalone: '<%= pkg.name %>'
}
}
},
'require minified':
{
src: '<%= pkg.main %>',
dest: DIST_DIR+'/<%= pkg.name %>_require.min.js',
options:
{
debug: true,
plugin: [
['minifyify',
{
compressPath: DIST_DIR,
map: '<%= pkg.name %>.map'
}]
]
}
},
'standalone minified':
{
src: '<%= pkg.main %>',
dest: DIST_DIR+'/<%= pkg.name %>.min.js',
options:
{
debug: true,
bundleOptions: {
standalone: '<%= pkg.name %>'
},
plugin: [
['minifyify',
{
compressPath: DIST_DIR,
map: '<%= pkg.name %>.map',
output: DIST_DIR+'/<%= pkg.name %>.map'
}]
]
}
}
},
// Generate bower.json file from package.json data
sync:
{
bower:
{
options:
{
sync: [
'name', 'description', 'license', 'keywords', 'homepage',
'repository'
],
overrides: {
authors: (pkg.author ? [pkg.author] : []).concat(pkg.contributors || []),
main: 'js/<%= pkg.name %>.js'
}
}
}
},
// Publish / update package info in Bower
shell:
{
bower: {
command: [
'curl -X DELETE "https://bower.herokuapp.com/packages/<%= pkg.name %>?auth_token=<%= bower.TOKEN %>"',
'node_modules/.bin/bower register <%= pkg.name %> <%= bower.repository %>',
'node_modules/.bin/bower cache clean'
].join('&&')
}
}
});
// Load plugins
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.loadNpmTasks('grunt-npm2bower-sync');
grunt.loadNpmTasks('grunt-shell');
// Alias tasks
grunt.registerTask('default', ['clean', 'jsdoc', 'browserify']);
grunt.registerTask('bower', ['sync:bower', 'shell:bower']);
};
|
JavaScript
| 0.999999 |
@@ -1386,17 +1386,16 @@
%5D,
-
%0A
|
874886cda57b80b5f06a9e3003bd9e20c6601feb
|
Add es2015 preset to babel
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
"babel": {
options: {
sourceMap: false
},
dist: {
files: [
{
"expand": true,
"cwd": "modules/",
"src": ["**/*.js"],
"dest": "dist",
"ext": ".js"
}]
}
},
eslint: {
target: ["./modules/**/*.js"]
},
watch: {
babel: {
files: ['./modules/*.js'],
tasks: ['babel'],
options: {
spawn: false,
}
}
},
ava: {
target: ['test/*.spec.js']
}
});
grunt.loadNpmTasks('grunt-babel');
grunt.loadNpmTasks('grunt-contrib-watch')
grunt.loadNpmTasks('grunt-eslint');
grunt.loadNpmTasks('grunt-ava');
grunt.registerTask("default", ["test", "watch"]);
grunt.registerTask("test", ["lint", "babel", "ava"]);
grunt.registerTask("lint", "eslint");
grunt.registerTask("dev", ["babel", "watch"]);
grunt.registerTask("deploy", "babel");
};
|
JavaScript
| 0 |
@@ -105,16 +105,45 @@
p: false
+,%0A presets: %5B'es2015'%5D
%0A %7D
|
d36a0e96bd1d7b249a90d8b5b93fc5c37c1bc97f
|
Tweak Gruntfile
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
'shell': {
'options': {
'stdout': true,
'stderr': true,
'failOnError': true
},
'cover': {
'command': 'istanbul cover --report "html" --verbose --dir "coverage" "tests/tests.js"'
},
'test-narwhal': {
'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "tests/tests.js"'
},
'test-phantomjs': {
'command': 'echo "Testing in PhantomJS..."; phantomjs "tests/tests.js"'
},
// Rhino 1.7R4 has a bug that makes it impossible to test in.
// https://bugzilla.mozilla.org/show_bug.cgi?id=775566
// To test, use Rhino 1.7R3, or wait (heh) for the 1.7R5 release.
'test-rhino': {
'command': 'echo "Testing in Rhino..."; rhino -opt -1 "tests.js"',
'options': {
'execOptions': {
'cwd': 'tests'
}
}
},
'test-ringo': {
'command': 'echo "Testing in Ringo..."; ringo -o -1 "tests/tests.js"'
},
'test-node': {
'command': 'echo "Testing in Node..."; node "tests/tests.js"'
},
'test-browser': {
'command': 'echo "Testing in a browser..."; open "tests/index.html"'
}
}
});
grunt.loadNpmTasks('grunt-shell');
grunt.registerTask('cover', 'shell:cover');
grunt.registerTask('test', [
'shell:test-narwhal',
'shell:test-phantomjs',
'shell:test-rhino',
'shell:test-ringo',
'shell:test-node',
'shell:test-browser'
]);
grunt.registerTask('default', [
'shell:test-node',
'cover'
]);
};
|
JavaScript
| 0.000001 |
@@ -244,32 +244,83 @@
%22tests/tests.js%22
+; istanbul report --root %22coverage%22 --format %22html%22
'%0A%09%09%09%7D,%0A%09%09%09'test
|
61444c0ee6f2a087ba76ba953a4bc6672d4728eb
|
Update phpdocumentor grunt task.
|
Gruntfile.js
|
Gruntfile.js
|
var fs = require('fs');
module.exports = function(grunt) {
grunt.initConfig(
{
/**
* Reads the 'package.json' file and puts it content into a 'pkg' Javascript object.
*/
pkg : grunt.file.readJSON('package.json'),
/**
* Clean task.
*/
clean : ['build'],
/**
* Copy task.
*/
copy : {
/**
* Copy test resource files to the build.
*/
'test-resources' : {
files : [
{
cwd: 'src/test/resources',
expand: true,
src: '**',
dest: 'build/test-resources/'
}
]
}
}, /* Copy task */
/**
* PHPUnit Task.
*/
phpunit : {
classes: {
dir: 'src/test/php'
},
options: {
configuration : 'phpunit.xml.dist',
//group : 'CURLClientTest'
}
}, /* PHPUnit Task */
/**
* Shell Task
*/
shell : {
pdepend : {
command : function() {
var command = 'php vendor/pdepend/pdepend/src/bin/pdepend';
command += ' --jdepend-chart=build/reports/pdepend/jdepend-chart.svg';
command += ' --jdepend-xml=build/reports/pdepend/jdepend.xml';
command += ' --overview-pyramid=build/reports/pdepend/overview-pyramid.svg';
command += ' --summary-xml=build/reports/pdepend/summary.xml';
command += ' src/main/php';
return command;
}
},
phpcs : {
command : function() {
var command = 'php ./vendor/squizlabs/php_codesniffer/scripts/phpcs';
command += ' --standard=PSR2';
command += ' -v';
if(grunt.option('checkstyle') === true) {
command += ' --report=checkstyle';
command += ' --report-file=build/reports/phpcs/phpcs.xml';
}
command += ' src/main/php';
command += ' src/test/php/Gomoob';
return command;
}
},
phpcbf : {
command : function() {
var command = 'php ./vendor/squizlabs/php_codesniffer/scripts/phpcbf';
command += ' --standard=PSR2';
command += ' --no-patch';
command += ' src/main/php';
command += ' src/test/php';
return command;
}
},
phpcpd : {
command : function() {
return 'php vendor/sebastian/phpcpd/phpcpd src/main/php';
}
},
phpdocumentor : {
command : function() {
return 'php vendor/phpdocumentor/phpdocumentor/bin/phpdoc --target=build/reports/phpdocumentor --directory=src/main/php';
}
},
phploc : {
command : function() {
return 'php vendor/phploc/phploc/phploc src/main/php';
}
},
phpmd : {
command : function() {
var command = 'php vendor/phpmd/phpmd/src/bin/phpmd ';
command += 'src/main/php ';
command += 'html ';
command += 'cleancode,codesize,controversial,design,naming,unusedcode ';
command += '--reportfile=build/reports/phpmd/phpmd.html';
return command;
},
options : {
callback : function(err, stdout, stderr, cb) {
grunt.file.write('build/reports/phpmd/phpmd.html', stdout);
cb();
}
}
}
} /* Shell Task */
}
); /* Grunt initConfig call */
// Load the Grunt Plugins
require('load-grunt-tasks')(grunt);
/**
* Task used to create directories needed by PDepend to generate its report.
*/
grunt.registerTask('before-pdepend' , 'Creating directories required by PDepend...', function() {
if(!fs.existsSync('build')) {
fs.mkdirSync('build');
}
if(!fs.existsSync('build/reports')) {
fs.mkdirSync('build/reports');
}
if(!fs.existsSync('build/reports/pdepend')) {
fs.mkdirSync('build/reports/pdepend');
}
});
/**
* Task used to create directories needed by PHP_CodeSniffer to generate its report.
*/
grunt.registerTask('before-phpcs', 'Creating directories required by PHP Code Sniffer...', function() {
if(grunt.option('checkstyle') === true) {
if(!fs.existsSync('build')) {
fs.mkdirSync('build');
}
if(!fs.existsSync('build/reports')) {
fs.mkdirSync('build/reports');
}
if(!fs.existsSync('build/reports/phpcs')) {
fs.mkdirSync('build/reports/phpcs');
}
}
});
/**
* Task used to create directories needed by PHPMD to generate its report.
*/
grunt.registerTask('before-phpmd', 'Creating directories required by PHP Mess Detector...', function() {
if(!fs.existsSync('build')) {
fs.mkdirSync('build');
}
if(!fs.existsSync('build/reports')) {
fs.mkdirSync('build/reports');
}
if(!fs.existsSync('build/reports/phpmd')) {
fs.mkdirSync('build/reports/phpmd');
}
});
/**
* Task used to generate a PDepend report.
*/
grunt.registerTask('pdepend', ['before-pdepend', 'shell:pdepend']);
/**
* Task used to automatically fix PHP_CodeSniffer errors.
*/
grunt.registerTask('phpcbf', ['shell:phpcbf']);
/**
* Task used to check the code using PHP_CodeSniffer.
*/
grunt.registerTask('phpcs', ['before-phpcs', 'shell:phpcs']);
/**
* Task used to generate a PHPMD report.
*/
grunt.registerTask('phpmd', ['before-phpmd', 'shell:phpmd']);
/**
* Task used to create the project documentation.
*/
grunt.registerTask('generate-documentation', ['pdepend', 'phpcs', 'phpmd', 'shell:phpdocumentor']);
/**
* Task used to execute the project tests.
*/
grunt.registerTask('test', ['copy:test-resources', 'phpunit']);
/**
* Default task, this task executes the following actions :
* - Clean the previous build folder
*/
grunt.registerTask('default', ['clean', 'test', 'generate-documentation']);
};
|
JavaScript
| 0 |
@@ -3992,16 +3992,20 @@
n/phpdoc
+.php
--targe
|
c8bd66263fec314217e61a3b8fa2903a93d20ff9
|
make removelogging work on min files
|
Gruntfile.js
|
Gruntfile.js
|
var cp = require('child_process');
var buildConfig = require('./config/build');
module.exports = function(grunt) {
grunt.initConfig({
concat: {
options: {
separator: ';\n'
},
dist: {
src: buildConfig.ionicFiles,
dest: 'dist/js/ionic.js'
},
distangular: {
src: buildConfig.angularIonicFiles,
dest: 'dist/js/ionic-angular.js'
},
bundle: {
options: {
banner:
'/*!\n' +
' * ionic.bundle.js is a concatenation of:\n' +
' * ionic.js, angular.js, angular-animate.js,\n'+
' * angular-ui-router.js, and ionic-angular.js\n'+
' */\n\n'
},
src: [
'dist/js/ionic.js',
'config/lib/js/angular/angular.js',
'config/lib/js/angular/angular-animate.js',
'config/lib/js/angular-ui/angular-ui-router.js',
'dist/js/ionic-angular.js'
],
dest: 'dist/js/ionic.bundle.js'
},
bundlemin: {
options: {
banner: '<%= concat.bundle.options.banner %>'
},
src: [
'dist/js/ionic.min.js',
'config/lib/js/angular/angular.min.js',
'config/lib/js/angular/angular-animate.min.js',
'config/lib/js/angular-ui/angular-ui-router.min.js',
'dist/js/ionic-angular.min.js'
],
dest: 'dist/js/ionic.bundle.min.js'
}
},
version: {
dist: {
dest: 'dist/version.json'
}
},
copy: {
dist: {
files: [{
expand: true,
cwd: './config/lib/',
src: buildConfig.vendorFiles,
dest: './dist/'
}]
}
},
//Used by CI to check for temporary test code
//xit, iit, ddescribe, xdescribe
'ddescribe-iit': ['js/**/*.js'],
'merge-conflict': ['js/**/*.js'],
'removelogging': {
dist: {
files: [{
expand: true,
cwd: 'dist/js/',
src: ['*.js'],
dest: '.'
}],
options: {
methods: 'log info assert count clear group groupEnd groupCollapsed trace debug dir dirxml profile profileEnd time timeEnd timeStamp table exception'.split(' ')
}
}
},
jshint: {
files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'],
options: {
jshintrc: '.jshintrc'
}
},
karma: {
options: {
configFile: 'config/karma.conf.js'
},
single: {
options: {
singleRun: true
}
},
sauce: {
options: {
singleRun: true,
configFile: 'config/karma-sauce.conf.js'
}
},
watch: {
}
},
uglify: {
dist: {
files: {
'dist/js/ionic.min.js': 'dist/js/ionic.js',
'dist/js/ionic-angular.min.js': 'dist/js/ionic-angular.js'
}
},
options: {
preserveComments: 'some'
}
},
sass: {
dist: {
files: {
'dist/css/ionic.css': 'scss/ionic.scss',
}
}
},
cssmin: {
dist: {
files: {
'dist/css/ionic.min.css': 'dist/css/ionic.css',
}
}
},
'string-replace': {
version: {
files: {
'dist/js/ionic.js': 'dist/js/ionic.js',
'dist/js/ionic-angular.js': 'dist/js/ionic-angular.js',
'dist/css/ionic.css': 'dist/css/ionic.css',
},
options: {
replacements: [{
pattern: /{{ VERSION }}/g,
replacement: '<%= pkg.version %>'
}]
}
}
},
bump: {
options: {
files: ['package.json'],
commit: false,
createTag: false,
push: false
}
},
watch: {
scripts: {
files: ['js/**/*.js', 'ext/**/*.js'],
tasks: ['concat:dist', 'concat:distangular', 'concat:bundle'],
options: {
spawn: false
}
},
sass: {
files: ['scss/**/*.scss'],
tasks: ['sass'],
options: {
spawn: false
}
}
},
pkg: grunt.file.readJSON('package.json')
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', [
'jshint',
'build'
]);
grunt.registerTask('build', [
'sass',
'cssmin',
'concat:dist',
'concat:distangular',
'copy',
'string-replace',
'uglify',
'version',
'concat:bundle',
'concat:bundlemin'
]);
grunt.registerMultiTask('karma', 'Run karma', function() {
var done = this.async();
var options = this.options();
var config = options.configFile;
var browsers = grunt.option('browsers');
var singleRun = grunt.option('singleRun') || options.singleRun;
var reporters = grunt.option('reporters');
cp.spawn('node', ['node_modules/karma/bin/karma', 'start', config,
browsers ? '--browsers=' + browsers : '',
singleRun ? '--single-run=' + singleRun : '',
reporters ? '--reporters=' + reporters : ''
], { stdio: 'inherit' })
.on('exit', function(code) {
if (code) return grunt.fail.warn('Karma test(s) failed. Exit code: ' + code);
done();
});
});
grunt.registerMultiTask('version', 'Generate version JSON', function() {
var pkg = grunt.config('pkg');
this.files.forEach(function(file) {
var dest = file.dest;
var d = new Date();
var version = {
version: pkg.version,
codename: pkg.codename,
date: grunt.template.today('yyyy-mm-dd'),
time: d.getUTCHours() + ':' + d.getUTCMinutes() + ':' + d.getUTCSeconds()
};
grunt.file.write(dest, JSON.stringify(version, null, 2));
});
});
};
|
JavaScript
| 0.000001 |
@@ -1966,24 +1966,17 @@
cwd: '
-dist/js/
+.
',%0A
@@ -1987,17 +1987,46 @@
src: %5B'
-*
+dist/js/*.js', '!dist/js/*.min
.js'%5D,%0A
@@ -2042,16 +2042,24 @@
dest: '.
+/dist/js
'%0A
@@ -4448,22 +4448,8 @@
e',%0A
- 'uglify',%0A
@@ -4476,24 +4476,59 @@
at:bundle',%0A
+ 'removelogging',%0A 'uglify',%0A
'concat:
|
02a65a53c028dcbd8cb8b39ffe7c1215b83e600f
|
Remove unneeded rules
|
Gruntfile.js
|
Gruntfile.js
|
"use strict";
module.exports = function(grunt) {
grunt.initConfig({
pkg: '<json:package.json>',
jshint: {
files: ['Gruntfile.js',
'test/**/*.js',
'public/js/**/*.js',
'routes/**/*.js'
],
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
node: true
}
},
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('default', ['lint']);
};
|
JavaScript
| 0.000019 |
@@ -160,78 +160,16 @@
'
-test/**/*.js',%0A 'public/js/**/*.js',%0A 'route
+public/j
s/**
|
0a3a0df6bf3e0d4c3b5cf7bb2d7b7f3785719697
|
fix build task
|
Gruntfile.js
|
Gruntfile.js
|
/**
* Created by Tivie on 12-11-2014.
*/
module.exports = function (grunt) {
if (grunt.option('q') || grunt.option('quiet')) {
require('quiet-grunt');
}
// Project configuration.
var config = {
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
sourceMap: true,
banner: ';/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n(function(){\n',
footer: '}).call(this);'
},
dist: {
src: [
'src/showdown.js',
'src/helpers.js',
'src/converter.js',
'src/subParsers/*.js',
'src/loader.js'
],
dest: 'dist/<%= pkg.name %>.js'
},
test: {
src: '<%= concat.dist.src %>',
dest: '.build/<%= pkg.name %>.js',
options: {
sourceMap: false
}
}
},
clean: ['.build/'],
uglify: {
options: {
sourceMap: true,
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
files: {
'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
files: [
'Gruntfile.js',
'src/**/*.js',
'test/**/*.js'
]
},
jscs: {
options: {
config: '.jscs.json'
},
files: {
src: [
'Gruntfile.js',
'src/**/*.js',
'test/**/*.js'
]
}
},
changelog: {
options: {
repository: 'http://github.com/showdownjs/showdown',
dest: 'CHANGELOG.md'
}
},
simplemocha: {
node: {
src: 'test/node/**/*.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
karlcow: {
src: 'test/node/testsuite.karlcow.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
issues: {
src: 'test/node/testsuite.issues.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
standard: {
src: 'test/node/testsuite.standard.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
features: {
src: 'test/node/testsuite.features.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
},
single: {
src: 'test/node/**/*.js',
options: {
globals: ['should'],
timeout: 3000,
ignoreLeaks: false,
reporter: 'spec'
}
}
}
};
grunt.initConfig(config);
require('load-grunt-tasks')(grunt);
grunt.registerTask('single-test', function (grep) {
'use strict';
grunt.config.merge({
simplemocha: {
single: {
options: {
grep: grep
}
}
}
});
grunt.task.run(['lint', 'concat:test', 'simplemocha:single', 'clean']);
});
grunt.registerTask('lint', ['jshint', 'jscs']);
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:node', 'clean']);
grunt.registerTask('build', ['test', 'concatenate', 'uglify']);
grunt.registerTask('prep-release', ['build', 'changelog']);
// Default task(s).
grunt.registerTask('default', ['test']);
};
|
JavaScript
| 0.000456 |
@@ -3519,13 +3519,13 @@
ncat
-enate
+:dist
', '
|
b210ae79588011c6fbeceb13c486187cc7a217c6
|
Refactor the build process
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.initConfig({
copyPackageTo: "\\\\telerik.com\\Resources\\BlackDragon\\Builds\\appbuilder-sublime-package",
movePackageTo: process.env["JOB_NAME"] ? "\\\\telerik.com\\Resources\\BlackDragon\\Builds\\appbuilder-sublime-package" : "build",
jobName: process.env["JOB_NAME"] || "local",
buildNumber: process.env["BUILD_NUMBER"] || "non-ci",
destinationFolder: process.env["JOB_NAME"] ? "<%= movePackageTo %>\\<%= jobName %>\\<%= grunt.template.today('yyyy-mm-dd') %> #<%= buildNumber %>" : "<%= movePackageTo %>",
compress: {
main: {
options: {
archive: "<%= destinationFolder %>\\Telerik AppBuilder.zip"
},
files: [
{ src: ["**/*.{py,pyd,so}", "*.{sublime-keymap,sublime-menu,sublime-settings}", "LICENSE"] }
]
},
second: {
options: {
archive: "<%= copyPackageTo %>\\<%= jobName %>\\Telerik AppBuilder.zip"
},
files: [
{ src: ["**/*.{py,pyd,so}", "*.{sublime-keymap,sublime-menu,sublime-settings}", "LICENSE"] }
]
}
},
clean: {
src: ["**/*.pyc"]
}
});
grunt.loadNpmTasks("grunt-contrib-compress");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.registerTask("default", ["compress:main","compress:second"]);
}
|
JavaScript
| 0 |
@@ -55,538 +55,49 @@
g(%7B%0A
-%09%09copyPackageTo: %22%5C%5C%5C%5Ctelerik.com%5C%5CResources%5C%5CBlackDragon%5C%5CBuilds%5C%5Cappbuilder-sublime-package%22,%0A%09%09%0A movePackageTo: process.env%5B%22JOB_NAME%22%5D ? %22%5C%5C%5C%5Ctelerik.com%5C%5CResources%5C%5CBlackDragon%5C%5CBuilds%5C%5Cappbuilder-sublime-package%22 : %22build%22,%0A jobName: process.env%5B%22JOB_NAME%22%5D %7C%7C %22local%22,%0A buildNumber: process.env%5B%22BUILD_NUMBER%22%5D %7C%7C %22non-ci%22,%0A destinationFolder: process.env%5B%22JOB_NAME%22%5D ? %22%3C%25= movePackageTo %25%3E%5C%5C%3C%25= jobName %25%3E%5C%5C%3C%25= grunt.template.today('yyyy-mm-dd') %25%3E #%3C%25= buildNumber %25%3E%22 : %22%3C%25= movePackageTo %25%3E
+%0A destinationFolder: %22build_output
%22,%0A%0A
@@ -422,330 +422,8 @@
%5D%0A
- %7D,%0A%09%09%09second: %7B%0A options: %7B%0A archive: %22%3C%25= copyPackageTo %25%3E%5C%5C%3C%25= jobName %25%3E%5C%5CTelerik AppBuilder.zip%22%0A %7D,%0A files: %5B%0A %7B src: %5B%22**/*.%7Bpy,pyd,so%7D%22, %22*.%7Bsublime-keymap,sublime-menu,sublime-settings%7D%22, %22LICENSE%22%5D %7D%0A %5D%0A
@@ -447,11 +447,9 @@
%7D,%0A
-%09%09
%0A
+
@@ -611,9 +611,12 @@
%22);%0A
-%09
+
grun
@@ -641,17 +641,16 @@
fault%22,
-%5B
%22compres
@@ -660,27 +660,9 @@
ain%22
-,%22compress:second%22%5D
);%0A%7D
+%0A
|
e00937642d3e034428360c911ce7968c69f2eb4e
|
Fix no-redeclare warning in js lint
|
senlin_dashboard/static/app/core/receivers/actions/actions.module.js
|
senlin_dashboard/static/app/core/receivers/actions/actions.module.js
|
/*
* 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';
/**
* @ngdoc overview
* @ngname horizon.cluster.receivers.actions
*
* @description
* Provides all of the actions for receivers.
*/
angular.module('horizon.cluster.receivers.actions', [
'horizon.framework.conf',
'horizon.cluster.receivers'
])
.run(registerReceiverActions);
registerReceiverActions.$inject = [
'horizon.framework.conf.resource-type-registry.service',
'horizon.app.core.receivers.actions.delete.service',
'horizon.app.core.receivers.resourceType'
];
function registerReceiverActions(
registry,
deleteReceiverService,
receiverResourceType
) {
var receiverResourceType = registry.getResourceType(receiverResourceType);
receiverResourceType.itemActions
.append({
id: 'deleteReceiverAction',
service: deleteReceiverService,
template: {
text: gettext('Delete Receiver'),
type: 'delete'
}
});
receiverResourceType.batchActions
.append({
id: 'batchDeleteReceiverAction',
service: deleteReceiverService,
template: {
type: 'delete-selected',
text: gettext('Delete Receivers')
}
});
}
})();
|
JavaScript
| 0.00001 |
@@ -1236,20 +1236,16 @@
Resource
-Type
= regis
@@ -1307,20 +1307,16 @@
Resource
-Type
.itemAct
@@ -1542,20 +1542,16 @@
Resource
-Type
.batchAc
|
ca974c1ab2a3e755216dc87e8eea7664a4369d31
|
fix gh-pages error
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
grunt.initConfig({
gitinfo: {},
pkg: pkg,
// Ignore patch versions. Those should only have bugfixes so we just want to
// udpate the docs in that case. Minor version changes should add features
// meaning we want new docs.
docVersion: pkg.version.split('.').slice(0,-1).join('.'),
src: ['src/**/*.js'],
clean: {
dist: ['dist/<%= docVersion %>']
},
ngdocs: {
options: {
dest: 'dist/<%= docVersion %>',
html5Mode: false,
title: 'FamilySearch Javascript SDK',
bestMatch: false,
navTemplate: 'dist/nav.tmpl',
styles: ['dist/fix.css']
},
all: ['<%= src %>']
},
jshint: {
src: {
options: {
jshintrc: '.jshintrc'
},
src: ['<%= src %>']
},
test: {
options: {
jshintrc: 'test/.jshintrc'
},
src: ['test/unit/*.js']
}
},
'gh-pages': {
options: {
base: 'dist',
message: 'Update docs and files to distribute',
add: true
},
travis: {
options: {
repo: 'https://' + process.env.GH_TOKEN + '@github.com/FamilySearch/familysearch-javascript-sdk.git',
user: {
name: 'Travis',
email: '[email protected]'
},
silent: true
},
src: ['**/*']
}
},
copy: {
dist: {
files: [{
cwd: '.',
src: 'bower.json',
dest: 'dist/<%= docVersion %>',
expand: true
}]
}
},
run: {
jasmine: {
exec: 'npm run jasmine'
},
coveralls: {
exec: 'npm run coveralls'
},
browserify: {
exec: 'npm run browserify'
}
},
uglify: {
build: {
files: {
'dist/familysearch-javascript-sdk.min.js': 'dist/familysearch-javascript-sdk.js'
}
}
},
gitcheckout: {
'gh-pages': {
options: {
branch: 'gh-pages'
}
},
'reset': {
options: {
branch: '<%= gitinfo.local.branch.current.name %>'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-gh-pages');
grunt.loadNpmTasks('grunt-ngdocs');
grunt.loadNpmTasks('grunt-run');
grunt.registerTask('test', [
'jshint',
'run:jasmine'
]);
grunt.registerTask('build', [
'clean:dist',
'test',
'ngdocs',
'run:browserify',
'uglify',
'copy:dist'
]);
grunt.registerTask('travis', [
'build',
'run:coveralls',
'gh-pages:travis'
]);
// Default task(s)
grunt.registerTask('default', ['build']);
};
|
JavaScript
| 0.000012 |
@@ -1432,16 +1432,19 @@
+ //
silent:
@@ -2855,24 +2855,46 @@
coveralls',%0A
+ 'gh-pages-clean',%0A
'gh-page
|
7c4c04aa4a8d8ef7593d503baa90b03f979ab325
|
fix decision card component test
|
frontend/tests/integration/components/decision-card-test.js
|
frontend/tests/integration/components/decision-card-test.js
|
import { expect } from 'chai';
import { context, beforeEach, describe, it } from 'mocha';
import { setupComponentTest } from 'ember-mocha';
import hbs from 'htmlbars-inline-precompile';
import { make, manualSetup } from 'ember-data-factory-guy';
let broadcast;
describe('Integration | Component | decision card', function() {
setupComponentTest('decision-card', {
integration: true
});
beforeEach(function(){
manualSetup(this.container);
broadcast = make('broadcast', {
title: 'This is the title'
});
});
it('renders', function() {
this.set('broadcast', broadcast);
this.render(hbs`{{decision-card broadcast=broadcast}}`);
expect(this.$()).to.have.length(1);
});
it('displays the title', function() {
this.set('broadcast', broadcast);
this.render(hbs`{{decision-card broadcast=broadcast}}`);
expect(this.$('#title').text().trim()).to.eq('This is the title');
});
describe('click on support button', function() {
it('turns the heart red', function() {
this.set('broadcast', broadcast);
this.render(hbs`{{decision-card broadcast=broadcast}}`);
expect(this.$('.decision-card-support-button i.icon.heart').hasClass('red')).to.be.false;
this.$('.decision-card-support-button').click();
expect(this.$('.decision-card-support-button i.icon.heart').hasClass('red')).to.be.true;
});
it('saves the response on the broadcast', function() {
this.set('broadcast', broadcast);
this.render(hbs`{{decision-card broadcast=broadcast}}`);
expect(broadcast.get('response')).to.be.undefined;
this.$('.decision-card-support-button').click();
expect(broadcast.get('response')).to.eq('positive');
});
it('calls respondAction and returns the broadcast, if respondAction given', function(done) {
let broadcast = make('broadcast', {
title: 'this title is to be expected'
});
this.set('broadcast', broadcast);
this.set('callback', function(broadcast) {
expect(broadcast.get('title')).to.eq('this title is to be expected');
done();
});
this.render(hbs`{{decision-card broadcast=broadcast respondAction=callback}}`);
this.$('.decision-card-support-button').click();
});
context('broadcast is already supported', function() {
beforeEach(function(){
make('selection', {
broadcast: broadcast,
response: 'positive'
});
});
it('turns the heart grey', function() {
this.set('broadcast', broadcast);
this.render(hbs`{{decision-card broadcast=broadcast}}`);
expect(this.$('.decision-card-support-button i.icon.heart').hasClass('red')).to.be.true;
this.$('.decision-card-support-button').click();
expect(this.$('.decision-card-support-button i.icon.heart').hasClass('red')).to.be.false;
});
it('toggles the response on the broadcast', function() {
this.set('broadcast', broadcast);
this.render(hbs`{{decision-card broadcast=broadcast}}`);
expect(broadcast.get('response')).to.eq('positive');
this.$('.decision-card-support-button').click();
expect(broadcast.get('response')).to.eq('neutral');
});
});
});
});
|
JavaScript
| 0 |
@@ -868,9 +868,9 @@
.$('
-#
+.
titl
|
7ef5d32cc313398c3933625a5b3029ddd9dc26a9
|
Update Gruntfile.js for unit tests #30
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Task Configuration
clean: {
dist: ['dist']
},
jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
src: {
src: ['src/**/*.js']
},
//test: {
// src: ['test/**/*.js']
//}
},
concat: {
//options: {
// separator: ';',
//},
dist: {
src: [
'src/snippet/header.js',
'src/init.js',
'src/scheduler/timer.js',
'src/scheduler/autorun.js',
'src/scheduler/scope.js',
'src/scheduler/drainqueue.js',
'src/model/core/query.js',
'src/model/core/base.js',
'src/model/core/bound.js',
'src/model/core/async.js',
'src/model/core/collection.js',
'src/model/fancy/sync.js',
'src/model/fancy/ajax.js',
'src/model/fancy/localstorage.js',
'src/model/fancy/location.js',
'src/model/fancy/localstoragecoll.js',
'src/dom/template/init.js',
'src/dom/template/render.js',
'src/dom/view/hash.js',
'src/dom/view/base.js',
'src/dom/view/render.js',
'src/dom/view/create.js',
'src/export.js',
//'src/ext/bbsupport.js' if backbone else None,
'src/snippet/footer.js'
],
dest: 'dist/<%= pkg.name %>.js',
},
},
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
src: 'js/<%= pkg.name %>.js',
dest: 'dist/js/<%= pkg.name %>.min.js'
}
},
qunit: {
files: ['js/tests/*.html']
},
connect: {
server: {
options: {
keepalive: true,
port: 3000,
}
}
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-recess');
// Default task(s).
grunt.registerTask('default', ['clean', 'jshint', 'qunit', 'concat', 'uglify']);
grunt.registerTask('server', ['default', 'connect']);
};
|
JavaScript
| 0 |
@@ -1399,18 +1399,16 @@
-//
'src/ext
@@ -1425,30 +1425,8 @@
.js'
- if backbone else None
,%0A
@@ -1597,16 +1597,35 @@
e %25%3E %3C%25=
+ pkg.version %25%3E %3C%25=
grunt.t
@@ -1699,18 +1699,20 @@
src: '
-js
+dist
/%3C%25= pkg
@@ -1745,19 +1745,16 @@
: 'dist/
-js/
%3C%25= pkg.
@@ -1817,18 +1817,25 @@
: %5B'
-js/
test
-s/*
+/static/index
.htm
@@ -2415,22 +2415,22 @@
', '
-qunit', 'conca
+concat', 'quni
t',
|
51899cc779bbfa534f8dbf62018fe21f7fb429f7
|
Change the comparison tests to run Narcissus as the last one.
|
test/compare.js
|
test/compare.js
|
/*jslint browser: true */
function runBenchmarks() {
'use strict';
var index = 0,
totalSize = 0,
totalTime = 0,
fixture;
fixture = [
'esprima jquery-1.7.1',
'narcissus jquery-1.7.1',
'parsejs jquery-1.7.1',
'zeparser jquery-1.7.1',
'esprima prototype-1.7.0.0',
'narcissus prototype-1.7.0.0',
'parsejs prototype-1.7.0.0',
'zeparser prototype-1.7.0.0',
'esprima mootools-1.4.1',
'narcissus mootools-1.4.1',
'parsejs mootools-1.4.1',
'zeparser mootools-1.4.1',
'esprima ext-core-3.1.0',
'narcissus ext-core-3.1.0',
'parsejs ext-core-3.1.0',
'zeparser ext-core-3.1.0'
];
totalTime = {
'esprima': 0,
'narcissus': 0,
'parsejs': 0,
'zeparser': 0
};
function showVersion() {
var el = document.getElementById('benchmarkjs-version');
el.textContent = ' version ' + window.Benchmark.version;
el = document.getElementById('version');
el.textContent = window.esprima.version;
}
function showStatus(parser, name) {
var el = document.getElementById(parser + '-' + name);
el.textContent = 'Running...';
}
function finish() {
var el = document.getElementById('status');
el.textContent = 'Completed.';
el = document.getElementById('total-size');
el.textContent = (totalSize / 1024).toFixed(1);
el = document.getElementById('esprima-time');
el.textContent = (1000 * totalTime.esprima).toFixed(1) + ' ms';
el = document.getElementById('narcissus-time');
if (totalTime.narcissus > 0) {
el.textContent = (1000 * totalTime.narcissus).toFixed(1) + ' ms';
}
el = document.getElementById('parsejs-time');
el.textContent = (1000 * totalTime.parsejs).toFixed(1) + ' ms';
el = document.getElementById('zeparser-time');
el.textContent = (1000 * totalTime.zeparser).toFixed(1) + ' ms';
}
function showResult(parser, name, size, stats) {
var el;
el = document.getElementById(name + '-size');
el.textContent = (size / 1024).toFixed(1);
el = document.getElementById(parser + '-' + name);
if (stats.size === 0) {
el.textContent = 'N/A';
} else {
el.textContent = (1000 * stats.mean).toFixed(1) + ' ms';
}
}
function runBenchmark() {
var test, source, parser, fn, benchmark;
if (index >= fixture.length) {
finish();
return;
}
test = fixture[index].split(' ');
parser = test[0];
test = test[1];
if (!document.getElementById(test)) {
throw 'Unknown text fixture ' + test;
}
source = document.getElementById(test).textContent;
showStatus(parser, test);
// Force the result to be held in this array, thus defeating any
// possible "dead core elimination" optimization.
window.tree = [];
switch (parser) {
case 'esprima':
fn = function () {
var syntax = window.esprima.parse(source);
window.tree.push(syntax.body.length);
};
break;
case 'narcissus':
fn = function () {
var syntax = window.Narcissus.parser.parse(source);
window.tree.push(syntax.children.length);
};
break;
case 'parsejs':
fn = function () {
var syntax = window.parseJS.parse(source);
window.tree.push(syntax.length);
};
break;
case 'zeparser':
fn = function () {
var syntax = window.ZeParser.parse(source, false);
window.tree.push(syntax.length);
};
break;
default:
throw 'Unknown parser type ' + parser;
}
benchmark = new window.Benchmark(test, fn, {
'onComplete': function () {
showResult(parser, this.name, source.length, this.stats);
totalSize += source.length;
totalTime[parser] += this.stats.mean;
}
});
window.setTimeout(function () {
benchmark.run();
index += 1;
window.setTimeout(runBenchmark, 211);
}, 211);
}
showVersion();
window.setTimeout(runBenchmark, 211);
}
|
JavaScript
| 0 |
@@ -200,42 +200,8 @@
1',%0A
- 'narcissus jquery-1.7.1',%0A
@@ -256,24 +256,58 @@
uery-1.7.1',
+%0A 'narcissus jquery-1.7.1',
%0A%0A 'e
@@ -337,47 +337,8 @@
0',%0A
- 'narcissus prototype-1.7.0.0',%0A
@@ -407,16 +407,55 @@
.7.0.0',
+%0A 'narcissus prototype-1.7.0.0',
%0A%0A
@@ -486,44 +486,8 @@
1',%0A
- 'narcissus mootools-1.4.1',%0A
@@ -546,24 +546,60 @@
ools-1.4.1',
+%0A 'narcissus mootools-1.4.1',
%0A%0A 'e
@@ -626,44 +626,8 @@
0',%0A
- 'narcissus ext-core-3.1.0',%0A
@@ -689,16 +689,52 @@
e-3.1.0'
+,%0A 'narcissus ext-core-3.1.0'
%0A %5D;%0A
|
3a9b4b82af54f31e7d65b5ec287b1abfc2d35adf
|
Enable karma in dist taks
|
Gruntfile.js
|
Gruntfile.js
|
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-karma');
grunt.loadNpmTasks('grunt-ng-annotate');
grunt.registerTask('default', ['jshint', 'concat:dev']);
grunt.registerTask('dist', ['jshint'/*, 'karma:dist'*/, 'concat:dist', 'ngAnnotate:dist', 'uglify:dist', 'clean']);
grunt.registerTask('test', ['jshint', 'concat:dev', 'karma:dev']);
grunt.initConfig({
concat: {
dev: {
src: ['src/*.js', 'src/**/*.js'],
dest: 'dist/angular-sharepoint.js'
},
dist: {
src: ['src/*.js', 'src/**/*.js'],
dest: 'tmp/concat.js'
}
},
jshint: {
default: ['src/*.js', 'src/**/*.js']
},
ngAnnotate: {
dist: {
files: {
'dist/angular-sharepoint.js': ['tmp/concat.js']
}
}
},
uglify: {
dist: {
compress: true,
files: {
'dist/angular-sharepoint.min.js': ['dist/angular-sharepoint.js']
}
}
},
karma: {
options: {
frameworks: ['jasmine'],
files: ['src/**/*.spec.js'],
singleRun: true
},
dev: {
browsers: ['Chrome']
},
dist: {
browsers: ['PhantomJS']
}
},
clean: [
'tmp/'
]
});
};
|
JavaScript
| 0.000001 |
@@ -381,18 +381,16 @@
'jshint'
-/*
, 'karma
@@ -395,18 +395,16 @@
ma:dist'
-*/
, 'conca
|
f7bcdd9e4ad48a50634fd136da1937f29ef3ff06
|
assert the final report
|
Gruntfile.js
|
Gruntfile.js
|
/*
* grunt-cucumberjs
* https://github.com/mavdi/cucumberjs
*
* Copyright (c) 2013 Mehdi Avdi
* Licensed under the MIT license.
*/
'use strict';
var report = require('./test/assert/assertReport');
module.exports = function(grunt) {
var options = {
templateDir: 'templates/bootstrap',
output: 'test/report/features_report.html',
theme: 'bootstrap',
debug: true,
reportSuiteAsScenarios: true
};
function assertReport() {
report.assert(options.output);
}
function setParallelMode() {
options.executeParallel = true;
options.parallel = 'scenarios';
return options;
}
function setSingleFormatter() {
options.format = 'html';
return options;
}
function setMultiFormatter() {
options.formats = ['html', 'pretty'];
return options;
}
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js',
'package.json',
'tasks/*.js',
'features/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
// Before generating any new files, remove any previously-created files.
clean: {
tests: ['test/report/*.json', 'test/report/*.html', 'test/report/screenshot/*.png']
},
// Configuration to be run (and then tested).
cucumberjs: {
options: options,
src: ['test/features']
},
jsbeautifier: {
src: ['<%= jshint.all %>']
}
});
// Actually load this plugin's task(s).
grunt.loadTasks('tasks');
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.registerTask('assertReport', assertReport);
grunt.registerTask('setSingleFormatter', setSingleFormatter);
grunt.registerTask('setMultiFormatter', setMultiFormatter);
grunt.registerTask('setParallelMode', setParallelMode);
grunt.registerTask('testSingleFormatter', ['clean', 'setSingleFormatter', 'cucumberjs', 'assertReport']);
grunt.registerTask('testMultiFormatter', ['clean', 'setMultiFormatter', 'cucumberjs', 'assertReport']);
grunt.registerTask('testParallelMode', ['clean', 'setParallelMode', 'cucumberjs', 'assertReport']);
// By default, lint and run all tests.
grunt.registerTask('default', ['jshint', 'jsbeautifier', 'testSingleFormatter', 'testMultiFormatter', 'testParallelMode']);
};
|
JavaScript
| 0.999987 |
@@ -149,17 +149,23 @@
t';%0Avar
-r
+assertR
eport =
@@ -462,22 +462,22 @@
unction
-assert
+verify
Report()
@@ -483,25 +483,31 @@
) %7B%0A
-r
+assertR
eport.assert
@@ -1951,22 +1951,22 @@
eport',
-assert
+verify
Report);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.