Permalink
Please sign in to comment.
Showing
with
64,822 additions
and 0 deletions.
- +9 −0 README.md
- +95 −0 chrome/_locales/en_US/messages.json
- +5 −0 chrome/background.html
- +90 −0 chrome/background.js
- +239 −0 chrome/comment-snob.js
- +335 −0 chrome/content.js
- +16 −0 chrome/jquery.js
- +29 −0 chrome/lib/typo/dictionaries/en_US/README_en_US.txt
- +201 −0 chrome/lib/typo/dictionaries/en_US/en_US.aff
- +62,120 −0 chrome/lib/typo/dictionaries/en_US/en_US.dic
- +495 −0 chrome/lib/typo/typo.js
- +22 −0 chrome/manifest.json
- +61 −0 chrome/minify.json.js
- +282 −0 chrome/options.html
- +164 −0 chrome/skin/chrome-preferences-page.css
- BIN chrome/skin/icon-128.png
- BIN chrome/skin/icon-16.png
- BIN chrome/skin/icon-48.png
- +69 −0 chrome/skin/install.css
- BIN icon.xcf
- +336 −0 license.txt
- BIN web/add.png
- +123 −0 web/index.html
- BIN web/install.png
- +18 −0 web/rules/break.snob
- +17 −0 web/rules/chrisfinke.snob
- +15 −0 web/rules/fark.snob
- +17 −0 web/rules/hn.snob
- +17 −0 web/rules/mashable.snob
- +14 −0 web/rules/reddit.snob
- +17 −0 web/rules/yahoo-news.snob
- +16 −0 web/rules/youtube.snob
- BIN web/yahoo.png
- BIN web/youtube-after.png
- BIN web/youtube-before.png
- BIN web/youtube.png
@@ -0,0 +1,9 @@ | ||
+Comment Snob is an extension for Google Chrome that filters out undesirable comments from comment threads on the Web. | ||
+ | ||
+* More than # spelling mistakes. | ||
+* All capital letters | ||
+* No capital letters | ||
+* Doesn't start with a capital letter | ||
+* Excessive punctuation (!!!! ????) | ||
+* Excessive capitalization | ||
+* Profanity |
@@ -0,0 +1,95 @@ | ||
+{ | ||
+ "extName": { | ||
+ "message": "Comment Snob" | ||
+ }, | ||
+ "extDescription": { | ||
+ "message": "Filters out undesirable comments from the Web." | ||
+ }, | ||
+ "action_save": { | ||
+ "message": "Save" | ||
+ }, | ||
+ "options_page_title": { | ||
+ "message": "Comment Snob Options" | ||
+ }, | ||
+ "label_site": { | ||
+ "message": "Site:" | ||
+ }, | ||
+ "label_hide_all": { | ||
+ "message": "Hide all comments" | ||
+ }, | ||
+ "label_hide_no_capital": { | ||
+ "message": "Hide comments that have no capital letters." | ||
+ }, | ||
+ "label_hide_only_capital": { | ||
+ "message": "Hide comments that have only capital letters." | ||
+ }, | ||
+ "label_hide_start_lower": { | ||
+ "message": "Hide comments that do not start with a capital letter." | ||
+ }, | ||
+ "label_hide_too_much_punctuation": { | ||
+ "message": "Hide comments that have excessive punctuation. (!!!!! ?????)" | ||
+ }, | ||
+ "label_hide_too_much_capitalization": { | ||
+ "message": "Hide comments that have excessive capitalization." | ||
+ }, | ||
+ "label_hide_too_much_profanity": { | ||
+ "message": "Hide comments that include profanity." | ||
+ }, | ||
+ "label_hide_spelling": { | ||
+ "message": "Hide comments with at least this many spelling mistakes. (Set to zero to disable spellchecking.)" | ||
+ }, | ||
+ "label_hidden_reason": { | ||
+ "message": "Comment hidden ($reason$)", | ||
+ "placeholders": { | ||
+ "reason": { | ||
+ "content": "$1" | ||
+ } | ||
+ } | ||
+ }, | ||
+ "label_show": { | ||
+ "message": "Show" | ||
+ }, | ||
+ "label_hide": { | ||
+ "message": "Hide" | ||
+ }, | ||
+ "reason_no_capital": { | ||
+ "message": "No capital letters", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "reason_only_capital": { | ||
+ "message": "All capital letters", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "reason_start_lower": { | ||
+ "message": "Doesn't start with a capital letter", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "reason_too_much_punctuation": { | ||
+ "message": "Excessive punctuation", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "reason_too_much_capitalization": { | ||
+ "message": "Excessive capitalization", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "reason_too_much_profanity": { | ||
+ "message": "Profanity", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "reason_spelling": { | ||
+ "message" : "Too many spelling mistakes", | ||
+ "description": "A reason shown to the user when hiding a comment." | ||
+ }, | ||
+ "option_default": { | ||
+ "message": "(Default)" | ||
+ }, | ||
+ "action_remove": { | ||
+ "message": "Remove This Rule" | ||
+ }, | ||
+ "action_add": { | ||
+ "message": "Add a new rule" | ||
+ }, | ||
+ "install_rule": { | ||
+ "message": "Install a Comment Snob Rule from this page" | ||
+ } | ||
+} |
@@ -0,0 +1,5 @@ | ||
+<script src="jquery.js" type="text/javascript"></script> | ||
+<script src="lib/typo/typo.js" type="text/javascript"></script> | ||
+<script src="comment-snob.js" type="text/javascript"></script> | ||
+<script src="minify.json.js" type="text/javascript"></script> | ||
+<script src="background.js" type="text/javascript"></script> |
@@ -0,0 +1,90 @@ | ||
+var currentRules = null; | ||
+var dictionaryObject = null; | ||
+ | ||
+chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) { | ||
+ currentRules = null; | ||
+ | ||
+ // Re-get the rules for this tab. | ||
+ chrome.tabs.sendRequest(tabId, { subject : "rules" }); | ||
+ | ||
+ // Check if this page matches any of the rules. | ||
+ var rules = COMMENT_SNOB.prefs.getJSONPref("rules", {}); | ||
+ | ||
+ for (var i in rules) { | ||
+ var regex = new RegExp(rules[i].url, "i"); | ||
+ | ||
+ if (tab.url.match(regex)) { | ||
+ var prefs = COMMENT_SNOB.getRulePrefs(i); | ||
+ | ||
+ var response = { | ||
+ subject : "filter", | ||
+ rule : rules[i], | ||
+ prefs : prefs | ||
+ }; | ||
+ | ||
+ if (prefs.mistakes) { | ||
+ if (!dictionaryObject) { | ||
+ dictionaryObject = JSON.parse(JSON.stringify(new Typo("en_US"))); | ||
+ } | ||
+ | ||
+ response.dictionaryObject = dictionaryObject; | ||
+ } | ||
+ | ||
+ chrome.tabs.sendRequest(tabId, response); | ||
+ | ||
+ break; | ||
+ } | ||
+ } | ||
+}); | ||
+ | ||
+chrome.extension.onRequest.addListener(function (request, sender, sendResponse) { | ||
+ if (request.subject === "install_rule") { | ||
+ if ("rule" in request.rule) { | ||
+ var rv = COMMENT_SNOB.addRule(request.rule.rule); | ||
+ sendResponse(rv); | ||
+ } | ||
+ else if ("href" in request.rule) { | ||
+ function handleText(text) { | ||
+ var text = JSON.minify(text); | ||
+ | ||
+ try { | ||
+ var json = JSON.parse(text); | ||
+ } catch (e) { | ||
+ sendResponse({ status : false, msg : "Invalid JSON: " + e }); | ||
+ return; | ||
+ } | ||
+ | ||
+ var rv = COMMENT_SNOB.addRule(json); | ||
+ sendResponse(rv); | ||
+ } | ||
+ | ||
+ if (request.rule.href.indexOf("data:") === 0) { | ||
+ var parts = request.rule.href.split(";"); | ||
+ | ||
+ if (parts[1].indexOf("base64,") === 0) { | ||
+ var text = atob(parts[1].replace("base64,", "")); | ||
+ } | ||
+ else { | ||
+ var text = decodeURIComponent(parts[1].replace(/\+/g, " ")); | ||
+ } | ||
+ | ||
+ handleText(text); | ||
+ } | ||
+ else { | ||
+ var req = new XMLHttpRequest(); | ||
+ req.open("GET", request.rule.href, true); | ||
+ | ||
+ req.onreadystatechange = function () { | ||
+ if (req.readyState == 4) { | ||
+ var text = req.responseText; | ||
+ handleText(text); | ||
+ } | ||
+ }; | ||
+ | ||
+ req.send(null); | ||
+ } | ||
+ } | ||
+ } | ||
+}); | ||
+ | ||
+COMMENT_SNOB.load(); |

Oops, something went wrong.
0 comments on commit
b1d63ae