handleGhostModeOption.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. var immutable_1 = require("immutable");
  4. function handleGhostModeOption(incoming) {
  5. var value = incoming.get('ghostMode');
  6. var trueAll = {
  7. clicks: true,
  8. scroll: true,
  9. forms: {
  10. submit: true,
  11. inputs: true,
  12. toggles: true
  13. }
  14. };
  15. var falseAll = {
  16. clicks: false,
  17. scroll: false,
  18. forms: {
  19. submit: false,
  20. inputs: false,
  21. toggles: false
  22. }
  23. };
  24. if (value === false ||
  25. value === "false") {
  26. return [incoming.set('ghostMode', immutable_1.fromJS(falseAll)), []];
  27. }
  28. if (value === true ||
  29. value === "true") {
  30. return [incoming.set('ghostMode', immutable_1.fromJS(trueAll)), []];
  31. }
  32. if (value.get("forms") === false) {
  33. return [incoming.set('ghostMode', value.withMutations(function (map) {
  34. map.set("forms", immutable_1.fromJS({
  35. submit: false,
  36. inputs: false,
  37. toggles: false
  38. }));
  39. })), []];
  40. }
  41. if (value.get("forms") === true) {
  42. return [incoming.set('ghostMode', value.withMutations(function (map) {
  43. map.set("forms", immutable_1.fromJS({
  44. submit: true,
  45. inputs: true,
  46. toggles: true
  47. }));
  48. })), []];
  49. }
  50. return [incoming, []];
  51. }
  52. exports.handleGhostModeOption = handleGhostModeOption;
  53. //# sourceMappingURL=handleGhostModeOption.js.map