1export const loaming = () => { 2 let conditionCount = 1; 3 let $condition = $(".js-loaming-condition").first(); 4 let $addCondition = $(".js-loaming-addcondition"); 5 let $conditionSubmit = $(".js-loaming-submit"); 6 let $result = $(".js-loaming-result").first(); // æåã®çµæãããã¯ãåå¾ 7 let $resultClone = $result.clone() 8 9 $result.remove(); 10 11 // 追å ãã¿ã³ãã¯ãªãã¯ãã㨠`.js-loaming-condition` ã追å 12 $addCondition.on("click", function (e) { 13 e.preventDefault(); 14 conditionCount++; 15 16 let $newCondition = $condition.clone(); 17 $newCondition.find("input[type='radio']").each(function (index) { 18 let newId = `area${conditionCount}-${index+1}`; 19 $(this).attr("id", newId); 20 $(this).next("label").attr("for", newId); 21 $(this).prop("checked", false); 22 }); 23 24 // `name` ã `area-conditionCount` ã«å¤æ´ï¼ã©ã¸ãªãã¿ã³ãç¬ç«ï¼ 25 $newCondition.find("input[type='radio']").attr("name", `area-${conditionCount}`); 26 27 $newCondition.find(".js-loaming-country").empty().append('<option value="">-- 渡èªå ã鏿ãã¦ãã ãã --</option>'); 28 29 // åé¤ãã¿ã³ã追å 30 $newCondition.append("<button class='js-loaming-remove_condition'>åé¤</button>"); 31 32 $(".js-loaming-condition").last().after($newCondition); 33 }); 34 35 // åé¤ãã¿ã³ãã¯ãªãã¯ãã㨠`.js-loaming-condition` ãåé¤ 36 $(document).on("click", ".js-loaming-remove_condition", function () { 37 $(this).closest(".js-loaming-condition").remove(); 38 }); 39 40 // å°å鏿æã«ã該å½ããå½ãã»ã¬ã¯ãããã¯ã¹ã«è¿½å 41 $(document).on("change", ".js-loaming-area-radio", function () { 42 let selectedRegion = $(this).val(); 43 let $conditionBlock = $(this).closest(".js-loaming-condition"); 44 let $select = $conditionBlock.find(".js-loaming-country"); 45 46 $select.empty().append('<option value="">-- 渡èªå ã鏿ãã¦ãã ãã --</option>'); 47 48 countries.forEach(country => { 49 if (country.region === selectedRegion) { 50 $select.append(`<option value="${country.country_id}">${country.country_name}</option>`); 51 } 52 }); 53 }); 54 55 // æ¤ç´¢ãã¿ã³ã¯ãªãã¯æã«çµæãè¡¨ç¤ºï¼æ¢åçµæãåé¤ï¼ 56 $(document).on("click", ".js-loaming-submit", function () { 57 // æ¤ç´¢çµæãã¯ãªã¢ 58 $(".js-loaming-results").empty(); 59 60 $(".js-loaming-condition").each(function () { 61 let $conditionBlock = $(this); 62 let selectedCountryId = $conditionBlock.find(".js-loaming-country").val()?.trim(); 63 let selectedCountry = countries.find(c => c.country_id === selectedCountryId); 64 65 if (!selectedCountry) { 66 alert("鏿ããå½ã®ãã¼ã¿ãè¦ã¤ããã¾ãã"); 67 return; 68 } 69 70 let $newResult = $result.clone().removeClass('u-hide'); 71 $newResult.find(".js-loaming-region span").text(selectedCountry.region); 72 $newResult.find(".js-loaming-country_name span").text(selectedCountry.country_name); 73 $newResult.find(".js-loaming-data_result").text(selectedCountry.data_result); 74 $newResult.find(".js-loaming-regular_topping").text(selectedCountry.regular_topping); 75 $newResult.find(".js-loaming-area_topping").text(selectedCountry.area_topping); 76 $newResult.find(".js-loaming-wide_topping").text(selectedCountry.wide_topping); 77 $newResult.find(".js-loaming-call_sms").text(selectedCountry.call_sms); 78 $newResult.find(".js-loaming-outgoing_1").text(selectedCountry.outgoing_1); 79 $newResult.find(".js-loaming-outgoing_2").text(selectedCountry.outgoing_2); 80 $newResult.find(".js-loaming-outgoing_3").text(selectedCountry.outgoing_3); 81 $newResult.find(".js-loaming-incoming").text(selectedCountry.incoming); 82 $newResult.find(".js-loaming-sms_send").text(selectedCountry.sms_send); 83 $newResult.find(".js-loaming-sms_receive").text(selectedCountry.sms_receive); 84 85 $(".js-loaming-results").append($newResult); 86 87 let winH = document.documentElement.clientHeight 88 let targetY = $(".js-loaming-results").offset().top 89
90 let position = targetY - $('.p-header').height(); 91 92 $('body,html').stop(true,false).animate({ scrollTop: position }, 300, 'swing'); 93 }); 94 }); 95 96}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.