From a2c00af63c6d09987f393479b90a34aaa449fc73 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 14 Dec 2022 08:41:33 +0100 Subject: [PATCH] wait #5624 @0.5 --- Michelin/script.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Michelin/script.js b/Michelin/script.js index 57afaa8..dfa5e42 100644 --- a/Michelin/script.js +++ b/Michelin/script.js @@ -27,6 +27,17 @@ $(function () { window.parent.location.hash = "#/page/" + $(this).data('page'); }); + let existingSearch = getExistingSearch(); + $.each(existingSearch, function (k, v) { + $('[name=' + k).each(function () { + if ($(this).is('select')) { + $(this).val(v); + } else if ($(this).is('input[type=radio]')) { + $(this).prop('checked', $(this).attr('value') == v); + } + }); + }); + $(document).on('change', 'select,input', function () { updateForm(); }); @@ -37,14 +48,19 @@ $(function () { return false; }); - $(window).on('resize',function(){ - $("#holder").css('min-height',$(window).outerHeight()-60); + $(window).on('resize', function () { + $("#holder").css('min-height', $(window).outerHeight() - 60); }); + updateForm(); }); +function getExistingSearch() { + return parent.fluidbook.cache.get('find_tyre', {}); +} + function valueExists(array, value) { var found = false; $.each(array, function (k, v) { @@ -195,7 +211,6 @@ function updateSetForm() { var rearList = _tyreForm('rear', 'rear_'); if (rearList) { var res = []; - console.log(frontList, rearList); $.each(frontList, function (k, v) { var found = false; $.each(rearList, function (kk, vv) { -- 2.39.5