PageSourceSearch

https://www.comet-jp.cc/wp-content/plugins/contact-form-7-add-confirm/includes/js/scripts.js?ver=5.1

js comet-jp.cc collected 2026-10-05 09:41:23 UTC 7,674 bytes, 237 lines download raw bytes

1(function (jQuery) {
2
3
4
5  if (jQuery(".wpcf7c-elm-step1").length != 0) {
6    // 対象有り
7
8    jQuery(".wpcf7c-elm-step1").each(function () {
9      // 親のフォームを検索
10      var parent = jQuery(this).parents("form");
11      if (parent.attr("wpcf7c") == undefined) {
12        // elm-submitをsubmitボタンへもセット
13        parent.find(".wpcf7-submit").addClass("wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
14        parent.find(".ajax-loader").addClass("wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
15
16        // ajax用ID退避,処理済みフラグセット
17        var hidden_wpcf7 = parent.find("input[name=_wpcf7]");
18        var _wpcf7 = hidden_wpcf7.val();
19        parent.attr("wpcf7c", _wpcf7);
20
21        parent.attr("step", 1);
22
23        hidden_wpcf7.after('<input type="hidden" name="_wpcf7c" value="step1" />');
24
25        //parent.find("input[name=_wpcf7]").val("");
26
27        // 不要要素非表示
28        parent.find(".wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
29        parent.find(".wpcf7c-elm-step3").addClass("wpcf7c-force-hide");
30        parent.find(".wpcf7c-elm-step1").removeClass("wpcf7c-force-hide");
31
32        // 戻って編集ボタン挙動
33        parent.find(".wpcf7c-btn-back").on("click", function () {
34          wpcf7c_to_step1(parent, true);
35          return false;
36        });
37      }
38
39
40
41
42    });
43
44
45
46  }
47
48})(jQuery);
49
50var wpcf7c_to_step1 = function (parent, scroll) {
51  parent.find(".wpcf7c-conf").each(function () {
52    // 親フォーム
53    var parent_form = jQuery(this).parents("form");
54
55    jQuery(this).removeAttr("disabled").removeAttr("readonly").removeClass("wpcf7c-conf");
56
57  });
58
59  jQuery(".wpcf7c-conf-hidden").remove();
60
61  parent.find(".wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
62  parent.find(".wpcf7c-elm-step3").addClass("wpcf7c-force-hide");
63  parent.find(".wpcf7c-elm-step1").removeClass("wpcf7c-force-hide");
64
65  parent.find("input[name=_wpcf7c]").val("step1");
66
67  var responseOutput = parent.find('div.wpcf7-response-output');
68  responseOutput.removeClass("wpcf7c-force-hide");
69  responseOutput.removeClass("wpcf7-mail-sent-ng");
70  if (scroll) {
71    //responseOutput.css("display", "none");
72    responseOutput.addClass("wpcf7c-force-hide");
73  }
74
75  parent.find(".ajax-loader").addClass("wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
76
77  // スムーズスクロール
78  if (scroll) {
79    // スムーズスクロール
80    setTimeout(function () {
81      wpcf7c_scroll(parent.find("input[name=_wpcf7_unit_tag]").val())
82    }, 100);
83  }
84
85}
86
87
88var wpcf7c_step1 = function (unit_tag) {
89  // 確認完了
90
91  // 対象フォーム検索
92  //var elm_unit_tag = jQuery.find("input[name=_wpcf7_unit_tag]");
93  jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function () {
94    if (jQuery(this).val() == unit_tag) {
95      var parent = jQuery(this).parents("form");
96
97
98      var responseOutput = parent.find('div.wpcf7-response-output');
99      responseOutput.addClass("wpcf7c-force-hide");
100
101      // 確認画面表示
102      // テキストエリアを伸ばす
103      parent.find("textarea").each(function () {
104        if (this.scrollHeight > this.offsetHeight) {
105          this.style.height = (this.scrollHeight + 10) + 'px';
106        }
107      });
108      parent.find("textarea").attr("readonly", true).addClass("wpcf7c-conf");
109      parent.find("select").each(function () {
110        jQuery(this).attr("readonly", true).attr("disabled", true).addClass("wpcf7c-conf");
111        jQuery(this).after(
112          jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden")
113        );
114      });
115      parent.find("input").each(function () {
116        switch (jQuery(this).attr("type")) {
117          case "submit":
118          case "button":
119          case "hidden":
120          case "image":
121            // なにもしない
122            break;
123          case "radio":
124          case "checkbox":
125            // 選択されているものだけ対処
126            jQuery(this).attr("readonly", true).attr("disabled", true).addClass("wpcf7c-conf");
127            if (jQuery(this).is(":checked")) {
128              jQuery(this).after(
129                jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden")
130              );
131            }
132            break;
133          case "file":
134            jQuery(this).attr("readonly", true).addClass("wpcf7c-elm-step1").addClass("wpcf7c-force-hide");
135            jQuery(this).after(
136              jQuery('<input type="text" />').attr("name", (jQuery(this).attr("name") + "_conf")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden").addClass("wpcf7c-conf").attr("readonly", true).attr("disabled", true)
137            );
138
139            break;
140          default:
141            jQuery(this).attr("readonly", true).addClass("wpcf7c-conf");
142            jQuery(this).after(
143              jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden")
144            );
145            break;
146        }
147      });
148
149      // 表示切替
150      parent.find(".wpcf7c-elm-step1").addClass("wpcf7c-force-hide");
151      parent.find(".wpcf7c-elm-step3").addClass("wpcf7c-force-hide");
152      parent.find(".wpcf7c-elm-step2").removeClass("wpcf7c-force-hide");
153
154      parent.find(".ajax-loader").removeClass("wpcf7c-force-hide");
155
156      parent.find("input[name=_wpcf7c]").val("step2");
157
158      // スムーズスクロール
159      setTimeout(function () {
160        wpcf7c_scroll(unit_tag)
161      }, 100);
162
163
164    }
165  });
166}
167
168var wpcf7c_scroll = function (unit_tag) {
169  // エラーの時などにアンカーまでスクロール
170  jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function () {
171    if (jQuery(this).val() == unit_tag) {
172      var parent = jQuery(this).parents("form");
173      var speed = 1000;
174      var position = parent.offset().top;
175      if (jQuery('.wpcf7c-anchor').length != 0) {
176        position = jQuery('.wpcf7c-anchor').offset().top;
177      }
178      jQuery("html, body").animate({
179        scrollTop: position
180      }, speed, "swing");
181    }
182  });
183}
184
185var wpcf7c_step2 = function (unit_tag) {
186  // 確認完了
187
188  // 対象フォーム検索
189  //var elm_unit_tag = jQuery.find("input[name=_wpcf7_unit_tag]");
190  jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function () {
191    if (jQuery(this).val() == unit_tag) {
192      var parent = jQuery(this).parents("form");
193
194
195      var responseOutput = parent.find('div.wpcf7-response-output');
196      responseOutput.removeClass("wpcf7c-force-hide");
197
198      // step1状態の画面表示
199      wpcf7c_to_step1(parent);
200
201      // step3の要素があれば、それに切り替える
202      if (parent.find(".wpcf7c-elm-step3").length != 0) {
203        // 表示切替
204        parent.find(".wpcf7c-elm-step1").addClass("wpcf7c-force-hide");
205        parent.find(".wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
206        parent.find(".wpcf7c-elm-step3").removeClass("wpcf7c-force-hide");
207      }
208
209
210    }
211  });
212}
213
214var wpcf7c_step2_error = function (unit_tag) {
215  jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function () {
216    if (jQuery(this).val() == unit_tag) {
217      var parent = jQuery(this).parents("form");
218
219      var responseOutput = parent.find('div.wpcf7-response-output');
220      responseOutput.removeClass("wpcf7c-force-hide");
221    }
222  });
223
224}
225
226
227document.addEventListener('wpcf7submit', function (event) {
228  switch (event.detail.status) {
229    case 'wpcf7c_confirmed':
230      wpcf7c_step1(event.detail.unitTag);
231      break;
232    case 'mail_sent':
233      wpcf7c_step2(event.detail.unitTag);
234      break;
235
236  }
237}, false);

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.