Skip to content

Instantly share code, notes, and snippets.

@eksana
Created May 2, 2017 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eksana/9e97bd1818a9347ff1656a36193b906c to your computer and use it in GitHub Desktop.
Save eksana/9e97bd1818a9347ff1656a36193b906c to your computer and use it in GitHub Desktop.
Замена русских букв английскими аналогами
<script type="text/javascript">
function addTrans() {
var d = document.getElementsByTagName('body')[0];
var e = window.getSelection();
var c = e + "";
var f = "С с Е е Т О о р Р А а Н К Х х В М y З 3".split(/ +/g);
var g = "C c E e T O o p P A a H K X x B M у 3 З".split(/ +/g);
var b;
for (var b = 0; b < f.length; b++) {
c = c.split(f[b]).join(g[b])
}
var a = document.createElement('div');
a.style.position = 'absolute';
a.style.left = '-99999px';
d.appendChild(a);
a.innerHTML = c;
e.selectAllChildren(a);
window.setTimeout(function () {
d.removeChild(a)
}, 0)
}
document.oncopy = addTrans;
</script>
https://seo-zona.ru/novyj-unikalnyj-metod-zashhity-teksta-ot-kopirovaniya-2017-02-15.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment