From 5c7b082a5c8ec93314fc7bd384f693207de998ac Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Sat, 3 Dec 2016 16:56:54 -0500 Subject: [PATCH] Much Polishing. Such happy. --- html/css/stylesheet.css | 6 +- html/imgs/synchrony-financial-logo-dlpx_1.ico | Bin 0 -> 5430 bytes html/imgs/synchrony-financial-logo-dlpx_1.png | Bin 0 -> 273 bytes html/javascript/listing.js | 42 ++++- html/javascript/navbar.js | 2 +- html/javascript/nhpup_1.1.js | 170 ++++++++++++++++++ html/javascript/shoppingCart.js | 8 +- html/webpages/homePage.html | 1 + html/webpages/listingPage.html | 66 +++---- html/webpages/map.html | 1 + html/webpages/requestPage.html | 21 +-- html/webpages/returnPage.html | 7 +- html/webpages/shoppingCart.html | 13 +- 13 files changed, 263 insertions(+), 74 deletions(-) create mode 100644 html/imgs/synchrony-financial-logo-dlpx_1.ico create mode 100644 html/imgs/synchrony-financial-logo-dlpx_1.png create mode 100644 html/javascript/nhpup_1.1.js diff --git a/html/css/stylesheet.css b/html/css/stylesheet.css index 02d3699..022a40a 100644 --- a/html/css/stylesheet.css +++ b/html/css/stylesheet.css @@ -23,7 +23,11 @@ div.displayDevice{ padding-left: 30px; width: 100%; height: 100%; - overflow: auto; + overflow: scroll; left: 300px; } +ul.nav{ + padding: 0px; +} + diff --git a/html/imgs/synchrony-financial-logo-dlpx_1.ico b/html/imgs/synchrony-financial-logo-dlpx_1.ico new file mode 100644 index 0000000000000000000000000000000000000000..e357005d7f9fce8bda64c3fbd2bb0a93c6c7a65b GIT binary patch literal 5430 zcmeI0u}T9$5QgWBVi5ufVkurFb`nyBGbMR$%=Voq}o!QyT5k<5{^*Z5->13T~PkM1SzJ~k^vV9Ci zMZ}T)CF(+6yqGzn#GF&g?+)o#DK&RF*^%g#0lhxp41>ObJwN1Ry)s+tU+w>V{Sb=^ z*!27ykIDEUrcKz6fW-L??3O(v6o0i}|gW!U_%O?XxI14-? ziy0WWg+Z8+Vb&Z8pdfpRr>`sf10H5kUBTEzFT8<5^E_P~Ln02py}pr?$xx*IqrN-a zhK)Oq-E(61NPW$9t}u8<|JJj-N*&BGi(}vLD=K!(`LI{-;r~hU{U)3yA##?C&WhhS zIv=lj&-A5rU-6Q)*ADEP5LtWUHq-1&H)XkX0vEY-3aNTc(Eu`ZS0~Ax6y53U5wpMG z{<;Y_`q7F@3Yn}@7hgTe~ HDWM4f!|7!a literal 0 HcmV?d00001 diff --git a/html/javascript/listing.js b/html/javascript/listing.js index 1723e54..7fd2d55 100644 --- a/html/javascript/listing.js +++ b/html/javascript/listing.js @@ -56,9 +56,49 @@ function show(){ for(var i = 0; i < devices.length; i++){ if(type.localeCompare(devices[i].hardware) == 0 || type.localeCompare(devices[i].software) == 0){ - html += '
' + devices[i].name + '

' + devices[i].description + '



' + html += '
' + devices[i].name + '

' + devices[i].description + '



' } } document.getElementById('devContainer').innerHTML = html; + + var unavailable = getUnavailableItems(); + var anchors = document.getElementsByClassName('availableAnchor'); + for(var i = 0; i < anchors.length; i++){ + var anchor = anchors[i]; + var id = anchor.getAttribute('id'); + if(isUnavailable(id)){ + document.getElementById(id).innerHTML = 'Unavailable'; + id = '#' + id; + $(id).css({'background-color':'#ff3535'}); + } + else{ + document.getElementById(id).innerHTML = 'Available'; + id = '#' + id; + $(id).css({'background-color':'#1fe07f'}); + } + } +} + + +function getUnavailableItems(){ + var unavailable = new Array; + var unavailable_str = localStorage.getItem('unavailable'); + if(unavailable_str !== ""){ + unavailable = JSON.parse(unavailable_str); + } + return unavailable; +} + +function isUnavailable(id){ + var unavailable = getUnavailableItems(); + if(unavailable.length == 0) + return 0; + else{ + for(var i = 0; i < unavailable.length; i++){ + if(unavailable[i] == (id)) + return 1; + } + } + return 0; } \ No newline at end of file diff --git a/html/javascript/navbar.js b/html/javascript/navbar.js index 66a150b..f34276e 100644 --- a/html/javascript/navbar.js +++ b/html/javascript/navbar.js @@ -1 +1 @@ -document.getElementById('navbaruniversal').innerHTML = '' \ No newline at end of file +document.getElementById('navbaruniversal').innerHTML = '' \ No newline at end of file diff --git a/html/javascript/nhpup_1.1.js b/html/javascript/nhpup_1.1.js new file mode 100644 index 0000000..32324ac --- /dev/null +++ b/html/javascript/nhpup_1.1.js @@ -0,0 +1,170 @@ +/* + +-------------------------------------------------------------------------- +Code for link-hover text boxes +By Nicolas Höning +Usage: a link +The configuration dict with CSS class and width is optional - default is class .pup and width of 200px. +You can style the popup box via CSS, targeting its ID #pup. +You can escape " in the popup text with ". +Tutorial and support at http://nicolashoening.de?twocents&nr=8 +-------------------------------------------------------------------------- + +The MIT License (MIT) + +Copyright (c) 2014 Nicolas Höning + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +nhpup = { + + pup: null, // This is the popup box, represented by a div + identifier: "pup", // Name of ID and class of the popup box + minMargin: 15, // Set how much minimal space there should be (in pixels) + // between the popup and everything else (borders, mouse) + default_width: 200, // Will be set to width from css in document.ready + move: false, // Move it around with the mouse? we are only ready for that when the mouse event is set up. + // Besides, having this turned off initially is resource-friendly. + + /* + Write message, show popup w/ custom width if necessary, + make sure it disappears on mouseout + */ + popup: function(p_msg, p_config) + { + // do track mouse moves and update position + this.move = true; + // restore defaults + this.pup.removeClass() + .addClass(this.identifier) + .width(this.default_width); + + // custom configuration + if (typeof p_config != 'undefined') { + if ('class' in p_config) { + this.pup.addClass(p_config['class']); + } + if ('width' in p_config) { + this.pup.width(p_config['width']); + } + } + + // Write content and display + this.pup.html(p_msg).show(); + + // Make sure popup goes away on mouse out and we stop the constant + // positioning on mouse moves. + // The event obj needs to be gotten from the virtual + // caller, since we use onmouseover='nhpup.popup(p_msg)' + var t = this.getTarget(arguments.callee.caller.arguments[0]); + $jq(t).unbind('mouseout').bind('mouseout', + function(e){ + nhpup.pup.hide(); + nhpup.move = false; + } + ); + }, + + // set the target element position + setElementPos: function(x, y) + { + // Call nudge to avoid edge overflow. Important tweak: x+10, because if + // the popup is where the mouse is, the hoverOver/hoverOut events flicker + var x_y = this.nudge(x + 10, y); + // remember: the popup is still hidden + this.pup.css('top', x_y[1] + 'px') + .css('left', x_y[0] + 'px'); + }, + + /* Avoid edge overflow */ + nudge: function(x,y) + { + var win = $jq(window); + + // When the mouse is too far on the right, put window to the left + var xtreme = $jq(document).scrollLeft() + win.width() - this.pup.width() - this.minMargin; + if(x > xtreme) { + x -= this.pup.width() + 2 * this.minMargin; + } + x = this.max(x, 0); + + // When the mouse is too far down, move window up + if((y + this.pup.height()) > (win.height() + $jq(document).scrollTop())) { + y -= this.pup.height() + this.minMargin; + } + + return [ x, y ]; + }, + + /* custom max */ + max: function(a,b) + { + if (a>b) return a; + else return b; + }, + + /* + Get the target (element) of an event. + Inspired by quirksmode + */ + getTarget: function(e) + { + var targ; + if (!e) var e = window.event; + if (e.target) targ = e.target; + else if (e.srcElement) targ = e.srcElement; + if (targ.nodeType == 3) // defeat Safari bug + targ = targ.parentNode; + return targ; + }, + + onTouchDevice: function() + { + var deviceAgent = navigator.userAgent.toLowerCase(); + return deviceAgent.match(/(iphone|ipod|ipad|android|blackberry|iemobile|opera m(ob|in)i|vodafone)/) !== null; + }, + + initialized: false, + initialize : function(){ + if (this.initialized) return; + + window.$jq = jQuery; // this is safe in WP installations with noConflict mode (which is default) + + /* Prepare popup and define the mouseover callback */ + jQuery(document).ready(function () { + // create default popup on the page + $jq('body').append(''); + nhpup.pup = $jq('#' + nhpup.identifier); + + // set dynamic coords when the mouse moves + $jq(document).mousemove(function (e) { + if (!nhpup.onTouchDevice()) { // turn off constant repositioning for touch devices (no use for this anyway) + if (nhpup.move) { + nhpup.setElementPos(e.pageX, e.pageY); + } + } + }); + }); + + this.initialized = true; + } +}; + +if ('jQuery' in window) nhpup.initialize(); diff --git a/html/javascript/shoppingCart.js b/html/javascript/shoppingCart.js index d170c72..de1e66e 100644 --- a/html/javascript/shoppingCart.js +++ b/html/javascript/shoppingCart.js @@ -43,7 +43,7 @@ var dev5 = { var dev6 = { id: 6, name:"Captain America", - description:'"Make America Great Again. Wait, thats someone else.."', + description:""Make America Great Again." Wait, thats someone else..", hardware:"computerStick", software:"intel", }; @@ -74,13 +74,15 @@ This function displays a list of devices that a user has currently in their shop function show(){ var cart = getCartItems(); //get all the cart items you want to show var html = ''; //html string initially empty + var part1 = "nhpup.popup('"; + var part2 = "');" if(cart.length !== 0){ //only continue if there are cart items html += '

Tickets have been generated below based on your desired selections.


' for(var i = 0; i < cart.length; i++){ //iterate cart var id = cart[i]; //this gets the id value from the cart for(var j = 0; j < devices.length; j++){ //iterate device list - if(devices[j].id === id){ //match the id's - html += ''; //create listing of all the devices + if(devices[j].id === id){ //match the id's "nhpup.popup(' ');" + html += ''; //create listing of all the devices break; //break out of loop when we match } } diff --git a/html/webpages/homePage.html b/html/webpages/homePage.html index d1267f6..1ff77d6 100644 --- a/html/webpages/homePage.html +++ b/html/webpages/homePage.html @@ -13,6 +13,7 @@ + diff --git a/html/webpages/map.html b/html/webpages/map.html index 546088d..dd92b7e 100644 --- a/html/webpages/map.html +++ b/html/webpages/map.html @@ -13,6 +13,7 @@ + diff --git a/html/webpages/returnPage.html b/html/webpages/returnPage.html index df616cc..568bd53 100644 --- a/html/webpages/returnPage.html +++ b/html/webpages/returnPage.html @@ -12,13 +12,14 @@ + diff --git a/html/webpages/shoppingCart.html b/html/webpages/shoppingCart.html index 3c337ce..07dfc6c 100644 --- a/html/webpages/shoppingCart.html +++ b/html/webpages/shoppingCart.html @@ -13,12 +13,9 @@ + @@ -57,5 +61,6 @@

Welcome to your shopping cart!

+ \ No newline at end of file