Prettified all files.

This commit is contained in:
2019-07-18 12:26:39 +02:00
parent 7744b92771
commit 2d400a18ec
125 changed files with 11184 additions and 8154 deletions
+11 -17
View File
@@ -1,15 +1,14 @@
import {Capabilities} from './capabilities.js'
import { Capabilities } from './capabilities.js'
export default class Index {
constructor(template, pages, notfound='thumbnails/notfound.png') {
constructor(template, pages, notfound = 'thumbnails/notfound.png') {
this.template = template
this.pages = pages
this.notfound = notfound
}
setup() {
for(let pair of this.pages) {
for (let pair of this.pages) {
let [title, src] = pair
let id = getId()
pair.push(id)
@@ -18,20 +17,18 @@ export default class Index {
wrapper.id = id
let clone = document.importNode(t.content, true)
container.appendChild(clone)
wrapper = container.querySelector('#'+id)
wrapper = container.querySelector('#' + id)
let icon = wrapper.querySelector('.icon')
icon.onerror = (e) => {
if (this.notfound)
icon.src = this.notfound
icon.onerror = e => {
if (this.notfound) icon.src = this.notfound
}
let iconSrc = src.replace('.html', '.png')
//console.log("iconSrc", iconSrc)
if (iconSrc.endsWith('index.png')) {
icon.src = iconSrc.replace('index.png', 'thumbnail.png')
}
else {
} else {
icon.src = 'thumbnails/' + iconSrc
}
@@ -44,8 +41,7 @@ export default class Index {
}
frames() {
if (this.pages.length == 0)
return
if (this.pages.length == 0) return
let [title, src, id] = this.pages.shift()
let iframe = document.createElement('iframe')
iframe.frameborder = 0
@@ -53,7 +49,7 @@ export default class Index {
let icon = wrapper.querySelector('.icon')
icon.parentNode.replaceChild(iframe, icon)
iframe.onload = (e) => {
iframe.onload = e => {
this.frames()
}
iframe.src = src + window.location.search
@@ -61,13 +57,11 @@ export default class Index {
load() {
this.setup()
if (window.location.search.startsWith('?test'))
this.frames()
if (window.location.search.startsWith('?test')) this.frames()
}
loadAndTest() {
this.setup()
if (!Capabilities.isMobile)
this.frames()
if (!Capabilities.isMobile) this.frames()
}
}