computeroverhauls

Untitled

Mar 31st, 2017
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.12 KB | None | 0 0
  1. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  2. <script>
  3. // handles the click event for link 1, sends the query
  4. function getOutput() {
  5. var model = document.getElementById('model').value;
  6. var carrier = document.getElementById('carrier').value;
  7. var condition = document.getElementById('condition').value;
  8. var storage = document.getElementById('storage').value;
  9.  
  10. getRequest(
  11. 'quotest/PHPExcel//getQuote.php?model=' + model + "&condition=" + condition + '&storage=' + storage + '&carrier=' + carrier , // URL for the PHP file
  12. drawOutput, // handle successful request
  13. drawError // handle error
  14. );
  15. return false;
  16. }
  17. // handles drawing an error message
  18. function drawError() {
  19. var container = document.getElementById('output');
  20. container.innerHTML = 'Please try again later or contact us at [email protected]';
  21. }
  22. // handles the response, adds the html
  23. function drawOutput(responseText) {
  24. $('#outputcont').show(300);
  25. var container = document.getElementById('output');
  26. container.innerHTML = responseText;
  27. }
  28. // helper function for cross-browser request object
  29. function getRequest(url, success, error) {
  30. var req = false;
  31. try{
  32. // most browsers
  33. req = new XMLHttpRequest();
  34. } catch (e){
  35. // IE
  36. try{
  37. req = new ActiveXObject("Msxml2.XMLHTTP");
  38. } catch(e) {
  39. // try an older version
  40. try{
  41. req = new ActiveXObject("Microsoft.XMLHTTP");
  42. } catch(e) {
  43. return false;
  44. }
  45. }
  46. }
  47. if (!req) return false;
  48. if (typeof success != 'function') success = function () {};
  49. if (typeof error!= 'function') error = function () {};
  50. req.onreadystatechange = function(){
  51. if(req.readyState == 4) {
  52. return req.status === 200 ?
  53. success(req.responseText) : error(req.status);
  54. }
  55. }
  56. req.open("GET", url, true);
  57. req.send(null);
  58. return req;
  59. }
  60. $(document).ready(function(){
  61. $("#1").hide(); //Hides all the capacity fields
  62. $("#2").hide();
  63. $("#3").hide();
  64. $("#4").hide();
  65. $("#5").hide();
  66. $('#model').change(function(e){
  67. if($(this).val() == "iPhone 7 Plus" || $(this).val() == "iPhone 7"){ //Only show the right capacity field for the right model, hide all others
  68. $("#1").show();
  69. $("#2").show();
  70. $("#3").hide();
  71. $("#4").show();
  72. $("#5").hide();
  73. }
  74. if($(this).val() == "iPhone 6s Plus" || $(this).val() == "iPhone 6s"){
  75. $("#1").hide();
  76. $("#2").show();
  77. $("#3").show();
  78. $("#4").show();
  79. $("#5").show();
  80. }
  81. if($(this).val() == "iPhone SE"){
  82. $("#1").hide();
  83. $("#2").hide();
  84. $("#3").show();
  85. $("#4").hide();
  86. $("#5").show();
  87. }
  88. if($(this).val() == "iPhone 6 Plus" || $(this).val() == "iPhone 6"){
  89. $("#1").hide();
  90. $("#2").show();
  91. $("#3").show();
  92. $("#4").hide();
  93. $("#5").show();
  94. }
  95. });
  96. $('#model').on('change', function() { //Removes the placeholder after anything has been selected
  97. if ( this.value !== 'none') //Also fades in the next dropdown
  98. {
  99. $("#modelplaceholder").hide();
  100. $("#storage").show(300);
  101. $("#storageHeader").show(300);
  102. }
  103. });
  104. $('#storage').on('change', function() {
  105. if ( this.value !== 'none')
  106. {
  107. $("#carrier").show(300);
  108. $("#carrierHeader").show(300);
  109. $("#storageplaceholder").hide();
  110. }
  111. });
  112. $('#carrier').on('change', function() {
  113. if ( this.value !== 'none')
  114. {
  115. $("#condition").show(300);
  116. $("#conditionHeader").show(300);
  117. $("#carrierplaceholder").hide();
  118. }
  119. });
  120. $('#condition').on('change', function() {
  121. if (this.value !== 'none')
  122. {
  123. $(".btn").fadeIn(300);
  124. $("#conditionplaceholder").hide();
  125. }
  126. });
  127.  
  128. $('#condition').change(function(e){ //Fades in the blurb for each condition, fades out all the others
  129. if($(this).val() == "New"){
  130. $("#new").fadeIn(300);
  131. $("#flawless").fadeOut(300);
  132. $("#good").fadeOut(300);
  133. $("#fair").fadeOut(300);
  134. $("#cracked").fadeOut(300);
  135. $("#broken").fadeOut(300);
  136. }
  137. if($(this).val() == "Flawless"){
  138. $("#flawless").fadeIn(300);
  139. $("#new").fadeOut(300);
  140. $("#good").fadeOut(300);
  141. $("#fair").fadeOut(300);
  142. $("#cracked").fadeOut(300);
  143. $("#broken").fadeOut(300);
  144. }
  145. if($(this).val() == "Good"){
  146. $("#good").fadeIn(300);
  147. $("#new").fadeOut(300);
  148. $("#flawless").fadeOut(300);
  149. $("#fair").fadeOut(300);
  150. $("#cracked").fadeOut(300);
  151. $("#broken").fadeOut(300);
  152. }
  153. if($(this).val() == "Fair"){
  154. $("#good").fadeOut(300);
  155. $("#new").fadeOut(300);
  156. $("#flawless").fadeOut(300);
  157. $("#fair").fadeIn(300);
  158. $("#cracked").fadeOut(300);
  159. $("#broken").fadeOut(300);
  160. }
  161. if($(this).val() == "Cracked"){
  162. $("#good").fadeOut(300);
  163. $("#new").fadeOut(300);
  164. $("#flawless").fadeOut(300);
  165. $("#fair").fadeOut(300);
  166. $("#cracked").fadeIn(300);
  167. $("#broken").fadeOut(300);
  168. }
  169. if($(this).val() == "Broken"){
  170. $("#good").fadeOut(300);
  171. $("#new").fadeOut(300);
  172. $("#flawless").fadeOut(300);
  173. $("#fair").fadeOut(300);
  174. $("#cracked").fadeOut(300);
  175. $("#broken").fadeIn(300);
  176. }
  177. if($(this).val() == "none"){
  178. $("#good").fadeOut(300);
  179. $("#new").fadeOut(300);
  180. $("#flawless").fadeOut(300);
  181. $("#fair").fadeOut(300);
  182. $("#cracked").fadeOut(300);
  183. $("#broken").fadeOut(300);
  184. }
  185. });
  186. $("#ip7p").click(function () {
  187. if($('#model').val() == 'none'){
  188. $('#model').val('iPhone 7 Plus');
  189. $('#model').change();
  190. $(".modelscont").fadeOut(300);
  191. $(this).fadeIn(300);
  192. }else{
  193. $(this).fadeOut(function(){
  194. $('.modelscont').fadeIn(300);
  195. $('#model').val('none');
  196. });
  197. }
  198. });
  199. $("#ip7").click(function () {
  200. if($('#model').val() == 'none'){
  201. $('#model').val('iPhone 7');
  202. $('#model').change();
  203. $(".modelscont").fadeOut(300);
  204. $(this).fadeIn(300);
  205. }else{
  206. $(this).fadeOut(function(){
  207. $('.modelscont').fadeIn(300);
  208. $('#model').val('none');
  209. });
  210. }
  211. });
  212. $("#ip6sp").click(function () {
  213. if($('#model').val() == 'none'){
  214. $('#model').val('iPhone 6s Plus');
  215. $('#model').change();
  216. $(".modelscont").fadeOut(300);
  217. $(this).fadeIn(300);
  218. }else{
  219. $(this).fadeOut(function(){
  220. $('.modelscont').fadeIn(300);
  221. $('#model').val('none');
  222. });
  223. }
  224. });
  225. $("#ip6s").click(function () {
  226. if($('#model').val() == 'none'){
  227. $('#model').val('iPhone 6s');
  228. $('#model').change();
  229. $(".modelscont").fadeOut(300);
  230. $(this).fadeIn(300);
  231. }else{
  232. $(this).fadeOut(function(){
  233. $('.modelscont').fadeIn(300);
  234. $('#model').val('none');
  235. });
  236. }
  237. });
  238. $("#ipse").click(function () {
  239. if($('#model').val() == 'none'){
  240. $('#model').val('iPhone SE');
  241. $('#model').change();
  242. $(".modelscont").fadeOut(300);
  243. $(this).fadeIn(300);
  244. }else{
  245. $(this).fadeOut(function(){
  246. $('.modelscont').fadeIn(300);
  247. $('#model').val('none');
  248. });
  249. }
  250. });
  251. $("#ip6p").click(function () {
  252. if($('#model').val() == 'none'){
  253. $('#model').val('iPhone 6 Plus');
  254. $('#model').change();
  255. $(".modelscont").fadeOut(300);
  256. $(this).fadeIn(300);
  257. }else{
  258. $(this).fadeOut(function(){
  259. $('.modelscont').fadeIn(300);
  260. $('#model').val('none');
  261. });
  262. }
  263. });
  264. $("#ip6").click(function () {
  265. if($('#model').val() == 'none'){
  266. $('#model').val('iPhone 6');
  267. $('#model').change();
  268. $(".modelscont").fadeOut(300);
  269. $(this).fadeIn(300);
  270. }else{
  271. $(this).fadeOut(function(){
  272. $('.modelscont').fadeIn(300);
  273. $('#model').val('none');
  274. });
  275. }
  276. });
  277.  
  278. });
  279. $(window).on('resize', function(){
  280. if ($(this).width() < 800) {
  281. $('#model').show();
  282. $('.modelscont').hide();
  283. }else if($('#model').val() == 'none'){
  284. $('#model').hide();
  285. $('.modelscont').show();
  286. }
  287. });
  288.  
  289. </script>
  290. <!-- Google Code for Add to Cart Conversion Page
  291. In your html page, add the snippet and call goog_report_conversion
  292. when someone clicks on the chosen link or button. -->
  293.  
  294. <style>
  295. #model{
  296. display:none;
  297. }
  298. .itemcont {
  299. display: flex;
  300. overflow: hidden;
  301. margin:15px;
  302. align-items: center;
  303. }
  304. .itemheader{
  305. margin-right: auto;
  306. }
  307. .modelscont{
  308. display:inline-block;
  309. background-color:white;
  310. border-radius:5px;
  311. padding:20px 20px 0px 20px;
  312. transition:background-color .25s, color .25s;
  313. user-select: none;
  314. -moz-user-select: none;
  315. -khtml-user-select: none;
  316. -webkit-user-select: none;
  317. -o-user-select: none;
  318. cursor:hand;
  319. margin-bottom:20px;
  320. border:solid #a5a5a5 1px;
  321. }
  322. #outputcont{
  323. display:none;
  324. margin:20px;
  325. }
  326. #output{
  327. font-size:3em;
  328. margin:20px;
  329. }
  330. .modelscont:hover {
  331. background-color:rgba(121, 169, 128, 1);
  332. }
  333. .modelscont:active{
  334. background-color:rgba(20, 20, 20, 0.73);
  335. color:#e2e2e2;
  336. }
  337. .models{
  338. height:100px;
  339. width:100px;
  340. }
  341. #jumbotron{
  342. background-color:rgba(0, 0, 0, 0.06);
  343. border-radius:3px;
  344. width:100%;
  345. }
  346. #output{
  347. margin-top:50px;
  348. }
  349. body {
  350. color: #333333;
  351. font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;
  352. }
  353. .btn {
  354. -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
  355. -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
  356. box-shadow:inset 0px 1px 0px 0px #ffffff;
  357. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1eeb66), color-stop(1, #0ac937) );
  358. background:-moz-linear-gradient( center top, #1eeb66 5%, #0ac937 100% );
  359. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1eeb66', endColorstr='#0ac937');
  360. background-color:#1eeb66;
  361. -webkit-border-top-left-radius:6px;
  362. -moz-border-radius-topleft:6px;
  363. border-top-left-radius:6px;
  364. -webkit-border-top-right-radius:6px;
  365. -moz-border-radius-topright:6px;
  366. border-top-right-radius:6px;
  367. -webkit-border-bottom-right-radius:6px;
  368. -moz-border-radius-bottomright:6px;
  369. border-bottom-right-radius:6px;
  370. -webkit-border-bottom-left-radius:6px;
  371. -moz-border-radius-bottomleft:6px;
  372. border-bottom-left-radius:6px;
  373. text-indent:0;
  374. border:1px solid #dcdcdc;
  375. display:inline-block;
  376. color:#424242;
  377. font-family:arial;
  378. font-size:15px;
  379. font-weight:bold;
  380. font-style:normal;
  381. height:50px;
  382. line-height:50px;
  383. text-decoration:none;
  384. text-align:center;
  385. text-shadow:1px 1px 0px #ffffff;
  386. transition:background .25s, background-color .25s, filter .25s;
  387. display:none;
  388. outline:none;
  389. }
  390. .btn:hover {
  391. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #0ac937), color-stop(1, #1eeb66) );
  392. background:-moz-linear-gradient( center top, #0ac937 5%, #1eeb66 100% );
  393. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0ac937', endColorstr='#1eeb66');
  394. background-color:#0ac937;
  395. }.btn:active {
  396. position:relative;
  397. top:1px;
  398. }
  399. #jumbotron {
  400. width:100%;
  401. margin:0 auto;
  402. text-align:center;
  403. padding:20px;
  404. }
  405. #5 {
  406. display:none;
  407. }
  408. #items{
  409. width:40%;
  410. margin:0 auto;
  411. }
  412.  
  413. select {
  414. border: 1px solid #ccc;
  415. border-radius: 3px;
  416. overflow: hidden;
  417. background: #fafafa ;
  418. display:inline-block;
  419. width:100px;
  420. }
  421.  
  422. select option {
  423. padding: 5px 8px;
  424. width: 130%;
  425. border: none;
  426. box-shadow: none;
  427. background: transparent;
  428. background-image: none;
  429. -webkit-appearance: none;
  430. }
  431.  
  432. select select:focus {
  433. outline: none;
  434. }
  435. #output{
  436. transition:all .25s;
  437. }
  438. #output p{
  439. margin:0 auto;
  440. width:60%;
  441. }
  442. .blurb{
  443. display:none;
  444. margin:15px;
  445. text-align:left;
  446. }
  447.  
  448. </style>
Advertisement
Add Comment
Please, Sign In to add comment