diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-27 10:02:57 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-27 10:02:57 +0100 |
| commit | ab5edf33460292721161d90031472132318904d3 (patch) | |
| tree | 326b45f53e6f25d73d83c10943c413737e7bdf61 /public | |
| parent | b6777c92daf6e2becfb0efb3316a05885ce18109 (diff) | |
checks
Diffstat (limited to 'public')
| -rw-r--r-- | public/assets/js/lib/sdk/_sdk.js | 16 | ||||
| -rw-r--r-- | public/assets/js/lib/sdk/notification.js | 24 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadbox.js | 5 |
3 files changed, 34 insertions, 11 deletions
diff --git a/public/assets/js/lib/sdk/_sdk.js b/public/assets/js/lib/sdk/_sdk.js index 320113e..06726d8 100644 --- a/public/assets/js/lib/sdk/_sdk.js +++ b/public/assets/js/lib/sdk/_sdk.js @@ -1,10 +1,10 @@ var sdk = (function(){ var sdk = {} - + sdk.env = "development" - + var endpoint = window.location.origin - + sdk.init = function(opt){ switch (sdk.env = opt.env || "development") { case 'test': @@ -16,19 +16,19 @@ var sdk = (function(){ break } } - + sdk.path = function(api){ return endpoint + api } - + sdk.image = function(file, size){ return "https://i.asdf.us/bucky/data/" + file.thread + "/" + file.id } - + // $.ajaxSetup({ // // possibly: application/json; charset=utf-8" // contentType: "application/json", // }) - + return sdk -})()
\ No newline at end of file +})() diff --git a/public/assets/js/lib/sdk/notification.js b/public/assets/js/lib/sdk/notification.js new file mode 100644 index 0000000..1ca85e7 --- /dev/null +++ b/public/assets/js/lib/sdk/notification.js @@ -0,0 +1,24 @@ +sdk.notification = (function(){ + + var notification = {} + + notification.request = (cb) => { + Notification.requestPermission().then(function(permission) { + if (permission === "granted") { + + } + }) + } + + notification.notify = (msg) => { + if (Notification.permission === "granted") { + var n = new Notification(msg); + } else if (Notification.permission !== 'denied') { + notification.request(() => { + notification.notify(msg) + }) + } + } + + return notification +})() diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index 4ecb919..70dc961 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -48,11 +48,10 @@ var ThreadBox = View.extend({ }, parse: function(thread){ - if (thread.comment_count === undefined) return "" var views = hush_views(thread.viewed) var size = hush_size(thread.size) - var comments = hush_null(thread.comment_count, "c") - var files = hush_null(thread.file_count, "f") + var comments = hush_null(thread.comment_count || 0, "c") + var files = hush_null(thread.file_count || 0, "f") var dot = privacy_dot(thread.privacy) var datetime = verbose_date(thread.lastmodified) var age = get_age(thread.lastmodified) |
