PageSourceSearch

https://www.watanabe-mfg.co.jp/wp-content/plugins/contact-form-7-a…/includes/js/scripts.js?ver=5.1-20210805

js watanabe-mfg.co.jp collected 2026-10-04 04:25:31 UTC 7,140 bytes, 232 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	responseOutput.css("display", "none");
71
72	parent.find(".ajax-loader").addClass("wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
73
74	// スムーズスクロール
75	if(scroll) {
76		// スムーズスクロール
77		setTimeout(function() { wpcf7c_scroll(parent.find("input[name=_wpcf7_unit_tag]").val()) }, 100);
78	}
79	
80	// 確認ボタン挙動
81	parent.find(".wpcf7c-btn-confirm").on("click", function() {
82	  responseOutput.css("display", "");
83	});
84}
85
86
87var wpcf7c_step1 = function(unit_tag){
88	// 確認完了
89
90	// 対象フォーム検索
91	//var elm_unit_tag = jQuery.find("input[name=_wpcf7_unit_tag]");
92	jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){
93		if(jQuery(this).val() == unit_tag) {
94			var parent = jQuery(this).parents("form");
95
96
97			var responseOutput = parent.find('div.wpcf7-response-output');
98			responseOutput.addClass("wpcf7c-force-hide");
99
100			// 確認画面表示
101			// テキストエリアを伸ばす
102			parent.find("textarea").each(function(){
103				if(this.scrollHeight > this.offsetHeight){
104					this.style.height = (this.scrollHeight + 10) + 'px';
105				}
106			});
107			parent.find("textarea").attr("readonly", true).addClass("wpcf7c-conf");
108			parent.find("select").each(function(){
109				jQuery(this).attr("readonly", true).attr("disabled", true).addClass("wpcf7c-conf");
110				jQuery(this).after(
111					jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden")
112				);
113			});
114			parent.find("input").each(function(){
115				switch(jQuery(this).attr("type")) {
116					case "submit":
117					case "button":
118					case "hidden":
119					case "image":
120						// なにもしない
121						break;
122					case "radio":
123					case "checkbox":
124						// 選択されているものだけ対処
125						jQuery(this).attr("readonly", true).attr("disabled", true).addClass("wpcf7c-conf");
126						if(jQuery(this).is(":checked")) {
127							jQuery(this).after(
128								jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden")
129							);
130						}
131						break;
132					case "file":
133						jQuery(this).attr("readonly", true).addClass("wpcf7c-elm-step1").addClass("wpcf7c-force-hide");
134						jQuery(this).after(
135							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)
136						);
137
138						break;
139					default:
140						jQuery(this).attr("readonly", true).addClass("wpcf7c-conf");
141						jQuery(this).after(
142							jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden")
143						);
144						break;
145				}
146			});
147
148			// 表示切替
149			parent.find(".wpcf7c-elm-step1").addClass("wpcf7c-force-hide");
150			parent.find(".wpcf7c-elm-step3").addClass("wpcf7c-force-hide");
151			parent.find(".wpcf7c-elm-step2").removeClass("wpcf7c-force-hide");
152
153			parent.find(".ajax-loader").removeClass("wpcf7c-force-hide");
154
155			parent.find("input[name=_wpcf7c]").val("step2");
156
157			// スムーズスクロール
158			setTimeout(function() { wpcf7c_scroll(unit_tag) }, 100);
159
160
161		}
162	});
163}
164
165var wpcf7c_scroll = function(unit_tag) {
166	// エラーの時などにアンカーまでスクロール
167	jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){
168		if(jQuery(this).val() == unit_tag) {
169			var parent = jQuery(this).parents("form");
170			var speed = 1000;
171			var position = parent.offset().top;
172			if(jQuery('.wpcf7c-anchor').length != 0) {
173				position = jQuery('.wpcf7c-anchor').offset().top;
174			}
175			jQuery("html, body").animate({scrollTop:position}, speed, "swing");
176		}
177	});
178}
179
180var wpcf7c_step2 = function(unit_tag){
181	// 確認完了
182
183	// 対象フォーム検索
184	//var elm_unit_tag = jQuery.find("input[name=_wpcf7_unit_tag]");
185	jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){
186		if(jQuery(this).val() == unit_tag) {
187			var parent = jQuery(this).parents("form");
188
189
190			var responseOutput = parent.find('div.wpcf7-response-output');
191			responseOutput.removeClass("wpcf7c-force-hide");
192
193			// step1状態の画面表示
194			wpcf7c_to_step1(parent);
195
196			// step3の要素があれば、それに切り替える
197			if(parent.find(".wpcf7c-elm-step3").length != 0) {
198				// 表示切替
199				parent.find(".wpcf7c-elm-step1").addClass("wpcf7c-force-hide");
200				parent.find(".wpcf7c-elm-step2").addClass("wpcf7c-force-hide");
201				parent.find(".wpcf7c-elm-step3").removeClass("wpcf7c-force-hide");
202			}
203
204
205		}
206	});
207}
208
209var wpcf7c_step2_error = function(unit_tag) {
210	jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){
211		if(jQuery(this).val() == unit_tag) {
212			var parent = jQuery(this).parents("form");
213
214			var responseOutput = parent.find('div.wpcf7-response-output');
215			responseOutput.removeClass("wpcf7c-force-hide");
216		}
217	});
218
219}
220
221
222document.addEventListener( 'wpcf7submit', function( event ) {
223	switch ( event.detail.status ) {
224		case 'wpcf7c_confirmed':
225		wpcf7c_step1(event.detail.unitTag);
226		break;
227		case 'mail_sent':
228		wpcf7c_step2(event.detail.unitTag);
229		break;
230
231	}
232}, 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.