My post has content:
<p>download <a href="https://www.google.com/file/JRWZZPB5HS69" target="_blank">Download</a></p>
<p>download mirror <a href="https://mega.nz/#!Z3wkgaba!KdgfdsDgSDgSDgdsg" target="_blank">Download</a></p>
And i have a script to add prefix domain, i put it before </body>
:
<script type="text/javascript">
var tui_url = 'https://mydomainasd.com';
var tui_domains = ['mediafire.com', 'www.abc.com','mega.nz', 'drive.google.com','secufiles.com'];
</script>
<script>
function tui_get_url(e) {
var n = document.createElement("a");
return n.href = e, n
}
function tui_get_host_name(e) {
var n;
return void 0 === e || null === e || "" === e || e.match(/^\#/) ? "" : -1 === (e = tui_get_url(e)).href.search(/^http[s]?:\/\//) ? "" : (n = e.href.split("/")[2], (n = n.split(":")[0]).toLowerCase())
}
document.addEventListener("DOMContentLoaded", function(e) {
if ("undefined" != typeof tui_url) {
var l = document.getElementsByTagName("a");
if ("undefined" == typeof tui_domains)
if ("undefined" == typeof tui_exclude_domains);
else
for (o = 0; o < l.length; o++) {
var t = tui_get_host_name(l[o].getAttribute("href"));
t.length > 0 && -1 === tui_exclude_domains.indexOf(t) ?
l[o].href = tui_url + "?u=" + encodeURIComponent(l[o].href) : "magnet:" ===
l[o].protocol && (l[o].href = tui_url + "?u=" + encodeURIComponent(l[o].href))
} else
for (var o = 0; o < l.length; o++)(t =
tui_get_host_name(l[o].getAttribute("href"))).length > 0 &&
tui_domains.indexOf(t) > -1 ? l[o].href = tui_url + "?u=" +
encodeURIComponent(l[o].href): "magnet:" === l[o].protocol && (l[o].href =
tui_url + "?u=" + encodeURIComponent(l[o].href))
}
});
</script>
It works well.
But now I want to it perform this task before generating post content, mean that above script will not appear in output HTML.
I think about creating a plugin or function but I don't know how to do.
Can you help me solve this? sorry for my English