Search by

mojahed / only-eye

Hide emails and markup.

Maintainers

Package info

github.com/md-mojahed/only-eye

pkg:composer/mojahed/only-eye

Transparency log

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-08-20 11:33 UTC

This package is auto-updated.

Last update: 2026-08-20 11:36:22 UTC


README

Hide emails and markup using a <only-eye>:

Install

composer require mojahed/only-eye

copy the script on any page that uses the <only-eye> element:

<script src="assets/only-eye.min.js"></script>

(Or copy assets/only-eye.min.js into your own public assets and reference it from there.)

Usage

PHP

use Mojahed\OnlyEye;

echo OnlyEye::show('abc@gmail.com');
// <only-eye>YWJjQGdtYWlsLmNvbQ==</only-eye>

OnlyEye::show($str, $js = false, $mode = 'closed')

Param Type Default Description
$str string Raw HTML/text to hide. Gets base64-encoded into the element body.
$js bool false Adds the js attribute, allowing inline <script> content to run.
$mode string 'closed' Shadow DOM mode: 'open' or 'closed'. Adds mode="open" only when open.
OnlyEye::show('mojahed@dsds.com', false, 'open');
// <only-eye mode="open">bW9qYWhlZEBsaWdodHRlY2hiZC5jb20=</only-eye>

A global onlyEye() helper function is also available, so you can skip the use statement:

echo onlyEye('abc@gmail.com');
// <only-eye>YWJjQGdtYWlsLmNvbQ==</only-eye>

Attributes

  • mode"open" or "closed" (default).

API

document.querySelector('only-eye').value
// => decoded innerHTML of the shadow root

Examples

See example/demo.html for the raw HTML/JS usage and example/index.php for the PHP helper.

License

MIT © Mojahed