Removed flickering on iframes

This commit is contained in:
2017-10-16 11:53:47 +02:00
parent fb04540c29
commit 8fdeb97de9
8 changed files with 70 additions and 14 deletions

View File

@ -369,6 +369,20 @@ export function arrayRemove(arn: AnimeNotifier, element: HTMLElement) {
.catch(err => arn.statusMessage.showError(err))
}
// Load more
export function loadMore(arn: AnimeNotifier, element: HTMLElement) {
let target = arn.app.find("load-more-target")
let index = "9"
fetch("/_" + arn.app.currentPath + "/from/" + index)
.then(response => response.text())
.then(body => {
target.innerHTML += body
arn.app.emit("DOMContentLoaded")
})
.catch(err => arn.statusMessage.showError(err))
}
// Chrome extension installation
export function installExtension(arn: AnimeNotifier, button: HTMLElement) {
let browser: any = window["chrome"]

View File

@ -549,7 +549,7 @@ export class AnimeNotifier {
// Once the iframe becomes visible, load it
element["became visible"] = () => {
// If the source is already set correctly, don't set it again to avoid iframe flickering.
if(element.src !== element.dataset.src) {
if(element.src !== element.dataset.src && element.src !== (window.location.protocol + element.dataset.src)) {
element.src = element.dataset.src
}

View File

@ -91,12 +91,12 @@ export class Diff {
continue
}
if(attrib.name === "class") {
// If the class is exactly the same, skip this attribute.
if(elemA.getAttribute("class") === attrib.value) {
continue
}
// If the attribute value is exactly the same, skip this attribute.
if(elemA.getAttribute(attrib.name) === attrib.value) {
continue
}
if(attrib.name === "class") {
let classesA = elemA.classList
let classesB = elemB.classList
let removeClasses: string[] = []
@ -119,8 +119,8 @@ export class Diff {
continue
}
elemA.setAttribute(attrib.name, elemB.getAttribute(attrib.name))
elemA.setAttribute(attrib.name, attrib.value)
}
// Special case: Apply state of input elements