FlightRising GUI Improvements Sandboxed Portion

Runs potentially unsafe code in a protective sandbox.

  1. // Generated by CoffeeScript 1.9.3
  2.  
  3. /* UserScript options {{{1
  4. // ==UserScript==
  5. // @name FlightRising GUI Improvements Sandboxed Portion
  6. // @description Runs potentially unsafe code in a protective sandbox.
  7. // @namespace ahto
  8. // @version 1.1.2
  9. // @include http://*flightrising.com/*
  10. // @require https://greasyfork.org/scripts/10922-ahto-library/code/Ahto%20Library.js?version=75750
  11. // @grant GM_addStyle
  12. // ==/UserScript==
  13. */
  14. var addCheckboxListeners, updateCheckbox;
  15.  
  16. if (new RegExp('http://www1\.flightrising\.com/msgs$', 'i').test(document.location.href)) {
  17. GM_addStyle('#ajaxbody tr.highlight-tr.selected-tr {\n background-color: #CAA;\n}\n\n#ajaxbody tr.selected-tr {\n background-color: #CBB;\n}');
  18. updateCheckbox = function(targetCheckbox) {
  19. var tr;
  20. tr = targetCheckbox.parents('tr');
  21. if (targetCheckbox.prop('checked')) {
  22. return tr.addClass('selected-tr');
  23. } else {
  24. return tr.removeClass('selected-tr');
  25. }
  26. };
  27. addCheckboxListeners = function() {
  28. return findMatches('#ajaxbody tr input[type=checkbox]').click(function(event) {
  29. return updateCheckbox($(event.target));
  30. });
  31. };
  32. addCheckboxListeners();
  33. findMatches('input#set', 1, 1).click(function(event) {
  34. var i, j, len, ref, results;
  35. ref = findMatches('#ajaxbody tr input[type=checkbox]');
  36. results = [];
  37. for (j = 0, len = ref.length; j < len; j++) {
  38. i = ref[j];
  39. results.push(updateCheckbox($(i)));
  40. }
  41. return results;
  42. });
  43. findMatches('img#prev, img#next, button#delete-confirm-yes', 0, 3).click(function(event) {
  44. return setTimeout((function() {
  45. return addCheckboxListeners();
  46. }), 500);
  47. });
  48. }