Added difference ignore button
This commit is contained in:
parent
1e63498fa3
commit
cb9e277718
@ -12,7 +12,7 @@ import (
|
|||||||
"github.com/animenotifier/notify.moe/utils"
|
"github.com/animenotifier/notify.moe/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
const maxCompareMALEntries = 20
|
const maxCompareMALEntries = 10
|
||||||
|
|
||||||
// CompareMAL ...
|
// CompareMAL ...
|
||||||
func CompareMAL(ctx *aero.Context) string {
|
func CompareMAL(ctx *aero.Context) string {
|
||||||
@ -66,8 +66,9 @@ func CompareMAL(ctx *aero.Context) string {
|
|||||||
|
|
||||||
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "CanonicalTitle", hash) {
|
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "CanonicalTitle", hash) {
|
||||||
differences = append(differences, &animediff.CanonicalTitle{
|
differences = append(differences, &animediff.CanonicalTitle{
|
||||||
TitleA: anime.Title.Canonical,
|
TitleA: anime.Title.Canonical,
|
||||||
TitleB: malAnime.Title,
|
TitleB: malAnime.Title,
|
||||||
|
NumericHash: hash,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,8 +79,9 @@ func CompareMAL(ctx *aero.Context) string {
|
|||||||
|
|
||||||
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "JapaneseTitle", hash) {
|
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "JapaneseTitle", hash) {
|
||||||
differences = append(differences, &animediff.JapaneseTitle{
|
differences = append(differences, &animediff.JapaneseTitle{
|
||||||
TitleA: anime.Title.Japanese,
|
TitleA: anime.Title.Japanese,
|
||||||
TitleB: malAnime.JapaneseTitle,
|
TitleB: malAnime.JapaneseTitle,
|
||||||
|
NumericHash: hash,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -90,8 +92,9 @@ func CompareMAL(ctx *aero.Context) string {
|
|||||||
|
|
||||||
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "Synopsis", hash) {
|
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "Synopsis", hash) {
|
||||||
differences = append(differences, &animediff.Synopsis{
|
differences = append(differences, &animediff.Synopsis{
|
||||||
SynopsisA: anime.Summary,
|
SynopsisA: anime.Summary,
|
||||||
SynopsisB: malAnime.Synopsis,
|
SynopsisB: malAnime.Synopsis,
|
||||||
|
NumericHash: hash,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,8 +106,9 @@ func CompareMAL(ctx *aero.Context) string {
|
|||||||
if hashA != hashB {
|
if hashA != hashB {
|
||||||
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "Genres", hashB) {
|
if !arn.IsAnimeDifferenceIgnored(anime.ID, "mal", malAnime.ID, "Genres", hashB) {
|
||||||
differences = append(differences, &animediff.Genres{
|
differences = append(differences, &animediff.Genres{
|
||||||
GenresA: anime.Genres,
|
GenresA: anime.Genres,
|
||||||
GenresB: malAnime.Genres,
|
GenresB: malAnime.Genres,
|
||||||
|
NumericHash: hashB,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,12 @@ component CompareMAL(comparisons []*utils.MALComparison, url string, user *arn.U
|
|||||||
.data-comparison-differences
|
.data-comparison-differences
|
||||||
each difference in comparison.Differences
|
each difference in comparison.Differences
|
||||||
.data-comparison-difference
|
.data-comparison-difference
|
||||||
.data-comparison-difference-title= difference.Explanation()
|
.data-comparison-difference-title
|
||||||
|
span= difference.Explanation()
|
||||||
|
|
||||||
.data-comparison-difference-details
|
.data-comparison-difference-details
|
||||||
.data-comparison-difference-detail= difference.DetailsA()
|
.data-comparison-difference-detail= difference.DetailsA()
|
||||||
.data-comparison-difference-detail= difference.DetailsB()
|
.data-comparison-difference-detail= difference.DetailsB()
|
||||||
|
|
||||||
|
button.data-comparison-difference-ignore.action(data-action="newAnimeDiffIgnore", data-trigger="click", data-id=arn.CreateDifferenceID(comparison.Anime.ID, "mal", comparison.MALAnime.ID, difference.Type()), data-hash=difference.Hash())
|
||||||
|
RawIcon("trash")
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
.data-comparison-difference
|
.data-comparison-difference
|
||||||
vertical
|
vertical
|
||||||
ui-element
|
ui-element
|
||||||
|
position relative
|
||||||
padding 0.5rem 0.75rem
|
padding 0.5rem 0.75rem
|
||||||
margin-bottom 0.5rem
|
margin-bottom 0.5rem
|
||||||
|
|
||||||
@ -48,3 +49,14 @@
|
|||||||
.data-comparison-difference-detail
|
.data-comparison-difference-detail
|
||||||
flex 1
|
flex 1
|
||||||
padding 0.5rem 0.75rem
|
padding 0.5rem 0.75rem
|
||||||
|
|
||||||
|
.data-comparison-difference-ignore
|
||||||
|
position absolute
|
||||||
|
top 0.5rem
|
||||||
|
right 0.5rem
|
||||||
|
width 30px
|
||||||
|
height 30px
|
||||||
|
padding 0
|
||||||
|
display flex
|
||||||
|
justify-content center
|
||||||
|
align-items center
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
export * from "./Actions/AnimeList"
|
export * from "./Actions/AnimeList"
|
||||||
export * from "./Actions/Diff"
|
export * from "./Actions/Diff"
|
||||||
|
export * from "./Actions/Editor"
|
||||||
export * from "./Actions/Explore"
|
export * from "./Actions/Explore"
|
||||||
export * from "./Actions/FollowUser"
|
export * from "./Actions/FollowUser"
|
||||||
export * from "./Actions/Forum"
|
export * from "./Actions/Forum"
|
||||||
|
20
scripts/Actions/Editor.ts
Normal file
20
scripts/Actions/Editor.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { AnimeNotifier } from "../AnimeNotifier"
|
||||||
|
|
||||||
|
// newAnimeDiffIgnore
|
||||||
|
export function newAnimeDiffIgnore(arn: AnimeNotifier, button: HTMLButtonElement) {
|
||||||
|
if(!confirm("Are you sure you want to permanently ignore this difference?")) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let id = button.dataset.id
|
||||||
|
let hash = button.dataset.hash
|
||||||
|
|
||||||
|
arn.post(`/api/new/ignoreanimedifference`, {
|
||||||
|
id,
|
||||||
|
hash
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
arn.reloadContent()
|
||||||
|
})
|
||||||
|
.catch(err => arn.statusMessage.showError(err))
|
||||||
|
}
|
@ -2,8 +2,9 @@ package animediff
|
|||||||
|
|
||||||
// CanonicalTitle describes differing titles.
|
// CanonicalTitle describes differing titles.
|
||||||
type CanonicalTitle struct {
|
type CanonicalTitle struct {
|
||||||
TitleA string
|
TitleA string
|
||||||
TitleB string
|
TitleB string
|
||||||
|
NumericHash uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns the diff type.
|
// Type returns the diff type.
|
||||||
@ -25,3 +26,8 @@ func (diff *CanonicalTitle) DetailsA() string {
|
|||||||
func (diff *CanonicalTitle) DetailsB() string {
|
func (diff *CanonicalTitle) DetailsB() string {
|
||||||
return diff.TitleB
|
return diff.TitleB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hash returns the hash for the suggested value (from anime B).
|
||||||
|
func (diff *CanonicalTitle) Hash() uint64 {
|
||||||
|
return diff.NumericHash
|
||||||
|
}
|
||||||
|
@ -4,8 +4,9 @@ import "strings"
|
|||||||
|
|
||||||
// Genres describes differing genres.
|
// Genres describes differing genres.
|
||||||
type Genres struct {
|
type Genres struct {
|
||||||
GenresA []string
|
GenresA []string
|
||||||
GenresB []string
|
GenresB []string
|
||||||
|
NumericHash uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns the diff type.
|
// Type returns the diff type.
|
||||||
@ -27,3 +28,8 @@ func (diff *Genres) DetailsA() string {
|
|||||||
func (diff *Genres) DetailsB() string {
|
func (diff *Genres) DetailsB() string {
|
||||||
return strings.Join(diff.GenresB, ", ")
|
return strings.Join(diff.GenresB, ", ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hash returns the hash for the suggested value (from anime B).
|
||||||
|
func (diff *Genres) Hash() uint64 {
|
||||||
|
return diff.NumericHash
|
||||||
|
}
|
||||||
|
@ -6,4 +6,5 @@ type Difference interface {
|
|||||||
Explanation() string
|
Explanation() string
|
||||||
DetailsA() string
|
DetailsA() string
|
||||||
DetailsB() string
|
DetailsB() string
|
||||||
|
Hash() uint64
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,9 @@ package animediff
|
|||||||
|
|
||||||
// JapaneseTitle describes differing Japanese titles.
|
// JapaneseTitle describes differing Japanese titles.
|
||||||
type JapaneseTitle struct {
|
type JapaneseTitle struct {
|
||||||
TitleA string
|
TitleA string
|
||||||
TitleB string
|
TitleB string
|
||||||
|
NumericHash uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns the diff type.
|
// Type returns the diff type.
|
||||||
@ -25,3 +26,8 @@ func (diff *JapaneseTitle) DetailsA() string {
|
|||||||
func (diff *JapaneseTitle) DetailsB() string {
|
func (diff *JapaneseTitle) DetailsB() string {
|
||||||
return diff.TitleB
|
return diff.TitleB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hash returns the hash for the suggested value (from anime B).
|
||||||
|
func (diff *JapaneseTitle) Hash() uint64 {
|
||||||
|
return diff.NumericHash
|
||||||
|
}
|
||||||
|
@ -2,8 +2,9 @@ package animediff
|
|||||||
|
|
||||||
// Synopsis describes differing synopsis.
|
// Synopsis describes differing synopsis.
|
||||||
type Synopsis struct {
|
type Synopsis struct {
|
||||||
SynopsisA string
|
SynopsisA string
|
||||||
SynopsisB string
|
SynopsisB string
|
||||||
|
NumericHash uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns the diff type.
|
// Type returns the diff type.
|
||||||
@ -25,3 +26,8 @@ func (diff *Synopsis) DetailsA() string {
|
|||||||
func (diff *Synopsis) DetailsB() string {
|
func (diff *Synopsis) DetailsB() string {
|
||||||
return diff.SynopsisB
|
return diff.SynopsisB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hash returns the hash for the suggested value (from anime B).
|
||||||
|
func (diff *Synopsis) Hash() uint64 {
|
||||||
|
return diff.NumericHash
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user