From b6c561ef13b9b5971ab5066e81dae6461f98e954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=9F=E9=85=8C=20=E9=B5=AC=E5=85=84?= Date: Fri, 15 Nov 2024 09:13:10 +0800 Subject: [PATCH] Removed lingering v2 recaptcha codes --- botanjs/src/Astro/Blog/Components/Comment.css | 15 ++---- botanjs/src/Astro/Blog/Components/Comment.js | 48 +++++-------------- 2 files changed, 16 insertions(+), 47 deletions(-) diff --git a/botanjs/src/Astro/Blog/Components/Comment.css b/botanjs/src/Astro/Blog/Components/Comment.css index 37591ea..f76a1a8 100644 --- a/botanjs/src/Astro/Blog/Components/Comment.css +++ b/botanjs/src/Astro/Blog/Components/Comment.css @@ -257,17 +257,6 @@ .info_field .website span { width: 20%; } .info_field .website input { width: 80%; } -#capcha_wrapper { - overflow: hidden; - height: 0; - -} - -#recaptcha_field { - float: right; - background: white; -} - iframe[src="about:blank"] { /* recaptcha about:blank page */ display: none; @@ -287,6 +276,10 @@ iframe[src="about:blank"] { transition-timing-function: cubic-bezier(0.770, 0.000, 0.175, 1.000); /* easeInOutQuart */ } +#c_input_panel.reply { + max-width: 80%; +} + .c_so_sorry { padding: 0.2em; font-size: 0.8em; diff --git a/botanjs/src/Astro/Blog/Components/Comment.js b/botanjs/src/Astro/Blog/Components/Comment.js index 463fa66..7aee1c2 100644 --- a/botanjs/src/Astro/Blog/Components/Comment.js +++ b/botanjs/src/Astro/Blog/Components/Comment.js @@ -70,7 +70,6 @@ , nameHaveText = false , fieldReady = false , releaseReplyLock - , captcha_wrapper , submit_button , cBubble , button @@ -99,6 +98,8 @@ , nameHadHaveText = false , nameInput = function () { + if( !nameField ) + return; // trim whitespaces nameHaveText = nameField.value.trim(); if( nameHadHaveText != nameHaveText ) { @@ -133,21 +134,13 @@ // Configure release lock button = c_reply; - var rf = Dand.id( "recaptcha_field" ); - if( rf && rf.hasChildNodes() ) - { - // if capcha opened - hideSubmit(); - Cycle.delay( function() { - closeInputPanel( reviveInputpanel.bind( c_reply.parentNode.parentNode ) ) - }, 500); - } - else - { - Cycle.delay( function() { - closeInputPanel( reviveInputpanel.bind( c_reply.parentNode.parentNode ) ) - }, 250); - } + hideSubmit(); + Cycle.delay( function() { + closeInputPanel( function() { + cp.classList.add( "reply" ); + reviveInputpanel.bind( c_reply.parentNode.parentNode )(); + } ); + }, 500); } , releaseReplyButton = function () @@ -164,8 +157,6 @@ , fieldReadyTrigger = loggedIn ? /* Overload */ function () { - // Get wrapper - captcha_wrapper || (captcha_wrapper = Dand.id( "capcha_wrapper", true )); submit_button || ( submit_button = Dand.id( "c_submit", true ) ); if(contentHaveText) { @@ -182,9 +173,7 @@ } : /* Overload */ function () { - captcha_wrapper || (captcha_wrapper = Dand.id( "capcha_wrapper", true )); submit_button || ( submit_button = Dand.id( "c_submit", true ) ); - // Create capcha if(!fieldReady && contentHaveText && nameHaveText) { // show submit button @@ -290,12 +279,12 @@ }); // After transition finished, remove input panel - Trigger.height(cp, 0, function() + Cycle.delay(function() { cp.parentNode.removeChild(cp); // Pass panel to handler if(handler) handler(); - }); + }, 500); } , openInputPanel = function () @@ -318,17 +307,13 @@ }, 500); } - , reviveInputpanel = function () { this.appendChild(cp); Cycle.next(openInputPanel); } - - // Comments submission and handling - , commentFailed = function (obj) { // Handle error here to prevent accidental catch by caller @@ -338,14 +323,11 @@ { if(obj.reload) { - // reload the recaptcha Cycle.delay(showSubmit, 1500); - // Wrong answer. - var f = Dand.id("false_capcha"); Cycle.delay( function() { - this.innerHTML = "Wrong answer, please re-enter."; + this.innerHTML = "Recaptcha failure"; this.style.height = "1.2em"; }.bind(f), 500 ); @@ -360,14 +342,11 @@ cBubble.setColor("red"); cBubble.pop("Server error"); }, 1000); - } } else { - // reload the recaptcha Cycle.delay(showSubmit, 1500); - Cycle.delay(function (){cBubble.blurp();}, 500); Cycle.delay(function () { @@ -383,9 +362,6 @@ } , submitKey = new EventKey("Click", submitComment) - // Enter key - , captchaKey = new EventKey("KeyDown", function(e) { if(e.keyCode == 13) submitComment(); }) - , showSubmit = function () {