Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import 'jquery-ui/themes/base/theme.css';
import 'jquery-ui/themes/base/autocomplete.css';
import 'jquery-ui/ui/core';
import 'jquery-ui/ui/widgets/autocomplete';
import jdenticon from 'jdenticon'
import md5 from 'md5'
import * as tw from '../twoWayBinding.js';
import '../style/style.css';
import '../style/ui.css';
import '../style/projectSettings-style.css';
import '../style/access-style.css';
import '../style/dropdown-style.css';
// Add avatar based on project's name
jdenticon.update($("svg")[0],md5(projectShortname));
// WS Autocompletion
var cb, label;
let ws;
var host = "ws://" + window.location.hostname + ":8080/";
if (window.WebSocket) {
ws = new WebSocket(host);
} else if (window.MozWebSocket) {
ws = new MozWebSocket(host);
}
ws.onopen = function(msg) {
ws.send(JSON.stringify({"type":"autocompleteClient"}));
}
ws.onmessage = function(message) {
message = JSON.parse(message.data);
if (message.type === "userNameQuery") {
drawCanvas () {
if (this.symbolsMap[this.account]) {
this.imgShow = true;
this.imgSrc = this.symbolsMap[this.account];
} else {
this.imgShow = false;
if (this.account) {
jdenticon.update(this.$refs.canvas, this.hash, 0);
} else {
let ctx = this.$refs.canvas.getContext('2d');
ctx.fillStyle = 'rgba(100, 100, 100, 0.5)';
let size = ctx.canvas.width;
ctx.clearRect(0, 0, size, size);
ctx.fillRect(0, 0, size, size);
ctx.clearRect(0 + 1, 0 + 1, size - 2, size - 2);
ctx.font = `${size}px sans-serif`;
ctx.fillText('?', size / 4, size - size / 6);
}
}
}
},