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 responseOutput.css("display", "none"); 73 74 parent.find(".ajax-loader").addClass("wpcf7c-elm-step2").addClass("wpcf7c-force-hide"); 75 76 // ã¹ã ã¼ãºã¹ã¯ãã¼ã« 77 if(scroll) { 78 // ã¹ã ã¼ãºã¹ã¯ãã¼ã« 79 setTimeout(function() { wpcf7c_scroll(parent.find("input[name=_wpcf7_unit_tag]").val()) }, 100); 80 } 81 82} 83 84 85var wpcf7c_step1 = function(unit_tag){ 86 // 確èªå®äº 87 88 // 対象ãã©ã¼ã æ¤ç´¢ 89 //var elm_unit_tag = jQuery.find("input[name=_wpcf7_unit_tag]"); 90 jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){ 91 if(jQuery(this).val() == unit_tag) { 92 var parent = jQuery(this).parents("form"); 93 94 95 var responseOutput = parent.find('div.wpcf7-response-output'); 96 responseOutput.addClass("wpcf7c-force-hide"); 97 98 // 確èªç»é¢è¡¨ç¤º 99 // ããã¹ãã¨ãªã¢ã伸ã°ã 100 parent.find("textarea").each(function(){ 101 if(this.scrollHeight > this.offsetHeight){ 102 this.style.height = (this.scrollHeight + 10) + 'px'; 103 } 104 }); 105 parent.find("textarea").attr("readonly", true).addClass("wpcf7c-conf"); 106 parent.find("select").each(function(){ 107 jQuery(this).attr("readonly", true).attr("disabled", true).addClass("wpcf7c-conf"); 108 jQuery(this).after( 109 jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden") 110 ); 111 }); 112 parent.find("input").each(function(){ 113 switch(jQuery(this).attr("type")) { 114 case "submit": 115 case "button": 116 case "hidden": 117 case "image": 118 // ãªã«ãããªã 119 break; 120 case "radio": 121 case "checkbox": 122 // 鏿ããã¦ãããã®ã ãå¯¾å¦ 123 jQuery(this).attr("readonly", true).attr("disabled", true).addClass("wpcf7c-conf"); 124 if(jQuery(this).is(":checked")) { 125 jQuery(this).after( 126 jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden") 127 ); 128 } 129 break; 130 case "file": 131 jQuery(this).attr("readonly", true).addClass("wpcf7c-elm-step1").addClass("wpcf7c-force-hide"); 132 jQuery(this).after( 133 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) 134 ); 135 136 break; 137 default: 138 jQuery(this).attr("readonly", true).addClass("wpcf7c-conf"); 139 jQuery(this).after( 140 jQuery('<input type="hidden" />').attr("name", jQuery(this).attr("name")).val(jQuery(this).val()).addClass("wpcf7c-conf-hidden") 141 ); 142 break; 143 } 144 }); 145 146 // è¡¨ç¤ºåæ¿ 147 parent.find(".wpcf7c-elm-step1").addClass("wpcf7c-force-hide"); 148 parent.find(".wpcf7c-elm-step3").addClass("wpcf7c-force-hide"); 149 parent.find(".wpcf7c-elm-step2").removeClass("wpcf7c-force-hide"); 150 151 parent.find(".ajax-loader").removeClass("wpcf7c-force-hide"); 152 153 parent.find("input[name=_wpcf7c]").val("step2"); 154 155 // ã¹ã ã¼ãºã¹ã¯ãã¼ã« 156 setTimeout(function() { wpcf7c_scroll(unit_tag) }, 100); 157 158 159 } 160 }); 161} 162 163var wpcf7c_scroll = function(unit_tag) { 164 // ã¨ã©ã¼ã®æãªã©ã«ã¢ã³ã«ã¼ã¾ã§ã¹ã¯ãã¼ã« 165 jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){ 166 if(jQuery(this).val() == unit_tag) { 167 var parent = jQuery(this).parents("form"); 168 var speed = 1000; 169 var position = parent.offset().top; 170 if(jQuery('.wpcf7c-anchor').length != 0) { 171 position = jQuery('.wpcf7c-anchor').offset().top; 172 } 173 jQuery("html, body").animate({scrollTop:position}, speed, "swing"); 174 } 175 }); 176} 177 178var wpcf7c_step2 = function(unit_tag){ 179 // 確èªå®äº 180 181 // 対象ãã©ã¼ã æ¤ç´¢ 182 //var elm_unit_tag = jQuery.find("input[name=_wpcf7_unit_tag]"); 183 jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){ 184 if(jQuery(this).val() == unit_tag) { 185 var parent = jQuery(this).parents("form"); 186 187 188 var responseOutput = parent.find('div.wpcf7-response-output'); 189 responseOutput.removeClass("wpcf7c-force-hide"); 190 191 // step1ç¶æ ã®ç»é¢è¡¨ç¤º 192 wpcf7c_to_step1(parent); 193 194 // step3ã®è¦ç´ ãããã°ãããã«åãæ¿ãã 195 if(parent.find(".wpcf7c-elm-step3").length != 0) { 196 // è¡¨ç¤ºåæ¿ 197 parent.find(".wpcf7c-elm-step1").addClass("wpcf7c-force-hide"); 198 parent.find(".wpcf7c-elm-step2").addClass("wpcf7c-force-hide"); 199 parent.find(".wpcf7c-elm-step3").removeClass("wpcf7c-force-hide"); 200 } 201 202 203 } 204 }); 205} 206 207var wpcf7c_step2_error = function(unit_tag) { 208 jQuery(jQuery.find("input[name=_wpcf7_unit_tag]")).each(function(){ 209 if(jQuery(this).val() == unit_tag) { 210 var parent = jQuery(this).parents("form"); 211 212 var responseOutput = parent.find('div.wpcf7-response-output'); 213 responseOutput.removeClass("wpcf7c-force-hide"); 214 } 215 }); 216 217} 218 219 220document.addEventListener( 'wpcf7submit', function( event ) { 221 switch ( event.detail.status ) { 222 case 'wpcf7c_confirmed': 223 wpcf7c_step1(event.detail.id); 224 break; 225 case 'mail_sent': 226 wpcf7c_step2(event.detail.id); 227 break; 228 229 } 230}, 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.