Skip to content

Commit

Permalink
eslint src
Browse files Browse the repository at this point in the history
  • Loading branch information
boscoh committed Sep 25, 2018
1 parent 3c791aa commit 607fde1
Show file tree
Hide file tree
Showing 19 changed files with 1,282 additions and 1,283 deletions.
308 changes: 154 additions & 154 deletions dist/jolecule.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jolecule.js.map

Large diffs are not rendered by default.

48 changes: 22 additions & 26 deletions jol-static.js
Expand Up @@ -156,9 +156,9 @@ const fullPageIndexHtmlMustache = `
`

let knownOpts = {
'out': [String, null],
'browser': [Boolean, false],
'embed': [Boolean, true]
out: [String, null],
browser: [Boolean, false],
embed: [Boolean, true]
}
let shortHands = {
o: ['--out'],
Expand All @@ -171,7 +171,6 @@ let remain = parsed.argv.remain
if (remain.length < 1) {
console.log(doc)
} else {

const pdb = remain[0]
let base = path.basename(pdb.replace('.pdb', ''))
let targetDir = path.join(path.dirname(pdb), base + '-jol')
Expand All @@ -197,7 +196,7 @@ if (remain.length < 1) {
dataServerLoadStr += `"data-server${i}"`
dataServerArgStr += `dataServer${i}`
let pdbLines = pdbText.split(/\r?\n/)
pdbLines = _.map(pdbLines, (l) => l.replace(/"/g, '\\"'))
pdbLines = _.map(pdbLines, l => l.replace(/"/g, '\\"'))
let pdbId = base
let viewsJson = pdb.replace('.pdb', '') + '.views.json'
console.log(`Checking ${viewsJson}`)
Expand All @@ -207,9 +206,11 @@ if (remain.length < 1) {
views = JSON.parse(text)
}
let viewsJsonStr = JSON.stringify(views, null, 2)
let dataJsText = mustache.render(
dataServerMustache,
{pdbId, pdbLines, viewsJsonStr})
let dataJsText = mustache.render(dataServerMustache, {
pdbId,
pdbLines,
viewsJsonStr
})
fs.writeFileSync(dataJs, dataJsText)
}

Expand All @@ -219,39 +220,34 @@ if (remain.length < 1) {
let htmlText
if (isFullPage) {
let user_nickname = 'anonymous'
htmlText = mustache.render(
fullPageIndexHtmlMustache, {
dataServerLoadStr,
dataServerArgStr,
user_nickname
})
htmlText = mustache.render(fullPageIndexHtmlMustache, {
dataServerLoadStr,
dataServerArgStr,
user_nickname
})
} else {
htmlText = mustache.render(
embedIndexHtmlMustache, {
dataServerLoadStr,
dataServerArgStr,
})
htmlText = mustache.render(embedIndexHtmlMustache, {
dataServerLoadStr,
dataServerArgStr
})
}
fs.writeFileSync(html, htmlText)

let fnames = [
'dist/jolecule.js',
'dist/jolecule.js.map',
'dist/full-page-jolecule.css',
'node_modules/requirejs/require.js']
'node_modules/requirejs/require.js'
]

for (let fname of fnames) {
fs.copySync(
path.join(__dirname, fname),
path.join(targetDir, path.basename(fname)))
path.join(targetDir, path.basename(fname))
)
}

if (!parsed.browser) {
opener(html)
}
}





4 changes: 2 additions & 2 deletions src/animation.js
Expand Up @@ -20,7 +20,7 @@
* typically MS_PER_STEP = 17
*/

function loop () {
function loop() {
requestAnimationFrame(loop)

if (window.globalWidgets === []) {
Expand All @@ -46,7 +46,7 @@ function loop () {
* run loop() as a singleton by using the global
* window space to lock one single copy of loop
*/
function registerGlobalAnimationLoop (widget) {
function registerGlobalAnimationLoop(widget) {
// only set once by checking the global window variable

if (typeof window.globalWidgets === 'undefined') {
Expand Down
50 changes: 25 additions & 25 deletions src/data.js
Expand Up @@ -66,7 +66,7 @@ for (let [k, v] of _.toPairs(ElementColors)) {
ElementColors[k] = new THREE.Color(v)
}

function getSsColor (ss) {
function getSsColor(ss) {
if (ss === 'E') {
return yellow
} else if (ss === 'H') {
Expand Down Expand Up @@ -127,26 +127,26 @@ const backboneAtomTypes = [
'HA',
'CA',
'OXT',
'C3\'',
"C3'",
'P',
'OP1',
'O5\'',
"O5'",
'OP2',
'C5\'',
'O5\'',
'O3\'',
'C4\'',
'O4\'',
'C1\'',
'C2\'',
'O2\'',
'H2\'',
'H2\'\'',
'H3\'',
'H4\'',
'H5\'',
'H5\'\'',
'HO3\''
"C5'",
"O5'",
"O3'",
"C4'",
"O4'",
"C1'",
"C2'",
"O2'",
"H2'",
"H2''",
"H3'",
"H4'",
"H5'",
"H5''",
"HO3'"
]

// Cartoon cross-sections
Expand All @@ -171,14 +171,14 @@ const fatCoilFace = new THREE.Shape([
new THREE.Vector2(+0.25, -0.25)
])

function getSsFace (ss) {
function getSsFace(ss) {
if (ss === 'C' || ss === '-') {
return coilFace
}
return ribbonFace
}

function getNucleotideBaseAtomTypes (resType) {
function getNucleotideBaseAtomTypes(resType) {
let atomTypes = []
if (resType === 'DA' || resType === 'A') {
atomTypes = ['N9', 'C8', 'N7', 'C5', 'C6', 'N1', 'C2', 'N3', 'C4']
Expand All @@ -192,16 +192,16 @@ function getNucleotideBaseAtomTypes (resType) {
return atomTypes
}

function getNucleotideConnectorBondAtomTypes (resType) {
function getNucleotideConnectorBondAtomTypes(resType) {
let bondTypes = []
if (resType === 'DA' || resType === 'A') {
bondTypes = [['C3\'', 'C2\''], ['C2\'', 'C1\''], ['C1\'', 'N9']]
bondTypes = [["C3'", "C2'"], ["C2'", "C1'"], ["C1'", 'N9']]
} else if (resType === 'DG' || resType === 'G') {
bondTypes = [['C3\'', 'C2\''], ['C2\'', 'C1\''], ['C1\'', 'N9']]
bondTypes = [["C3'", "C2'"], ["C2'", "C1'"], ["C1'", 'N9']]
} else if (resType === 'DT' || resType === 'U') {
bondTypes = [['C3\'', 'C2\''], ['C2\'', 'C1\''], ['C1\'', 'N1']]
bondTypes = [["C3'", "C2'"], ["C2'", "C1'"], ["C1'", 'N1']]
} else if (resType === 'DC' || resType === 'C') {
bondTypes = [['C3\'', 'C2\''], ['C2\'', 'C1\''], ['C1\'', 'N1']]
bondTypes = [["C3'", "C2'"], ["C2'", "C1'"], ["C1'", 'N1']]
}
return bondTypes
}
Expand Down
17 changes: 7 additions & 10 deletions src/embed-widget.js
Expand Up @@ -32,11 +32,11 @@ let defaultArgs = {
}

class EmbedJolecule {
constructor (params) {
constructor(params) {
this.params = _.cloneDeep(defaultArgs)
_.assign(this.params, params)
console.log('EmbedJolecule.constructor', this.params)
this.isProcessing = {flag: false}
this.isProcessing = { flag: false }

this.divTag = this.params.divTag
this.div = $(this.params.divTag)
Expand Down Expand Up @@ -66,7 +66,7 @@ class EmbedJolecule {
resizeFn()
}

async asyncAddDataServer (dataServer) {
async asyncAddDataServer(dataServer) {
while (this.isProcessing.flag) {
await delay(100)
}
Expand Down Expand Up @@ -121,13 +121,13 @@ class EmbedJolecule {
this.isProcessing.flag = false
}

clear () {
clear() {
while (this.soupWidget.soup.structureIds.length > 0) {
this.soupWidget.deleteStructure(0)
}
}

createDivs () {
createDivs() {
this.headerDiv = $('<div>').attr('id', `${this.divId}-sequence-widget`)

this.bodyDiv = $('<div>')
Expand Down Expand Up @@ -331,7 +331,7 @@ class EmbedJolecule {
}
}

resize () {
resize() {
this.bodyDiv.width(this.div.outerWidth())

let height = this.div.outerHeight()
Expand All @@ -348,7 +348,4 @@ class EmbedJolecule {
}
}

export {
EmbedJolecule,
defaultArgs
}
export { EmbedJolecule, defaultArgs }

0 comments on commit 607fde1

Please sign in to comment.