Improved diff
This commit is contained in:
parent
406306df37
commit
647aed0e76
@ -43,8 +43,8 @@ component AnimeList(animeList *arn.AnimeList, viewUser *arn.User, user *arn.User
|
|||||||
td.anime-list-item-name
|
td.anime-list-item-name
|
||||||
a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.Canonical
|
a.ajax(href=item.Link(animeList.User().Nick))= item.Anime().Title.Canonical
|
||||||
|
|
||||||
if user != nil && item.Status == arn.AnimeListStatusWatching && item.Anime().EpisodeByNumber(item.Episodes + 1) != nil
|
td.anime-list-item-actions
|
||||||
td.anime-list-item-actions
|
if user != nil && item.Status == arn.AnimeListStatusWatching && item.Anime().EpisodeByNumber(item.Episodes + 1) != nil
|
||||||
for _, link := range item.Anime().EpisodeByNumber(item.Episodes + 1).Links
|
for _, link := range item.Anime().EpisodeByNumber(item.Episodes + 1).Links
|
||||||
a(href=link, title="Watch episode " + toString(item.Episodes + 1) + " on twist.moe", target="_blank", rel="noopener")
|
a(href=link, title="Watch episode " + toString(item.Episodes + 1) + " on twist.moe", target="_blank", rel="noopener")
|
||||||
RawIcon("eye")
|
RawIcon("eye")
|
||||||
|
@ -152,7 +152,7 @@ export class Application {
|
|||||||
for(let i = 0; i < links.length; i++) {
|
for(let i = 0; i < links.length; i++) {
|
||||||
let link = links[i] as HTMLElement
|
let link = links[i] as HTMLElement
|
||||||
|
|
||||||
link.classList.remove(this.ajaxClass)
|
// link.classList.remove(this.ajaxClass)
|
||||||
|
|
||||||
let self = this
|
let self = this
|
||||||
link.onclick = function(e) {
|
link.onclick = function(e) {
|
||||||
|
@ -82,29 +82,35 @@ export class Diff {
|
|||||||
for(let x = 0; x < elemB.attributes.length; x++) {
|
for(let x = 0; x < elemB.attributes.length; x++) {
|
||||||
let attrib = elemB.attributes[x]
|
let attrib = elemB.attributes[x]
|
||||||
|
|
||||||
if(attrib.specified) {
|
if(!attrib.specified) {
|
||||||
// Skip mountables
|
continue
|
||||||
if(attrib.name == "class") {
|
}
|
||||||
let classesA = elemA.classList
|
|
||||||
let classesB = elemB.classList
|
|
||||||
|
|
||||||
for(let className of classesA) {
|
|
||||||
if(!classesB.contains(className) && !Diff.persistentClasses.has(className)) {
|
|
||||||
classesA.remove(className)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(let className of classesB) {
|
|
||||||
if(!classesA.contains(className)) {
|
|
||||||
classesA.add(className)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(attrib.name === "class") {
|
||||||
|
// If the class is exactly the same, skip this attribute.
|
||||||
|
if(elemA.getAttribute("class") === attrib.value) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
elemA.setAttribute(attrib.name, elemB.getAttribute(attrib.name))
|
let classesA = elemA.classList
|
||||||
|
let classesB = elemB.classList
|
||||||
|
|
||||||
|
for(let className of classesA) {
|
||||||
|
if(!classesB.contains(className) && !Diff.persistentClasses.has(className)) {
|
||||||
|
classesA.remove(className)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(let className of classesB) {
|
||||||
|
if(!classesA.contains(className)) {
|
||||||
|
classesA.add(className)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elemA.setAttribute(attrib.name, elemB.getAttribute(attrib.name))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Special case: Apply state of input elements
|
// Special case: Apply state of input elements
|
||||||
|
Loading…
Reference in New Issue
Block a user