Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let regex = /<(\w+)\s*(.*)>([^{>]*)\{([^}]+)\}(.*)/g,
- body = document.body,
- html = body.innerHTML;
- body.innerHTML = html.replace(regex, (s,tag,eAttr,bCont, attr, aCont) => {
- let attributes = attr.split(' ').map((part) => {
- return part
- .replace(/^\./,'class=')
- .replace(/^#/,'id=')
- .replace(/^([^=]+)=(.+)$/,'$1="$2"');
- }).join(' ');
- return `<${tag} ${eAttr} ${attributes}>${bCont} ${aCont}`
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement