computeroverhauls

Untitled

Mar 30th, 2017
543
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.08 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. margin:15px;
  300. text-align:left;
  301. }
  302. .modelscont{
  303. display:inline-block;
  304. background-color:white;
  305. border-radius:5px;
  306. padding:20px 20px 0px 20px;
  307. transition:background-color .25s, color .25s;
  308. user-select: none;
  309. -moz-user-select: none;
  310. -khtml-user-select: none;
  311. -webkit-user-select: none;
  312. -o-user-select: none;
  313. cursor:hand;
  314. margin-bottom:20px;
  315. border:solid #a5a5a5 1px;
  316. }
  317. #outputcont{
  318. display:none;
  319. margin:20px;
  320. }
  321. #output{
  322. font-size:3em;
  323. margin:20px;
  324. }
  325. .modelscont:hover {
  326. background-color:rgba(121, 169, 128, 1);
  327. }
  328. .modelscont:active{
  329. background-color:rgba(20, 20, 20, 0.73);
  330. color:#e2e2e2;
  331. }
  332. .models{
  333. height:100px;
  334. width:100px;
  335. }
  336. #jumbotron{
  337. background-color:rgba(0, 0, 0, 0.06);
  338. border-radius:3px;
  339. width:100%;
  340. }
  341. #output{
  342. margin-top:50px;
  343. }
  344. body {
  345. color: #333333;
  346. font-family: ‘Palatino Linotype’, ‘Book Antiqua’, Palatino, serif;
  347. }
  348. .btn {
  349. -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
  350. -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
  351. box-shadow:inset 0px 1px 0px 0px #ffffff;
  352. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #1eeb66), color-stop(1, #0ac937) );
  353. background:-moz-linear-gradient( center top, #1eeb66 5%, #0ac937 100% );
  354. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#1eeb66', endColorstr='#0ac937');
  355. background-color:#1eeb66;
  356. -webkit-border-top-left-radius:6px;
  357. -moz-border-radius-topleft:6px;
  358. border-top-left-radius:6px;
  359. -webkit-border-top-right-radius:6px;
  360. -moz-border-radius-topright:6px;
  361. border-top-right-radius:6px;
  362. -webkit-border-bottom-right-radius:6px;
  363. -moz-border-radius-bottomright:6px;
  364. border-bottom-right-radius:6px;
  365. -webkit-border-bottom-left-radius:6px;
  366. -moz-border-radius-bottomleft:6px;
  367. border-bottom-left-radius:6px;
  368. text-indent:0;
  369. border:1px solid #dcdcdc;
  370. display:inline-block;
  371. color:#424242;
  372. font-family:arial;
  373. font-size:15px;
  374. font-weight:bold;
  375. font-style:normal;
  376. height:50px;
  377. line-height:50px;
  378. text-decoration:none;
  379. text-align:center;
  380. text-shadow:1px 1px 0px #ffffff;
  381. transition:background .25s, background-color .25s, filter .25s;
  382. display:none;
  383. outline:none;
  384. }
  385. .btn:hover {
  386. background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #0ac937), color-stop(1, #1eeb66) );
  387. background:-moz-linear-gradient( center top, #0ac937 5%, #1eeb66 100% );
  388. filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#0ac937', endColorstr='#1eeb66');
  389. background-color:#0ac937;
  390. }.btn:active {
  391. position:relative;
  392. top:1px;
  393. }
  394. #jumbotron {
  395. width:75%;
  396. margin:0 auto;
  397. text-align:center;
  398. padding:20px;
  399. }
  400. #5 {
  401. display:none;
  402. }
  403. #items{
  404. width:40%;
  405. margin:0 auto;
  406. }
  407.  
  408. select {
  409. border: 1px solid #ccc;
  410. border-radius: 3px;
  411. overflow: hidden;
  412. background: #fafafa ;
  413. display:inline-block;
  414. margin:0 auto;
  415. width:75px;
  416. }
  417.  
  418. select option {
  419. padding: 5px 8px;
  420. width: 130%;
  421. border: none;
  422. box-shadow: none;
  423. background: transparent;
  424. background-image: none;
  425. -webkit-appearance: none;
  426. }
  427.  
  428. select select:focus {
  429. outline: none;
  430. }
  431. #output{
  432. transition:all .25s;
  433. }
  434. #output p{
  435. margin:0 auto;
  436. width:60%;
  437. }
  438. .blurb{
  439. display:none;
  440. margin:0 auto;
  441. text-align:left;
  442. }
  443. .itemheader{
  444. display:inline-block;
  445. margin-right:5px;
  446. }
  447.  
  448. </style>
Advertisement
Add Comment
Please, Sign In to add comment