Skip to content

Commit

Permalink
API補記
Browse files Browse the repository at this point in the history
  • Loading branch information
X-20A committed Nov 11, 2024
1 parent 2111f51 commit 71e06ed
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# x-20a

主に艦これ関連のツール群です

## 羅針盤シミュ\([/compass](https://x-20a.github.io/compass/)\)

URLパラメータでの編成読み込みに対応しています

**predeck: デッキビルダー形式で読み込み**

```
const deck = {version:4,hqlv:120,f1:{s1:...};
const deck_string = JSON.stringify(deck);
const encoded_deck = encodeURIComponent(deck_string);
window.open(`https://x-20a.github.io/compass/?predeck=${encoded_deck}`, '_blank');
```
**pdz: デッキビルダー形式(圧縮)で読み込み**

Vivaldi等一部のブラウザではURLが長すぎるとURI too longエラーが発生するようです
これはパラメータを圧縮することで回避できます
圧縮には lz-string > compressToEncodedURIComponent を使用してください
```
const deck = {version:4,hqlv:120,f1:{s1:...};
const deck_string = JSON.stringify(deck);
const compressed_deck = LZString.compressToEncodedURIComponent(deck_string);
const encoded_deck = encodeURIComponent(compressed_deck);
window.open(`https://x-20a.github.io/compass/?pdz=${encoded_deck}`, '_blank');
```

0 comments on commit 71e06ed

Please sign in to comment.