Playblink Ignore Button

Puts an ignore button on users' profile pages

  1. // ==UserScript==
  2. // @name Playblink Ignore Button
  3. // @namespace
  4. // @version 0.1.1
  5. // @description Puts an ignore button on users' profile pages
  6. // @match http://www.playblink.com/profile/*
  7. // @copyright 2014+, Arpione
  8. // ==/UserScript==
  9.  
  10. var wrap = document.getElementsByClassName("wrap")[1];
  11.  
  12. if((wrap.children[0].children.length > 0) && (wrap.children[0].children[0].textContent == "Send me a message")){
  13. var style = document.createElement("style");
  14. style.setAttribute("type", "text/css");
  15. style.innerHTML = ".red {" +
  16. "color: #eeeeee;" +
  17. "border: solid 1px #A40000;" +
  18. "background: #CC0000;" +
  19. "background: -webkit-gradient(linear, left top, left bottom, from(#EE0000), to(#A60000));" +
  20. "background: -moz-linear-gradient(top, #EE0000, #A60000);" +
  21. "filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#EE0000', endColorstr='#A60000');" +
  22. "}" +
  23. ".red:hover {" +
  24. "background: #AC0000;" +
  25. "background: -webkit-gradient(linear, left top, left bottom, from(#CC0000), to(#8E0000));" +
  26. "background: -moz-linear-gradient(top, #CC0000, #8E0000);" +
  27. "filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#CC0000', endColorstr='#8E0000');" +
  28. "}" +
  29. ".red:active {" +
  30. "color: #C3C3C3;" +
  31. "background: #CC0000;" +
  32. "background: -webkit-gradient(linear, left top, left bottom, from(#A60000), to(#EE0000));" +
  33. "background: -moz-linear-gradient(top, #A60000, #EE0000);" +
  34. "filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#A60000', endColorstr='#EE0000');" +
  35. "}";
  36. wrap.children[0].appendChild(style);
  37. var button = document.createElement("div");
  38. var label = document.createTextNode("Ignore");
  39. button.appendChild(label);
  40. button.setAttribute("class", "button red");
  41. button.setAttribute("style", "float:right;vertical-align:bottom;margin-right:10px;");
  42. button.onclick = function (){
  43. var username = wrap.children[0].innerHTML.split(' ')[0];
  44. var confirmed = window.confirm("Are you sure you want to ignore " + username + "?");
  45. if(confirmed){
  46. $.get("/?do=shout&act=ignore&username=" + username, function (res) {
  47. if (res == "OK") {
  48. document.location = "/profile/" + username;
  49. }else{
  50. window.alert("Failed to add " + username + " to the ignore list:\n\"" + res + "\"");
  51. }
  52. });
  53. }
  54. }
  55. wrap.children[0].appendChild(button);
  56. }