Commit f3f67b72 authored by Jacob Durrant's avatar Jacob Durrant

Update.

parent 522745ec
/**
* Webina Copyright 2019 Jacob Durrant
*
* 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.
*/
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// There are a few variables and functions from vina.js that I want to easily
// access from here.
var VERSION = "1.0.0"; // Replaced by compile script.
......@@ -21,15 +39,36 @@ var Webina = (function () {
WEBINA_BASE_URL: "./",
FS: window["FS"],
start: function start(vinaParams, receptorPDBQTTxt, ligandPDBQTTxt, onDone, onError, baseUrl) {
var _this = this;
// baseUrl = undefined; // For debugging.
var baseUrlMsg = "\nWEBINA\n======\n\n";
if (baseUrl !== undefined) {
if (baseUrl.slice(baseUrl.length - 1) !== "/") {
baseUrl += "/";
}
this.WEBINA_BASE_URL = baseUrl;
console.log("Webina: Using baseUrl = " + baseUrl);
baseUrlMsg += "User specified baseUrl: " + baseUrl + "\n";
}
else {
console.warn("Webina: No baseUrl specified, so using the main directory ./");
baseUrlMsg += "No baseUrl specified, so using ./\n\n";
baseUrlMsg += "Use Webina.start() to specify the baseUrl:\n";
baseUrlMsg += " function start(vinaParams, receptorPDBQTTxt, \n";
baseUrlMsg += " ligandPDBQTTxt, onDone, \n";
baseUrlMsg += " onError, baseUrl)\n";
}
baseUrlMsg += "\nExpecting files at the following locations:\n";
for (var i = 0; i < 5; i++) {
var fileName = ["Webina.min.js", "vina.html.mem",
"vina.min.js", "vina.worker.min.js",
"vina.wasm"][i];
baseUrlMsg += " " + (baseUrl === undefined ? "./" : baseUrl) + fileName + "\n";
}
baseUrlMsg += "\n";
if (baseUrl !== undefined) {
console.log(baseUrlMsg);
}
else {
console.warn(baseUrlMsg);
}
if (onError === undefined) {
onError = function () {
......@@ -72,11 +111,6 @@ var Webina = (function () {
"receptorPDBQTTxt": receptorPDBQTTxt,
"ligandPDBQTTxt": ligandPDBQTTxt
};
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.open("GET", memoryInitializer, !0), meminitXHR.responseType = "arraybuffer", meminitXHR.send(null);
if (vinaParams["receptor"] !== undefined) {
console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");
}
......@@ -106,9 +140,25 @@ var Webina = (function () {
}
}
window["WEBINA_Module"] = WEBINA_Module;
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.onloadend = function () {
if (meminitXHR.status === 404) {
var msg = "Unable to access " + memoryInitializer + ". See JavaScript console for warnings. The \"baseUrl\" variable passed to Webina is likely incorrect.";
WEBINA_Module["catchError"]({ "message": msg });
console.warn(msg);
}
else {
var script = document.createElement("script");
script.src = _this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
}
};
meminitXHR.open("GET", memoryInitializer, !0);
meminitXHR.responseType = "arraybuffer";
meminitXHR.send(null);
},
isDataURI: function (r) {
return String.prototype.startsWith ? r.startsWith(this.WEBINA_DATA_URI_PREFIX) : 0 === r.indexOf(this.WEBINA_DATA_URI_PREFIX);
......
This diff is collapsed.
......@@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>Webina</title>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.855da08c5d0a31c2e6e9.1.css" rel="stylesheet"><link href="styles.855da08c5d0a31c2e6e9.3.css" rel="stylesheet"></head>
<link rel="shortcut icon" href="favicon.ico"><link href="vendors.a60461f7d6b6cc0ca2d6.1.css" rel="stylesheet"><link href="styles.a60461f7d6b6cc0ca2d6.3.css" rel="stylesheet"></head>
<body>
<div id="app"></div>
......@@ -19,6 +19,6 @@
<script src="vue.min.js"></script>
<script src="vuex.min.js"></script>
<script src="bootstrap-vue.min.js"></script>
<script type="text/javascript" src="runtime.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="vendors.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="app.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="styles.855da08c5d0a31c2e6e9.js"></script><script type="text/javascript" src="styles.css.855da08c5d0a31c2e6e9.js"></script></body>
<script type="text/javascript" src="runtime.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="vendors.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="app.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="styles.a60461f7d6b6cc0ca2d6.js"></script><script type="text/javascript" src="styles.css.a60461f7d6b6cc0ca2d6.js"></script></body>
</html>
......@@ -23,3 +23,23 @@ ls dist/*.min.js | awk '{print "cat " $1 " | sed \"s/\\.js/.min.js/g\" > t; mv t
# Fix version
export WEBINA_VERSION=`cat ../Version.ts | grep VERSION | awk '{print $5}' | sed 's/"//g' | sed "s/;//g"`
grep -l "XXXXXXXXXXXXX.X" dist/* | awk '{print "cat " $1 " | sed \"s/XXXXXXXXXXXXX.X/TMPSTR/g\" > t; mv t " $1}' | sed "s/TMPSTR/${WEBINA_VERSION}/g" | bash
cd dist
echo "/**
* Webina Copyright 2019 Jacob Durrant
*
* 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.
*/" > t
ls Webina*js | awk '{print "cat t > " $1 ".tmp; cat " $1 " >> " $1 ".tmp; mv " $1 ".tmp " $1}' | bash
rm t
cd -
/**
* Webina Copyright 2019 Jacob Durrant
*
* 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.
*/
// This file is part of Webina, released under the Apache 2.0 License. See
// LICENSE.md or go to https://opensource.org/licenses/Apache-2.0 for full
// details. Copyright 2019 Jacob D. Durrant.
// There are a few variables and functions from vina.js that I want to easily
// access from here.
var VERSION = "1.0.0"; // Replaced by compile script.
......@@ -21,15 +39,36 @@ var Webina = (function () {
WEBINA_BASE_URL: "./",
FS: window["FS"],
start: function start(vinaParams, receptorPDBQTTxt, ligandPDBQTTxt, onDone, onError, baseUrl) {
var _this = this;
// baseUrl = undefined; // For debugging.
var baseUrlMsg = "\nWEBINA\n======\n\n";
if (baseUrl !== undefined) {
if (baseUrl.slice(baseUrl.length - 1) !== "/") {
baseUrl += "/";
}
this.WEBINA_BASE_URL = baseUrl;
console.log("Webina: Using baseUrl = " + baseUrl);
baseUrlMsg += "User specified baseUrl: " + baseUrl + "\n";
}
else {
console.warn("Webina: No baseUrl specified, so using the main directory ./");
baseUrlMsg += "No baseUrl specified, so using ./\n\n";
baseUrlMsg += "Use Webina.start() to specify the baseUrl:\n";
baseUrlMsg += " function start(vinaParams, receptorPDBQTTxt, \n";
baseUrlMsg += " ligandPDBQTTxt, onDone, \n";
baseUrlMsg += " onError, baseUrl)\n";
}
baseUrlMsg += "\nExpecting files at the following locations:\n";
for (var i = 0; i < 5; i++) {
var fileName = ["Webina.min.js", "vina.html.mem",
"vina.min.js", "vina.worker.min.js",
"vina.wasm"][i];
baseUrlMsg += " " + (baseUrl === undefined ? "./" : baseUrl) + fileName + "\n";
}
baseUrlMsg += "\n";
if (baseUrl !== undefined) {
console.log(baseUrlMsg);
}
else {
console.warn(baseUrlMsg);
}
if (onError === undefined) {
onError = function () {
......@@ -72,11 +111,6 @@ var Webina = (function () {
"receptorPDBQTTxt": receptorPDBQTTxt,
"ligandPDBQTTxt": ligandPDBQTTxt
};
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.open("GET", memoryInitializer, !0), meminitXHR.responseType = "arraybuffer", meminitXHR.send(null);
if (vinaParams["receptor"] !== undefined) {
console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");
}
......@@ -106,9 +140,25 @@ var Webina = (function () {
}
}
window["WEBINA_Module"] = WEBINA_Module;
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
// Initialize the memory
var memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
var meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.onloadend = function () {
if (meminitXHR.status === 404) {
var msg = "Unable to access " + memoryInitializer + ". See JavaScript console for warnings. The \"baseUrl\" variable passed to Webina is likely incorrect.";
WEBINA_Module["catchError"]({ "message": msg });
console.warn(msg);
}
else {
var script = document.createElement("script");
script.src = _this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script);
}
};
meminitXHR.open("GET", memoryInitializer, !0);
meminitXHR.responseType = "arraybuffer";
meminitXHR.send(null);
},
isDataURI: function (r) {
return String.prototype.startsWith ? r.startsWith(this.WEBINA_DATA_URI_PREFIX) : 0 === r.indexOf(this.WEBINA_DATA_URI_PREFIX);
......
This diff is collapsed.
......@@ -58,15 +58,34 @@ let Webina = (function() {
FS: window["FS"],
start: function start(vinaParams: IVinaParams, receptorPDBQTTxt: string, ligandPDBQTTxt: string, onDone?: any, onError?: any, baseUrl?: string): void {
// baseUrl = undefined; // For debugging.
let baseUrlMsg = "\nWEBINA\n======\n\n";
if (baseUrl !== undefined) {
if (baseUrl.slice(baseUrl.length - 1) !== "/") {
baseUrl += "/";
}
this.WEBINA_BASE_URL = baseUrl;
console.log("Webina: Using baseUrl = " + baseUrl);
baseUrlMsg += "User specified baseUrl: " + baseUrl + "\n";
} else {
baseUrlMsg += "No baseUrl specified, so using ./\n\n";
baseUrlMsg += "Use Webina.start() to specify the baseUrl:\n";
baseUrlMsg += " function start(vinaParams, receptorPDBQTTxt, \n"
baseUrlMsg += " ligandPDBQTTxt, onDone, \n";
baseUrlMsg += " onError, baseUrl)\n";
}
baseUrlMsg += "\nExpecting files at the following locations:\n";
for (let i = 0; i < 5; i++) {
const fileName = ["Webina.min.js", "vina.html.mem",
"vina.min.js", "vina.worker.min.js",
"vina.wasm"][i];
baseUrlMsg += " " + (baseUrl === undefined ? "./" : baseUrl) + fileName + "\n";
}
baseUrlMsg += "\n";
if (baseUrl !== undefined) {
console.log(baseUrlMsg);
} else {
console.warn("Webina: No baseUrl specified, so using the main directory ./")
console.warn(baseUrlMsg);
}
if (onError === undefined) {
......@@ -118,13 +137,6 @@ let Webina = (function() {
"ligandPDBQTTxt": ligandPDBQTTxt
};
// Initialize the memory
let memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
let meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.open("GET", memoryInitializer, !0), meminitXHR.responseType = "arraybuffer", meminitXHR.send(null);
if (vinaParams["receptor"] !== undefined) {
console.warn("Webina does not support Vina's --receptor parameter. Instead, pass the content of the receptor file as a string to the webina.start() function.");
}
......@@ -161,9 +173,27 @@ let Webina = (function() {
window["WEBINA_Module"] = WEBINA_Module;
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script)
// Initialize the memory
let memoryInitializer = this.WEBINA_BASE_URL + "vina.html.mem";
memoryInitializer = WEBINA_Module["locateFile"] ? WEBINA_Module["locateFile"](memoryInitializer, "") : memoryInitializer, WEBINA_Module["memoryInitializerRequestURL"] = memoryInitializer;
let meminitXHR = WEBINA_Module["memoryInitializerRequest"] = new XMLHttpRequest;
meminitXHR.onloadend = () => {
if (meminitXHR.status === 404) {
let msg = "Unable to access " + memoryInitializer +". See JavaScript console for warnings. The \"baseUrl\" variable passed to Webina is likely incorrect.";
WEBINA_Module["catchError"]({"message": msg});
console.warn(msg);
} else {
var script = document.createElement("script");
script.src = this.WEBINA_BASE_URL + "vina.js";
document.body.appendChild(script)
}
}
meminitXHR.open("GET", memoryInitializer, !0);
meminitXHR.responseType = "arraybuffer";
meminitXHR.send(null);
},
isDataURI: function(r) {
......
......@@ -9,5 +9,41 @@ import { VERSION } from "./Version";
console.log("Webina Web App " + VERSION);
declare var ga;
VueSetup.setup();
UI.setup();
// If the url has "durrantlab" in it, contact google analytics. Logging all
// usage would be ideal for grant reporting, but some users may wish to run
// versions of webina on their own servers specifically to maintain privacy
// (e.g., in case of proprietary data). Calls to google analytics in such
// scenarios could be alarming, even though I'm only recording basic
// demographics anyway.
if (window.location.href.indexOf("durrantlab") !== -1) {
setTimeout(() => {
// Just to make sure it isn't blocking...
(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().getTime();
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', 'UA-144382730-1', {
'name': 'webina'
});
// UA-144382730-1 reports to pcaviz account.
ga('webina.send', {
"hitType": 'event',
"eventCategory": 'webina',
"eventAction": 'pageview',
"eventLabel": window.location.href
});
}, 0)
}
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment