FlightRising GUI Improvements Sandboxed Portion

Runs potentially unsafe code in a protective sandbox.

当前为 2015-09-11 提交的版本,查看 最新版本

// Generated by CoffeeScript 1.9.3

/* UserScript options {{{1
// ==UserScript==
// @name         FlightRising GUI Improvements Sandboxed Portion
// @description  Runs potentially unsafe code in a protective sandbox.
// @namespace    ahto
// @version      1.0.0
// @include      http://*flightrising.com/*
// @require      https://greasyfork.org/scripts/10922-ahto-library/code/Ahto%20Library.js?version=61626
// @grant        GM_addStyle
// ==/UserScript==
 */
var injectScript;

injectScript = function(f) {
  var script, source;
  if (typeof f === 'function') {
    source = "(" + f + ")();";
  }
  script = $("<script type='application/javascript'>\n    " + source + "\n</script>");
  $(document).append(script);
  return script.remove();
};

if (new RegExp('http://www1\.flightrising\.com/msgs$', 'i').test(document.location.href)) {
  GM_addStyle('#ajaxbody tr.highlight-tr.selected-tr {\n    background-color: #CAA;\n}\n\n#ajaxbody tr.selected-tr {\n    background-color: #CBB;\n}');
  findMatches('#ajaxbody tr input[type=checkbox]').click(function(event) {
    var target, tr;
    target = $(event.target);
    tr = target.parents('tr');
    if (target.prop('checked')) {
      return tr.addClass('selected-tr');
    } else {
      return tr.removeClass('selected-tr');
    }
  });
}