Skip to content

Commit

Permalink
/groups ブックマーク機構の最適化
Browse files Browse the repository at this point in the history
  • Loading branch information
hibiyahibiyahibiya committed Sep 5, 2023
1 parent c4c12eb commit c12e6f8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pages/groups/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ type Data = {
sort_displayname: string
query_cache: any
search_result_number: number
storage_bookmarks: (string | null)[]
display_bookmarks: boolean
selectedTag: Tag | undefined
}
Expand All @@ -255,6 +256,7 @@ export default Vue.extend({
search_result_number: 0,
search_query: '',
sort_displayname: 'デフォルト順',
storage_bookmarks: [],
display_bookmarks: false,
query_cache: undefined,
}
Expand Down Expand Up @@ -321,6 +323,9 @@ export default Vue.extend({
}
},
mounted() {
for (let i = 0; i < localStorage.length; i++) {
this.storage_bookmarks.push(localStorage.key(i))
}
this.nowloading = false
},
Expand All @@ -334,6 +339,7 @@ export default Vue.extend({
R = R === null ? this.$route.query.r : R
this.$router.push({ query: { q: Q, t: T, b: B, s: S, r: R } }) // nullは「現在のクエリを維持」と同義
},
SortGroups(sort: 'id' | 'groupname' | 'title') {
if (sort === 'groupname') {
this.sort_displayname = '団体名順'
Expand Down Expand Up @@ -439,13 +445,13 @@ export default Vue.extend({
FilterBookmarks(id: string) {
// お気に入りならtrue
if (this.nowloading === true) return false
for (let i = 0; i < localStorage.length; i++) {
if ('seiryofes.groups.favorite.' + id === localStorage.key(i)) {
return true
}
if (this.nowloading === true) {
return false
} else {
return this.storage_bookmarks.includes(
'seiryofes.groups.favorite.' + id
)
}
return false
},
HashColor(text: string) {
Expand Down

0 comments on commit c12e6f8

Please sign in to comment.