Posted By

smoover on 07/27/11


Tagged

javascript greasemonkey 23hq


Versions (?)

"Report spam on this page" for www.23hq.com photo and album pages


 / Published in: JavaScript
 

This Greasemonkey script will insert a link to "Report spam on this page" for photo and album pages on www.23hq.com. The current URL will be POSTed to a forum on 23hq.com.

Feel free to add suggestions and improvements in the comments.

  1. // ==UserScript==
  2. // @name 23hq.com: Report Spam
  3. // @namespace http://www.23hq.com
  4. // @description Adds a link to a photo detail page to quickly report spam in comments
  5. // @match http://23hq.com/*/photo/*
  6. // @match http://www.23hq.com/*/photo/*
  7. // @match http://23hq.com/*/album/*
  8. // @match http://www.23hq.com/*/album/*
  9. // Inspired by Skeeve's script at http://board.jdownloader.org/showthread.php?t=14453
  10. // ==/UserScript==
  11. (function()
  12. {
  13. try {
  14. var photosidebar = document.getElementById('addCommentForm');
  15. if (!photosidebar) { return; }
  16.  
  17. var clickListener=function (evt) {
  18. var href= evt.target.href;
  19. GM_xmlhttpRequest({
  20. method: "POST",
  21. //url: "http://www.23hq.com/photogroup/help/conversation/5804228/message-add",
  22. url: "http://www.23hq.com/photogroup/help/conversation/6958311/message-add",
  23. headers: {
  24. "Content-Type": "application/x-www-form-urlencoded",
  25. "Accept": "*/*"
  26. },
  27. data: "subject=Spam person detected!&content=Spam found on this page: " + encodeURIComponent(document.location),
  28. onload: function(response) {
  29. // alert("OnLoad: " + response.responseText);
  30. }
  31. });
  32. evt.stopPropagation();
  33. evt.preventDefault();
  34. }
  35.  
  36. var toolsDiv = document.createElement('div');
  37. toolsDiv.setAttribute("style", "margin-top:16px;text-align:right");
  38.  
  39. // create our link
  40. var reportSpamLink = document.createElement('a');
  41. reportSpamLink.href='#';
  42.  
  43. // add text to our link
  44. var reportSpamLinkText = document.createTextNode('Report spam on this page');
  45. reportSpamLink.appendChild(reportSpamLinkText);
  46. reportSpamLink.addEventListener('click', clickListener, true);
  47.  
  48. // add link to our div
  49. toolsDiv.appendChild(reportSpamLink);
  50. photosidebar.appendChild(toolsDiv);
  51.  
  52. } catch (eErr) {
  53. alert ("Greasemonkey error: " + eErr);
  54. }
  55. return;
  56. }) ();

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: smoover on August 2, 2011

Changed @include to @match

You need to login to post a comment.