Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,5 @@
"engines": {
"node": ">=10.0.0"
},
"version": "0.16.1"
"version": "0.17.0"
}
3 changes: 2 additions & 1 deletion src/client/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,8 @@ class Editor extends DataComponent {

window.addEventListener('beforeunload', (event) => {
const isDevMode = NODE_ENV != 'production';
const shouldWarnUser = this.data.document.initiated() && !isDevMode; // dev mode blacklisted so livereload works (for productivity)
const isDemo = doc.secret() === DEMO_SECRET;
const shouldWarnUser = this.data.document.initiated() && !isDemo && !isDevMode; // dev mode blacklisted so livereload works (for productivity)

if (shouldWarnUser) {
event.preventDefault();
Expand Down
4 changes: 2 additions & 2 deletions src/client/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ class Home extends Component {
h('p', [
`All Biofactoid data is made `,
h('a.plain-link', { target: '_blank', href: 'https://github.com/PathwayCommons/factoid/blob/unstable/README.md#getting-the-data' }, `freely available to download`),
` to the research community, and licensed under `,
h('a.plain-link', { target: '_blank', href: 'https://creativecommons.org/publicdomain/zero/1.0/legalcode' }, `CC0`),
` to the research community under a public domain-equivalent license `,
h('a.plain-link', { target: '_blank', href: 'https://creativecommons.org/publicdomain/zero/1.0/legalcode' }, `(Creative Commons CC0 license)`),
`.`
]),
h('p', [
Expand Down
3 changes: 3 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,6 @@ export const NO_ABSTRACT_HANDLING = env('NO_ABSTRACT_HANDLING', 'text');
export const MIN_SEMANTIC_SCORE = env('MIN_SEMANTIC_SCORE', 0.47);
export const SEMANTIC_SEARCH_LIMIT = env('SEMANTIC_SEARCH_LIMIT', 30);
export const MIN_RELATED_PAPERS = env('MIN_RELATED_PAPERS', 6);

// google analytics
export const GA_ID = env('GA_ID', 'UA-43341809-12');
10 changes: 7 additions & 3 deletions src/server/routes/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import express from 'express';
import { generateSitemap, getDocumentJson } from './api/document';
import { TWITTER_ACCOUNT_NAME, BASE_URL, EMAIL_ADDRESS_INFO } from '../../config';
import { TWITTER_ACCOUNT_NAME, BASE_URL, EMAIL_ADDRESS_INFO, NODE_ENV, GA_ID } from '../../config';

const http = express.Router();

Expand All @@ -10,7 +10,9 @@ const getDocumentPage = function(req, res) {
.then(document => res.render('index.html.ejs', {
document,
TWITTER_ACCOUNT_NAME,
BASE_URL
BASE_URL,
NODE_ENV,
GA_ID
}))
.catch( () => res.render( '404', { EMAIL_ADDRESS_INFO } ) )
);
Expand All @@ -36,7 +38,9 @@ http.get('/document/:id', getDocumentPage);
http.get('*', function(req, res) {
res.render('index.html.ejs', {
TWITTER_ACCOUNT_NAME,
BASE_URL
BASE_URL,
NODE_ENV,
GA_ID
});
});

Expand Down
14 changes: 14 additions & 0 deletions src/views/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@
<i class="icon icon-spinner"></i>
</span>
</div>

<% if (NODE_ENV === 'production') { %>
<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', '<%= GA_ID %>', 'auto');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<% } %>
</body>

</html>