PageSourceSearch

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

js sannfreres.co.jp collected 2026-10-07 16:08:39 UTC 7,677 bytes, 263 lines download raw bytes

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

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.