From 41e74860d8abc8e33648471249b127dd3f60fb88 Mon Sep 17 00:00:00 2001
From: Reed Garmsen
Date: Wed, 12 Aug 2015 11:02:47 -0700
Subject: [PATCH] Cosmetic refactoring of the notifyMe function in utils.jsx
and removed unnecessary files
---
web/react/utils/utils.jsx | 48 ++--
web/static/js/marked/doc/broken.md | 426 -----------------------------
web/static/js/marked/doc/todo.md | 2 -
3 files changed, 24 insertions(+), 452 deletions(-)
delete mode 100644 web/static/js/marked/doc/broken.md
delete mode 100644 web/static/js/marked/doc/todo.md
diff --git a/web/react/utils/utils.jsx b/web/react/utils/utils.jsx
index 2136accb47..2a4cbaa623 100644
--- a/web/react/utils/utils.jsx
+++ b/web/react/utils/utils.jsx
@@ -97,31 +97,31 @@ module.exports.getCookie = function(name) {
}
module.exports.notifyMe = function(title, body, channel) {
- if ("Notification" in window && Notification.permission !== 'denied') {
- Notification.requestPermission(function (permission) {
- if (Notification.permission !== permission) {
- Notification.permission = permission;
- }
+ if ('Notification' in window && Notification.permission !== 'denied') {
+ Notification.requestPermission(function(permission) {
+ if (Notification.permission !== permission) {
+ Notification.permission = permission;
+ }
- if (permission === "granted") {
- var notification = new Notification(title,
- { body: body, tag: body, icon: '/static/images/icon50x50.gif' }
- );
- notification.onclick = function() {
- window.focus();
- if (channel) {
- module.exports.switchChannel(channel);
- } else {
- window.location.href = "/";
- }
- };
- setTimeout(function(){
- notification.close();
- }, 5000);
- }
- });
- }
-}
+ if (permission === 'granted') {
+ var notification = new Notification(title,
+ {body: body, tag: body, icon: '/static/images/icon50x50.gif'}
+ );
+ notification.onclick = function() {
+ window.focus();
+ if (channel) {
+ module.exports.switchChannel(channel);
+ } else {
+ window.location.href = '/';
+ }
+ };
+ setTimeout(function() {
+ notification.close();
+ }, 5000);
+ }
+ });
+ }
+};
module.exports.ding = function() {
var audio = new Audio('/static/images/ding.mp3');
diff --git a/web/static/js/marked/doc/broken.md b/web/static/js/marked/doc/broken.md
deleted file mode 100644
index 7bfa49e8a9..0000000000
--- a/web/static/js/marked/doc/broken.md
+++ /dev/null
@@ -1,426 +0,0 @@
-# Markdown is broken
-
-I have a lot of scraps of markdown engine oddities that I've collected over the
-years. What you see below is slightly messy, but it's what I've managed to
-cobble together to illustrate the differences between markdown engines, and
-why, if there ever is a markdown specification, it has to be absolutely
-thorough. There are a lot more of these little differences I have documented
-elsewhere. I know I will find them lingering on my disk one day, but until
-then, I'll continue to add whatever strange nonsensical things I find.
-
-Some of these examples may only mention a particular engine compared to marked.
-However, the examples with markdown.pl could easily be swapped out for
-discount, upskirt, or markdown.js, and you would very easily see even more
-inconsistencies.
-
-A lot of this was written when I was very unsatisfied with the inconsistencies
-between markdown engines. Please excuse the frustration noticeable in my
-writing.
-
-## Examples of markdown's "stupid" list parsing
-
-```
-$ markdown.pl
-
- * item1
-
- * item2
-
- text
-^D
-
-```
-
-
-```
-$ marked
- * item1
-
- * item2
-
- text
-^D
-
-```
-
-Which looks correct to you?
-
-- - -
-
-```
-$ markdown.pl
-* hello
- > world
-^D
-
-
-```
-
-```
-$ marked
-* hello
- > world
-^D
-
-```
-
-Again, which looks correct to you?
-
-- - -
-
-EXAMPLE:
-
-```
-$ markdown.pl
-* hello
- * world
- * hi
- code
-^D
-
-```
-
-The code isn't a code block even though it's after the bullet margin. I know,
-lets give it two more spaces, effectively making it 8 spaces past the bullet.
-
-```
-$ markdown.pl
-* hello
- * world
- * hi
- code
-^D
-
-```
-
-And, it's still not a code block. Did you also notice that the 3rd item isn't
-even its own list? Markdown screws that up too because of its indentation
-unaware parsing.
-
-- - -
-
-Let's look at some more examples of markdown's list parsing:
-
-```
-$ markdown.pl
-
- * item1
-
- * item2
-
- text
-^D
-
-```
-
-Misnested tags.
-
-
-```
-$ marked
- * item1
-
- * item2
-
- text
-^D
-
-```
-
-Which looks correct to you?
-
-- - -
-
-```
-$ markdown.pl
-* hello
- > world
-^D
-
-
-```
-
-More misnested tags.
-
-
-```
-$ marked
-* hello
- > world
-^D
-
-```
-
-Again, which looks correct to you?
-
-- - -
-
-# Why quality matters - Part 2
-
-``` bash
-$ markdown.pl
-* hello
- > world
-^D
-
-
-```
-
-``` bash
-$ sundown # upskirt
-* hello
- > world
-^D
-
-```
-
-``` bash
-$ marked
-* hello
- > world
-^D
-
-```
-
-Which looks correct to you?
-
-- - -
-
-See: https://github.com/evilstreak/markdown-js/issues/23
-
-``` bash
-$ markdown.pl # upskirt/markdown.js/discount
-* hello
- var a = 1;
-* world
-^D
-
-- hello
-var a = 1;
-- world
-
-```
-
-``` bash
-$ marked
-* hello
- var a = 1;
-* world
-^D
-- hello
-
code>var a = 1;
-- world
-```
-
-Which looks more reasonable? Why shouldn't code blocks be able to appear in
-list items in a sane way?
-
-- - -
-
-``` bash
-$ markdown.js
-hello
-
-hello
-^D
-<div>hello</div>
-
-<span>hello</span>
-```
-
-``` bash
-$ marked
-hello
-
-hello
-^D
-hello
-
-
-hello
-
-```
-
-- - -
-
-See: https://github.com/evilstreak/markdown-js/issues/27
-
-``` bash
-$ markdown.js
-[](/link)
-^D
-](/link)
-^D
-
-
-```
-
-- - -
-
-See: https://github.com/evilstreak/markdown-js/issues/24
-
-``` bash
-$ markdown.js
-> a
-
-> b
-
-> c
-^D
-a
bundefined> c
-```
-
-``` bash
-$ marked
-> a
-
-> b
-
-> c
-^D
-a
-
-
-b
-
-
-c
-
-```
-
-- - -
-
-``` bash
-$ markdown.pl
-* hello
- * world
- how
-
- are
- you
-
- * today
-* hi
-^D
-
-hello
-
-
-
-are
-you
-
-
-- hi
-
-```
-
-``` bash
-$ marked
-* hello
- * world
- how
-
- are
- you
-
- * today
-* hi
-^D
-
-hello
-
-world
-how
-are
-you
-
-today
-
-
-
-- hi
-
-```
diff --git a/web/static/js/marked/doc/todo.md b/web/static/js/marked/doc/todo.md
deleted file mode 100644
index 2e60b162ae..0000000000
--- a/web/static/js/marked/doc/todo.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Todo
-