From b0c9a764c77a451726049a79a19a0fa28ae0b30c Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 21 Dec 2014 11:58:01 +0000 Subject: Exclusion; unique keys. --- lib/utils.coffee | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/utils.coffee') diff --git a/lib/utils.coffee b/lib/utils.coffee index b7f8731a..81b0fb49 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -110,6 +110,12 @@ Utils = # detects both literals and dynamically created strings isString: (obj) -> typeof obj == 'string' or obj instanceof String + # Transform "zjkjkabz" into "abjkz". + uniqueCharacters: (str) -> + unique = "" + for char in str.split("").sort() + unique += char unless 0 <= unique.indexOf char + unique # Compares two version strings (e.g. "1.1" and "1.5") and returns # -1 if versionA is < versionB, 0 if they're equal, and 1 if versionA is > versionB. -- cgit v1.2.3 From 7ce860833fea405dae522e431a017a6135cfc54e Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 21 Dec 2014 13:07:26 +0000 Subject: Exclusion; warn on chrome pages. --- lib/utils.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/utils.coffee') diff --git a/lib/utils.coffee b/lib/utils.coffee index 81b0fb49..8ee948b0 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -26,7 +26,7 @@ Utils = -> id += 1 hasChromePrefix: do -> - chromePrefixes = [ "about:", "view-source:", "extension:", "chrome-extension:", "data:" ] + chromePrefixes = [ "about:", "view-source:", "extension:", "chrome://", "chrome-extension:", "data:" ] (url) -> if 0 < url.indexOf ":" for prefix in chromePrefixes -- cgit v1.2.3 From feab329b9fc40463e185ce50a81ca0c3f35c813f Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 21 Dec 2014 14:26:41 +0000 Subject: Exclusion; fiddle with styling. --- lib/utils.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/utils.coffee') diff --git a/lib/utils.coffee b/lib/utils.coffee index 8ee948b0..81b0fb49 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -26,7 +26,7 @@ Utils = -> id += 1 hasChromePrefix: do -> - chromePrefixes = [ "about:", "view-source:", "extension:", "chrome://", "chrome-extension:", "data:" ] + chromePrefixes = [ "about:", "view-source:", "extension:", "chrome-extension:", "data:" ] (url) -> if 0 < url.indexOf ":" for prefix in chromePrefixes -- cgit v1.2.3 From b5c0b8da794407bc72f9f43da40422ed23e3899e Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 30 Dec 2014 10:58:46 +0000 Subject: Exclusions; use querySelector to find sub-elements. As @philc pointed out in #1366, this is less brittle. --- lib/utils.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/utils.coffee') diff --git a/lib/utils.coffee b/lib/utils.coffee index 81b0fb49..05ebd071 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -111,7 +111,7 @@ Utils = isString: (obj) -> typeof obj == 'string' or obj instanceof String # Transform "zjkjkabz" into "abjkz". - uniqueCharacters: (str) -> + distinctCharacters: (str) -> unique = "" for char in str.split("").sort() unique += char unless 0 <= unique.indexOf char -- cgit v1.2.3