Debug events tagCo

Debug TC events

  1. // ==UserScript==
  2. // @name Debug events tagCo
  3. // @namespace http://seenaptic.com/
  4. // @version 0.5.1
  5. // @description Debug TC events
  6. // @author BAMF Consulting
  7. // @match *://*/*
  8. // @grant none
  9. // @noframes
  10. // ==/UserScript==
  11.  
  12. function overrideTcEvents(){
  13. if(typeof window.overrideFuncs == "undefined"){
  14. window.overrideFuncs = [];
  15. }
  16. let tc_events = Object.getOwnPropertyNames(window).filter(function (p) {
  17. return typeof window[p] === 'function';
  18. }).filter(function (p) {
  19. return p.match(/tc_events_[0-9]+/)
  20. });
  21. for (let i = 0; i < tc_events.length; i++) {
  22. let func_name = tc_events[i];
  23. if(typeof window.overrideFuncs[func_name] == 'undefined') {
  24. console.log('%c overriding '+func_name,"background-color:#005555; color: #ffffff");
  25. window.overrideFuncs[func_name] = window[func_name];
  26. window[func_name] = function (tc_elt, tc_id_event, tc_array_events) {
  27. console.log("%c------ TC EVENT ------","color:#FF4444;background-color:#000000;");
  28. console.log('%c ' + func_name, 'background-color:#eb0149; color: #ffffff');
  29. console.log(tc_id_event, JSON.parse(JSON.stringify(tc_array_events)));
  30. return window.overrideFuncs[func_name](tc_elt, tc_id_event, tc_array_events);
  31. }
  32. }
  33. window.clearInterval(window.orinterval);
  34. }
  35. }
  36.  
  37. window.orinterval = window.setInterval(overrideTcEvents,100);
  38. window.setTimeout(function(){window.clearInterval(window.orinterval);},5000);