Showing the changes to assets/javascripts/debug.js (1 of 80 files). Show all
Unified · Split
| @@ -9,26 +9,33 @@ · 8 unmodified lines | ||
| 9 | 9 | * DS209: Avoid top-level return |
| 10 | 10 | * Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md |
| 11 | 11 | */ |
| 12 | −if (!(typeof console !== 'undefined' && console !== null ? console.time : undefined) || !console.groupCollapsed) { return; } | |
| 12 | +if ( | |
| 13 | + !(typeof console !== "undefined" && console !== null | |
| 14 | + ? console.time | |
| 15 | + : undefined) || | |
| 16 | + !console.groupCollapsed | |
| 17 | +) { | |
| 18 | + return; | |
| 19 | +} | |
| 13 | 20 | |
| 14 | 21 | // |
| 15 | 22 | // App |
| 16 | 23 | // |
| 17 | 24 | |
| 18 | 25 | const _init = app.init; |
| 19 | −app.init = function() { | |
| 20 | − console.time('Init'); | |
| 26 | +app.init = function () { | |
| 27 | + console.time("Init"); | |
| 21 | 28 | _init.call(app); |
| 22 | − console.timeEnd('Init'); | |
| 23 | − return console.time('Load'); | |
| 29 | + console.timeEnd("Init"); | |
| 30 | + return console.time("Load"); | |
| 24 | 31 | }; |
| 25 | 32 | |
| 26 | 33 | const _start = app.start; |
| 27 | −app.start = function() { | |
| 28 | − console.timeEnd('Load'); | |
| 29 | − console.time('Start'); | |
| 34 | +app.start = function () { | |
| 35 | + console.timeEnd("Load"); | |
| 36 | + console.time("Start"); | |
| 30 | 37 | _start.call(app, ...arguments); |
| 31 | − return console.timeEnd('Start'); | |
| 38 | + return console.timeEnd("Start"); | |
| 32 | 39 | }; |
| 33 | 40 | |
| 34 | 41 | // |
| @@ -38,47 +45,50 @@ app.start = function() { · 3 unmodified lines | ||
| 38 | 45 | const _super = app.Searcher; |
| 39 | 46 | const _proto = app.Searcher.prototype; |
| 40 | 47 | |
| 41 | −app.Searcher = function() { | |
| 48 | +app.Searcher = function () { | |
| 42 | 49 | _super.apply(this, arguments); |
| 43 | 50 | |
| 44 | 51 | const _setup = this.setup.bind(this); |
| 45 | − this.setup = function() { | |
| 52 | + this.setup = function () { | |
| 46 | 53 | console.groupCollapsed(`Search: ${this.query}`); |
| 47 | − console.time('Total'); | |
| 54 | + console.time("Total"); | |
| 48 | 55 | return _setup(); |
| 49 | 56 | }; |
| 50 | 57 | |
| 51 | 58 | const _match = this.match.bind(this); |
| 52 | 59 | this.match = () => { |
| 53 | − if (this.matcher) { console.timeEnd(this.matcher.name); } | |
| 60 | + if (this.matcher) { | |
| 61 | + console.timeEnd(this.matcher.name); | |
| 62 | + } | |
| 54 | 63 | return _match(); |
| 55 | 64 | }; |
| 56 | 65 | |
| 57 | 66 | const _setupMatcher = this.setupMatcher.bind(this); |
| 58 | − this.setupMatcher = function() { | |
| 67 | + this.setupMatcher = function () { | |
| 59 | 68 | console.time(this.matcher.name); |
| 60 | 69 | return _setupMatcher(); |
| 61 | 70 | }; |
| 62 | 71 | |
| 63 | 72 | const _end = this.end.bind(this); |
| 64 | − this.end = function() { | |
| 73 | + this.end = function () { | |
| 65 | 74 | console.log(`Results: ${this.totalResults}`); |
| 66 | − console.timeEnd('Total'); | |
| 75 | + console.timeEnd("Total"); | |
| 67 | 76 | console.groupEnd(); |
| 68 | 77 | return _end(); |
| 69 | 78 | }; |
| 70 | 79 | |
| 71 | 80 | const _kill = this.kill.bind(this); |
| 72 | − this.kill = function() { | |
| 81 | + this.kill = function () { | |
| 73 | 82 | if (this.timeout) { |
| 74 | − if (this.matcher) { console.timeEnd(this.matcher.name); } | |
| 83 | + if (this.matcher) { | |
| 84 | + console.timeEnd(this.matcher.name); | |
| 85 | + } | |
| 75 | 86 | console.groupEnd(); |
| 76 | − console.timeEnd('Total'); | |
| 77 | − console.warn('Killed'); | |
| 87 | + console.timeEnd("Total"); | |
| 88 | + console.warn("Killed"); | |
| 78 | 89 | } |
| 79 | 90 | return _kill(); |
| 80 | 91 | }; |
| 81 | − | |
| 82 | 92 | }; |
| 83 | 93 | |
| 84 | 94 | $.extend(app.Searcher, _super); |
| @@ -89,23 +99,40 @@ app.Searcher.prototype = _proto; · 4 unmodified lines | ||
| 89 | 99 | // View tree |
| 90 | 100 | // |
| 91 | 101 | |
| 92 | −this.viewTree = function(view, level, visited) { | |
| 93 | − if (view == null) { view = app.document; } | |
| 94 | − if (level == null) { level = 0; } | |
| 95 | − if (visited == null) { visited = []; } | |
| 96 | − if (visited.indexOf(view) >= 0) { return; } | |
| 102 | +this.viewTree = function (view, level, visited) { | |
| 103 | + if (view == null) { | |
| 104 | + view = app.document; | |
| 105 | + } | |
| 106 | + if (level == null) { | |
| 107 | + level = 0; | |
| 108 | + } | |
| 109 | + if (visited == null) { | |
| 110 | + visited = []; | |
| 111 | + } | |
| 112 | + if (visited.indexOf(view) >= 0) { | |
| 113 | + return; | |
| 114 | + } | |
| 97 | 115 | visited.push(view); |
| 98 | 116 | |
| 99 | − console.log(`%c ${Array(level + 1).join(' ')}${view.constructor.name}: ${!!view.activated}`, | |
| 100 | − 'color:' + ((view.activated && 'green') || 'red')); | |
| 117 | + console.log( | |
| 118 | + `%c ${Array(level + 1).join(" ")}${ | |
| 119 | + view.constructor.name | |
| 120 | + }: ${!!view.activated}`, | |
| 121 | + "color:" + ((view.activated && "green") || "red"), | |
| 122 | + ); | |
| 101 | 123 | |
| 102 | 124 | for (var key of Object.keys(view || {})) { |
| 103 | 125 | var value = view[key]; |
| 104 | − if ((key !== 'view') && value) { | |
| 105 | − if ((typeof value === 'object') && value.setupElement) { | |
| 126 | + if (key !== "view" && value) { | |
| 127 | + if (typeof value === "object" && value.setupElement) { | |
| 106 | 128 | this.viewTree(value, level + 1, visited); |
| 107 | 129 | } else if (value.constructor.toString().match(/Object\(\)/)) { |
| 108 | − for (var k of Object.keys(value || {})) { var v = value[k]; if (v && (typeof v === 'object') && v.setupElement) { this.viewTree(v, level + 1, visited); } } | |
| 130 | + for (var k of Object.keys(value || {})) { | |
| 131 | + var v = value[k]; | |
| 132 | + if (v && typeof v === "object" && v.setupElement) { | |
| 133 | + this.viewTree(v, level + 1, visited); | |
| 134 | + } | |
| 135 | + } | |
| 109 | 136 | } |
| 110 | 137 | } |
| 111 | 138 | } |