Okoun.cz admin ban button

Adds Banuj button for Okoun

  1. // ==UserScript==
  2. // @name Okoun.cz admin ban button
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description Adds Banuj button for Okoun
  6. // @author eso
  7. // @include https://*.okoun.cz/boards/*
  8. // @include https://*.okoun.cz/updateBoard.jsp*
  9. // @require https://code.jquery.com/jquery-3.3.1.min.js
  10. // @license MIT
  11. // @grant none
  12. // ==/UserScript==
  13.  
  14. $( document ).ready(function() {
  15.  
  16. var okounUsSetLink = $('div.settings a').filter(function(index) { return $(this).text() === "Nastavení klubu"; }).attr("href");
  17.  
  18. if (okounUsSetLink !== undefined) {
  19. $( "div.meta span.user" ).each(function( index ) {
  20. var item = $( this );
  21. item.before( '<span class="yui-button"><a href="' + okounUsSetLink + '&uuName=' + item.text() +'&uuAction=banishHim" target="_blank">Banuj!</a></span>' );
  22. });
  23. }
  24.  
  25. if (window.location.href.indexOf('okoun.cz/updateBoard.jsp?boardId=') !== -1) {
  26.  
  27. var urlParams = new URLSearchParams(window.location.search);
  28. if (urlParams.get('uuAction') == 'banishHim') {
  29.  
  30. $('input[name="newPermUserLogin[0]"]').val(urlParams.get('uuName'));
  31. $('input[name="newPermRead[0]"]').prop('checked', false);
  32. $('input[name="newPermWrite[0]"]').prop('checked', false);
  33. $('input[name="newPermDeleteOwn[0]"]').prop('checked', false)
  34.  
  35. $('html, body').animate({scrollTop: $(document).height()},500);
  36.  
  37. $('fieldset#owners button.submit').stop().css("background-color", "#ff0000")
  38. .animate({ backgroundColor: ''}, 1500);
  39.  
  40. }
  41. }
  42.  
  43. });