Skip to content

Commit

Permalink
Add eBay to baskets
Browse files Browse the repository at this point in the history
  • Loading branch information
Terrance committed Dec 30, 2015
1 parent a8064c1 commit 254a73a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions Homely/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"management",
"https://www.amazon.co.uk/",
"https://www.amazon.com/",
"http://cart.payments.ebay.co.uk/",
"https://www.facebook.com/",
"https://github.com/",
"https://accounts.google.com/", "https://mail.google.com/",
Expand Down
14 changes: 11 additions & 3 deletions Homely/res/html/homely.html
Original file line number Diff line number Diff line change
Expand Up @@ -348,23 +348,31 @@ <h4 class="modal-title"><i class="fa fa-cog"></i>&nbsp; Settings</h4>
<div class="col-sm-offset-3 col-sm-8">
<label class="checkbox-inline">
<input id="settings-baskets-amazon-uk" type="checkbox">
<span>Amazon UK</span>
<span><i class="fa fa-amazon"></i> Amazon UK</span>
</label>
</div>
</div>
<div class="form-group form-control-nomar-bottom settings-perm" data-key="amazon-usa">
<div class="col-sm-offset-3 col-sm-8">
<label class="checkbox-inline">
<input id="settings-baskets-amazon-usa" type="checkbox">
<span>Amazon USA</span>
<span><i class="fa fa-amazon"></i> Amazon USA</span>
</label>
</div>
</div>
<div class="form-group form-control-nomar-bottom settings-perm" data-key="ebay">
<div class="col-sm-offset-3 col-sm-8">
<label class="checkbox-inline">
<input id="settings-baskets-ebay" type="checkbox">
<span><i class="fa fa-shopping-bag"></i> eBay</span>
</label>
</div>
</div>
<div class="form-group settings-perm" data-key="steam-store">
<div class="col-sm-offset-3 col-sm-8">
<label class="checkbox-inline">
<input id="settings-baskets-steam" type="checkbox">
<span>Steam</span>
<span><i class="fa fa-steam"></i> Steam</span>
</label>
<p class="help-block"></p>
</div>
Expand Down
15 changes: 15 additions & 0 deletions Homely/res/js/homely.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ $(document).ready(function() {
"baskets": {
"amazon-uk": false,
"amazon-usa": false,
"ebay": false,
"steam": false
},
"general": {
Expand Down Expand Up @@ -258,6 +259,7 @@ $(document).ready(function() {
var ajaxPerms = {
"amazon-uk": ["https://www.amazon.co.uk/"],
"amazon-usa": ["https://www.amazon.com/"],
"ebay": ["http://cart.payments.ebay.co.uk/"],
"facebook": ["https://www.facebook.com/"],
"github": ["https://github.com/"],
"gmail": ["https://accounts.google.com/", "https://mail.google.com/"],
Expand Down Expand Up @@ -1817,6 +1819,17 @@ $(document).ready(function() {
return parseInt($("#nav-cart-count", resp).text());
}
},
"ebay": {
title: "eBay",
icon: "shopping-bag",
api: "http://cart.payments.ebay.co.uk/sc/view",
count: function(basket, resp) {
var text = $(".cartsummarytitle", resp).next().text();
if (text === "") return 0;
var match = /[0-9]+/.exec(text);
return match ? parseInt(match[0]) : NaN;
}
},
"steam": {
title: "Steam",
icon: "steam",
Expand Down Expand Up @@ -1947,6 +1960,7 @@ $(document).ready(function() {
.parent().toggleClass("text-muted", !settings.notifs["ticktick"].enable);
$("#settings-baskets-amazon-uk").prop("checked", settings.baskets["amazon-uk"]);
$("#settings-baskets-amazon-usa").prop("checked", settings.baskets["amazon-usa"]);
$("#settings-baskets-ebay").prop("checked", settings.baskets["ebay"]);
$("#settings-baskets-steam").prop("checked", settings.baskets["steam"]);
// highlight notif/basket permissions status
$(".settings-perm").each(function(i, group) {
Expand Down Expand Up @@ -2336,6 +2350,7 @@ $(document).ready(function() {
settings.baskets = {
"amazon-uk": $("#settings-baskets-amazon-uk").prop("checked"),
"amazon-usa": $("#settings-baskets-amazon-usa").prop("checked"),
"ebay": $("#settings-baskets-ebay").prop("checked"),
"steam": $("#settings-baskets-steam").prop("checked")
};
$.each(settings.baskets, function(key, basket) {
Expand Down

0 comments on commit 254a73a

Please sign in to comment.