widget: verification works

This commit is contained in:
realaravinth
2021-05-29 21:19:45 +05:30
parent d9cb38ac13
commit 98cf4a476d
13 changed files with 188 additions and 39 deletions

View File

@@ -5,5 +5,7 @@
href="<.= &*crate::VERIFICATIN_WIDGET_CSS .>"
/>
<script src="<.= &*crate::VERIFICATIN_WIDGET_JS .>"></script>
<script src="<.= &*crate::WIDGET_ROUTES.js .>"></script>
<script src="<.= &*crate::WIDGET_ROUTES.wasm .>"></script>
</body>
</html>

View File

@@ -15,11 +15,41 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import './main.scss';
const PARENT = window.parent;
const verificationContainer = <HTMLElement>(
document.querySelector('.widget__verification-container')
);
verificationContainer.style.display = 'flex';
//PARENT.postMessage
//import prove from './runner/prove';
//import fetchPoWConfig from './runner/fetchPoWConfig';
//import sendWork from './runner/sendWork';
//import sendToParent from './runner/sendToParent';
//import * as CONST from './runner/const';
//
///** add mcaptcha widget element to DOM */
//export const register = () => {
// const verificationContainer = <HTMLElement>(
// document.querySelector('.widget__verification-container')
// );
// verificationContainer.style.display = 'flex';
//
// CONST.btn().addEventListener('click', e => solveCaptchaRunner(e));
//};
//
//const solveCaptchaRunner = async (e: Event) => {
// e.preventDefault();
// // steps:
//
// // 1. hide --before message
// CONST.messageText().before().style.display = 'none';
//
// // 1. show --during
// CONST.messageText().during().style.display = 'block';
// // 1. get config
// const config = await fetchPoWConfig();
// // 2. prove work
// const proof = await prove(config);
// // 3. submit work
// const token = await sendWork(proof);
// // 4. send token
// sendToParent(token);
// // 5. mark checkbox checked
// CONST.btn().checked = true;
//};
//
//register();

View File

@@ -83,7 +83,7 @@
}
.widget__verification-checkbox:checked ~ .widget__verification-text--during {
display: non;
display: none;
}
.widget__verification-checkbox:checked ~ .widget__verification-text--error {