@@ -9,6 +9,7 @@ import compound from 'src/utils/compoundEvent.js';
99import hasOwn from 'src/utils/hasOwn.js' ;
1010import { cardName } from 'src/utils/cardHelper.js' ;
1111
12+ // TODO: translation
1213const setting = settings . register ( {
1314 name : 'Disable Deck Storage' ,
1415 key : 'underscript.storage.disable' ,
@@ -33,17 +34,9 @@ onPage('Decks', function deckStorage() {
3334 function getFromLibrary ( id , library = [ ] , shiny = undefined ) {
3435 return library . find ( ( card ) => card . id === id && ( shiny === undefined || card . shiny === shiny ) ) ;
3536 }
36- function getCardData ( id , shiny , deep ) {
37+ function getCardData ( id , shiny ) {
38+ // TODO: Filter out cards with insufficient quantity
3739 const library = global ( 'deckCollections' , 'collections' ) ;
38- if ( deep ) {
39- // Search all decks
40- const keys = Object . keys ( library ) ;
41- for ( let i = 0 ; i < keys . length ; i ++ ) {
42- const card = getFromLibrary ( id , library [ keys [ i ] ] , shiny ) ;
43- if ( card ) return card ;
44- }
45- return null ;
46- }
4740 return getFromLibrary ( id , library [ global ( 'soul' ) ] , shiny ) ;
4841 }
4942
@@ -113,10 +106,8 @@ onPage('Decks', function deckStorage() {
113106 const deck = JSON . parse ( localStorage . getItem ( key ) ) ;
114107 if ( ! deck ) return null ;
115108 if ( trim ) {
116- return deck . cards . filter ( ( { id, shiny } ) => {
117- const data = getCardData ( id , shiny ) ;
118- return data && cardName ( data ) ;
119- } ) ;
109+ // TODO: Filter out cards with insufficient quantity
110+ return deck . cards . filter ( ( { id, shiny } ) => getCardData ( id , shiny ) ) ;
120111 }
121112 return deck . cards ;
122113 }
@@ -147,6 +138,7 @@ onPage('Decks', function deckStorage() {
147138 function cards ( list ) {
148139 const names = [ ] ;
149140 list . forEach ( ( card ) => {
141+ // TODO: Filter out cards with insufficient quantity
150142 let data = getCardData ( card . id , card . shiny ) ;
151143 const name = data ?
152144 `<span class="${ data . rarity } ">${ cardName ( data ) } </span>` :
@@ -196,6 +188,7 @@ onPage('Decks', function deckStorage() {
196188 if ( e . type === 'mouseenter' ) {
197189 const deck = getDeck ( i ) ;
198190 fixClass ( ! ! deck ) ;
191+ // TODO: translation
199192 if ( deck ) {
200193 text = `
201194 <div id="deckName">${ localStorage . getItem ( nameKey ) || `${ soul } -${ i + 1 } ` } </div>
0 commit comments