diff options
| -rwxr-xr-x | StoneIsland/www/index.html | 1 | ||||
| -rwxr-xr-x | StoneIsland/www/js/index.js | 1 | ||||
| -rw-r--r-- | StoneIsland/www/js/lib/etc/sim.js | 28 | ||||
| -rwxr-xr-x | StoneIsland/www/js/lib/products/ProductView.js | 14 |
4 files changed, 44 insertions, 0 deletions
diff --git a/StoneIsland/www/index.html b/StoneIsland/www/index.html index 747d6efe..7e660fe7 100755 --- a/StoneIsland/www/index.html +++ b/StoneIsland/www/index.html @@ -1099,6 +1099,7 @@ <script src="js/lib/etc/push.js"></script> <script src="js/lib/etc/deeplink.js"></script> <script src="js/lib/etc/geo.js"></script> +<script src="js/lib/etc/sim.js"></script> <script src="js/lib/etc/backup_db.js"></script> <script src="js/lib/view/View.js"></script> diff --git a/StoneIsland/www/js/index.js b/StoneIsland/www/js/index.js index eb3b32b9..e554f672 100755 --- a/StoneIsland/www/js/index.js +++ b/StoneIsland/www/js/index.js @@ -79,6 +79,7 @@ var app = (function(){ cordova.plugins.Keyboard.disableScroll(true) cordova.plugins.Keyboard.hideKeyboardAccessoryBar(false) geo.fetch() + sim.fetch() var image = new Image image.src = "./img/compass-logo.png" } diff --git a/StoneIsland/www/js/lib/etc/sim.js b/StoneIsland/www/js/lib/etc/sim.js new file mode 100644 index 00000000..4507e160 --- /dev/null +++ b/StoneIsland/www/js/lib/etc/sim.js @@ -0,0 +1,28 @@ +var sim = (function(){ + var sim = {} + + sim.loaded = false + sim.data = { + carrierName: 'unknown', + countryCode: 'xx', + mcc: '0', + mnc: '0', + } + + sim.fetch = function(){ + window.plugins.sim.getSimInfo(sim.success, sim.error) + } + + sim.success = function(data){ + console.log(data) + sim.data = data + sim.data.countryCode = sim.data.countryCode.toLowerCase() + sim.loaded = true + } + + sim.error = function(){ + console.log("no SIM card detected") + } + + return sim +})()
\ No newline at end of file diff --git a/StoneIsland/www/js/lib/products/ProductView.js b/StoneIsland/www/js/lib/products/ProductView.js index c1847496..de29bf73 100755 --- a/StoneIsland/www/js/lib/products/ProductView.js +++ b/StoneIsland/www/js/lib/products/ProductView.js @@ -5,6 +5,7 @@ var ProductView = ScrollableView.extend({ events: { "click .fit": "scroll_to_bottom", + "click .notAvailableInCanada": "scroll_to_bottom", "click .size": "select_size", "click .color": "select_color", "click .share": "share", @@ -25,6 +26,7 @@ var ProductView = ScrollableView.extend({ this.$color = this.$(".color") this.$body = this.$(".body") this.$fit = this.$(".fit") + this.$notAvailableInCanada = this.$(".notAvailableInCanada") this.$sizing = this.$(".sizing") this.$style = this.$(".style") }, @@ -42,6 +44,9 @@ var ProductView = ScrollableView.extend({ if (this.not_available) { app.footer.show("SOLD OUT") } + else if (this.isNotAvailableInCanada) { + app.footer.show("NOT AVAILABLE") + } else { app.footer.show("ADD TO CART", "BUY NOW") } @@ -177,6 +182,15 @@ var ProductView = ScrollableView.extend({ app.product.$fit.toggle( fits_large ) app.product.$sizing.toggle( fits_large ) + var notAvailableInCanada = !! app.store.notAvailableInCanada + app.product.$notAvailableInCanada.toggle( notAvailableInCanada ) + if (notAvailableInCanada && sim.data.countryCode === 'ca') { + this.isNotAvailableInCanada = true + } + else { + this.isNotAvailableInCanada = false + } + this.showFooter() this.deferScrollToTop() |
