diff --git a/src/content/toys.ts b/src/content/toys.ts index 72e62561..0cc4aa7c 100644 --- a/src/content/toys.ts +++ b/src/content/toys.ts @@ -8,11 +8,11 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ export function jack_in() { - //chinese characters - taken from the unicode charset + // chinese characters - taken from the unicode charset const chinese = "田由甲申甴电甶男甸甹町画甼甽甾甿畀畁畂畃畄畅畆畇畈畉畊畋界畍畎畏畐畑".split( "", ) - const colour = "#0F0" //green text + const colour = "#0F0" // green text rain(chinese, colour) } @@ -35,42 +35,42 @@ export function rain(characters: string[], colour, darkening = 0.05) { document.body.appendChild(d) let ctx = c.getContext("2d") - //making the canvas full screen + // making the canvas full screen c.height = window.innerHeight c.width = window.innerWidth - //converting the string into an array of single characters + // converting the string into an array of single characters let font_size = 10 - let columns = c.width / font_size //number of columns for the rain - //an array of drops - one per column + let columns = c.width / font_size // number of columns for the rain + // an array of drops - one per column let drops = [] - //x below is the x coordinate - //1 = y co-ordinate of the drop(same for every drop initially) + // x below is the x coordinate + // 1 = y co-ordinate of the drop(same for every drop initially) for (let x = 0; x < columns; x++) drops[x] = 1 - //drawing the characters + // drawing the characters function draw() { - //Black BG for the canvas - //translucent BG to show trail + // Black BG for the canvas + // translucent BG to show trail ctx.fillStyle = "rgba(0, 0, 0, " + darkening + ")" ctx.fillRect(0, 0, c.width, c.height) ctx.fillStyle = colour ctx.font = font_size + "px arial" - //looping over drops + // looping over drops for (let i = 0; i < drops.length; i++) { - //a random chinese character to print + // a random chinese character to print let text = characters[Math.floor(Math.random() * characters.length)] - //x = i*font_size, y = value of drops[i]*font_size + // x = i*font_size, y = value of drops[i]*font_size ctx.fillText(text, i * font_size, drops[i] * font_size) - //sending the drop back to the top randomly after it has crossed the screen - //adding a randomness to the reset to make the drops scattered on the Y axis + // sending the drop back to the top randomly after it has crossed the screen + // adding a randomness to the reset to make the drops scattered on the Y axis if (drops[i] * font_size > c.height && Math.random() > 0.975) drops[i] = 0 - //incrementing Y coordinate + // incrementing Y coordinate drops[i]++ } } diff --git a/src/excmds.ts b/src/excmds.ts index a065a9d5..64e39201 100644 --- a/src/excmds.ts +++ b/src/excmds.ts @@ -1,4 +1,5 @@ /* tslint:disable:array-type */ +/* tslint:disable:comment-format */ // '//#' is a start point for a simple text-replacement-type macro. See excmds_macros.py /** # Tridactyl help page diff --git a/src/lib/autocontainers.ts b/src/lib/autocontainers.ts index 51bdd3ff..d640d142 100644 --- a/src/lib/autocontainers.ts +++ b/src/lib/autocontainers.ts @@ -108,7 +108,7 @@ export class AutoContain implements IAutoContain { return { cancel: true } } - //Handles the requests after the initial checks made in this.autoContain. + // Handles the requests after the initial checks made in this.autoContain. cancelEarly = (tab: browser.tabs.Tab, details: IDetails): boolean => { if (!this.cancelledRequests[tab.id]) { this.cancelRequest(tab, details) diff --git a/src/lib/config.ts b/src/lib/config.ts index 958c2483..10bdbb0a 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -223,7 +223,7 @@ class default_config { // "?": "fillcmdline find -?", // n: "findnext 1", // N: "findnext -1", - //",": "nohlsearch", + // ",": "nohlsearch", M: "gobble 1 quickmark", B: "fillcmdline taball", b: "fillcmdline tab", @@ -406,8 +406,8 @@ class default_config { * Each key corresponds to a URL fragment which, if contained within the page URL, the site will be opened in a container tab instead. */ autocontain = o({ - //"github.com": "microsoft", - //"youtube.com": "google", + // "github.com": "microsoft", + // "youtube.com": "google", }) /** diff --git a/src/lib/dom.ts b/src/lib/dom.ts index 95b7f6b3..83e9c869 100644 --- a/src/lib/dom.ts +++ b/src/lib/dom.ts @@ -494,7 +494,6 @@ export function focus(e: HTMLElement): void { /** DOM reference to the last used Input field */ -//#content_helper let LAST_USED_INPUT: HTMLElement = null export function getLastUsedInput(): HTMLElement { diff --git a/src/lib/messaging.ts b/src/lib/messaging.ts index 0dcdd66b..e4ebc067 100644 --- a/src/lib/messaging.ts +++ b/src/lib/messaging.ts @@ -67,7 +67,6 @@ export async function message(type: NonTabMessageType, command, args?) { } /** Message the active tab of the currentWindow */ -//#background_helper export async function messageActiveTab( type: TabMessageType, command: string, @@ -85,9 +84,7 @@ export async function messageTab(tabId, type: TabMessageType, command, args?) { return browserBg.tabs.sendMessage(tabId, message) } -//#content_helper let _ownTabId = undefined -//#content_helper export async function messageOwnTab(type: TabMessageType, command, args?) { if (_ownTabId === undefined) { _ownTabId = await ownTabId() @@ -127,7 +124,6 @@ export function addListener(type: MessageType, callback: listener) { } // Warning: lib/webext.ts:ownTab() relies on this listener being added in order to work -//#content_helper addListener("owntab_background", (message, sender, sendResponse) => { let x = Object.assign(Object.create(null), sender.tab) x.mutedInfo = Object.assign(Object.create(null), sender.tab.mutedInfo) diff --git a/src/lib/requests.ts b/src/lib/requests.ts index 593ad589..edbab7c5 100644 --- a/src/lib/requests.ts +++ b/src/lib/requests.ts @@ -9,7 +9,7 @@ const logger = new Logger("requests") class DefaultMap extends Map { constructor(private defaultFactory, ...args) { - //super(...args) + // super(...args) super() } diff --git a/src/lib/url_util.ts b/src/lib/url_util.ts index 4f0ebe48..dc2de9e1 100644 --- a/src/lib/url_util.ts +++ b/src/lib/url_util.ts @@ -90,7 +90,7 @@ export function getUrlParent(url, count = 1) { // more than domain + TLD if (domains.length > 2) { - //domains.pop() + // domains.pop() parent.host = domains.slice(1).join(".") return gup(parent, count - 1) } @@ -368,14 +368,16 @@ export function interpolateSearchItem(urlPattern: URL, query: string): URL { // replace or append as needed if (hasInterpolationPoint) { - let resultingURL = new URL (urlPattern.href.replace(/%s\d+/g, function(x) { - const index = parseInt(x.slice(2)) - 1 - if (index >= queryWords.length) { - return "" - } + let resultingURL = new URL( + urlPattern.href.replace(/%s\d+/g, function(x) { + const index = parseInt(x.slice(2)) - 1 + if (index >= queryWords.length) { + return "" + } - return queryWords[index] - })) + return queryWords[index] + }), + ) return new URL(resultingURL.href.replace("%s", query)) } else { diff --git a/src/lib/webext.ts b/src/lib/webext.ts index e88acf12..e6380fbe 100644 --- a/src/lib/webext.ts +++ b/src/lib/webext.ts @@ -40,7 +40,6 @@ if (inContentScript()) { * TODO: Highlander theory: Can there ever be more than one? * */ -//#background_helper export async function activeTab() { return (await browserBg.tabs.query({ active: true, @@ -48,33 +47,27 @@ export async function activeTab() { }))[0] } -//#background_helper export async function activeTabId() { return (await activeTab()).id } -//#background_helper export async function activeTabContainerId() { return (await activeTab()).cookieStoreId } -//#content_helper export async function ownTab() { // Warning: this relies on the owntab_background listener being set in messaging.ts in order to work return browser.runtime.sendMessage({ type: "owntab_background" }) } -//#content_helper export async function ownTabId() { return (await ownTab()).id } -//#content_helper export async function ownTabContainer() { return browserBg.contextualIdentities.get((await ownTab()).cookieStoreId) } -//#background_helper export async function activeTabContainer() { let containerId = await activeTabContainerId() if (containerId !== "firefox-default") diff --git a/tslint.json b/tslint.json index a37debe3..3ca807f3 100644 --- a/tslint.json +++ b/tslint.json @@ -5,7 +5,6 @@ "arrow-parens": false, "class-name": false, "cognitive-complexity": false, - "comment-format": false, "curly": false, "forin": false, "if-filter": false,