// WHAT DOES THIS SCRIPT DO?
// This script adds a link (as the last one in row) in the toolbox on history tab of any article.
// CLicking the link hides all bot edits in the history of the page.
// Actually it replaces whole row with ellipsis (three dots: "…").

// HOW CAN I USE IT?
// To use this script you have to add the line below (without the "//" at the beggining of the line)
// importScript('Wikipedysta:Vinne2/hideBotsInHistory.js');
// into your common.js which is there: http://pl.wikipedia.orghttps://wikines.com/pl/Special:MyPage/common.js

// WILL IT WORK FOR MY COMPUTER?
// I do not guarantee it works with every skin, every system and every PC. If it does not, please let me know.

/* (Wymagany włączony gadżet Kolorowanie i zamiana nicków oraz rozsądna przeglądarka (nie-IE6), żeby zadziałała.) Taki kod po prostu ukryje na stronie historii wiersze odpowiadające edycjom botów (do odświeżenia strony) - linki "poprz." dalej będą porównywały zmiany botów, ale strona się oczyści. */

if(/action\=history/.test(window.location)){ //running script only while on history tab

    var hideBotsInHistoryLink = document.createElement('a'); // hideBotsInHistoryLink = link element that is hiding bots' edits in the history tab
    hideBotsInHistoryLink.id = 'hideBotsInHistoryLink'; //giving it the ID
    hideBotsInHistoryLink.href = '#'; //no href, just to avoid reloading the page
    hideBotsInHistoryLink.setAttribute('onclick','Array.prototype.slice.call(document.querySelectorAll(\'#pagehistory .nick_bot\'), 0).map(function(a){while(a.tagName.toLowerCase() != \'li\') a=a.parentNode; a.innerHTML=\'&#8230;\'}); var hideBotsInHistoryText = document.createElement(\'small\'); hideBotsInHistoryText.innerHTML = \'aby pokazać edycje botów odśwież stronę\'; hideBotsInHistoryLink.parentNode.replaceChild(hideBotsInHistoryText,hideBotsInHistoryLink);'); // on click it will do its job; additionally the link will disappear and a message "<small>aby pokazać edycje botów odśwież stronę</small>" (en: "refresh page to see bots' edits again") will show in its place
    hideBotsInHistoryLink.setAttribute('class','external text'); //setting the class as in neighbour links
    hideBotsInHistoryLink.setAttribute('rel','nofollow'); //setting the rel as in neighbour links
    hideBotsInHistoryLink.innerHTML = 'Ukryj edycje botów'; // displayed title of the link

    document.getElementById("history-toolbox").getElementsByTagName("p").appendChild(document.createTextNode("• ")); //adding the bullet after last neighbour link
    document.getElementById("history-toolbox").getElementsByTagName("p").appendChild(hideBotsInHistoryLink); //appending the link

}