PageSourceSearch

https://www.daysjapan.net/wp-content/plugins/contact-form-7-add-confirm/includes/js/scripts_ver-4.6.js

js daysjapan.net collected 2026-10-02 06:50:04 UTC 6,753 bytes, 215 lines download raw bytes

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

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.