Set up a community report page

Selects the "wrong category" option from the list and starts the explanation text

  1. // ==UserScript==
  2. // @name Set up a community report page
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Selects the "wrong category" option from the list and starts the explanation text
  6. // @author Sarah King
  7. // @match http://www.trademe.co.nz/Browse/CommunityWatch.aspx*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var splitUrl = function() {
  15. var vars = [], hash;
  16. var url = document.URL.split('?')[0];
  17. var p = document.URL.split('?')[1];
  18. if(p !== undefined){
  19. p = p.split('&');
  20. for(var i = 0; i < p.length; i++){
  21. hash = p[i].split('=');
  22. vars.push(hash[1]);
  23. vars[hash[0]] = hash[1];
  24. }
  25. }
  26. vars['url'] = url;
  27. return vars;
  28. };
  29.  
  30. var rptpath = splitUrl().rptpath;
  31.  
  32. //console.log( 'mobile-phones%2Fmobile-phones'.length);
  33.  
  34. $( "select[name*='complaint_subject_id']" ).val(19);
  35. var comment = $( "textarea[name*='body']" );
  36.  
  37. if (rptpath !== undefined){
  38. if (rptpath == '341-887-1099-'){
  39. comment.text('Belongs in Sewing Machine Accessories');
  40. }
  41. else if (rptpath.substr(0,29) == 'mobile-phones%2Fmobile-phones' || rptpath.substr(0,11) == '344-422-430'){
  42. comment.text('Belongs in Mobile Phones | Accessories or one of the subcategories.');
  43. }
  44. else if (rptpath == 'jewellery-watches%2Fearrings%2Fdiamond'){
  45. comment.text('Belongs in the Crystal or Cubic Zirconia sections. These earrings are not diamond');
  46. }
  47. else if (rptpath == 'jewellery-watches%2Fearrings%2Fplain-gold'){
  48. comment.text('These earrings are not plain gold and should be listed in another section');
  49. }
  50. else if (rptpath == '595' || rptpath == '5-380-595-'){
  51. comment.text('This item is either a component/part of a bike, clothing or it is a kids bike. None of these should be listed as a BMX bike.');
  52. }
  53. else if (rptpath == '341-4408-4413-'){
  54. comment.text('This item is not a cross stitch kit and should be listed elsewhere');
  55. }
  56. }
  57. //mobile-phones/accessories
  58. })();