Skip to content

Commit

Permalink
Update custom-comments-template.php
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperAtic committed Oct 31, 2023
1 parent ebd3976 commit a977b9a
Showing 1 changed file with 41 additions and 9 deletions.
50 changes: 41 additions & 9 deletions custom-comments-template.php
@@ -1,3 +1,17 @@
<script>
document.addEventListener('DOMContentLoaded', function() {
if (typeof window.nostr !== 'undefined') {
// nos2x extension is detected
console.log('nos2x extension detected');
// You can enable or show relevant UI elements here
} else {
// nos2x extension is not detected
console.log('nos2x extension not detected');
// You can show a message to the user or hide certain UI elements
}
});
</script>

<div id="wp-nostress-comments-form">
<h3>Deja un comentario con <a href="https://nostr.how" target="_blank">NOSTR</a></h3>
<form id="nsec-key-form">
Expand All @@ -8,7 +22,7 @@
<p><small><code>ₐₗₜₑᵣₙₐₜᵢᵥₐₘₑₙₜₑ</code></small></p>
<button onclick="window.open('https://hitony.com/nostrogen/', '_blank')" id="generate-new-key">Generar nueva llave <strong>NSEC</strong></button>
<p><small><code>ₐₗₜₑᵣₙₐₜᵢᵥₐₘₑₙₜₑ</code></small></p>
<button id="use-browser-extension">Conectar con Extensión</button>
<button id="connect-nos2x">Conectar con Extensión</button>
<p class="extensiones"><small><code>Por ejemplo <a href="https://getalby.com/" target="_blank"><strong>🐝Alby</strong></a> o <br/>
<a href="https://github.com/fiatjaf/nos2x" target="_blank"><strong>🔑Nost2x</strong></a>
en <a href="https://chrome.google.com/webstore/detail/nos2x/kpgefcfmnafjgpblomihpgmejjdanjjp" target="_blank">Chrom</a>
Expand All @@ -17,13 +31,31 @@
</div>
<script>
document.getElementById('generate-new-key').addEventListener('click', function() {
// Logic to generate a new NSEC key using the Nostr library.
// This will require more specific details from the Nostr library's documentation.
});
document.getElementById('connect-nos2x').addEventListener('click', function() {
if (typeof window.nostr !== 'undefined') {
window.nostr.getPublicKey().then(function(pubKey) {
console.log('Public Key:', pubKey);
// You can now use this public key for further actions
}).catch(function(error) {
console.error('Error retrieving public key:', error);
});
} else {
alert('Please install the nos2x extension to continue.');
}
});
</script>
document.getElementById('use-browser-extension').addEventListener('click', function() {
// Logic to use an external browser extension like Alby or Nos2x.
// This might require specific integration based on the extension's API or functionality.
});
<script>
function signEvent(event) {
if (typeof window.nostr !== 'undefined') {
window.nostr.signEvent(event).then(function(signedEvent) {
console.log('Signed Event:', signedEvent);
// You can now use this signed event for further actions
}).catch(function(error) {
console.error('Error signing event:', error);
});
} else {
alert('Please install the nos2x extension to continue.');
}
}
</script>

0 comments on commit a977b9a

Please sign in to comment.