Skip to content

Commit

Permalink
Version 1.0.0 adding new features
Browse files Browse the repository at this point in the history
  • Loading branch information
BenSouchet committed Apr 8, 2022
1 parent f61b8da commit b485aa3
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 66 deletions.
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,21 @@ Now you have two options: the **script with a User Interface** *(like a true sof
> python3 cw-wizard.py -h
```
```text
usage: CW Wizard [-h] [-v] -w wantlist_URLS [wantlist_URLS ...] [-m MAX_SELLERS] [-c]
usage: CW Wizard [-h] [-v] -u WANTLIST_URLS [WANTLIST_URLS ...] [-m MAX_SELLERS] [-w] [-c]
CW Wizard, Find the best bundles for the cards in your wantlist(s).
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-w wantlist_URLS [wantlist_URLS ...], --wantlist-urls wantlist_URLS [wantlist_URLS ...]
-u WANTLIST_URLS [WANTLIST_URLS ...], --wantlist-urls WANTLIST_URLS [WANTLIST_URLS ...]
wantlist url(s) (if you pass multiples whislists, separate them with spaces)
-m MAX_SELLERS, --max-sellers MAX_SELLERS
maximum number of sellers to display on the result page
-c, --continue-on-error
-w, --continue-on-warning
if specified the script will continue on non fatal errors
-c, --articles-comment
if specified the sellers comments will be added to the result page
```

As you can see, you can call the script with one or more wantlist urls, and there is optional arguments available ([info on script arguments](https://github.com/BenSouchet/cw-wizard/blob/main/README.md#script-arguments)).
Expand All @@ -79,9 +81,20 @@ With the command line version of the script you can use the following arguments:
|:-------------:|:-----------:|:--------:|
| `-v` *OR* `--version` | Display the version number of the script in your terminal | No |
| `-h` *OR* `--help` | Display the help in your terminal | No |
| `-w` *OR* `--wantlist_urls` | One or more Cardmarket wantlists (wantlists) urls.<br />If you add multiple urls simply put a space between then (not a comma). | **Yes** |
| `-m` *OR* `--max_sellers` | The maximum number of sellers to display on the result page.<br />Default value `20`. `0` means display all. | No |
| `-c` *OR* `--continue_on_error` | Whatever to stop on non fatal requests errors.<br />Default value `False`. | No |
| `-u` *OR* `--wantlist-urls` | One or more Cardmarket wantlists (wantlists) urls.<br />If you add multiple urls simply put a space between then (not a comma). | **Yes** |
| `-m` *OR* `--max-sellers` | The maximum number of sellers to display on the result page.<br />Default value `20`. `0` means display all. | No |
| `-w` *OR* `--continue-on-warning` | If specified the script won't stop on non fatal requests errors. | No |
| `-c` *OR* `--articles-comment` |If specified the script will retrieve and add sellers comments to the result page. | No |

## Version
Current version is `1.0.0`, you can download this latest release on the Releases category (on the sidebar), from [this page](https://github.com/BenSouchet/cw-wizard/releases) or `git clone` the `main` branch of the repository.

### Latest Version Changelog
- Handle more than the 50 first articles for the card pages (see function [`load_more_articles()`]()).
- Skip article and sellers that doesn't ship to your address.
- Extract and display sellers comments for articles (if script argument `-c` is specified).
- Add number or sales of the current seller when you display the cards list.
- Minors code simplification.

## Sorting Relevant Sellers
Currently the most relevant sellers are the ones with the most cards you are looking for in your wantlists.
Expand Down
24 changes: 21 additions & 3 deletions assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,18 @@ a.seller-name:focus {
}
#popup-header {
display: grid;
grid-template-columns: 1fr auto;
grid-template-columns: auto 1fr auto;
place-items: start;
gap: .8rem;
padding-top: .2rem;
}
#popup-header .close-popup {
line-height: 1em;
}
.card-item {
width: 100%;
display: grid;
grid-template-columns: 34px 24px 1fr 66px 1px;/* Last column for the scrollbar */
grid-template-columns: 34px 24px auto 1fr 66px 1px;/* Last column for the scrollbar */
place-items: center start;
gap: 0.8rem;
padding: 2px 8px;
Expand Down Expand Up @@ -311,20 +316,33 @@ a.seller-name:focus {
.card-item span:last-of-type {
justify-self: end;
}
.card-item .card-comment {
font-size: 0.9em;
color: #a58155;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}
#list-header {
margin-top: .8rem;
font-weight: 500;
padding-bottom: .4rem;
}
#popup-seller-name {
font-size: 1.4rem;
line-height: 1.3em;
align-self: end;
}
#popup-seller-sales-number {
align-self: end;
}
#cards-list {
display: grid;
grid-auto-flow: row;
overflow-y: scroll;
color: #d3a164;
height: calc(100vh - 116px);/* Yes, this an hardcoded value. Bad. Bad. Bad...*/
max-height: calc(100vh - 116px);/* Yes, this an hardcoded value. Bad. Bad. Bad...*/
}
#outside-popup {
position: fixed;
Expand Down
9 changes: 8 additions & 1 deletion assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ function showCardsList(seller_id) {
seller_link_popup_tag.href = seller_link_tag.href
seller_link_popup_tag.innerText = seller_link_tag.innerText;

var seller_sales_number_tag = document.getElementById("seller-"+seller_id+"-sales-number");
var seller_sales_popup_tag = document.getElementById("popup-seller-sales-number");
if (!seller_sales_popup_tag) { return false; }
seller_sales_popup_tag.innerText = '('+ seller_sales_number_tag.innerText + ' Sales)';

// Step 4: Block overflow body
var body = document.querySelector("body");
body.style.overflow = "hidden";
Expand All @@ -38,4 +43,6 @@ function closePopup() {
// Step 2: Block overflow body
var body = document.querySelector("body");
body.style.overflow = "auto";
}

return false;
}
8 changes: 4 additions & 4 deletions assets/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ <h4>Easily find the sellers with the most cards you are looking for!</h4>
</header>
<main id="main-content" role="main">
<div id="wantlists" class="container">
<h3>wantlist(s) you give to the Wizard:</h3>
<h3>Wantlist(s) you give to the Wizard:</h3>
<div id="wantlist-links" class="grid-items">
</div>
</div>
Expand All @@ -30,12 +30,12 @@ <h2>Most Relevant Sellers (<span id="max-sellers-value"></span>):</h2>
</div>
<div id="popup-container" class="hidden">
<div id="popup-modal">
<div id="popup-header"><a href="#" id="popup-seller-name" class="seller-name" target="_blank" rel="noopener noreferrer"></a><a href="#" onclick="closePopup(); return false;" title="Close the popup.">Close</a></div>
<div id="list-header" class="card-item"><span></span><span></span><span>Card Name</span><span>Price</span></div>
<div id="popup-header"><a href="#" id="popup-seller-name" class="seller-name" target="_blank" rel="noopener noreferrer"></a><span id="popup-seller-sales-number"></span><a class="close-popup" href="#" onclick="closePopup();" title="Close the popup.">Close</a></div>
<div id="list-header" class="card-item"><span></span><span></span><span>Card Name</span><span></span><span>Price</span></div>
<div id="cards-list">
</div>
</div>
<a href="#" id="outside-popup" onclick="closePopup(); return false;"></a>
<a href="#" id="outside-popup" onclick="closePopup();"></a>
</div>
</main>
<script src="./assets/js/main.js"></script>
Expand Down
Loading

0 comments on commit b485aa3

Please sign in to comment.