PageSourceSearch

https://www.yamaen.co.jp/wordpress/wp-content/themes/yamaen/js/simulator.js

js yamaen.co.jp collected 2026-10-07 00:18:28 UTC 11,713 bytes, 387 lines download raw bytes

1// JavaScript Document
2
3//----------------------------------------
4// ギフト シミュレーション start
5//----------------------------------------
6 // textare insert start -----------------
7
8              function setGiftTextArea(){
9
10                var resultText = '';
11
12                if( $('#giftAutoCalculation tr.giftItemRow').length){
13
14                  // 商品選択があった場合
15
16                    $('#giftAutoCalculation tr.giftItemRow').each(function() {
17
18                      var giftName = $(this).find("td.giftItem").text();
19                      var giftNum = $(this).find("td.giftNum").text();
20                      var giftPrice = $(this).find("td.onePrice").text();
21
22                      var rowText = `${giftName} : 個数 ${giftNum} : 価格 ${giftPrice}\n`;
23                      resultText += rowText;
24
25                    });
26
27                    var textareaTotalPrice = $("#giftAutoCalculation .giftPriceAdd em").text();
28
29                    resultText += `目安金額:${textareaTotalPrice}円`;
30
31                    $('textarea#choiceGiftTextarea').val(resultText);
32
33                }else{
34
35                  // 商品選択がない場合
36
37                  $('textarea#choiceGiftTextarea').val("");
38
39                }
40
41              }
42
43          // 選択アイテムの全削除 start ---------------
44
45              $("#giftAutoCalculation .giftClear").on("click",function(){
46
47                $("#giftAutoCalculation .choicedGift table .giftItemRow").remove();
48                $("#giftAutoCalculation .giftPriceAdd em").text(0);
49                $("textarea#choiceGiftTextarea").val("");
50
51              });
52
53          // 選択アイテムの全削除 end   ---------------
54
55          // 合計金額の算出 start -------------------
56
57            function giftTotalPrice(){
58
59              let total = 0;
60
61              if($("#giftAutoCalculation .choicedGift table td").length){
62
63                $('#giftAutoCalculation .choicedGift .onePrice').each(function() {
64
65                  total += parseFloat($(this).data('onetotal')) || 0;
66
67                });
68
69              }
70
71              var formatTotal = total.toLocaleString();
72
73              $("#giftAutoCalculation .giftPriceAdd em").text(formatTotal);
74
75            }
76
77          // 合計金額の算出 end   -------------------
78
79          // 選択アイテムの削除 start ----------------
80
81            $(document).on("click","#giftAutoCalculation td.delete em",function(){
82
83              console.log(1);
84
85              var parrentElement = $(this).parent().parent();
86
87              parrentElement.remove();
88
89              // 合計金額の計算
90
91                giftTotalPrice();
92                setGiftTextArea();
93
94            });
95
96          // 選択アイテムの削除 end   ----------------
97
98          // 選択ギフトの追加 start -------------------
99
100            $("#giftAutoCalculation .giftAdd").on("click",function(){
101
102              var addGiftValue = $("#giftAutoCalculation option:selected").val();
103
104              if(addGiftValue != ""){
105
106                var addGiftText = $("#giftAutoCalculation option:selected").text();
107
108                // 新規追加か、変更か判断
109
110                if( $("#giftAutoCalculation .choicedGift table tr td").length){
111
112
113                  // すでに存在しているか確認
114
115                    var addCount = 0;
116
117                    $('#giftAutoCalculation td.giftItem').each(function() {
118
119                        if ($(this).text().includes(addGiftText)) {
120
121                            // 個数の追加
122
123                            var thisNumber = $(this).next('td').text();
124                            var tnisNumber_number = Number(thisNumber);
125                            var aftterNumber = tnisNumber_number + 1;
126                            $(this).next('td').text(aftterNumber);
127
128                            // 金額の変更
129
130                            var onePrice = $(this).data("oneprice");
131
132                            console.log(aftterPrice);
133                            var aftterPrice = aftterNumber * Number(onePrice);
134
135                            var formatPrice = aftterPrice.toLocaleStr
135ing();
136                            $(this).next('td').next('td').text(`${formatPrice}円〜`);
137                            $(this).next('td').next('td').data("onetotal",aftterPrice);
138
139                            addCount++;
140
141                        }
142                    });
143
144                    if(addCount == 0){
145
146                      addGiftValue = Number(addGiftValue);
147
148                      var formatPrice = addGiftValue.toLocaleString();
149
150                      $("#giftAutoCalculation .choicedGift table").append(`
151                        <tr class="giftItemRow">
152                          <td class="delete">
153                            <em>✖️</em>
154                          </td>
155                          <td class="giftItem" data-onePrice="${addGiftValue}">${addGiftText}</td>
156                          <td class="giftNum">1</td>
157                          <td class="onePrice" data-onetotal="${addGiftValue}">${formatPrice}円〜</td>
158                        </tr>
159                      `);
160
161                    }
162
163                }else{
164
165                  // 新規追加
166                  addGiftValue = Number(addGiftValue);
167
168                  var formatPrice = addGiftValue.toLocaleString();
169
170                  $("#giftAutoCalculation .choicedGift table").append(`
171                    <tr class="giftItemRow">
172                      <td class="delete">
173                        <em>✖️</em>
174                      </td>
175                      <td class="giftItem" data-onePrice="${addGiftValue}">${addGiftText}</td>
176                      <td class="giftNum">1</td>
177                      <td class="onePrice" data-onetotal="${addGiftValue}">${formatPrice}円〜</td>
178                    </tr>
179                  `);
180                }
181
182                // 合計金額の計算
183
184                  giftTotalPrice();
185                  setGiftTextArea();
186
187              }
188
189            });
190$("#giftAutoCalculation").appendTo(".giftSimyuBox");
191//----------------------------------------
192// ギフト シミュレーション end
193//----------------------------------------
194
195//----------------------------------------
196// 門松 シミュレーション start
197//----------------------------------------
198  // textare insert start -----------------
199
200      function setKadoTextArea(){
201
202        var resultText = '';
203
204        if( $('#kadoAutoCalculation tr.kadoItemRow').length){
205
206          // 商品選択があった場合
207
208            $('#kadoAutoCalculation tr.kadoItemRow').each(function() {
209
210              var giftName = $(this).find("td.kadoItem").text();
211              var giftNum = $(this).find("td.kadoNum").text();
212              var giftPrice = $(this).find("td.onePrice").text();
213
214              var rowText = `ギフト名 ${giftName} : 個数 ${giftNum} : 価格 ${giftPrice}\n`;
215              resultText += rowText;
216
217            });
218
219            var textareaTotalPrice = $("#kadoAutoCalculation .kadoPriceAdd em").text();
220
221            resultText += `目安金額:${textareaTotalPrice}`;
222
223            $('textarea#choiceKadoTextarea').val(resultText);
224
225        }else{
226
227          // 商品選択がない場合
228
229          $('textarea#choiceKadoTextarea').val("");
230
231        }
232
233      }
234
235  // 選択アイテムの全削除 start ---------------
236
237      $("#kadoAutoCalculation .kadoClear").on("click",function(){
238
239        $("#kadoAutoCalculation .choicedKado table .kadoItemRow").remove();
240        $("#kadoAutoCalculation .kadoPriceAdd em").text(0);
241        $("textarea#choiceKadoTextarea").val("");
242
243      });
244
245  // 選択アイテムの全削除 end   ---------------
246
247  // 合計金額の算出 start -------------------
248
249    function kadoTotalPrice(){
250
251      let total = 0;
252
253      if($("#kadoAutoCalculation .choicedKado table td").length){
254
255        $('#kadoAutoCalculation .choicedKado .onePrice').each(function() {
256
257          total += parseFloat($(this).data('onetotal')) || 0;
258
259        });
260
261      }
262
263      var formatTotal = total.toLocaleString();
264
265      $("#kadoAutoCalculation .kadoPriceAdd em").text(formatTotal);
266
267    }
268
269  // 合計金額の算出 end   -------------------
270
271  // 選択アイテムの削除 start ----------------
272
273    $(document).on("click","#kadoAutoCalculation td.delete em",function(){
274
275      console.log(1);
276
277      var parrentElement = $(this).parent().parent();
278
279      parrentElement.remove();
280
281      // 合計金額の計算
282
283        kadoTotalPrice();
284        setKadoTextArea();
285
286    });
287
288  // 選択アイテムの削除 end   ----------------
289
290  // 選択ギフトの追加 start -------------------
291
292    $("#kadoAutoCalculation .kadoAdd").on("click",function(){
293
294      var addGiftValue = $("#kadoAutoCalculation option:selected").val();
295
296      if(addGiftValue != ""){
297
298        var addGiftText = $("#kadoAutoCalculation option:selected").text();
299
300        // 新規追加か、変更か判断
301
302        if( $("#kadoAutoCalculation .choicedKado table tr td").length){
303
304
305          // すでに存在しているか確認
306
307            var addCount = 0;
308
309            $('#kadoAutoCalculation td.kadoItem').each(function() {
310  
311                if ($(this).text().includes(addGiftText)) {
312
313                    // 個数の追加
314                    
315                    var thisNumber = $(this).next('td').text();
316                    var tnisNumber_number = Number(thisNumber);
317                    var aftterNumber = tnisNumber_number + 1;
318                    $(this).next('td').text(aftterNumber);
319
320                    // 金額の変更
321
322                    var onePrice = $(this).data("oneprice");
323
324                    console.log(aftterPrice);
325                    var aftterPrice = aftterNumber * Number(onePrice);
326                    
327                    var formatPrice = aftterPrice.toLocaleString();
328                    $(this).next('td').next('td').text(`${formatPrice}円`);
329                    $(this).next('td').next('td').data("onetotal",aftterPrice);
330
331                    addCount++;
332
333                }
334            });
335
336            if(addCount == 0){
337
338              addGiftValue = Number(addGiftValue);
339
340              var formatPrice = addGiftValue.toLocaleString();
341
342              $("#kadoAutoCalculation .choicedKado table").append(`
343                <tr class="kadoItemRow">
344                  <td class="delete">
345                    <em>✖️</em>
346                  </td>
347                  <td class="kadoItem" data-onePrice="${addGiftValue}">${addGiftText}</td>
348                  <td class="kadoNum">1</td>
349                  <td class="onePrice" data-onetotal="${addGiftValue}">${formatPrice}円</td>
350                </tr>
351              `);
352
353            }
354
355        }else{
356
357          // 新規追加
358          addGiftValue = Number(addGiftValue);
359
360          var formatPrice = addGiftValue.toLocaleString();
361
362          $("#kadoAutoCalculation .choicedKado table").append(`
363            <tr class="kadoItemRow">
364              <td class="delete">
365                <em>✖️</em>
366              </td>
367              <td class="kadoItem" data-onePrice="${addGiftValue}">${addGiftText}</td>
368              <td class="kadoNum">1</td>
369              <td class="onePrice" data-onetotal="${addGiftValue}">${formatPrice}円</td>
370            </tr>
371          `);
372        }
373
374        // 合計金額の計算
375
376          kadoTotalPrice();
377          setKadoTextArea();
378
379      }
380
381    });
382
383    // 選択ギフトの追加 end   -------------------
384
385//----------------------------------------
386// 門松 シミュレーション end
387//----------------------------------------

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.