I believe that the extension adds the button to all the code blocks on the page, each time a post is loaded. Which will result in as many buttons as there are posts visible.
@Nearata instead of doing document.getElementsByTagName('pre') you can use this.$('pre') (jQuery) or this.element.getElementsByTagName('pre') (pure javascript) to get only children of the current post.