var block = [ "Чужая2_3", "Falcon", "Joss", "Brander", "Арбитр изящества", ]; var posts = document.getElementsByClassName("alt2"); for (var i = 0; i < posts.length; i++) { if(posts[i].querySelector("div > a > b") != null) { if(block.indexOf(posts[i].querySelector("div > a > b").innerText) != -1) { var el = posts[i].querySelector("div > a > b").parentNode.parentNode.parentNode.parentNode; el.style.visibility = "collapse"; } } } var fieldset = document.getElementsByClassName("fieldset"); var youtube = document.createElement('a'); youtube.setAttribute('href', 'javascript:bbcode(\'[youtube]\',\'[/youtube]\')'); youtube.setAttribute('style', 'margin-left: 10px; vertical-align: 4px;'); youtube.textContent = "YouTube"; var link = document.createElement('a'); link.setAttribute('href', 'javascript:bbcode(\'[url]\',\'[/url]\')'); link.setAttribute('style', 'margin-left: 10px; vertical-align: 4px;'); link.textContent = "URL"; fieldset.item(0).querySelector("div").appendChild(youtube); fieldset.item(0).querySelector("div").appendChild(link);