From 0f51f9bd5311c565dae310664262c06ca4b16188 Mon Sep 17 00:00:00 2001 From: BinChan Date: Fri, 18 Aug 2017 17:37:43 +0800 Subject: [PATCH 01/26] add hub feed --- css/Menu.css | 19 ++++++++++++++++++- js/ActivityList.coffee | 3 +++ js/ContentFeed.coffee | 29 +++++++++++++++++++++++++++-- js/PostList.coffee | 4 ++++ 4 files changed, 52 insertions(+), 3 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index 2147819..03c9664 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -14,4 +14,21 @@ .menu-item.selected:before { content: "L"; display: inline-block; transform: rotateZ(45deg) scaleX(-1); line-height: 15px; font-weight: bold; position: absolute; margin-left: -14px; font-size: 12px; margin-top: 2px; -} \ No newline at end of file +} + +.post-list-type .menu { + width: 280px; + margin-top: 220px; + margin-left: 230px; + text-align: left; +} +.post-list-type .menu .menu-item { + padding: 0; + margin: 0px; + border-bottom: none !important; +} +.post-list-type .menu .menu-item a { + overflow: hidden; + text-overflow: ellipsis; + max-width: 240px; +} diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 003a57a..afaf4bc 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -7,10 +7,13 @@ class ActivityList extends Class @found = 0 @loading = true @update_timer = null + @filter_hub = null queryActivities: (cb) -> if @directories == "all" where = "WHERE date_added > #{Time.timestamp()-60*60*24*2} AND date_added < #{Time.timestamp()+120} " + else if @directories == "hub" + where = "WHERE json.hub = '#{@filter_hub}' AND date_added < #{Time.timestamp()+120} " else where = "WHERE json.directory IN #{Text.sqlIn(@directories)} AND date_added < #{Time.timestamp()+120} " diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 77e7f04..b32dcbf 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -5,6 +5,7 @@ class ContentFeed extends Class @activity_list = new ActivityList() @new_user_list = new UserList("new") @suggested_user_list = new UserList("suggested") + @hubs = new Menu() @need_update = true @type = "followed" @update() @@ -16,6 +17,20 @@ class ContentFeed extends Class @update() return false + renderHubsMenu: (hub_title, address)=> + h("a.link", {href: "#" + hub_title, onclick: @handleListTypeClick, type: "hub"+"_"+address, classes: {active: @type == "hub"+"_"+address}}, hub_title) + + handleHubsClick: => + @hubs.items = [] + Page.cmd "mergerSiteList", true, (sites) => + for address, site of sites + if address == Page.userdb + continue + @hubs.items.push [@renderHubsMenu(site.content.title, address), null] + + @hubs.toggle() + return false + render: => if @post_list.loaded and not Page.on_loaded.resolved then Page.on_loaded.resolve() @@ -26,23 +41,31 @@ class ContentFeed extends Class @new_user_list.need_update = true @suggested_user_list.need_update = true + @post_list.filter_post_ids = null + @post_list.filter_hub = null + @activity_list.filter_hub = null + # Post list if @type == "followed" @post_list.directories = ("data/users/#{key.split('/')[1]}" for key, followed of Page.user.followed_users) if Page.user.hub # Also show my posts @post_list.directories.push("data/users/"+Page.user.auth_address) - @post_list.filter_post_ids = null else if @type == "liked" @post_list.directories = ("data/users/#{like.split('_')[0]}" for like, _ of Page.user.likes) @post_list.filter_post_ids = (like.split('_')[1] for like, _ of Page.user.likes) + else if @type.slice(0,3) == "hub" + @post_list.directories = "all" + @post_list.filter_hub = @type.slice(4) else @post_list.directories = "all" - @post_list.filter_post_ids = null @post_list.need_update = true # Activity list if @type == "followed" @activity_list.directories = ("data/users/#{key.split('/')[1]}" for key, followed of Page.user.followed_users) + else if @type.slice(0,3) == "hub" + @activity_list.directories = "hub" + @activity_list.filter_hub = @type.slice(4) else @activity_list.directories = "all" @activity_list.update() @@ -52,6 +75,8 @@ class ContentFeed extends Class h("div.col-center", [ @post_create.render(), h("div.post-list-type", + h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs") + @hubs.render() h("a.link", {href: "#Everyone", onclick: @handleListTypeClick, type: "everyone", classes: {active: @type == "everyone"}}, "Everyone") h("a.link", {href: "#Liked", onclick: @handleListTypeClick, type: "liked", classes: {active: @type == "liked"}}, "Liked") h("a.link", {href: "#Followed+users", onclick: @handleListTypeClick, type: "followed", classes: {active: @type == "followed"}}, "Followed users") diff --git a/js/PostList.coffee b/js/PostList.coffee index d313d32..175487a 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -6,6 +6,7 @@ class PostList extends Class @directories = [] @loaded = false @filter_post_ids = null + @filter_hub = null @limit = 10 queryComments: (post_uris, cb) => @@ -37,6 +38,9 @@ class PostList extends Class if @filter_post_ids where += "AND post_id IN #{Text.sqlIn(@filter_post_ids)} " + if @filter_hub + where += "AND json.hub = '#{@filter_hub}' " + if Page.local_storage.settings.hide_hello_zerome where += "AND post_id > 1 " From 4d6fec1d2ee65141b57dd46207b592344df9ddef Mon Sep 17 00:00:00 2001 From: BinChan Date: Fri, 18 Aug 2017 20:06:15 +0800 Subject: [PATCH 02/26] Change hubs menu position to relative --- css/Menu.css | 8 ++++++-- js/ContentFeed.coffee | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index 03c9664..25add2b 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -16,10 +16,14 @@ font-weight: bold; position: absolute; margin-left: -14px; font-size: 12px; margin-top: 2px; } +.post-list-type .hub-menu { + position: relative; + top: -7px; + left: 590px; + float: left; +} .post-list-type .menu { width: 280px; - margin-top: 220px; - margin-left: 230px; text-align: left; } .post-list-type .menu .menu-item { diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index b32dcbf..8fb74f0 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -76,7 +76,9 @@ class ContentFeed extends Class @post_create.render(), h("div.post-list-type", h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs") - @hubs.render() + h("div.hub-menu", + @hubs.render() + ) h("a.link", {href: "#Everyone", onclick: @handleListTypeClick, type: "everyone", classes: {active: @type == "everyone"}}, "Everyone") h("a.link", {href: "#Liked", onclick: @handleListTypeClick, type: "liked", classes: {active: @type == "liked"}}, "Liked") h("a.link", {href: "#Followed+users", onclick: @handleListTypeClick, type: "followed", classes: {active: @type == "followed"}}, "Followed users") From 4f72e0f7dcf878c0fbc1a8b342c50bd59b79470f Mon Sep 17 00:00:00 2001 From: BinChan Date: Fri, 18 Aug 2017 20:26:30 +0800 Subject: [PATCH 03/26] fix hubs menu position in mobile mode --- css/Menu.css | 5 ++--- js/ContentFeed.coffee | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index 25add2b..d045ed3 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -18,9 +18,8 @@ .post-list-type .hub-menu { position: relative; - top: -7px; - left: 590px; - float: left; + top: -37px; + left: 235px; } .post-list-type .menu { width: 280px; diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 8fb74f0..fc99d7a 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -75,9 +75,10 @@ class ContentFeed extends Class h("div.col-center", [ @post_create.render(), h("div.post-list-type", - h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs") - h("div.hub-menu", - @hubs.render() + h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs", + h("div.hub-menu", + @hubs.render() + ) ) h("a.link", {href: "#Everyone", onclick: @handleListTypeClick, type: "everyone", classes: {active: @type == "everyone"}}, "Everyone") h("a.link", {href: "#Liked", onclick: @handleListTypeClick, type: "liked", classes: {active: @type == "liked"}}, "Liked") From 3e457267486e8706e51efadb5c51c2b4f0b50e6e Mon Sep 17 00:00:00 2001 From: BinChan Date: Fri, 18 Aug 2017 20:53:50 +0800 Subject: [PATCH 04/26] add z-index to hub-menu, also after wrapping menu with hub-menu, toggling menu misfunctions, investigating --- css/Menu.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/css/Menu.css b/css/Menu.css index d045ed3..cda5b11 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -20,6 +20,8 @@ position: relative; top: -37px; left: 235px; + pointer-events: all; + z-index: 999; } .post-list-type .menu { width: 280px; From 7b48f51bf584e6aa10d72b6e895333b02845f4b0 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 19 Aug 2017 01:44:06 +0800 Subject: [PATCH 05/26] fix menu toggle --- css/Menu.css | 8 +++++--- js/ContentFeed.coffee | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index cda5b11..d4fd09e 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -18,14 +18,16 @@ .post-list-type .hub-menu { position: relative; - top: -37px; - left: 235px; - pointer-events: all; z-index: 999; + display: inline-block; } .post-list-type .menu { width: 280px; text-align: left; + margin-left: -55px; + margin-top: 43px; + transform: none; + transition: max-height 0.3s ease-out; } .post-list-type .menu .menu-item { padding: 0; diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index fc99d7a..d8e9447 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -75,14 +75,14 @@ class ContentFeed extends Class h("div.col-center", [ @post_create.render(), h("div.post-list-type", - h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs", - h("div.hub-menu", - @hubs.render() - ) + h("div.hub-menu", + h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs") + @hubs.render() ) h("a.link", {href: "#Everyone", onclick: @handleListTypeClick, type: "everyone", classes: {active: @type == "everyone"}}, "Everyone") h("a.link", {href: "#Liked", onclick: @handleListTypeClick, type: "liked", classes: {active: @type == "liked"}}, "Liked") h("a.link", {href: "#Followed+users", onclick: @handleListTypeClick, type: "followed", classes: {active: @type == "followed"}}, "Followed users") + ), @post_list.render() ]), From 964e0d9228e1ac801de5b3cd3650786b02928ec0 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 00:44:47 +0800 Subject: [PATCH 06/26] add language character filter --- css/Menu.css | 107 ++++++++++++++++++++++++++++------- js/ActivityList.coffee | 36 +++++++----- js/ContentFeed.coffee | 124 ++++++++++++++++++++++++++++++++++++++--- js/PostList.coffee | 4 ++ js/utils/Menu.coffee | 9 ++- 5 files changed, 235 insertions(+), 45 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index d4fd09e..877d058 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -10,32 +10,97 @@ .menu-item-separator { margin-top: 3px; margin-bottom: 3px; border-top: 1px solid #eee } .menu-item:hover { background-color: #F6F6F6; transition: none; color: inherit; cursor: pointer; color: black; text-decoration: none } -.menu-item:active, .menu-item:focus { background-color: #AF3BFF; color: white; transition: none } +.menu-item:active, .menu-item:focus { +background-color: transparent; +color: white; transition: none; +-webkit-tap-highlight-color: transparent; +} .menu-item.selected:before { content: "L"; display: inline-block; transform: rotateZ(45deg) scaleX(-1); line-height: 15px; font-weight: bold; position: absolute; margin-left: -14px; font-size: 12px; margin-top: 2px; } -.post-list-type .hub-menu { - position: relative; - z-index: 999; - display: inline-block; +.menu-radio { white-space: normal; line-height: 26px } +.menu-item:hover, .menu-radio:hover {background-color: transparent} +.menu-radio span, .menu-radio a.all, .menu-radio a.filter { + background-color: #EEE; width: 18.5%; text-align: center; margin-top: 2px; margin-bottom: 2px; color: #333; font-weight: bold; + text-decoration: none; font-size: 13px; transition: all 0.3s; text-transform: uppercase; display: inline-block; +} +.post-list-type .menu-radio a:hover {color: #333} +.menu-item .menu-radio .lang-on:hover, +.menu-radio .lang-on.selected { +background-color: rgba(130,255,137,0.2); +} +.menu-item .menu-radio .lang-off:hover, +.menu-radio .lang-off.selected { +background-color: rgba(255,138,140,0.2); +} +.menu-radio a:hover, .menu-radio a.all.active { transition: none; background-color: #d8f1d9;} +.menu-radio a.long { font-size: 11px } + +.menu-radio span { +text-align: center; +width: 46%; +margin-top: 2px; +margin-right: 4px; +display: inline-block; +white-space: pre; +outline: 4px solid transparent; +} +.menu-radio a { +position: absolute; +white-space: pre; +display: block !important; +width: 59px !important; +} +.menu-radio a.all, .menu-radio a.filter { +position: relative; +width: 46% !important; +float: left; +margin-right: 4px !important; +} +.menu-radio .lang-on { +text-align: left; +color: #333; } +.menu-radio .lang-off { +color: #333; +text-align: right; +margin-left: 59px !important; +} + .post-list-type .menu { - width: 280px; - text-align: left; - margin-left: -55px; - margin-top: 43px; - transform: none; - transition: max-height 0.3s ease-out; -} -.post-list-type .menu .menu-item { - padding: 0; - margin: 0px; - border-bottom: none !important; -} -.post-list-type .menu .menu-item a { - overflow: hidden; - text-overflow: ellipsis; - max-width: 240px; +width: 280px; +text-align: left; +margin-left: -55px; +margin-top: 43px; +transform: none; +transition: max-height 0.3s ease-out; +} +.post-list-type .hub-menu, .post-list-type .filters-menu { +position: relative; +z-index: 1; +display: inline-block; +} +.post-list-type .filters-menu .menu { +margin-left: -85px; +width: 257px; +padding-left: 15px; +} +.post-list-type .hub-menu .menu .menu-item { +width: 90px; +overflow: hidden; +text-overflow: ellipsis; +} +.post-list-type .hub-menu .menu .menu-item a { + width: 90%; +} +.post-list-type .menu .menu-item, .post-list-type .menu .menu-radio a { +padding: 0; +margin: 0px; +border-bottom: none !important; +} +.post-list-type .menu .menu-radio .all, .post-list-type .menu .menu-radio .filter { +margin-bottom: 2px; +margin-top: 2px; } diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index afaf4bc..37621ec 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -8,10 +8,14 @@ class ActivityList extends Class @loading = true @update_timer = null @filter_hub = null + @filter_language_ids = null queryActivities: (cb) -> if @directories == "all" where = "WHERE date_added > #{Time.timestamp()-60*60*24*2} AND date_added < #{Time.timestamp()+120} " + if @filter_language_ids + where += "AND (comment_id, json_id) IN #{@filter_language_ids} " + else if @directories == "hub" where = "WHERE json.hub = '#{@filter_hub}' AND date_added < #{Time.timestamp()+120} " else @@ -20,32 +24,36 @@ class ActivityList extends Class query = """ SELECT 'comment' AS type, json.*, - json.site || "/" || post_uri AS subject, body, date_added, + json.site || "/" || post_uri AS subject, body, date_added, comment_id, NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name FROM - json - LEFT JOIN comment USING (json_id) + comment + LEFT JOIN json USING (json_id) #{where} + """ + if !@filter_language_ids + query += """ - UNION ALL + UNION ALL - SELECT - 'post_like' AS type, json.*, - json.site || "/" || post_uri AS subject, '' AS body, date_added, - NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name - FROM - json - LEFT JOIN post_like USING (json_id) - #{where} - """ + SELECT + 'post_like' AS type, json.*, + json.site || "/" || post_uri AS subject, '' AS body, date_added, NULL AS comment_id, + NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name + FROM + json + LEFT JOIN post_like USING (json_id) + #{where} + """ if @directories != "all" # Dont show follows in all users activity feed query += """ + UNION ALL SELECT 'follow' AS type, json.*, - follow.hub || "/" || follow.auth_address AS subject, '' AS body, date_added, + follow.hub || "/" || follow.auth_address AS subject, '' AS body, date_added, NULL AS comment_id, follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name FROM json diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index d8e9447..68c4673 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -6,12 +6,30 @@ class ContentFeed extends Class @new_user_list = new UserList("new") @suggested_user_list = new UserList("suggested") @hubs = new Menu() + @lang_filter = new Menu() + @filter_lang_list = {} @need_update = true @type = "followed" @update() + @language_dict = { + "English": /[\u0041-\u007A]/, + "Latin-1": /[\u00C0-\u00FF]/, + "Greek": /[\u0391-\u03C9]/, + "Cyrillic": /[\u0410-\u044F]/, + "Armenian": /[\u0531-\u0586]/, + "Hebrew": /[\u05D0-\u05EA]/, + "Arabic": /[\u0620-\u06D5]/, + "Devanagari": /[\u0904-\u097F]/ + "Kana": /[\u3041-\u30FA]/, + "ZH-JA-KO": /[\u4E00-\u9FEA]/, + "Hangul": /[\uAC00-\uD7A3]/, + "Emoji": /[\ud83C-\ud83E][\uDC00-\uDDEF]/ + } handleListTypeClick: (e) => @type = e.currentTarget.attributes.type.value + if @type == "everyone" + @filter_lang_list = {} @post_list.limit = 10 @activity_list.limit = 10 @update() @@ -31,6 +49,70 @@ class ContentFeed extends Class @hubs.toggle() return false + handleLanguageClick: (e) => + value = e.currentTarget.value + if @filter_lang_list[value] + delete @filter_lang_list[value] + else + @filter_lang_list[value] = true + if value.slice(0,7) == "lang-on" + delete @filter_lang_list["lang-off"+value.slice(7)] + else if value.slice(0,8) == "lang-off" + delete @filter_lang_list["lang-on"+value.slice(8)] + # Without re-push, the language won't be selected. + @lang_filter.items = [] + @lang_filter.items.push [@renderFilterLanguage(), null] + return false + + renderFilterLanguage: => + langs = Object.keys(@language_dict) + + h("div.menu-radio", + h("a.all", {href: "#all", onclick: @handleListTypeClick, type: "everyone", classes: {active: @type == "everyone"}}, "Show all") + h("a.filter", {href: "#filter", onclick: @handleListTypeClick, type: "lang", classes: {active: @type == "lang"}}, "Filter") + for lang in langs + [ + h("span", + h("a.lang-on", {href: "#"+lang+"_on", onclick: @handleLanguageClick, value: "lang-on"+"_"+lang, classes: {selected: @filter_lang_list["lang-on"+"_"+lang]}}, " +"), + h("a.lang-off", {href: "#"+lang+"_off", onclick: @handleLanguageClick, value: "lang-off"+"_"+lang, classes: {selected: @filter_lang_list["lang-off"+"_"+lang]}}, "- "), + " ", lang + ) + ] + ) + + handleFiltersClick: => + @lang_filter.items = [] + @lang_filter.items.push [@renderFilterLanguage(), null] + if @lang_filter.visible + @lang_filter.hide() + else + @lang_filter.show() + return false + + queryLanguageIds: (query, lang_list, cb) => + language_ids = [] + Page.cmd "dbQuery", [query], (rows) => + for row in rows + if row["body"] == null + continue + # Only select 100 letters + if row["body"].length > 100 + body_tmp = "" + for i in [0..9] + start_point = ~~(row["body"].length/10)*i + body_tmp += row["body"].slice(start_point, start_point+9) + row["body"] = body_tmp + for lang_off in lang_list["off"] + if row["body"].match(@language_dict[lang_off]) + break + if lang_list["on"].length == 0 + language_ids.push([row["item_id"], row["json_id"]]) + for lang_on in lang_list["on"] + if row["body"].match(@language_dict[lang_on]) + language_ids.push([row["item_id"], row["json_id"]]) + break + cb(language_ids) + render: => if @post_list.loaded and not Page.on_loaded.resolved then Page.on_loaded.resolve() @@ -43,7 +125,11 @@ class ContentFeed extends Class @post_list.filter_post_ids = null @post_list.filter_hub = null + @post_list.filter_language_ids = null + @post_list.directories = "all" @activity_list.filter_hub = null + @activity_list.filter_language_ids = null + @activity_list.directories = "all" # Post list if @type == "followed" @@ -54,11 +140,20 @@ class ContentFeed extends Class @post_list.directories = ("data/users/#{like.split('_')[0]}" for like, _ of Page.user.likes) @post_list.filter_post_ids = (like.split('_')[1] for like, _ of Page.user.likes) else if @type.slice(0,3) == "hub" - @post_list.directories = "all" @post_list.filter_hub = @type.slice(4) - else - @post_list.directories = "all" - @post_list.need_update = true + else if @type == "lang" + lang_list = {"on": [], "off": []} + for lang in Object.keys(@filter_lang_list) + if lang.slice(0,7) == "lang-on" + lang_list["on"].push(lang.slice(8)) + else + lang_list["off"].push(lang.slice(9)) + query = "SELECT post_id AS item_id, post.json_id, post.body FROM post" + @queryLanguageIds query, lang_list, (language_ids) => + @post_list.filter_language_ids = "(VALUES "+("(#{id_pair[0]},#{id_pair[1]})" for id_pair in language_ids).join(',')+")" + @post_list.need_update = true + if @type.slice(0,4) != "lang" + @post_list.need_update = true # Activity list if @type == "followed" @@ -66,9 +161,19 @@ class ContentFeed extends Class else if @type.slice(0,3) == "hub" @activity_list.directories = "hub" @activity_list.filter_hub = @type.slice(4) - else - @activity_list.directories = "all" - @activity_list.update() + else if @type == "lang" + lang_list = {"on": [], "off": []} + for lang in Object.keys(@filter_lang_list) + if lang.slice(0,7) == "lang-on" + lang_list["on"].push(lang.slice(8)) + else + lang_list["off"].push(lang.slice(9)) + query = "SELECT comment_id AS item_id, comment.json_id, comment.body FROM comment" + @queryLanguageIds query, lang_list, (language_ids) => + @activity_list.filter_language_ids = "(VALUES "+("(#{id_pair[0]},#{id_pair[1]})" for id_pair in language_ids).join(',')+")" + @activity_list.update() + if @type.slice(0,4) != "lang" + @activity_list.update() h("div#Content.center", [ @@ -79,7 +184,10 @@ class ContentFeed extends Class h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs") @hubs.render() ) - h("a.link", {href: "#Everyone", onclick: @handleListTypeClick, type: "everyone", classes: {active: @type == "everyone"}}, "Everyone") + h("div.filters-menu", + h("a.link", {href: "#Filters", onmousedown: @handleFiltersClick, onclick: Page.returnFalse}, "Everyone") + @lang_filter.render() + ) h("a.link", {href: "#Liked", onclick: @handleListTypeClick, type: "liked", classes: {active: @type == "liked"}}, "Liked") h("a.link", {href: "#Followed+users", onclick: @handleListTypeClick, type: "followed", classes: {active: @type == "followed"}}, "Followed users") diff --git a/js/PostList.coffee b/js/PostList.coffee index 175487a..20655fd 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -7,6 +7,7 @@ class PostList extends Class @loaded = false @filter_post_ids = null @filter_hub = null + @filter_language_ids = null @limit = 10 queryComments: (post_uris, cb) => @@ -41,6 +42,9 @@ class PostList extends Class if @filter_hub where += "AND json.hub = '#{@filter_hub}' " + if @filter_language_ids + where += "AND (post_id, post.json_id) IN #{@filter_language_ids} " + if Page.local_storage.settings.hide_hello_zerome where += "AND post_id > 1 " diff --git a/js/utils/Menu.coffee b/js/utils/Menu.coffee index 9d81f70..93ba6c7 100644 --- a/js/utils/Menu.coffee +++ b/js/utils/Menu.coffee @@ -39,7 +39,12 @@ class Menu [title, cb, selected] = item if title == e.target.textContent keep_menu = cb(item) - if keep_menu != true + # Keep Language Filter opened when selecting language + if e.target.type == "everyone" or e.target.type == "lang" + @hide() + else if e.target.value or e.target.title == "" + @show() + else if keep_menu != true @hide() return false @@ -70,4 +75,4 @@ document.body.addEventListener "mouseup", (e) -> return false if e.target != window.visible_menu.node.parentNode and e.target.parentNode != window.visible_menu.node and e.target.parentNode != window.visible_menu.node.parentNode and e.target.parentNode != window.visible_menu.node and e.target.parentNode.parentNode != window.visible_menu.node.parentNode window.visible_menu.hide() - Page.projector.scheduleRender() \ No newline at end of file + Page.projector.scheduleRender() From 1e756af88c17f4b147124ecfc2d5b5db65a9dff4 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 12:44:59 +0800 Subject: [PATCH 07/26] fix text overflow --- css/Menu.css | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index 877d058..29d4cb8 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -90,10 +90,11 @@ padding-left: 15px; .post-list-type .hub-menu .menu .menu-item { width: 90px; overflow: hidden; -text-overflow: ellipsis; } .post-list-type .hub-menu .menu .menu-item a { - width: 90%; +width: 90%; +overflow: hidden; +text-overflow: ellipsis; } .post-list-type .menu .menu-item, .post-list-type .menu .menu-radio a { padding: 0; From a17f0abe961fcce6b49d33e72616baac0d29ad65 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 17:23:58 +0800 Subject: [PATCH 08/26] remove unnecessary code --- js/ContentFeed.coffee | 6 ------ 1 file changed, 6 deletions(-) diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 68c4673..e1d9bc8 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -162,12 +162,6 @@ class ContentFeed extends Class @activity_list.directories = "hub" @activity_list.filter_hub = @type.slice(4) else if @type == "lang" - lang_list = {"on": [], "off": []} - for lang in Object.keys(@filter_lang_list) - if lang.slice(0,7) == "lang-on" - lang_list["on"].push(lang.slice(8)) - else - lang_list["off"].push(lang.slice(9)) query = "SELECT comment_id AS item_id, comment.json_id, comment.body FROM comment" @queryLanguageIds query, lang_list, (language_ids) => @activity_list.filter_language_ids = "(VALUES "+("(#{id_pair[0]},#{id_pair[1]})" for id_pair in language_ids).join(',')+")" From 65aedeb78ca334af6dde09856044ea341206a2f7 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 18:33:39 +0800 Subject: [PATCH 09/26] fix selection logic flaw --- js/ContentFeed.coffee | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index e1d9bc8..2ea2762 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -102,15 +102,19 @@ class ContentFeed extends Class start_point = ~~(row["body"].length/10)*i body_tmp += row["body"].slice(start_point, start_point+9) row["body"] = body_tmp + + not_match = false for lang_off in lang_list["off"] if row["body"].match(@language_dict[lang_off]) + not_match = true break if lang_list["on"].length == 0 language_ids.push([row["item_id"], row["json_id"]]) - for lang_on in lang_list["on"] - if row["body"].match(@language_dict[lang_on]) - language_ids.push([row["item_id"], row["json_id"]]) - break + if !not_match + for lang_on in lang_list["on"] + if row["body"].match(@language_dict[lang_on]) + language_ids.push([row["item_id"], row["json_id"]]) + break cb(language_ids) render: => From c48b051b4ccd5c0d84a008b02fd93c3bb37728f9 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 20:18:36 +0800 Subject: [PATCH 10/26] fix hub toggle --- js/utils/Menu.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/utils/Menu.coffee b/js/utils/Menu.coffee index 93ba6c7..0231009 100644 --- a/js/utils/Menu.coffee +++ b/js/utils/Menu.coffee @@ -40,7 +40,7 @@ class Menu if title == e.target.textContent keep_menu = cb(item) # Keep Language Filter opened when selecting language - if e.target.type == "everyone" or e.target.type == "lang" + if e.target.type == "everyone" or e.target.type == "lang" or e.target.type.slice(0,3) == "hub" @hide() else if e.target.value or e.target.title == "" @show() From 099b614d82fcbdb614b4b0e3650afdd446f91373 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 21:03:51 +0800 Subject: [PATCH 11/26] fix hub toggle --- js/utils/Menu.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/utils/Menu.coffee b/js/utils/Menu.coffee index 0231009..67e5617 100644 --- a/js/utils/Menu.coffee +++ b/js/utils/Menu.coffee @@ -40,7 +40,7 @@ class Menu if title == e.target.textContent keep_menu = cb(item) # Keep Language Filter opened when selecting language - if e.target.type == "everyone" or e.target.type == "lang" or e.target.type.slice(0,3) == "hub" + if e.target.type and (e.target.type == "everyone" or e.target.type == "lang" or e.target.type.slice(0,3) == "hub") @hide() else if e.target.value or e.target.title == "" @show() From b02aa2549db79fbc4cf7a96c690958f35896f11a Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 21:48:14 +0800 Subject: [PATCH 12/26] Fix selection logic flaw again. Small improvement --- js/ActivityList.coffee | 12 ++++++------ js/ContentFeed.coffee | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 37621ec..fe805cc 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -11,10 +11,10 @@ class ActivityList extends Class @filter_language_ids = null queryActivities: (cb) -> - if @directories == "all" + if @filter_language_ids + where = "WHERE (comment_id, json_id) IN #{@filter_language_ids} AND date_added < #{Time.timestamp()+120} " + else if @directories == "all" where = "WHERE date_added > #{Time.timestamp()-60*60*24*2} AND date_added < #{Time.timestamp()+120} " - if @filter_language_ids - where += "AND (comment_id, json_id) IN #{@filter_language_ids} " else if @directories == "hub" where = "WHERE json.hub = '#{@filter_hub}' AND date_added < #{Time.timestamp()+120} " @@ -24,7 +24,7 @@ class ActivityList extends Class query = """ SELECT 'comment' AS type, json.*, - json.site || "/" || post_uri AS subject, body, date_added, comment_id, + json.site || "/" || post_uri AS subject, body, date_added, NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name FROM comment @@ -38,7 +38,7 @@ class ActivityList extends Class SELECT 'post_like' AS type, json.*, - json.site || "/" || post_uri AS subject, '' AS body, date_added, NULL AS comment_id, + json.site || "/" || post_uri AS subject, '' AS body, date_added, NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name FROM json @@ -53,7 +53,7 @@ class ActivityList extends Class SELECT 'follow' AS type, json.*, - follow.hub || "/" || follow.auth_address AS subject, '' AS body, date_added, NULL AS comment_id, + follow.hub || "/" || follow.auth_address AS subject, '' AS body, date_added, follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name FROM json diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 2ea2762..5be01b8 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -108,8 +108,9 @@ class ContentFeed extends Class if row["body"].match(@language_dict[lang_off]) not_match = true break - if lang_list["on"].length == 0 - language_ids.push([row["item_id"], row["json_id"]]) + if lang_off == lang_list["off"][-1] + if lang_list["on"].length == 0 + language_ids.push([row["item_id"], row["json_id"]]) if !not_match for lang_on in lang_list["on"] if row["body"].match(@language_dict[lang_on]) From b3e6678645eefcf48fd2ada43cd61c891bca8933 Mon Sep 17 00:00:00 2001 From: BinChan Date: Sat, 26 Aug 2017 22:54:50 +0800 Subject: [PATCH 13/26] Fix syntax error --- js/ContentFeed.coffee | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 5be01b8..22d39d7 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -103,15 +103,15 @@ class ContentFeed extends Class body_tmp += row["body"].slice(start_point, start_point+9) row["body"] = body_tmp - not_match = false + matched = false for lang_off in lang_list["off"] if row["body"].match(@language_dict[lang_off]) - not_match = true + matched = true break - if lang_off == lang_list["off"][-1] - if lang_list["on"].length == 0 - language_ids.push([row["item_id"], row["json_id"]]) - if !not_match + if lang_off == lang_list["off"].slice(-1)[0] + if lang_list["on"].length == 0 + language_ids.push([row["item_id"], row["json_id"]]) + if !matched for lang_on in lang_list["on"] if row["body"].match(@language_dict[lang_on]) language_ids.push([row["item_id"], row["json_id"]]) From ac892ab7bc6a9e2704c09c36bf8b6f9a2a2a6af8 Mon Sep 17 00:00:00 2001 From: BinChan Date: Thu, 26 Oct 2017 13:47:08 +0800 Subject: [PATCH 14/26] small fix --- js/ContentFeed.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 22d39d7..ffa2e90 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -19,7 +19,7 @@ class ContentFeed extends Class "Armenian": /[\u0531-\u0586]/, "Hebrew": /[\u05D0-\u05EA]/, "Arabic": /[\u0620-\u06D5]/, - "Devanagari": /[\u0904-\u097F]/ + "Devanagari": /[\u0904-\u097F]/, "Kana": /[\u3041-\u30FA]/, "ZH-JA-KO": /[\u4E00-\u9FEA]/, "Hangul": /[\uAC00-\uD7A3]/, From c15153b00a76f66189cabb8366cb63f8fe8c2368 Mon Sep 17 00:00:00 2001 From: BinChan Date: Thu, 26 Oct 2017 13:49:32 +0800 Subject: [PATCH 15/26] Open hub drawer faster --- js/ContentFeed.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index ffa2e90..5e18ba7 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -180,7 +180,7 @@ class ContentFeed extends Class @post_create.render(), h("div.post-list-type", h("div.hub-menu", - h("a.link", {href: "#Hubs", onclick: @handleHubsClick}, "Hubs") + h("a.link", {href: "#Hubs", onmousedown: @handleFiltersClick, onclick: Page.returnFalse}, "Hubs") @hubs.render() ) h("div.filters-menu", From 1e19a923e6b1cf707678009df5e27172de9fa435 Mon Sep 17 00:00:00 2001 From: BinChan Date: Tue, 13 Feb 2018 17:31:25 +0800 Subject: [PATCH 16/26] Merge Upstream update --- css/Menu.css | 2 +- dbschema.json | 6 +-- js/ContentCreateProfile.coffee | 13 +++++- js/ContentFeed.coffee | 2 +- js/Head.coffee | 11 +++++ js/ZeroMe.coffee | 19 ++++++-- js/utils/ImagePreview.coffee | 12 ++--- js/utils/Text.coffee | 5 ++- languages/sk.json | 81 ++++++++++++++++++++++++++++++++++ 9 files changed, 133 insertions(+), 18 deletions(-) create mode 100644 languages/sk.json diff --git a/css/Menu.css b/css/Menu.css index 29d4cb8..00c0047 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -1,7 +1,7 @@ .menu { background-color: white; padding: 10px 0px; position: absolute; top: 0px; max-height: 0px; overflow: hidden; transform: translate(-100%, -30px); pointer-events: none; box-shadow: 0px 2px 8px rgba(0,0,0,0.1); border-radius: 2px; opacity: 0; transition: opacity 0.2s ease-out, transform 1s ease-out, max-height 0.2s ease-in-out; z-index: 99; - display: inline-block; z-index: 999; margin-top: 50px; + display: inline-block; z-index: 99999999999999999; margin-top: 50px; } .menu-right { left: 100% } .menu.visible { opacity: 1; max-height: 350px; transform: translate(-100%, 0px); transition: opacity 0.1s ease-out, transform 0.3s ease-out, max-height 0.3s ease-in-out; pointer-events: all } diff --git a/dbschema.json b/dbschema.json index 4e34eee..b60aefe 100644 --- a/dbschema.json +++ b/dbschema.json @@ -69,7 +69,7 @@ ["date_added", "INTEGER"], ["json_id", "INTEGER REFERENCES json (json_id)"] ], - "indexes": ["CREATE UNIQUE INDEX comment_key ON comment(json_id, comment_id)", "CREATE INDEX comment_post_uri ON comment(post_uri)"], + "indexes": ["CREATE UNIQUE INDEX comment_key ON comment(json_id, comment_id)", "CREATE INDEX comment_post_uri ON comment(post_uri)", "CREATE INDEX comment_date_added ON comment(date_added)"], "schema_changed": 2 }, "follow": { @@ -81,7 +81,7 @@ ["date_added", "INTEGER"], ["json_id", "INTEGER REFERENCES json (json_id)"] ], - "indexes": ["CREATE UNIQUE INDEX follow_key ON follow(json_id, follow_id)"], + "indexes": ["CREATE UNIQUE INDEX follow_key ON follow(json_id, follow_id)", "CREATE INDEX follow_date_added ON follow(date_added)"], "schema_changed": 2 }, "user": { @@ -103,4 +103,4 @@ "Posts": "SELECT 'post' AS type, post.date_added AS date_added, 'In ' || json.user_name || \"'s post\" AS title, post.body AS body, '?Post/' || json.site || '/' || REPLACE(json.directory, 'data/users/', '') || '/' || post_id AS url FROM post LEFT JOIN json USING (json_id)", "Comments": "SELECT 'comment' AS type, comment.date_added AS date_added, 'a post' AS title, '@' || user_name || ': ' || comment.body AS body, '?Post/' || json.site || '/' || REPLACE(post_uri, '_', '/') AS url FROM comment LEFT JOIN json USING (json_id)" } -} \ No newline at end of file +} diff --git a/js/ContentCreateProfile.coffee b/js/ContentCreateProfile.coffee index 4352c26..23e5dd2 100644 --- a/js/ContentCreateProfile.coffee +++ b/js/ContentCreateProfile.coffee @@ -16,7 +16,16 @@ class ContentCreateProfile extends Class handleJoinClick: (e) => - hub = e.target.attributes.address.value + hub_address = e.target.attributes.address.value + if Page.user?.hub + hub_name = (hub.content.title for hub in @hubs when hub.address == Page.user.hub)?[0] + hub_name ?= Page.user.hub + Page.cmd "wrapperConfirm", ["You already have profile on hub #{hub_name},
are you sure you want to create a new one?", "Create new profile"], => + @joinHub(hub_address) + else + @joinHub(hub_address) + + joinHub: (hub) => user = new User({hub: hub, auth_address: Page.site_info.auth_address}) @creation_status.push "Checking user on selected hub..." Page.cmd "fileGet", {"inner_path": user.getPath()+"/content.json", "required": false}, (found) => @@ -144,4 +153,4 @@ class ContentCreateProfile extends Class -window.ContentCreateProfile = ContentCreateProfile \ No newline at end of file +window.ContentCreateProfile = ContentCreateProfile diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 5e18ba7..0e92097 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -180,7 +180,7 @@ class ContentFeed extends Class @post_create.render(), h("div.post-list-type", h("div.hub-menu", - h("a.link", {href: "#Hubs", onmousedown: @handleFiltersClick, onclick: Page.returnFalse}, "Hubs") + h("a.link", {href: "#Hubs", onmousedown: @handleHubsClick, onclick: Page.returnFalse}, "Hubs") @hubs.render() ) h("div.filters-menu", diff --git a/js/Head.coffee b/js/Head.coffee index 9c1b3f6..1f82ed0 100644 --- a/js/Head.coffee +++ b/js/Head.coffee @@ -47,6 +47,17 @@ class Head extends Class return false ), Page.local_storage.settings.hide_hello_zerome] + if (key for key of Page.user_hubs).length > 1 + @menu.items.push ["---"] + for key, val of Page.user_hubs + ((key) => + @menu.items.push ["Use hub #{key}", ( (item) => + Page.local_storage.settings.hub = key + Page.saveLocalStorage() + Page.checkUser() + ), Page.user.row.site == key] + )(key) + @menu.toggle() Page.projector.scheduleRender() return false diff --git a/js/ZeroMe.coffee b/js/ZeroMe.coffee index 5d90c1e..a99bf35 100644 --- a/js/ZeroMe.coffee +++ b/js/ZeroMe.coffee @@ -8,6 +8,7 @@ class ZeroMe extends ZeroFrame @server_info = null @address = null @user = false + @user_hubs = {} @user_loaded = false @userdb = "1UDbADib99KE9d3qZ87NqJF2QLTHmMkoV" @cache_time = Time.timestamp() # Image cache invalidation @@ -205,12 +206,22 @@ class ZeroMe extends ZeroFrame Page.cmd "dbQuery", ["SELECT * FROM json WHERE directory = :directory AND user_name IS NOT NULL AND file_name = 'data.json' AND intro IS NOT NULL", {directory: "data/users/#{@site_info.auth_address}"}], (res) => if res?.length > 0 - @user = new User({hub: res[0]["hub"], auth_address: @site_info.auth_address}) - @user.row = res[0] + @user_hubs = {} for row in res + @log "Possible site for user", row.site + @user_hubs[row.site] = row if row.site == row.hub - @user.row = row - @log "Choosen site for user", @user.row.site, @user.row + user_row = row + + if @user_hubs[@local_storage.settings.hub] + row = @user_hubs[@local_storage.settings.hub] + @log "Force hub", row.site + user_row = row + user_row.hub = row.site + + @log "Choosen site for user", user_row.site, user_row + @user = new User({hub: user_row.hub, auth_address: @site_info.auth_address}) + @user.row = user_row @user.updateInfo(cb) else # No currently seeded user with that cert_user_id diff --git a/js/utils/ImagePreview.coffee b/js/utils/ImagePreview.coffee index edba302..b8fc71b 100644 --- a/js/utils/ImagePreview.coffee +++ b/js/utils/ImagePreview.coffee @@ -52,18 +52,18 @@ class ImagePreview extends Class #ctx.putImageData(image_data, 1, 0) #ctx.putImageData(image_data, 0, 1) ctx.putImageData(image_data, 0, 0) - ### + + # Add some blur for more smooth image canvas2 = document.createElement("canvas") canvas2.width = width*3 canvas2.height = height*3 ctx = canvas2.getContext('2d') ctx.filter = "blur(1px)" - ctx.drawImage(canvas, 1, 0, canvas.width*3, canvas.height*3) - ctx.drawImage(canvas, 0, 1, canvas.width*3, canvas.height*3) + ctx.drawImage(canvas, -5, -5, canvas.width*3 + 10, canvas.height*3 + 10) ctx.drawImage(canvas, 0, 0, canvas.width*3, canvas.height*3) - ### - back = canvas.toDataURL("image/png") + + back = canvas2.toDataURL("image/png") @logEnd "Render" return back -window.ImagePreview = ImagePreview \ No newline at end of file +window.ImagePreview = ImagePreview diff --git a/js/utils/Text.coffee b/js/utils/Text.coffee index 86d8c3d..44681bc 100644 --- a/js/utils/Text.coffee +++ b/js/utils/Text.coffee @@ -43,6 +43,7 @@ class Text if window.is_proxy text = text.replace(/href="http:\/\/(127.0.0.1|localhost):43110/gi, 'href="http://zero') text = text.replace(/http:\/\/zero\/([^\/]+\.bit)/, "http://$1") + text = text.replace(/href="\/([A-Za-z0-9]{26,35})/g, 'href="http://zero/$1') # Links without 127.0.0.1 else text = text.replace(/href="http:\/\/(127.0.0.1|localhost):43110/g, 'href="') # Add no-refresh linking to local links @@ -54,7 +55,9 @@ class Text fixLink: (link) -> if window.is_proxy back = link.replace(/http:\/\/(127.0.0.1|localhost):43110/, 'http://zero') - return back.replace(/http:\/\/zero\/([^\/]+\.bit)/, "http://$1") # Domain links + back = back.replace(/http:\/\/zero\/([^\/]+\.bit)/, "http://$1") # Domain links + back = back.replace(/\/([A-Za-z0-9]{26,35})/, "http://zero/$1") # Links without 127.0.0.1 + return back else return link.replace(/http:\/\/(127.0.0.1|localhost):43110/, '') diff --git a/languages/sk.json b/languages/sk.json new file mode 100644 index 0000000..ddbf200 --- /dev/null +++ b/languages/sk.json @@ -0,0 +1,81 @@ +{ + "Visitor": "Návštevník", + "Select your account": "Zvoľte svoj účet", + "You need a profile for this feature": "Pre túto funkciu potrebujete profil", + + "Follow username mentions": "Sledovať spomenutia používateľského mena", + "Follow comments on your posts": "Sledovať komentáre na vaších príspevkoch", + "Follow new followers": "Sledovať nových sledovateľov", + + "Follow": "Sledovať", + "Unfollow": "Prestať sledovať", + "Help distribute this user's images": "Pomôcť s distribúciou obrázkov tohto používateľa", + "Following": "Sledované", + "Activity feed": "Prehľad aktivít", + "Show more...": "Viac...", + + " started following ": " začal sledovať ", + " commented on ": " komentoval na ", + " liked ": " like-ol ", + "'s ": "", + "_(post, like post)": "_(post, like-núť post)", + "_(post, comment post)": "_(post, komentovať post)", + + "Cancel": "Zrušiť", + "Save": "Uložiť", + "Delete": "Vymazať", + + "User's profile site not loaded to your client yet.": "Stránka používateľského účtu ešte nebola načítaná do vašeho klinta.", + "Download user's site": "Stiahnuť stránku používateľa", + + "Browse all \\u203A": "Prezrieť všetko \\u203A", + "New users": "Nový používatelia", + "Suggested users": "Doporučený používatelia", + + "Create new profile": "Vytvoriť nový profil", + "Creating new profile...": "Vytvára sa nový profil...", + "Checking user on selected hub...": "Kontroluje sa používateľ na zvolenom hub-e...", + "User \" + Page.site_info.cert_user_id + \" already exists on this hub": "Používateľ \" + Page.site_info.cert_user_id + \" už na tomto hub-e existuje", + "Select ID...": "Zvoliť ID...", + "Seeded HUBs": "Seed-ovaných Hub-ov", + "Available HUBs": "Dostupných Hub-ov", + "(With this you choose where is your profile stored. There is no difference on content and you will able to reach all users from any hub)": + "(S týmto si zvolíš kde bude tvoj profil uložený. Žiadny rozdiel medzi obsahom nieje a budeš vidieť všetkých používateľov z ostatných hub-ov)", + + "Random ZeroNet user": "Náhodný ZeroNetpoužívateľ", + "Hello ZeroMe!": "Ahoj ZeroMe!", + + "Loading...\\nShow image": "Načítava sa...\\nKép mutatása", + "Help distribute this user's new images": "Pomôcť s distribúciou obrázkov tohto používateľa", + "Delete image": "Vymazať obrázok", + "Show image": "Ukázať obrázok", + "'s new images": " nových obrázkov", + + "Comment": "Komentovať", + "Add your comment": "Pridaj svoj komentár", + "Reply": "Odpovedať", + + "Everyone": "Všetci", + "Followed users": "Sledovaný používatelia", + "Show more posts...": "Ukázať viac postov...", + "Show more comments...": "Ukázať viac komentárov...", + "No posts yet": "Zatiaľ žiadne príspevky", + "Let's follow some users!": "Začnite sledovať nejakých používateľov!", + + "Select user to post new content": "Zvoľte používateľa za ktorého chcete uverejniť obsah", + "Write something...": "Napíšte niečo...", + "Submit new post": "Zaslať nový príspevok", + "Invalid image, only jpg format supported": "Neplatný obrázok, podporovaný iba jpg formát", + + "Follow in newsfeed": "Sledovať v novinkách", + + "New users in ZeroMe": "Nový používatelia na ZeroMe", + "Total: ": "Ceľkom: ", + " registered users": " registrovaných používateľov", + + " minutes ago": " minút dozadu", + " hours ago": " hodín dozadu", + " days ago": " dní dozadu", + "on ": "", + "Just now": "Teraz" +} From 242e50926b52989e501157f37947c9ac1bca4913 Mon Sep 17 00:00:00 2001 From: BinChan Date: Tue, 13 Feb 2018 20:32:05 +0800 Subject: [PATCH 17/26] Add chronological timeline feature --- css/Menu.css | 16 + css/all.css | 148 +++- js/ActivityList.coffee | 35 +- js/Head.coffee | 34 + js/PostList.coffee | 79 +- js/all.js | 1635 +++++++++++++++++++++++++--------------- js/utils/Menu.coffee | 17 +- 7 files changed, 1308 insertions(+), 656 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index 00c0047..a209f82 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -105,3 +105,19 @@ border-bottom: none !important; margin-bottom: 2px; margin-top: 2px; } + +/* Drop menu show after */ + +.show-after { +padding: 3px 0; +} +.show-after .menu-item { +display: inline; +padding-right: 5px; +} +.show-after #show-after-date { +width: 100px; +border: 1px solid transparent; +border-bottom: 1px solid #333; +padding: 1px 5px; +} diff --git a/css/all.css b/css/all.css index 2c378a3..8a730b2 100644 --- a/css/all.css +++ b/css/all.css @@ -1,6 +1,6 @@ -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Activity.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Activity.css ---- */ .activity-list { margin-bottom: 30px } @@ -23,7 +23,7 @@ .activity.latest .circle { border-color: #666 } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Button.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Button.css ---- */ .button { @@ -60,7 +60,7 @@ -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Comment.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Comment.css ---- */ .comment-list { @@ -83,7 +83,7 @@ .comment h1, .comment h2, .comment h3, .comment h4, .comment h5, .comment h6 { font-size: inherit; font-weight: bold } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Editable.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Editable.css ---- */ .editable .icon-edit { margin-left: -24px; padding: 7px; -webkit-border-radius: 30px; -moz-border-radius: 30px; -o-border-radius: 30px; -ms-border-radius: 30px; border-radius: 30px ; margin-top: -5px; position: absolute; opacity: 0; -webkit-transition: all 0.3s ; -moz-transition: all 0.3s ; -o-transition: all 0.3s ; -ms-transition: all 0.3s ; transition: all 0.3s } @@ -97,7 +97,7 @@ } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Head.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Head.css ---- */ .head-container { background-color: white; -webkit-box-shadow: 0px -7px 32px rgba(0,0,0,0.15); -moz-box-shadow: 0px -7px 32px rgba(0,0,0,0.15); -o-box-shadow: 0px -7px 32px rgba(0,0,0,0.15); -ms-box-shadow: 0px -7px 32px rgba(0,0,0,0.15); box-shadow: 0px -7px 32px rgba(0,0,0,0.15) ; } @@ -125,7 +125,7 @@ } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Hub.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Hub.css ---- */ .hub.card { padding: 21px; text-align: left; font-size: 18px; width: 80%; display: block; margin-left: auto; margin-right: auto; } @@ -136,7 +136,7 @@ .hubselect { padding-top: 30px } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Maxheight.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Maxheight.css ---- */ .maxheight { max-height: 550px; overflow: hidden; -webkit-transition: all 1s ease-in-out ; -moz-transition: all 1s ease-in-out ; -o-transition: all 1s ease-in-out ; -ms-transition: all 1s ease-in-out ; transition: all 1s ease-in-out } @@ -147,13 +147,13 @@ } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Menu.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Menu.css ---- */ .menu { background-color: white; padding: 10px 0px; position: absolute; top: 0px; max-height: 0px; overflow: hidden; -webkit-transform: translate(-100%, -30px); -moz-transform: translate(-100%, -30px); -o-transform: translate(-100%, -30px); -ms-transform: translate(-100%, -30px); transform: translate(-100%, -30px) ; pointer-events: none; -webkit-box-shadow: 0px 2px 8px rgba(0,0,0,0.1); -moz-box-shadow: 0px 2px 8px rgba(0,0,0,0.1); -o-box-shadow: 0px 2px 8px rgba(0,0,0,0.1); -ms-box-shadow: 0px 2px 8px rgba(0,0,0,0.1); box-shadow: 0px 2px 8px rgba(0,0,0,0.1) ; -webkit-border-radius: 2px; -moz-border-radius: 2px; -o-border-radius: 2px; -ms-border-radius: 2px; border-radius: 2px ; opacity: 0; -webkit-transition: opacity 0.2s ease-out, transform 1s ease-out, max-height 0.2s ease-in-out; -moz-transition: opacity 0.2s ease-out, transform 1s ease-out, max-height 0.2s ease-in-out; -o-transition: opacity 0.2s ease-out, transform 1s ease-out, max-height 0.2s ease-in-out; -ms-transition: opacity 0.2s ease-out, transform 1s ease-out, max-height 0.2s ease-in-out; transition: opacity 0.2s ease-out, transform 1s ease-out, max-height 0.2s ease-in-out ; z-index: 99; - display: inline-block; z-index: 999; margin-top: 50px; + display: inline-block; z-index: 99999999999999999; margin-top: 50px; } .menu-right { left: 100% } .menu.visible { opacity: 1; max-height: 350px; -webkit-transform: translate(-100%, 0px); -moz-transform: translate(-100%, 0px); -o-transform: translate(-100%, 0px); -ms-transform: translate(-100%, 0px); transform: translate(-100%, 0px) ; -webkit-transition: opacity 0.1s ease-out, transform 0.3s ease-out, max-height 0.3s ease-in-out; -moz-transition: opacity 0.1s ease-out, transform 0.3s ease-out, max-height 0.3s ease-in-out; -o-transition: opacity 0.1s ease-out, transform 0.3s ease-out, max-height 0.3s ease-in-out; -ms-transition: opacity 0.1s ease-out, transform 0.3s ease-out, max-height 0.3s ease-in-out; transition: opacity 0.1s ease-out, transform 0.3s ease-out, max-height 0.3s ease-in-out ; pointer-events: all } @@ -162,14 +162,121 @@ .menu-item-separator { margin-top: 3px; margin-bottom: 3px; border-top: 1px solid #eee } .menu-item:hover { background-color: #F6F6F6; -webkit-transition: none; -moz-transition: none; -o-transition: none; -ms-transition: none; transition: none ; color: inherit; cursor: pointer; color: black; text-decoration: none } -.menu-item:active, .menu-item:focus { background-color: #AF3BFF; color: white; -webkit-transition: none ; -moz-transition: none ; -o-transition: none ; -ms-transition: none ; transition: none } +.menu-item:active, .menu-item:focus { +background-color: transparent; +color: white; -webkit-transition: none; -moz-transition: none; -o-transition: none; -ms-transition: none; transition: none ; +-webkit-tap-highlight-color: transparent; +} .menu-item.selected:before { content: "L"; display: inline-block; -webkit-transform: rotateZ(45deg) scaleX(-1); -moz-transform: rotateZ(45deg) scaleX(-1); -o-transform: rotateZ(45deg) scaleX(-1); -ms-transform: rotateZ(45deg) scaleX(-1); transform: rotateZ(45deg) scaleX(-1) ; line-height: 15px; font-weight: bold; position: absolute; margin-left: -14px; font-size: 12px; margin-top: 2px; } +.menu-radio { white-space: normal; line-height: 26px } +.menu-item:hover, .menu-radio:hover {background-color: transparent} +.menu-radio span, .menu-radio a.all, .menu-radio a.filter { + background-color: #EEE; width: 18.5%; text-align: center; margin-top: 2px; margin-bottom: 2px; color: #333; font-weight: bold; + text-decoration: none; font-size: 13px; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; -o-transition: all 0.3s; -ms-transition: all 0.3s; transition: all 0.3s ; text-transform: uppercase; display: inline-block; +} +.post-list-type .menu-radio a:hover {color: #333} +.menu-item .menu-radio .lang-on:hover, +.menu-radio .lang-on.selected { +background-color: rgba(130,255,137,0.2); +} +.menu-item .menu-radio .lang-off:hover, +.menu-radio .lang-off.selected { +background-color: rgba(255,138,140,0.2); +} +.menu-radio a:hover, .menu-radio a.all.active { -webkit-transition: none; -moz-transition: none; -o-transition: none; -ms-transition: none; transition: none ; background-color: #d8f1d9;} +.menu-radio a.long { font-size: 11px } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Overlay.css ---- */ +.menu-radio span { +text-align: center; +width: 46%; +margin-top: 2px; +margin-right: 4px; +display: inline-block; +white-space: pre; +outline: 4px solid transparent; +} +.menu-radio a { +position: absolute; +white-space: pre; +display: block !important; +width: 59px !important; +} +.menu-radio a.all, .menu-radio a.filter { +position: relative; +width: 46% !important; +float: left; +margin-right: 4px !important; +} +.menu-radio .lang-on { +text-align: left; +color: #333; +} +.menu-radio .lang-off { +color: #333; +text-align: right; +margin-left: 59px !important; +} + +.post-list-type .menu { +width: 280px; +text-align: left; +margin-left: -55px; +margin-top: 43px; +-webkit-transform: none; -moz-transform: none; -o-transform: none; -ms-transform: none; transform: none ; +-webkit-transition: max-height 0.3s ease-out; -moz-transition: max-height 0.3s ease-out; -o-transition: max-height 0.3s ease-out; -ms-transition: max-height 0.3s ease-out; transition: max-height 0.3s ease-out ; +} +.post-list-type .hub-menu, .post-list-type .filters-menu { +position: relative; +z-index: 1; +display: inline-block; +} +.post-list-type .filters-menu .menu { +margin-left: -85px; +width: 257px; +padding-left: 15px; +} +.post-list-type .hub-menu .menu .menu-item { +width: 90px; +overflow: hidden; +} +.post-list-type .hub-menu .menu .menu-item a { +width: 90%; +overflow: hidden; +text-overflow: ellipsis; +} +.post-list-type .menu .menu-item, .post-list-type .menu .menu-radio a { +padding: 0; +margin: 0px; +border-bottom: none !important; +} +.post-list-type .menu .menu-radio .all, .post-list-type .menu .menu-radio .filter { +margin-bottom: 2px; +margin-top: 2px; +} + +/* Drop menu */ + +.show-after { +padding: 3px 0; +} +.show-after .menu-item { +display: inline; +padding-right: 5px; +} +.show-after #show-after-date { +width: 100px; +border: 1px solid transparent; +border-bottom: 1px solid #333; +padding: 1px 5px; +} + + + +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Overlay.css ---- */ #Overlay { @@ -180,7 +287,7 @@ #Overlay .img { position: absolute; background-size: contain; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; -o-transition: all 0.3s; -ms-transition: all 0.3s; transition: all 0.3s ; background-repeat: no-repeat; } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Post.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Post.css ---- */ .post { @@ -279,14 +386,14 @@ .post .img .oldversion { background-color: rgba(0, 0, 0, 0.5); padding: 10px 10px; top: 49%; position: relative; color: white; -webkit-border-radius: 25px; -moz-border-radius: 25px; -o-border-radius: 25px; -ms-border-radius: 25px; border-radius: 25px ; } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/Uploadable.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Uploadable.css ---- */ .uploadable .icon-upload { opacity: 0; -webkit-transition: all 0.3s ; -moz-transition: all 0.3s ; -o-transition: all 0.3s ; -ms-transition: all 0.3s ; transition: all 0.3s } .uploadable .icon-upload:hover { opacity: 0.8; -webkit-transition: all 0.1s ; -moz-transition: all 0.1s ; -o-transition: all 0.1s ; -ms-transition: all 0.1s ; transition: all 0.1s } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/User.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/User.css ---- */ .users .user { padding-left: 70px; padding-bottom: 20px } @@ -336,7 +443,7 @@ -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/ZeroMe.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/ZeroMe.css ---- */ body { @@ -478,7 +585,7 @@ h5 { font-weight: normal; color: rgba(0, 0, 0, 0.5) } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/fonts.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/fonts.css ---- */ /* Base64 encoder: http://www.motobit.com/util/base64-decoder-encoder.asp */ @@ -515,7 +622,7 @@ h5 { font-weight: normal; color: rgba(0, 0, 0, 0.5) } } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/icons.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/icons.css ---- */ .icon { @@ -614,7 +721,7 @@ h5 { font-weight: normal; color: rgba(0, 0, 0, 0.5) } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/css/mobile.css ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/mobile.css ---- */ /* ZeroMe Mobile */ @@ -704,7 +811,10 @@ height: 16px; outline: none; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; border-radius: 5px ; } - +.col-left.faded { +opacity: 1; +-webkit-filter: none; -moz-filter: none; -o-filter: none; -ms-filter: none; filter: none ; +} .user.card { background-color: #f6f7f8; -webkit-box-shadow: none; -moz-box-shadow: none; -o-box-shadow: none; -ms-box-shadow: none; box-shadow: none ; diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index fe805cc..4c42dad 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -9,18 +9,34 @@ class ActivityList extends Class @update_timer = null @filter_hub = null @filter_language_ids = null + @show_after_date = 1471946844 queryActivities: (cb) -> if @filter_language_ids where = "WHERE (comment_id, json_id) IN #{@filter_language_ids} AND date_added < #{Time.timestamp()+120} " else if @directories == "all" - where = "WHERE date_added > #{Time.timestamp()-60*60*24*2} AND date_added < #{Time.timestamp()+120} " + if Page.local_storage.settings.sort_chronologically || \ + Page.local_storage.settings.show_one_month_ago || \ + Page.local_storage.settings.show_one_day_ago || \ + Page.local_storage.settings.show_after + where = "WHERE date_added < #{Time.timestamp()+120} " + else + where = "WHERE date_added > #{Time.timestamp()-60*60*24*2} AND date_added < #{Time.timestamp()+120} " else if @directories == "hub" where = "WHERE json.hub = '#{@filter_hub}' AND date_added < #{Time.timestamp()+120} " else where = "WHERE json.directory IN #{Text.sqlIn(@directories)} AND date_added < #{Time.timestamp()+120} " + if Page.local_storage.settings.show_after + if document.getElementById("show-after-date") + this.show_after_date = document.getElementById("show-after-date").value - 121 + where += "AND date_added > " + String(this.show_after_date) + " " + if Page.local_storage.settings.show_one_day_ago + where += "AND date_added > strftime('%s', 'now') - 3600*24 " + if Page.local_storage.settings.show_one_month_ago + where += "AND date_added > strftime('%s', 'now') - 3600*24*30 " + query = """ SELECT 'comment' AS type, json.*, @@ -60,12 +76,21 @@ class ActivityList extends Class LEFT JOIN follow USING (json_id) #{where} """ + if Page.local_storage.settings.sort_chronologically || \ + Page.local_storage.settings.show_one_month_ago || \ + Page.local_storage.settings.show_one_day_ago || \ + Page.local_storage.settings.show_after + query += """ - query += """ + ORDER BY date_added ASC + LIMIT #{@limit+1} + """ + else + query += """ - ORDER BY date_added DESC - LIMIT #{@limit+1} - """ + ORDER BY date_added DESC + LIMIT #{@limit+1} + """ @logStart("Update") Page.cmd "dbQuery", [query, {directories: @directories}], (rows) => diff --git a/js/Head.coffee b/js/Head.coffee index 1f82ed0..ab215a4 100644 --- a/js/Head.coffee +++ b/js/Head.coffee @@ -46,6 +46,40 @@ class Head extends Class Page.content.need_update = true return false ), Page.local_storage.settings.hide_hello_zerome] + @menu.items.push ["---"] + @menu.items.push ["Show posts after", ( (item) => + Page.local_storage.settings.show_after = not Page.local_storage.settings.show_after + item[2] = Page.local_storage.settings.show_after + Page.projector.scheduleRender() + Page.saveLocalStorage() + Page.content.need_update = true + return false + ), Page.local_storage.settings.show_after] + @menu.items.push ["Show posts chronologically", ( (item) => + Page.local_storage.settings.sort_chronologically = not Page.local_storage.settings.sort_chronologically + item[2] = Page.local_storage.settings.sort_chronologically + Page.projector.scheduleRender() + Page.saveLocalStorage() + Page.content.need_update = true + return false + ), Page.local_storage.settings.sort_chronologically] + @menu.items.push ["Show posts since one day ago", ( (item) => + Page.local_storage.settings.show_one_day_ago = not Page.local_storage.settings.show_one_day_ago + item[2] = Page.local_storage.settings.show_one_day_ago + Page.projector.scheduleRender() + Page.saveLocalStorage() + Page.content.need_update = true + return false + ), Page.local_storage.settings.show_one_day_ago] + @menu.items.push ["Show posts since one month ago", ( (item) => + Page.local_storage.settings.show_one_month_ago = not Page.local_storage.settings.show_month_day_ago + item[2] = Page.local_storage.settings.show_one_month_ago + Page.projector.scheduleRender() + Page.saveLocalStorage() + Page.content.need_update = true + return false + ), Page.local_storage.settings.show_one_month_ago] + if (key for key of Page.user_hubs).length > 1 @menu.items.push ["---"] diff --git a/js/PostList.coffee b/js/PostList.coffee index 20655fd..7ed2418 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -9,18 +9,34 @@ class PostList extends Class @filter_hub = null @filter_language_ids = null @limit = 10 + @show_after_date = 1471946844 queryComments: (post_uris, cb) => - query = " - SELECT - post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site - FROM - comment - LEFT JOIN json USING (json_id) - WHERE - ? AND date_added < #{Time.timestamp()+120} - ORDER BY date_added DESC - " + if Page.local_storage.settings.sort_chronologically || \ + Page.local_storage.settings.show_one_month_ago || \ + Page.local_storage.settings.show_one_day_ago || \ + Page.local_storage.settings.show_after + query = " + SELECT + post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site + FROM + comment + LEFT JOIN json USING (json_id) + WHERE + ? AND date_added < #{Time.timestamp()+120} + ORDER BY date_added ASC + " + else + query = " + SELECT + post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site + FROM + comment + LEFT JOIN json USING (json_id) + WHERE + ? AND date_added < #{Time.timestamp()+120} + ORDER BY date_added DESC + " return Page.cmd "dbQuery", [query, {post_uri: post_uris}], cb queryLikes: (post_uris, cb) => @@ -48,16 +64,39 @@ class PostList extends Class if Page.local_storage.settings.hide_hello_zerome where += "AND post_id > 1 " - query = " - SELECT - * - FROM - post - LEFT JOIN json ON (post.json_id = json.json_id) - #{where} - ORDER BY date_added DESC - LIMIT #{@limit+1} - " + if Page.local_storage.settings.show_after + if document.getElementById("show-after-date") + this.show_after_date = document.getElementById("show-after-date").value - 121 + where += "AND date_added > " + String(this.show_after_date) + " " + if Page.local_storage.settings.show_one_day_ago + where += "AND date_added > strftime('%s', 'now') - 3600*24 " + if Page.local_storage.settings.show_one_month_ago + where += "AND date_added > strftime('%s', 'now') - 3600*24*30 " + if Page.local_storage.settings.sort_chronologically || \ + Page.local_storage.settings.show_one_month_ago || \ + Page.local_storage.settings.show_one_day_ago || \ + Page.local_storage.settings.show_after + query = " + SELECT + * + FROM + post + LEFT JOIN json ON (post.json_id = json.json_id) + #{where} + ORDER BY date_added ASC + LIMIT #{@limit+1} + " + else + query = " + SELECT + * + FROM + post + LEFT JOIN json ON (post.json_id = json.json_id) + #{where} + ORDER BY date_added DESC + LIMIT #{@limit+1} + " @logStart "Update" Page.cmd "dbQuery", [query, param], (rows) => items = [] diff --git a/js/all.js b/js/all.js index ada5840..77e9e3b 100644 --- a/js/all.js +++ b/js/all.js @@ -1,11 +1,11 @@ -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/Class.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Class.coffee ---- */ (function() { var Class, - __slice = [].slice; + slice = [].slice; Class = (function() { function Class() {} @@ -14,7 +14,7 @@ Class.prototype.log = function() { var args; - args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + args = 1 <= arguments.length ? slice.call(arguments, 0) : []; if (!this.trace) { return; } @@ -28,23 +28,23 @@ Class.prototype.logStart = function() { var args, name; - name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + name = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; if (!this.trace) { return; } this.logtimers || (this.logtimers = {}); this.logtimers[name] = +(new Date); if (args.length > 0) { - this.log.apply(this, ["" + name].concat(__slice.call(args), ["(started)"])); + this.log.apply(this, ["" + name].concat(slice.call(args), ["(started)"])); } return this; }; Class.prototype.logEnd = function() { var args, ms, name; - name = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + name = arguments[0], args = 2 <= arguments.length ? slice.call(arguments, 1) : []; ms = +(new Date) - this.logtimers[name]; - this.log.apply(this, ["" + name].concat(__slice.call(args), ["(Done in " + ms + "ms)"])); + this.log.apply(this, ["" + name].concat(slice.call(args), ["(Done in " + ms + "ms)"])); return this; }; @@ -57,7 +57,7 @@ }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/Dollar.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Dollar.coffee ---- */ (function() { @@ -70,39 +70,39 @@ }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/Promise.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Promise.coffee ---- */ (function() { var Promise, - __slice = [].slice; + slice = [].slice; Promise = (function() { Promise.join = function() { - var args, num_uncompleted, promise, task, task_id, tasks, _fn, _i, _len; - tasks = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + var args, fn, i, len, num_uncompleted, promise, task, task_id, tasks; + tasks = 1 <= arguments.length ? slice.call(arguments, 0) : []; num_uncompleted = tasks.length; args = new Array(num_uncompleted); promise = new Promise(); - _fn = function(task_id) { + fn = function(task_id) { return task.then(function() { - var callback, _j, _len1, _ref, _results; + var callback, j, len1, ref, results; args[task_id] = Array.prototype.slice.call(arguments); num_uncompleted--; if (num_uncompleted === 0) { - _ref = promise.callbacks; - _results = []; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - callback = _ref[_j]; - _results.push(callback.apply(promise, args)); + ref = promise.callbacks; + results = []; + for (j = 0, len1 = ref.length; j < len1; j++) { + callback = ref[j]; + results.push(callback.apply(promise, args)); } - return _results; + return results; } }); }; - for (task_id = _i = 0, _len = tasks.length; _i < _len; task_id = ++_i) { + for (task_id = i = 0, len = tasks.length; i < len; task_id = ++i) { task = tasks[task_id]; - _fn(task_id); + fn(task_id); } return promise; }; @@ -115,7 +115,7 @@ } Promise.prototype.resolve = function() { - var back, callback, _i, _len, _ref; + var back, callback, i, len, ref; if (this.resolved) { return false; } @@ -125,9 +125,9 @@ this.data = [true]; } this.result = this.data[0]; - _ref = this.callbacks; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - callback = _ref[_i]; + ref = this.callbacks; + for (i = 0, len = ref.length; i < len; i++) { + callback = ref[i]; back = callback.apply(callback, this.data); } if (this.end_promise && back && back.then) { @@ -200,7 +200,7 @@ }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/Property.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Property.coffee ---- */ (function() { @@ -211,7 +211,7 @@ }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/Prototypes.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Prototypes.coffee ---- */ (function() { @@ -238,12 +238,12 @@ }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/RateLimitCb.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/RateLimitCb.coffee ---- */ (function() { var call_after_interval, calling, last_time, - __slice = [].slice; + slice = [].slice; last_time = {}; @@ -279,7 +279,7 @@ return calling[fn] = args; } else { last_time[fn] = Date.now(); - return fn.apply(this, [cb].concat(__slice.call(args))); + return fn.apply(this, [cb].concat(slice.call(args))); } }; @@ -318,7 +318,7 @@ }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/anime.min.js ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/anime.min.js ---- */ /* @@ -350,7 +350,7 @@ c.raf=requestAnimationFrame(c.tick)};b.restart=function(){b.reversed&&y(b);b.pau function(a){a=e.string(a)?B(a)[0]:a;return{path:a,value:a.getTotalLength()}};l.random=function(a,b){return Math.floor(Math.random()*(b-a+1))+a};return l}); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/clone.js ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/clone.js ---- */ function clone(obj) { @@ -363,7 +363,7 @@ function clone(obj) { } -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/maquette.js ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/maquette.js ---- */ (function (root, factory) { @@ -1142,7 +1142,7 @@ function clone(obj) { -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/lib/marked.min.js ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/marked.min.js ---- */ /** @@ -1153,7 +1153,7 @@ function clone(obj) { (function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
"+(escaped?code:escape(code,true))+"\n
"}return'
'+(escaped?code:escape(code,true))+"\n
\n"};Renderer.prototype.blockquote=function(quote){return"
\n"+quote+"
\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
\n":"
\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Animation.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Animation.coffee ---- */ (function() { @@ -1324,8 +1324,8 @@ function clone(obj) { }; Animation.prototype.show = function(elem, props) { - var delay, _ref; - delay = ((_ref = arguments[arguments.length - 2]) != null ? _ref.delay : void 0) * 1000 || 1; + var delay, ref; + delay = ((ref = arguments[arguments.length - 2]) != null ? ref.delay : void 0) * 1000 || 1; elem.className += " animate"; elem.style.opacity = 0; setTimeout((function() { @@ -1339,8 +1339,8 @@ function clone(obj) { }; Animation.prototype.hide = function(elem, remove_func, props) { - var delay, _ref; - delay = ((_ref = arguments[arguments.length - 2]) != null ? _ref.delay : void 0) * 1000 || 1; + var delay, ref; + delay = ((ref = arguments[arguments.length - 2]) != null ? ref.delay : void 0) * 1000 || 1; elem.className += " animate"; setTimeout((function() { return elem.style.opacity = 0; @@ -1413,30 +1413,30 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Autosize.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Autosize.coffee ---- */ (function() { var Autosize, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; - - Autosize = (function(_super) { - __extends(Autosize, _super); - - function Autosize(_at_attrs) { - var _base; - this.attrs = _at_attrs != null ? _at_attrs : {}; - this.render = __bind(this.render, this); - this.handleKeydown = __bind(this.handleKeydown, this); - this.handleInput = __bind(this.handleInput, this); - this.autoHeight = __bind(this.autoHeight, this); - this.setValue = __bind(this.setValue, this); - this.storeNode = __bind(this.storeNode, this); + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + Autosize = (function(superClass) { + extend(Autosize, superClass); + + function Autosize(attrs1) { + var base; + this.attrs = attrs1 != null ? attrs1 : {}; + this.render = bind(this.render, this); + this.handleKeydown = bind(this.handleKeydown, this); + this.handleInput = bind(this.handleInput, this); + this.autoHeight = bind(this.autoHeight, this); + this.setValue = bind(this.setValue, this); + this.storeNode = bind(this.storeNode, this); this.node = null; - if ((_base = this.attrs).classes == null) { - _base.classes = {}; + if ((base = this.attrs).classes == null) { + base.classes = {}; } this.attrs.classes.loading = false; this.attrs.oninput = this.handleInput; @@ -1551,7 +1551,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Debug.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Debug.coffee ---- */ (function() { @@ -1584,28 +1584,28 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Editable.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Editable.coffee ---- */ (function() { var Editable, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; - - Editable = (function(_super) { - __extends(Editable, _super); - - function Editable(_at_type, _at_handleSave, _at_handleDelete) { - this.type = _at_type; - this.handleSave = _at_handleSave; - this.handleDelete = _at_handleDelete; - this.render = __bind(this.render, this); - this.handleSaveClick = __bind(this.handleSaveClick, this); - this.handleDeleteClick = __bind(this.handleDeleteClick, this); - this.handleCancelClick = __bind(this.handleCancelClick, this); - this.handleEditClick = __bind(this.handleEditClick, this); - this.storeNode = __bind(this.storeNode, this); + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + Editable = (function(superClass) { + extend(Editable, superClass); + + function Editable(type, handleSave, handleDelete) { + this.type = type; + this.handleSave = handleSave; + this.handleDelete = handleDelete; + this.render = bind(this.render, this); + this.handleSaveClick = bind(this.handleSaveClick, this); + this.handleDeleteClick = bind(this.handleDeleteClick, this); + this.handleCancelClick = bind(this.handleCancelClick, this); + this.handleEditClick = bind(this.handleEditClick, this); + this.storeNode = bind(this.storeNode, this); this.node = null; this.editing = false; this.render_function = null; @@ -1695,20 +1695,20 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/ImagePreview.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/ImagePreview.coffee ---- */ (function() { var ImagePreview, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - ImagePreview = (function(_super) { - __extends(ImagePreview, _super); + ImagePreview = (function(superClass) { + extend(ImagePreview, superClass); function ImagePreview() { - this.setPreviewData = __bind(this.setPreviewData, this); + this.setPreviewData = bind(this.setPreviewData, this); this.width = 0; this.height = 0; this.preview_data = ""; @@ -1730,14 +1730,14 @@ function clone(obj) { return [Math.round(width), Math.round(height)]; }; - ImagePreview.prototype.setPreviewData = function(_at_preview_data) { - var colors, pixels, _ref; - this.preview_data = _at_preview_data; - return _ref = this.preview_data.split(","), this.width = _ref[0], this.height = _ref[1], colors = _ref[2], pixels = _ref[3], _ref; + ImagePreview.prototype.setPreviewData = function(preview_data) { + var colors, pixels, ref; + this.preview_data = preview_data; + return ref = this.preview_data.split(","), this.width = ref[0], this.height = ref[1], colors = ref[2], pixels = ref[3], ref; }; ImagePreview.prototype.getPreviewUri = function(target_width, target_height) { - var b, back, canvas, color, color_codes, colors, ctx, di, g, height, hex, i, image_data, pixel, pixels, r, width, _i, _j, _len, _len1, _ref, _ref1; + var b, back, canvas, canvas2, color, color_codes, colors, ctx, di, g, height, hex, i, image_data, j, k, len, len1, pixel, pixels, r, ref, ref1, width; if (target_width == null) { target_width = 10; } @@ -1745,8 +1745,8 @@ function clone(obj) { target_height = 10; } this.logStart("Render"); - _ref = this.preview_data.split(","), this.width = _ref[0], this.height = _ref[1], colors = _ref[2], pixels = _ref[3]; - _ref1 = this.getSize(target_width, target_height), width = _ref1[0], height = _ref1[1]; + ref = this.preview_data.split(","), this.width = ref[0], this.height = ref[1], colors = ref[2], pixels = ref[3]; + ref1 = this.getSize(target_width, target_height), width = ref1[0], height = ref1[1]; colors = colors.match(/.{3}/g); pixels = pixels.split(""); canvas = document.createElement("canvas"); @@ -1755,13 +1755,13 @@ function clone(obj) { ctx = canvas.getContext('2d'); image_data = ctx.createImageData(width, height); color_codes = {}; - for (i = _i = 0, _len = colors.length; _i < _len; i = ++_i) { + for (i = j = 0, len = colors.length; j < len; i = ++j) { color = colors[i]; color_codes[this.pixel_chars[i]] = color; } di = 0; - for (_j = 0, _len1 = pixels.length; _j < _len1; _j++) { - pixel = pixels[_j]; + for (k = 0, len1 = pixels.length; k < len1; k++) { + pixel = pixels[k]; hex = color_codes[pixel]; r = parseInt(hex[0], 16) * 17; g = parseInt(hex[1], 16) * 17; @@ -1773,18 +1773,14 @@ function clone(obj) { di += 4; } ctx.putImageData(image_data, 0, 0); - - /* - canvas2 = document.createElement("canvas") - canvas2.width = width*3 - canvas2.height = height*3 - ctx = canvas2.getContext('2d') - ctx.filter = "blur(1px)" - ctx.drawImage(canvas, 1, 0, canvas.width*3, canvas.height*3) - ctx.drawImage(canvas, 0, 1, canvas.width*3, canvas.height*3) - ctx.drawImage(canvas, 0, 0, canvas.width*3, canvas.height*3) - */ - back = canvas.toDataURL("image/png"); + canvas2 = document.createElement("canvas"); + canvas2.width = width * 3; + canvas2.height = height * 3; + ctx = canvas2.getContext('2d'); + ctx.filter = "blur(1px)"; + ctx.drawImage(canvas, -5, -5, canvas.width * 3 + 10, canvas.height * 3 + 10); + ctx.drawImage(canvas, 0, 0, canvas.width * 3, canvas.height * 3); + back = canvas2.toDataURL("image/png"); this.logEnd("Render"); return back; }; @@ -1798,37 +1794,37 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/ItemList.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/ItemList.coffee ---- */ (function() { var ItemList; ItemList = (function() { - function ItemList(_at_item_class, _at_key) { - this.item_class = _at_item_class; - this.key = _at_key; + function ItemList(item_class1, key1) { + this.item_class = item_class1; + this.key = key1; this.items = []; this.items_bykey = {}; } ItemList.prototype.sync = function(rows, item_class, key) { - var current_obj, item, row, _i, _len, _results; + var current_obj, i, item, len, results, row; this.items.splice(0, this.items.length); - _results = []; - for (_i = 0, _len = rows.length; _i < _len; _i++) { - row = rows[_i]; + results = []; + for (i = 0, len = rows.length; i < len; i++) { + row = rows[i]; current_obj = this.items_bykey[row[this.key]]; if (current_obj) { current_obj.row = row; - _results.push(this.items.push(current_obj)); + results.push(this.items.push(current_obj)); } else { item = new this.item_class(row, this); this.items_bykey[row[this.key]] = item; - _results.push(this.items.push(item)); + results.push(this.items.push(item)); } } - return _results; + return results; }; ItemList.prototype.deleteItem = function(item) { @@ -1851,7 +1847,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Maxheight.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Maxheight.coffee ---- */ (function() { @@ -1887,31 +1883,31 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Menu.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Menu.coffee ---- */ (function() { var Menu, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; Menu = (function() { function Menu() { - this.render = __bind(this.render, this); - this.renderItem = __bind(this.renderItem, this); - this.handleClick = __bind(this.handleClick, this); - this.storeNode = __bind(this.storeNode, this); - this.toggle = __bind(this.toggle, this); - this.hide = __bind(this.hide, this); - this.show = __bind(this.show, this); + this.render = bind(this.render, this); + this.renderItem = bind(this.renderItem, this); + this.handleClick = bind(this.handleClick, this); + this.storeNode = bind(this.storeNode, this); + this.toggle = bind(this.toggle, this); + this.hide = bind(this.hide, this); + this.show = bind(this.show, this); this.visible = false; this.items = []; this.node = null; } Menu.prototype.show = function() { - var _ref; - if ((_ref = window.visible_menu) != null) { - _ref.hide(); + var ref; + if ((ref = window.visible_menu) != null) { + ref.hide(); } this.visible = true; return window.visible_menu = this; @@ -1948,17 +1944,21 @@ function clone(obj) { }; Menu.prototype.handleClick = function(e) { - var cb, item, keep_menu, selected, title, _i, _len, _ref; + var cb, i, item, keep_menu, len, ref, selected, title; keep_menu = false; - _ref = this.items; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - item = _ref[_i]; + ref = this.items; + for (i = 0, len = ref.length; i < len; i++) { + item = ref[i]; title = item[0], cb = item[1], selected = item[2]; if (title === e.target.textContent) { keep_menu = cb(item); } } - if (keep_menu !== true) { + if (e.target.type && (e.target.type === "everyone" || e.target.type === "lang" || e.target.type.slice(0, 3) === "hub")) { + this.hide(); + } else if (e.target.value || e.target.title === "") { + this.show(); + } else if (keep_menu !== true) { this.hide(); } return false; @@ -1980,14 +1980,27 @@ function clone(obj) { href = "#" + title; onclick = this.handleClick; } - return h("a.menu-item", { - href: href, - onclick: onclick, - key: title, - classes: { - "selected": selected - } - }, [title]); + if (title === "Show posts after") { + return h("div.show-after", h("a.menu-item", { + href: href, + onclick: onclick, + key: title, + classes: { + "selected": selected + } + }, [title]), h("input#show-after-date", { + placeholder: "unix time" + })); + } else { + return h("a.menu-item", { + href: href, + onclick: onclick, + key: title, + classes: { + "selected": selected + } + }, [title]); + } } }; @@ -2015,7 +2028,7 @@ function clone(obj) { if (!window.visible_menu || !window.visible_menu.node) { return false; } - if (e.target !== window.visible_menu.node.parentNode && e.target.parentNode !== window.visible_menu.node && e.target.parentNode !== window.visible_menu.node.parentNode && e.target.parentNode !== window.visible_menu.node && e.target.parentNode.parentNode !== window.visible_menu.node.parentNode) { + if (e.target !== window.visible_menu.node.parentNode && e.target.parentNode !== window.visible_menu.node && e.target.parentNode !== window.visible_menu.node.parentNode && e.target.parentNode !== window.visible_menu.node && e.target.parentNode.parentNode !== window.visible_menu.node && e.target.parentNode.parentNode !== window.visible_menu.node.parentNode) { window.visible_menu.hide(); return Page.projector.scheduleRender(); } @@ -2024,22 +2037,22 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Overlay.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Overlay.coffee ---- */ (function() { var Overlay, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - Overlay = (function(_super) { - __extends(Overlay, _super); + Overlay = (function(superClass) { + extend(Overlay, superClass); function Overlay() { - this.render = __bind(this.render, this); - this.handleClick = __bind(this.handleClick, this); - this.zoomImageTag = __bind(this.zoomImageTag, this); + this.render = bind(this.render, this); + this.handleClick = bind(this.handleClick, this); + this.zoomImageTag = bind(this.zoomImageTag, this); this.visible = false; this.called = false; this.height = 0; @@ -2142,20 +2155,20 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Scrollwatcher.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Scrollwatcher.coffee ---- */ (function() { var Scrollwatcher, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - Scrollwatcher = (function(_super) { - __extends(Scrollwatcher, _super); + Scrollwatcher = (function(superClass) { + extend(Scrollwatcher, superClass); function Scrollwatcher() { - this.checkScroll = __bind(this.checkScroll, this); + this.checkScroll = bind(this.checkScroll, this); this.log("Scrollwatcher"); this.items = []; window.onscroll = (function(_this) { @@ -2167,24 +2180,24 @@ function clone(obj) { } Scrollwatcher.prototype.checkScroll = function() { - var cb, i, item_top, tag, view_bottom, view_top, _i, _ref, _ref1, _results; + var cb, i, item_top, j, ref, ref1, results, tag, view_bottom, view_top; if (!this.items.length) { return; } view_top = window.scrollY; view_bottom = window.scrollY + window.innerHeight; - _ref = this.items; - _results = []; - for (i = _i = _ref.length - 1; _i >= 0; i = _i += -1) { - _ref1 = _ref[i], item_top = _ref1[0], tag = _ref1[1], cb = _ref1[2]; + ref = this.items; + results = []; + for (i = j = ref.length - 1; j >= 0; i = j += -1) { + ref1 = ref[i], item_top = ref1[0], tag = ref1[1], cb = ref1[2]; if (item_top + 900 > view_top && item_top - 400 < view_bottom) { this.items.splice(i, 1); - _results.push(cb(tag)); + results.push(cb(tag)); } else { - _results.push(void 0); + results.push(void 0); } } - return _results; + return results; }; Scrollwatcher.prototype.add = function(tag, cb) { @@ -2201,18 +2214,18 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Text.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Text.coffee ---- */ (function() { var MarkedRenderer, Text, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty, + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - MarkedRenderer = (function(_super) { - __extends(MarkedRenderer, _super); + MarkedRenderer = (function(superClass) { + extend(MarkedRenderer, superClass); function MarkedRenderer() { return MarkedRenderer.__super__.constructor.apply(this, arguments); @@ -2228,12 +2241,12 @@ function clone(obj) { Text = (function() { function Text() { - this.renderLinks = __bind(this.renderLinks, this); - this.renderMarked = __bind(this.renderMarked, this); + this.renderLinks = bind(this.renderLinks, this); + this.renderMarked = bind(this.renderMarked, this); } Text.prototype.toColor = function(text, saturation, lightness) { - var hash, i, _i, _ref; + var hash, i, j, ref; if (saturation == null) { saturation = 30; } @@ -2241,7 +2254,7 @@ function clone(obj) { lightness = 50; } hash = 0; - for (i = _i = 0, _ref = text.length - 1; 0 <= _ref ? _i <= _ref : _i >= _ref; i = 0 <= _ref ? ++_i : --_i) { + for (i = j = 0, ref = text.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) { hash += text.charCodeAt(i) * i; hash = hash % 1777; } @@ -2285,6 +2298,7 @@ function clone(obj) { if (window.is_proxy) { text = text.replace(/href="http:\/\/(127.0.0.1|localhost):43110/gi, 'href="http://zero'); text = text.replace(/http:\/\/zero\/([^\/]+\.bit)/, "http://$1"); + text = text.replace(/href="\/([A-Za-z0-9]{26,35})/g, 'href="http://zero/$1'); } else { text = text.replace(/href="http:\/\/(127.0.0.1|localhost):43110/g, 'href="'); } @@ -2296,7 +2310,9 @@ function clone(obj) { var back; if (window.is_proxy) { back = link.replace(/http:\/\/(127.0.0.1|localhost):43110/, 'http://zero'); - return back.replace(/http:\/\/zero\/([^\/]+\.bit)/, "http://$1"); + back = back.replace(/http:\/\/zero\/([^\/]+\.bit)/, "http://$1"); + back = back.replace(/\/([A-Za-z0-9]{26,35})/, "http://zero/$1"); + return back; } else { return link.replace(/http:\/\/(127.0.0.1|localhost):43110/, ''); } @@ -2308,7 +2324,7 @@ function clone(obj) { Text.prototype.getSiteUrl = function(address) { if (window.is_proxy) { - if (__indexOf.call(address, ".") >= 0) { + if (indexOf.call(address, ".") >= 0) { return "http://" + address + "/"; } else { return "http://zero/" + address + "/"; @@ -2351,15 +2367,15 @@ function clone(obj) { }; Text.prototype.distance = function(s1, s2) { - var char, extra_parts, key, match, next_find, next_find_i, val, _i, _len; + var char, extra_parts, j, key, len, match, next_find, next_find_i, val; s1 = s1.toLocaleLowerCase(); s2 = s2.toLocaleLowerCase(); next_find_i = 0; next_find = s2[0]; match = true; extra_parts = {}; - for (_i = 0, _len = s1.length; _i < _len; _i++) { - char = s1[_i]; + for (j = 0, len = s1.length; j < len; j++) { + char = s1[j]; if (char !== next_find) { if (extra_parts[next_find_i]) { extra_parts[next_find_i] += char; @@ -2375,13 +2391,13 @@ function clone(obj) { extra_parts[next_find_i] = ""; } extra_parts = (function() { - var _results; - _results = []; + var results; + results = []; for (key in extra_parts) { val = extra_parts[key]; - _results.push(val); + results.push(val); } - return _results; + return results; })(); if (next_find_i >= s2.length) { return extra_parts.length + extra_parts.join("").length; @@ -2391,12 +2407,12 @@ function clone(obj) { }; Text.prototype.queryParse = function(query) { - var key, params, part, parts, val, _i, _len, _ref; + var j, key, len, params, part, parts, ref, val; params = {}; parts = query.split('&'); - for (_i = 0, _len = parts.length; _i < _len; _i++) { - part = parts[_i]; - _ref = part.split("="), key = _ref[0], val = _ref[1]; + for (j = 0, len = parts.length; j < len; j++) { + part = parts[j]; + ref = part.split("="), key = ref[0], val = ref[1]; if (val) { params[decodeURIComponent(key)] = decodeURIComponent(val); } else { @@ -2424,10 +2440,10 @@ function clone(obj) { }; Text.prototype.highlight = function(text, search) { - var back, i, part, parts, _i, _len; + var back, i, j, len, part, parts; parts = text.split(RegExp(search, "i")); back = []; - for (i = _i = 0, _len = parts.length; _i < _len; i = ++_i) { + for (i = j = 0, len = parts.length; j < len; i = ++j) { part = parts[i]; back.push(part); if (i < parts.length - 1) { @@ -2442,13 +2458,13 @@ function clone(obj) { Text.prototype.sqlIn = function(values) { var value; return "(" + ((function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = values.length; _i < _len; _i++) { - value = values[_i]; - _results.push("'" + value + "'"); + var j, len, results; + results = []; + for (j = 0, len = values.length; j < len; j++) { + value = values[j]; + results.push("'" + value + "'"); } - return _results; + return results; })()).join(',') + ")"; }; @@ -2479,7 +2495,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Time.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Time.coffee ---- */ (function() { @@ -2547,7 +2563,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Translate.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Translate.coffee ---- */ (function() { @@ -2558,25 +2574,25 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/Uploadable.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Uploadable.coffee ---- */ (function() { var Uploadable, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; - - Uploadable = (function(_super) { - __extends(Uploadable, _super); - - function Uploadable(_at_handleSave) { - this.handleSave = _at_handleSave; - this.getPixelData = __bind(this.getPixelData, this); - this.render = __bind(this.render, this); - this.handleUploadClick = __bind(this.handleUploadClick, this); - this.resizeImage = __bind(this.resizeImage, this); - this.storeNode = __bind(this.storeNode, this); + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + Uploadable = (function(superClass) { + extend(Uploadable, superClass); + + function Uploadable(handleSave) { + this.handleSave = handleSave; + this.getPixelData = bind(this.getPixelData, this); + this.render = bind(this.render, this); + this.handleUploadClick = bind(this.handleUploadClick, this); + this.resizeImage = bind(this.resizeImage, this); + this.storeNode = bind(this.storeNode, this); this.node = null; this.resize_width = 50; this.resize_height = 50; @@ -2607,11 +2623,11 @@ function clone(obj) { image = new Image(); image.onload = (function(_this) { return function() { - var canvas, canvas_quant, ctx, image_base64uri, optimizer, quant, _ref; + var canvas, canvas_quant, ctx, image_base64uri, optimizer, quant, ref; _this.log("Resize image loaded"); canvas = document.createElement("canvas"); if (_this.preverse_ratio) { - _ref = _this.image_preview.calcSize(image.width, image.height, width, height), canvas.width = _ref[0], canvas.height = _ref[1]; + ref = _this.image_preview.calcSize(image.width, image.height, width, height), canvas.width = ref[0], canvas.height = ref[1]; } else { canvas.width = width; canvas.height = height; @@ -2695,12 +2711,12 @@ function clone(obj) { }; Uploadable.prototype.getPixelData = function(data) { - var b, color_db, colors, colors_next_id, g, hex, i, pixels, r, _i, _ref; + var b, color_db, colors, colors_next_id, g, hex, i, j, pixels, r, ref; color_db = {}; colors = []; colors_next_id = 0; pixels = []; - for (i = _i = 0, _ref = data.length - 1; _i <= _ref; i = _i += 4) { + for (i = j = 0, ref = data.length - 1; j <= ref; i = j += 4) { r = data[i]; g = data[i + 1]; b = data[i + 2]; @@ -2727,11 +2743,11 @@ function clone(obj) { image.src = image_base64uri; return image.onload = (function(_this) { return function() { - var back, canvas, ctx, image_data, image_height, image_width, pixeldata, quant, _ref; + var back, canvas, ctx, image_data, image_height, image_width, pixeldata, quant, ref; image_width = image.width; image_height = image.height; canvas = document.createElement("canvas"); - _ref = _this.image_preview.calcSize(image.width, image.height, target_width, target_height), canvas.width = _ref[0], canvas.height = _ref[1]; + ref = _this.image_preview.calcSize(image.width, image.height, target_width, target_height), canvas.width = ref[0], canvas.height = ref[1]; ctx = canvas.getContext("2d"); ctx.fillStyle = "#FFF"; ctx.fillRect(0, 0, canvas.width, canvas.height); @@ -2765,23 +2781,23 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/utils/ZeroFrame.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/ZeroFrame.coffee ---- */ (function() { var ZeroFrame, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - ZeroFrame = (function(_super) { - __extends(ZeroFrame, _super); + ZeroFrame = (function(superClass) { + extend(ZeroFrame, superClass); function ZeroFrame(url) { - this.onCloseWebsocket = __bind(this.onCloseWebsocket, this); - this.onOpenWebsocket = __bind(this.onOpenWebsocket, this); - this.onRequest = __bind(this.onRequest, this); - this.onMessage = __bind(this.onMessage, this); + this.onCloseWebsocket = bind(this.onCloseWebsocket, this); + this.onOpenWebsocket = bind(this.onOpenWebsocket, this); + this.onRequest = bind(this.onRequest, this); + this.onMessage = bind(this.onMessage, this); this.url = url; this.waiting_cb = {}; this.history_state = {}; @@ -2919,23 +2935,23 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/ActivityList.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ActivityList.coffee ---- */ (function() { var ActivityList, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - ActivityList = (function(_super) { - __extends(ActivityList, _super); + ActivityList = (function(superClass) { + extend(ActivityList, superClass); function ActivityList() { - this.update = __bind(this.update, this); - this.render = __bind(this.render, this); - this.handleMoreClick = __bind(this.handleMoreClick, this); + this.update = bind(this.update, this); + this.render = bind(this.render, this); + this.handleMoreClick = bind(this.handleMoreClick, this); this.activities = null; this.directories = []; this.need_update = true; @@ -2943,20 +2959,50 @@ function clone(obj) { this.found = 0; this.loading = true; this.update_timer = null; + this.filter_hub = null; + this.filter_language_ids = null; + this.show_after_date = 1471946844; } ActivityList.prototype.queryActivities = function(cb) { var query, where; - if (this.directories === "all") { - where = "WHERE date_added > " + (Time.timestamp() - 60 * 60 * 24 * 2) + " AND date_added < " + (Time.timestamp() + 120) + " "; + if (this.filter_language_ids) { + where = "WHERE (comment_id, json_id) IN " + this.filter_language_ids + " AND date_added < " + (Time.timestamp() + 120) + " "; + } else if (this.directories === "all") { + if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + where = "WHERE date_added < " + (Time.timestamp() + 120) + " "; + } else { + where = "WHERE date_added > " + (Time.timestamp() - 60 * 60 * 24 * 2) + " AND date_added < " + (Time.timestamp() + 120) + " "; + } + } else if (this.directories === "hub") { + where = "WHERE json.hub = '" + this.filter_hub + "' AND date_added < " + (Time.timestamp() + 120) + " "; } else { where = "WHERE json.directory IN " + (Text.sqlIn(this.directories)) + " AND date_added < " + (Time.timestamp() + 120) + " "; } - query = "SELECT\n 'comment' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n json\nLEFT JOIN comment USING (json_id)\n " + where + "\n\nUNION ALL\n\nSELECT\n 'post_like' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, '' AS body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n json\nLEFT JOIN post_like USING (json_id)\n " + where; + if (Page.local_storage.settings.show_after) { + if (document.getElementById("show-after-date")) { + this.show_after_date = document.getElementById("show-after-date").value - 121; + } + where += "AND date_added > " + String(this.show_after_date) + " "; + } + if (Page.local_storage.settings.show_one_day_ago) { + where += "AND date_added > strftime('%s', 'now') - 3600*24 "; + } + if (Page.local_storage.settings.show_one_month_ago) { + where += "AND date_added > strftime('%s', 'now') - 3600*24*30 "; + } + query = "SELECT\n 'comment' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n comment\nLEFT JOIN json USING (json_id)\n " + where; + if (!this.filter_language_ids) { + query += "\nUNION ALL\n\nSELECT\n 'post_like' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, '' AS body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n json\nLEFT JOIN post_like USING (json_id)\n " + where; + } if (this.directories !== "all") { - query += "UNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; + query += "\nUNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; + } + if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + query += "\nORDER BY date_added ASC\nLIMIT " + (this.limit + 1); + } else { + query += "\nORDER BY date_added DESC\nLIMIT " + (this.limit + 1); } - query += "\nORDER BY date_added DESC\nLIMIT " + (this.limit + 1); this.logStart("Update"); return Page.cmd("dbQuery", [ query, { @@ -2964,27 +3010,27 @@ function clone(obj) { } ], (function(_this) { return function(rows) { - var directories, directory, row, subject_address, _i, _len; + var directories, directory, i, len, row, subject_address; directories = []; rows = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = rows.length; _i < _len; _i++) { - row = rows[_i]; + var i, len, results; + results = []; + for (i = 0, len = rows.length; i < len; i++) { + row = rows[i]; if (row.subject) { - _results.push(row); + results.push(row); } } - return _results; + return results; })(); - for (_i = 0, _len = rows.length; _i < _len; _i++) { - row = rows[_i]; + for (i = 0, len = rows.length; i < len; i++) { + row = rows[i]; row.auth_address = row.directory.replace("data/users/", ""); subject_address = row.subject.replace(/_.*/, "").replace(/.*\//, ""); row.post_id = row.subject.replace(/.*_/, "").replace(/.*\//, ""); row.subject_address = subject_address; directory = "data/users/" + subject_address; - if (__indexOf.call(directories, directory) < 0) { + if (indexOf.call(directories, directory) < 0) { directories.push(directory); } } @@ -2993,35 +3039,35 @@ function clone(obj) { directory: directories } ], function(subject_rows) { - var last_row, row_group, row_groups, subject_db, subject_row, _base, _base1, _base2, _j, _k, _l, _len1, _len2, _len3, _ref; + var base, base1, base2, j, k, l, last_row, len1, len2, len3, ref, row_group, row_groups, subject_db, subject_row; subject_db = {}; - for (_j = 0, _len1 = subject_rows.length; _j < _len1; _j++) { - subject_row = subject_rows[_j]; + for (j = 0, len1 = subject_rows.length; j < len1; j++) { + subject_row = subject_rows[j]; subject_row.auth_address = subject_row.directory.replace("data/users/", ""); subject_db[subject_row.auth_address] = subject_row; } - for (_k = 0, _len2 = rows.length; _k < _len2; _k++) { - row = rows[_k]; + for (k = 0, len2 = rows.length; k < len2; k++) { + row = rows[k]; row.subject = subject_db[row.subject_address]; if (row.subject == null) { row.subject = {}; } - if ((_base = row.subject).auth_address == null) { - _base.auth_address = row.subject_auth_address; + if ((base = row.subject).auth_address == null) { + base.auth_address = row.subject_auth_address; } - if ((_base1 = row.subject).hub == null) { - _base1.hub = row.subject_hub; + if ((base1 = row.subject).hub == null) { + base1.hub = row.subject_hub; } - if ((_base2 = row.subject).user_name == null) { - _base2.user_name = row.subject_user_name; + if ((base2 = row.subject).user_name == null) { + base2.user_name = row.subject_user_name; } } last_row = null; row_group = []; row_groups = []; - for (_l = 0, _len3 = rows.length; _l < _len3; _l++) { - row = rows[_l]; - if (!last_row || (row.auth_address === (last_row != null ? last_row.auth_address : void 0) && row.type === (last_row != null ? last_row.type : void 0) && ((_ref = row.type) === "post_like" || _ref === "follow"))) { + for (l = 0, len3 = rows.length; l < len3; l++) { + row = rows[l]; + if (!last_row || (row.auth_address === (last_row != null ? last_row.auth_address : void 0) && row.type === (last_row != null ? last_row.type : void 0) && ((ref = row.type) === "post_like" || ref === "follow"))) { row_group.push(row); } else { row_groups.push(row_group); @@ -3047,7 +3093,7 @@ function clone(obj) { }; ActivityList.prototype.renderActivity = function(activity_group) { - var activity, activity_more, activity_user_link, back, body, now, subject_post_link, subject_user_link, title, _i, _j, _len, _len1, _ref, _ref1; + var activity, activity_more, activity_user_link, back, body, i, j, len, len1, now, ref, ref1, subject_post_link, subject_user_link, title; back = []; now = Time.timestamp(); activity = activity_group[0]; @@ -3071,9 +3117,9 @@ function clone(obj) { }, _("post", "like post")) ]; if (activity_group.length > 1) { - _ref = activity_group.slice(1, 11); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - activity_more = _ref[_i]; + ref = activity_group.slice(1, 11); + for (i = 0, len = ref.length; i < len; i++) { + activity_more = ref[i]; subject_user_link = "?Profile/" + activity_more.subject.hub + "/" + activity_more.subject.auth_address + "/" + (activity_more.subject.cert_user_id || ''); subject_post_link = "?Post/" + activity_more.subject.hub + "/" + activity_more.subject.auth_address + "/" + activity_more.post_id; body.push(", "); @@ -3112,9 +3158,9 @@ function clone(obj) { }, activity.subject.user_name) ]; if (activity_group.length > 1) { - _ref1 = activity_group.slice(1, 11); - for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { - activity_more = _ref1[_j]; + ref1 = activity_group.slice(1, 11); + for (j = 0, len1 = ref1.length; j < len1; j++) { + activity_more = ref1[j]; subject_user_link = "?Profile/" + activity_more.subject.hub + "/" + activity_more.subject.auth_address + "/" + (activity_more.subject.cert_user_id || ''); body.push(", "); body.push(h("a.link", { @@ -3193,21 +3239,22 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/AnonUser.coffee ---- */ + +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/AnonUser.coffee ---- */ (function() { var AnonUser, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - AnonUser = (function(_super) { - __extends(AnonUser, _super); + AnonUser = (function(superClass) { + extend(AnonUser, superClass); function AnonUser() { - this.save = __bind(this.save, this); - this.updateInfo = __bind(this.updateInfo, this); + this.save = bind(this.save, this); + this.updateInfo = bind(this.updateInfo, this); this.auth_address = null; this.hub = null; this.followed_users = {}; @@ -3285,27 +3332,28 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/ContentCreateProfile.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentCreateProfile.coffee ---- */ (function() { var ContentCreateProfile, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - ContentCreateProfile = (function(_super) { - __extends(ContentCreateProfile, _super); + ContentCreateProfile = (function(superClass) { + extend(ContentCreateProfile, superClass); function ContentCreateProfile() { - this.update = __bind(this.update, this); - this.render = __bind(this.render, this); - this.renderDefaultHubs = __bind(this.renderDefaultHubs, this); - this.renderSeededHubs = __bind(this.renderSeededHubs, this); - this.renderHub = __bind(this.renderHub, this); - this.updateHubs = __bind(this.updateHubs, this); - this.handleJoinClick = __bind(this.handleJoinClick, this); - this.handleDownloadClick = __bind(this.handleDownloadClick, this); + this.update = bind(this.update, this); + this.render = bind(this.render, this); + this.renderDefaultHubs = bind(this.renderDefaultHubs, this); + this.renderSeededHubs = bind(this.renderSeededHubs, this); + this.renderHub = bind(this.renderHub, this); + this.updateHubs = bind(this.updateHubs, this); + this.joinHub = bind(this.joinHub, this); + this.handleJoinClick = bind(this.handleJoinClick, this); + this.handleDownloadClick = bind(this.handleDownloadClick, this); this.loaded = true; this.hubs = []; this.default_hubs = []; @@ -3327,8 +3375,36 @@ function clone(obj) { }; ContentCreateProfile.prototype.handleJoinClick = function(e) { - var hub, user; - hub = e.target.attributes.address.value; + var hub, hub_address, hub_name, ref, ref1; + hub_address = e.target.attributes.address.value; + if ((ref = Page.user) != null ? ref.hub : void 0) { + hub_name = (ref1 = (function() { + var i, len, ref2, results; + ref2 = this.hubs; + results = []; + for (i = 0, len = ref2.length; i < len; i++) { + hub = ref2[i]; + if (hub.address === Page.user.hub) { + results.push(hub.content.title); + } + } + return results; + }).call(this)) != null ? ref1[0] : void 0; + if (hub_name == null) { + hub_name = Page.user.hub; + } + return Page.cmd("wrapperConfirm", ["You already have profile on hub " + hub_name + ",
    are you sure you want to create a new one?", "Create new profile"], (function(_this) { + return function() { + return _this.joinHub(hub_address); + }; + })(this)); + } else { + return this.joinHub(hub_address); + } + }; + + ContentCreateProfile.prototype.joinHub = function(hub) { + var user; user = new User({ hub: hub, auth_address: Page.site_info.auth_address @@ -3364,14 +3440,14 @@ function clone(obj) { ContentCreateProfile.prototype.updateHubs = function() { return Page.cmd("mergerSiteList", true, (function(_this) { return function(sites) { - var address, content, _ref, _results; + var address, content, ref, results; Page.cmd("dbQuery", "SELECT * FROM json", function(users) { - var address, hubs, site, site_users, user, _i, _len, _name; + var address, hubs, i, len, name, site, site_users, user; site_users = {}; - for (_i = 0, _len = users.length; _i < _len; _i++) { - user = users[_i]; - if (site_users[_name = user.hub] == null) { - site_users[_name] = []; + for (i = 0, len = users.length; i < len; i++) { + user = users[i]; + if (site_users[name = user.hub] == null) { + site_users[name] = []; } site_users[user.hub].push(user); } @@ -3388,22 +3464,22 @@ function clone(obj) { return Page.projector.scheduleRender(); }); _this.default_hubs = []; - _ref = Page.site_info.content.settings.default_hubs; - _results = []; - for (address in _ref) { - content = _ref[address]; + ref = Page.site_info.content.settings.default_hubs; + results = []; + for (address in ref) { + content = ref[address]; if (!sites[address] && !_this.downloading[address]) { - _results.push(_this.default_hubs.push({ + results.push(_this.default_hubs.push({ users: [], address: address, content: content, type: "available" })); } else { - _results.push(void 0); + results.push(void 0); } } - return _results; + return results; }; })(this)); }; @@ -3427,8 +3503,8 @@ function clone(obj) { }, "Join!"), h("div.avatars", [ hub.users.map((function(_this) { return function(user) { - var avatar, _ref; - if (((_ref = user.avatar) !== "jpg" && _ref !== "png") || rendered >= 4) { + var avatar, ref; + if (((ref = user.avatar) !== "jpg" && ref !== "png") || rendered >= 4) { return ""; } avatar = "merged-ZeroMe/" + hub.address + "/" + user.directory + "/avatar." + user.avatar; @@ -3461,7 +3537,7 @@ function clone(obj) { }; ContentCreateProfile.prototype.render = function() { - var _ref; + var ref; if (this.loaded && !Page.on_loaded.resolved) { Page.on_loaded.resolve(); } @@ -3473,7 +3549,7 @@ function clone(obj) { h("h1", "Create new profile"), h("a.button.button-submit.button-certselect.certselect", { href: "#Select+user", onclick: this.handleSelectUserClick - }, [h("div.icon.icon-profile"), ((_ref = Page.site_info) != null ? _ref.cert_user_id : void 0) ? "As: " + Page.site_info.cert_user_id : "Select ID..."]), this.creation_status.length > 0 ? h("div.creation-status", { + }, [h("div.icon.icon-profile"), ((ref = Page.site_info) != null ? ref.cert_user_id : void 0) ? "As: " + Page.site_info.cert_user_id : "Select ID..."]), this.creation_status.length > 0 ? h("div.creation-status", { enterAnimation: Animation.slideDown, exitAnimation: Animation.slideUp }, [ @@ -3515,42 +3591,219 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/ContentFeed.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentFeed.coffee ---- */ (function() { var ContentFeed, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - ContentFeed = (function(_super) { - __extends(ContentFeed, _super); + ContentFeed = (function(superClass) { + extend(ContentFeed, superClass); function ContentFeed() { - this.update = __bind(this.update, this); - this.render = __bind(this.render, this); - this.handleListTypeClick = __bind(this.handleListTypeClick, this); + this.update = bind(this.update, this); + this.render = bind(this.render, this); + this.queryLanguageIds = bind(this.queryLanguageIds, this); + this.handleFiltersClick = bind(this.handleFiltersClick, this); + this.renderFilterLanguage = bind(this.renderFilterLanguage, this); + this.handleLanguageClick = bind(this.handleLanguageClick, this); + this.handleHubsClick = bind(this.handleHubsClick, this); + this.renderHubsMenu = bind(this.renderHubsMenu, this); + this.handleListTypeClick = bind(this.handleListTypeClick, this); this.post_create = new PostCreate(); this.post_list = new PostList(); this.activity_list = new ActivityList(); this.new_user_list = new UserList("new"); this.suggested_user_list = new UserList("suggested"); + this.hubs = new Menu(); + this.lang_filter = new Menu(); + this.filter_lang_list = {}; this.need_update = true; this.type = "followed"; this.update(); + this.language_dict = { + "English": /[\u0041-\u007A]/, + "Latin-1": /[\u00C0-\u00FF]/, + "Greek": /[\u0391-\u03C9]/, + "Cyrillic": /[\u0410-\u044F]/, + "Armenian": /[\u0531-\u0586]/, + "Hebrew": /[\u05D0-\u05EA]/, + "Arabic": /[\u0620-\u06D5]/, + "Devanagari": /[\u0904-\u097F]/, + "Kana": /[\u3041-\u30FA]/, + "ZH-JA-KO": /[\u4E00-\u9FEA]/, + "Hangul": /[\uAC00-\uD7A3]/, + "Emoji": /[\ud83C-\ud83E][\uDC00-\uDDEF]/ + }; } ContentFeed.prototype.handleListTypeClick = function(e) { this.type = e.currentTarget.attributes.type.value; + if (this.type === "everyone") { + this.filter_lang_list = {}; + } this.post_list.limit = 10; this.activity_list.limit = 10; this.update(); return false; }; + ContentFeed.prototype.renderHubsMenu = function(hub_title, address) { + return h("a.link", { + href: "#" + hub_title, + onclick: this.handleListTypeClick, + type: "hub" + "_" + address, + classes: { + active: this.type === "hub" + "_" + address + } + }, hub_title); + }; + + ContentFeed.prototype.handleHubsClick = function() { + this.hubs.items = []; + Page.cmd("mergerSiteList", true, (function(_this) { + return function(sites) { + var address, site; + for (address in sites) { + site = sites[address]; + if (address === Page.userdb) { + continue; + } + _this.hubs.items.push([_this.renderHubsMenu(site.content.title, address), null]); + } + return _this.hubs.toggle(); + }; + })(this)); + return false; + }; + + ContentFeed.prototype.handleLanguageClick = function(e) { + var value; + value = e.currentTarget.value; + if (this.filter_lang_list[value]) { + delete this.filter_lang_list[value]; + } else { + this.filter_lang_list[value] = true; + } + if (value.slice(0, 7) === "lang-on") { + delete this.filter_lang_list["lang-off" + value.slice(7)]; + } else if (value.slice(0, 8) === "lang-off") { + delete this.filter_lang_list["lang-on" + value.slice(8)]; + } + this.lang_filter.items = []; + this.lang_filter.items.push([this.renderFilterLanguage(), null]); + return false; + }; + + ContentFeed.prototype.renderFilterLanguage = function() { + var lang, langs; + langs = Object.keys(this.language_dict); + return h("div.menu-radio", h("a.all", { + href: "#all", + onclick: this.handleListTypeClick, + type: "everyone", + classes: { + active: this.type === "everyone" + } + }, "Show all"), h("a.filter", { + href: "#filter", + onclick: this.handleListTypeClick, + type: "lang", + classes: { + active: this.type === "lang" + } + }, "Filter"), (function() { + var j, len, results; + results = []; + for (j = 0, len = langs.length; j < len; j++) { + lang = langs[j]; + results.push([ + h("span", h("a.lang-on", { + href: "#" + lang + "_on", + onclick: this.handleLanguageClick, + value: "lang-on" + "_" + lang, + classes: { + selected: this.filter_lang_list["lang-on" + "_" + lang] + } + }, " +"), h("a.lang-off", { + href: "#" + lang + "_off", + onclick: this.handleLanguageClick, + value: "lang-off" + "_" + lang, + classes: { + selected: this.filter_lang_list["lang-off" + "_" + lang] + } + }, "- "), " ", lang) + ]); + } + return results; + }).call(this)); + }; + + ContentFeed.prototype.handleFiltersClick = function() { + this.lang_filter.items = []; + this.lang_filter.items.push([this.renderFilterLanguage(), null]); + if (this.lang_filter.visible) { + this.lang_filter.hide(); + } else { + this.lang_filter.show(); + } + return false; + }; + + ContentFeed.prototype.queryLanguageIds = function(query, lang_list, cb) { + var language_ids; + language_ids = []; + return Page.cmd("dbQuery", [query], (function(_this) { + return function(rows) { + var body_tmp, i, j, k, l, lang_off, lang_on, len, len1, len2, m, matched, ref, ref1, row, start_point; + for (j = 0, len = rows.length; j < len; j++) { + row = rows[j]; + if (row["body"] === null) { + continue; + } + if (row["body"].length > 100) { + body_tmp = ""; + for (i = k = 0; k <= 9; i = ++k) { + start_point = ~~(row["body"].length / 10) * i; + body_tmp += row["body"].slice(start_point, start_point + 9); + } + row["body"] = body_tmp; + } + matched = false; + ref = lang_list["off"]; + for (l = 0, len1 = ref.length; l < len1; l++) { + lang_off = ref[l]; + if (row["body"].match(_this.language_dict[lang_off])) { + matched = true; + break; + } + if (lang_off === lang_list["off"].slice(-1)[0]) { + if (lang_list["on"].length === 0) { + language_ids.push([row["item_id"], row["json_id"]]); + } + } + } + if (!matched) { + ref1 = lang_list["on"]; + for (m = 0, len2 = ref1.length; m < len2; m++) { + lang_on = ref1[m]; + if (row["body"].match(_this.language_dict[lang_on])) { + language_ids.push([row["item_id"], row["json_id"]]); + break; + } + } + } + } + return cb(language_ids); + }; + })(this)); + }; + ContentFeed.prototype.render = function() { - var followed, key, like, _; + var _, followed, j, key, lang, lang_list, len, like, query, ref; if (this.post_list.loaded && !Page.on_loaded.resolved) { Page.on_loaded.resolve(); } @@ -3559,73 +3812,131 @@ function clone(obj) { this.need_update = false; this.new_user_list.need_update = true; this.suggested_user_list.need_update = true; + this.post_list.filter_post_ids = null; + this.post_list.filter_hub = null; + this.post_list.filter_language_ids = null; + this.post_list.directories = "all"; + this.activity_list.filter_hub = null; + this.activity_list.filter_language_ids = null; + this.activity_list.directories = "all"; if (this.type === "followed") { this.post_list.directories = (function() { - var _ref, _results; - _ref = Page.user.followed_users; - _results = []; - for (key in _ref) { - followed = _ref[key]; - _results.push("data/users/" + (key.split('/')[1])); + var ref, results; + ref = Page.user.followed_users; + results = []; + for (key in ref) { + followed = ref[key]; + results.push("data/users/" + (key.split('/')[1])); } - return _results; + return results; })(); if (Page.user.hub) { this.post_list.directories.push("data/users/" + Page.user.auth_address); } - this.post_list.filter_post_ids = null; } else if (this.type === "liked") { this.post_list.directories = (function() { - var _ref, _results; - _ref = Page.user.likes; - _results = []; - for (like in _ref) { - _ = _ref[like]; - _results.push("data/users/" + (like.split('_')[0])); + var ref, results; + ref = Page.user.likes; + results = []; + for (like in ref) { + _ = ref[like]; + results.push("data/users/" + (like.split('_')[0])); } - return _results; + return results; })(); this.post_list.filter_post_ids = (function() { - var _ref, _results; - _ref = Page.user.likes; - _results = []; - for (like in _ref) { - _ = _ref[like]; - _results.push(like.split('_')[1]); + var ref, results; + ref = Page.user.likes; + results = []; + for (like in ref) { + _ = ref[like]; + results.push(like.split('_')[1]); } - return _results; + return results; })(); - } else { - this.post_list.directories = "all"; - this.post_list.filter_post_ids = null; + } else if (this.type.slice(0, 3) === "hub") { + this.post_list.filter_hub = this.type.slice(4); + } else if (this.type === "lang") { + lang_list = { + "on": [], + "off": [] + }; + ref = Object.keys(this.filter_lang_list); + for (j = 0, len = ref.length; j < len; j++) { + lang = ref[j]; + if (lang.slice(0, 7) === "lang-on") { + lang_list["on"].push(lang.slice(8)); + } else { + lang_list["off"].push(lang.slice(9)); + } + } + query = "SELECT post_id AS item_id, post.json_id, post.body FROM post"; + this.queryLanguageIds(query, lang_list, (function(_this) { + return function(language_ids) { + var id_pair; + _this.post_list.filter_language_ids = "(VALUES " + ((function() { + var k, len1, results; + results = []; + for (k = 0, len1 = language_ids.length; k < len1; k++) { + id_pair = language_ids[k]; + results.push("(" + id_pair[0] + "," + id_pair[1] + ")"); + } + return results; + })()).join(',') + ")"; + return _this.post_list.need_update = true; + }; + })(this)); + } + if (this.type.slice(0, 4) !== "lang") { + this.post_list.need_update = true; } - this.post_list.need_update = true; if (this.type === "followed") { this.activity_list.directories = (function() { - var _ref, _results; - _ref = Page.user.followed_users; - _results = []; - for (key in _ref) { - followed = _ref[key]; - _results.push("data/users/" + (key.split('/')[1])); + var ref1, results; + ref1 = Page.user.followed_users; + results = []; + for (key in ref1) { + followed = ref1[key]; + results.push("data/users/" + (key.split('/')[1])); } - return _results; + return results; })(); - } else { - this.activity_list.directories = "all"; + } else if (this.type.slice(0, 3) === "hub") { + this.activity_list.directories = "hub"; + this.activity_list.filter_hub = this.type.slice(4); + } else if (this.type === "lang") { + query = "SELECT comment_id AS item_id, comment.json_id, comment.body FROM comment"; + this.queryLanguageIds(query, lang_list, (function(_this) { + return function(language_ids) { + var id_pair; + _this.activity_list.filter_language_ids = "(VALUES " + ((function() { + var k, len1, results; + results = []; + for (k = 0, len1 = language_ids.length; k < len1; k++) { + id_pair = language_ids[k]; + results.push("(" + id_pair[0] + "," + id_pair[1] + ")"); + } + return results; + })()).join(',') + ")"; + return _this.activity_list.update(); + }; + })(this)); + } + if (this.type.slice(0, 4) !== "lang") { + this.activity_list.update(); } - this.activity_list.update(); } return h("div#Content.center", [ h("div.col-center", [ - this.post_create.render(), h("div.post-list-type", h("a.link", { - href: "#Everyone", - onclick: this.handleListTypeClick, - type: "everyone", - classes: { - active: this.type === "everyone" - } - }, "Everyone"), h("a.link", { + this.post_create.render(), h("div.post-list-type", h("div.hub-menu", h("a.link", { + href: "#Hubs", + onmousedown: this.handleHubsClick, + onclick: Page.returnFalse + }, "Hubs"), this.hubs.render()), h("div.filters-menu", h("a.link", { + href: "#Filters", + onmousedown: this.handleFiltersClick, + onclick: Page.returnFalse + }, "Everyone"), this.lang_filter.render()), h("a.link", { href: "#Liked", onclick: this.handleListTypeClick, type: "liked", @@ -3665,7 +3976,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/ContentProfile.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentProfile.coffee ---- */ (function() { @@ -3988,25 +4299,25 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/ContentUsers.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentUsers.coffee ---- */ (function() { var ContentUsers, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - ContentUsers = (function(_super) { - __extends(ContentUsers, _super); + ContentUsers = (function(superClass) { + extend(ContentUsers, superClass); function ContentUsers() { - this.update = __bind(this.update, this); - this.render = __bind(this.render, this); - this.handleSearchInput = __bind(this.handleSearchInput, this); - this.handleRecentMoreClick = __bind(this.handleRecentMoreClick, this); - this.handleActiveMoreClick = __bind(this.handleActiveMoreClick, this); - this.handleSuggestedMoreClick = __bind(this.handleSuggestedMoreClick, this); + this.update = bind(this.update, this); + this.render = bind(this.render, this); + this.handleSearchInput = bind(this.handleSearchInput, this); + this.handleRecentMoreClick = bind(this.handleRecentMoreClick, this); + this.handleActiveMoreClick = bind(this.handleActiveMoreClick, this); + this.handleSuggestedMoreClick = bind(this.handleSuggestedMoreClick, this); this.user_list_suggested = new UserList("suggested"); this.user_list_suggested.limit = 9; this.user_list_active = new UserList("active"); @@ -4069,7 +4380,7 @@ function clone(obj) { }; ContentUsers.prototype.render = function() { - var _ref, _ref1, _ref2; + var ref, ref1, ref2; if (this.loaded && !Page.on_loaded.resolved) { Page.on_loaded.resolve(); } @@ -4084,15 +4395,15 @@ function clone(obj) { if (this.need_update) { this.log("Updating"); this.need_update = false; - if ((_ref = this.user_list_recent) != null) { - _ref.need_update = true; + if ((ref = this.user_list_recent) != null) { + ref.need_update = true; } - if ((_ref1 = this.user_list_active) != null) { - _ref1.need_update = true; + if ((ref1 = this.user_list_active) != null) { + ref1.need_update = true; } if (Page.user.auth_address) { - if ((_ref2 = this.user_list_suggested) != null) { - _ref2.need_update = true; + if ((ref2 = this.user_list_suggested) != null) { + ref2.need_update = true; } } } @@ -4141,30 +4452,30 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/Head.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/Head.coffee ---- */ (function() { var Head, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - Head = (function(_super) { - __extends(Head, _super); + Head = (function(superClass) { + extend(Head, superClass); function Head() { - this.render = __bind(this.render, this); - this.saveFollows = __bind(this.saveFollows, this); - this.handleMenuClick = __bind(this.handleMenuClick, this); - this.handleFollowMenuItemClick = __bind(this.handleFollowMenuItemClick, this); + this.render = bind(this.render, this); + this.saveFollows = bind(this.saveFollows, this); + this.handleMenuClick = bind(this.handleMenuClick, this); + this.handleFollowMenuItemClick = bind(this.handleFollowMenuItemClick, this); this.menu = new Menu(); this.follows = []; } Head.prototype.handleSelectUserClick = function() { - if (__indexOf.call(Page.site_info.settings.permissions, "Merger:ZeroMe") < 0) { + if (indexOf.call(Page.site_info.settings.permissions, "Merger:ZeroMe") < 0) { Page.cmd("wrapperPermissionAdd", "Merger:ZeroMe", (function(_this) { return function() { return Page.updateSiteInfo(function() { @@ -4192,13 +4503,14 @@ function clone(obj) { }; Head.prototype.handleMenuClick = function() { - var _ref; - if (!((_ref = Page.site_info) != null ? _ref.cert_user_id : void 0)) { + var ref; + if (!((ref = Page.site_info) != null ? ref.cert_user_id : void 0)) { return this.handleSelectUserClick(); } Page.cmd("feedListFollow", [], (function(_this) { - return function(_at_follows) { - _this.follows = _at_follows; + return function(follows) { + var fn, key, ref1, val; + _this.follows = follows; _this.menu.items = []; _this.menu.items.push([ "Follow username mentions", (function(item) { @@ -4225,6 +4537,71 @@ function clone(obj) { return false; }), Page.local_storage.settings.hide_hello_zerome ]); + _this.menu.items.push(["---"]); + _this.menu.items.push([ + "Show posts after", (function(item) { + Page.local_storage.settings.show_after = !Page.local_storage.settings.show_after; + item[2] = Page.local_storage.settings.show_after; + Page.projector.scheduleRender(); + Page.saveLocalStorage(); + Page.content.need_update = true; + return false; + }), Page.local_storage.settings.show_after + ]); + _this.menu.items.push([ + "Show posts chronologically", (function(item) { + Page.local_storage.settings.sort_chronologically = !Page.local_storage.settings.sort_chronologically; + item[2] = Page.local_storage.settings.sort_chronologically; + Page.projector.scheduleRender(); + Page.saveLocalStorage(); + Page.content.need_update = true; + return false; + }), Page.local_storage.settings.sort_chronologically + ]); + _this.menu.items.push([ + "Show posts since one day ago", (function(item) { + Page.local_storage.settings.show_one_day_ago = !Page.local_storage.settings.show_one_day_ago; + item[2] = Page.local_storage.settings.show_one_day_ago; + Page.projector.scheduleRender(); + Page.saveLocalStorage(); + Page.content.need_update = true; + return false; + }), Page.local_storage.settings.show_one_day_ago + ]); + _this.menu.items.push([ + "Show posts since one month ago", (function(item) { + Page.local_storage.settings.show_one_month_ago = !Page.local_storage.settings.show_month_day_ago; + item[2] = Page.local_storage.settings.show_one_month_ago; + Page.projector.scheduleRender(); + Page.saveLocalStorage(); + Page.content.need_update = true; + return false; + }), Page.local_storage.settings.show_one_month_ago + ]); + if (((function() { + var results; + results = []; + for (key in Page.user_hubs) { + results.push(key); + } + return results; + })()).length > 1) { + _this.menu.items.push(["---"]); + ref1 = Page.user_hubs; + fn = function(key) { + return _this.menu.items.push([ + "Use hub " + key, (function(item) { + Page.local_storage.settings.hub = key; + Page.saveLocalStorage(); + return Page.checkUser(); + }), Page.user.row.site === key + ]); + }; + for (key in ref1) { + val = ref1[key]; + fn(key); + } + } _this.menu.toggle(); return Page.projector.scheduleRender(); }; @@ -4248,7 +4625,7 @@ function clone(obj) { }; Head.prototype.render = function() { - var _ref, _ref1, _ref2, _ref3; + var ref, ref1, ref2, ref3; return h("div.head.center", [ h("a.logo", { href: "?Home", @@ -4257,7 +4634,7 @@ function clone(obj) { src: "img/logo.svg", height: 40, onerror: "this.src='img/logo.png'; this.onerror=null;" - })), ((_ref = Page.user) != null ? _ref.hub : void 0) ? h("div.right.authenticated", [ + })), ((ref = Page.user) != null ? ref.hub : void 0) ? h("div.right.authenticated", [ h("div.user", h("a.name.link", { href: Page.user.getLink(), onclick: Page.handleLinkClick @@ -4269,7 +4646,7 @@ function clone(obj) { onclick: Page.returnFalse, onmousedown: this.handleMenuClick }, "\u22EE"), this.menu.render() - ]) : !((_ref1 = Page.user) != null ? _ref1.hub : void 0) && ((_ref2 = Page.site_info) != null ? _ref2.cert_user_id : void 0) ? h("div.right.selected", [ + ]) : !((ref1 = Page.user) != null ? ref1.hub : void 0) && ((ref2 = Page.site_info) != null ? ref2.cert_user_id : void 0) ? h("div.right.selected", [ h("div.user", h("a.name.link", { href: "?Create+profile", onclick: Page.handleLinkClick @@ -4281,7 +4658,7 @@ function clone(obj) { onclick: Page.returnFalse, onmousedown: this.handleMenuClick }, "\u22EE") - ]) : !((_ref3 = Page.user) != null ? _ref3.hub : void 0) && Page.site_info ? h("div.right.unknown", [ + ]) : !((ref3 = Page.user) != null ? ref3.hub : void 0) && Page.site_info ? h("div.right.unknown", [ h("div.user", h("a.name.link", { href: "#Select+user", onclick: this.handleSelectUserClick @@ -4306,36 +4683,36 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/Post.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/Post.coffee ---- */ (function() { var Post, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty, - __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; - - Post = (function(_super) { - __extends(Post, _super); - - function Post(row, _at_item_list) { - this.item_list = _at_item_list; - this.render = __bind(this.render, this); - this.renderComments = __bind(this.renderComments, this); - this.follow = __bind(this.follow, this); - this.unfollow = __bind(this.unfollow, this); - this.handleSettingsClick = __bind(this.handleSettingsClick, this); - this.getPostUri = __bind(this.getPostUri, this); - this.handleReplyClick = __bind(this.handleReplyClick, this); - this.handleMoreCommentsClick = __bind(this.handleMoreCommentsClick, this); - this.handleCommentDelete = __bind(this.handleCommentDelete, this); - this.handleCommentSave = __bind(this.handleCommentSave, this); - this.handleCommentSubmit = __bind(this.handleCommentSubmit, this); - this.handleCommentClick = __bind(this.handleCommentClick, this); - this.handleLikeClick = __bind(this.handleLikeClick, this); - this.handlePostDelete = __bind(this.handlePostDelete, this); - this.handlePostSave = __bind(this.handlePostSave, this); + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty, + indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; + + Post = (function(superClass) { + extend(Post, superClass); + + function Post(row, item_list) { + this.item_list = item_list; + this.render = bind(this.render, this); + this.renderComments = bind(this.renderComments, this); + this.follow = bind(this.follow, this); + this.unfollow = bind(this.unfollow, this); + this.handleSettingsClick = bind(this.handleSettingsClick, this); + this.getPostUri = bind(this.getPostUri, this); + this.handleReplyClick = bind(this.handleReplyClick, this); + this.handleMoreCommentsClick = bind(this.handleMoreCommentsClick, this); + this.handleCommentDelete = bind(this.handleCommentDelete, this); + this.handleCommentSave = bind(this.handleCommentSave, this); + this.handleCommentSubmit = bind(this.handleCommentSubmit, this); + this.handleCommentClick = bind(this.handleCommentClick, this); + this.handleLikeClick = bind(this.handleLikeClick, this); + this.handlePostDelete = bind(this.handlePostDelete, this); + this.handlePostSave = bind(this.handlePostSave, this); this.liked = false; this.commenting = false; this.submitting_like = false; @@ -4353,7 +4730,7 @@ function clone(obj) { } Post.prototype.setRow = function(row) { - var _ref; + var ref; this.row = row; if (this.row.meta) { this.meta = new PostMeta(this, JSON.parse(this.row.meta)); @@ -4366,7 +4743,7 @@ function clone(obj) { auth_address: row.directory.replace("data/users/", "") }); this.user.row = row; - this.owned = this.user.auth_address === ((_ref = Page.user) != null ? _ref.auth_address : void 0); + this.owned = this.user.auth_address === ((ref = Page.user) != null ? ref.auth_address : void 0); if (this.owned) { this.editable_body = new Editable("div.body", this.handlePostSave, this.handlePostDelete); this.editable_body.render_function = Text.renderMarked; @@ -4381,10 +4758,10 @@ function clone(obj) { Post.prototype.handlePostSave = function(body, cb) { return Page.user.getData(Page.user.hub, (function(_this) { return function(data) { - var i, post, post_index, _i, _len, _ref; - _ref = data.post; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - post = _ref[i]; + var i, j, len, post, post_index, ref; + ref = data.post; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + post = ref[i]; if (post.post_id === _this.row.post_id) { post_index = i; } @@ -4400,16 +4777,16 @@ function clone(obj) { Post.prototype.handlePostDelete = function(cb) { return Page.user.getData(Page.user.hub, (function(_this) { return function(data) { - var i, post, post_index, _i, _len, _ref, _ref1, _ref2; - _ref = data.post; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - post = _ref[i]; + var i, j, len, post, post_index, ref, ref1, ref2; + ref = data.post; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + post = ref[i]; if (post.post_id === _this.row.post_id) { post_index = i; } } data.post.splice(post_index, 1); - if ((_ref1 = _this.meta) != null ? (_ref2 = _ref1.meta) != null ? _ref2.img : void 0 : void 0) { + if ((ref1 = _this.meta) != null ? (ref2 = ref1.meta) != null ? ref2.img : void 0 : void 0) { return Page.cmd("fileDelete", (_this.user.getPath()) + "/" + _this.row.post_id + ".jpg", function() { return Page.user.save(data, Page.user.hub, function(res) { return cb(res); @@ -4425,9 +4802,9 @@ function clone(obj) { }; Post.prototype.handleLikeClick = function(e) { - var post_uri, site, _ref; + var post_uri, ref, site; this.submitting_like = true; - _ref = this.row.key.split("-"), site = _ref[0], post_uri = _ref[1]; + ref = this.row.key.split("-"), site = ref[0], post_uri = ref[1]; if (Page.user.likes[post_uri]) { Animation.flashOut(e.currentTarget.firstChild); Page.user.dislike(site, post_uri, (function(_this) { @@ -4463,13 +4840,13 @@ function clone(obj) { }; Post.prototype.handleCommentSubmit = function() { - var post_uri, site, timer_loading, _ref; + var post_uri, ref, site, timer_loading; timer_loading = setTimeout(((function(_this) { return function() { return _this.field_comment.loading = true; }; })(this)), 100); - _ref = this.row.key.split("-"), site = _ref[0], post_uri = _ref[1]; + ref = this.row.key.split("-"), site = ref[0], post_uri = ref[1]; return Page.user.comment(site, post_uri, this.field_comment.attrs.value, (function(_this) { return function(res) { clearInterval(timer_loading); @@ -4485,10 +4862,10 @@ function clone(obj) { Post.prototype.handleCommentSave = function(comment_id, body, cb) { return Page.user.getData(this.row.site, (function(_this) { return function(data) { - var comment, comment_index, i, _i, _len, _ref; - _ref = data.comment; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - comment = _ref[i]; + var comment, comment_index, i, j, len, ref; + ref = data.comment; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + comment = ref[i]; if (comment.comment_id === comment_id) { comment_index = i; } @@ -4504,10 +4881,10 @@ function clone(obj) { Post.prototype.handleCommentDelete = function(comment_id, cb) { return Page.user.getData(this.row.site, (function(_this) { return function(data) { - var comment, comment_index, i, _i, _len, _ref; - _ref = data.comment; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - comment = _ref[i]; + var comment, comment_index, i, j, len, ref; + ref = data.comment; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + comment = ref[i]; if (comment.comment_id === comment_id) { comment_index = i; } @@ -4539,9 +4916,9 @@ function clone(obj) { }; Post.prototype.getEditableComment = function(comment_uri) { - var comment_id, handleCommentDelete, handleCommentSave, user_address, _ref; + var comment_id, handleCommentDelete, handleCommentSave, ref, user_address; if (!this.editable_comments[comment_uri]) { - _ref = comment_uri.split("_"), user_address = _ref[0], comment_id = _ref[1]; + ref = comment_uri.split("_"), user_address = ref[0], comment_id = ref[1]; handleCommentSave = (function(_this) { return function(body, cb) { return _this.handleCommentSave(parseInt(comment_id), body, cb); @@ -4566,11 +4943,11 @@ function clone(obj) { this.css_style = "z-index: " + this.row.date_added + "; position: relative"; Page.cmd("feedListFollow", [], (function(_this) { return function(follows) { - var followed, _ref; + var followed, ref; if (!_this.menu) { _this.menu = new Menu(); } - followed = follows["Post follow"] && (_ref = _this.getPostUri(), __indexOf.call(follows["Post follow"][1], _ref) >= 0); + followed = follows["Post follow"] && (ref = _this.getPostUri(), indexOf.call(follows["Post follow"][1], ref) >= 0); _this.menu.items = []; _this.menu.items.push([ "Follow in newsfeed", (function() { @@ -4626,7 +5003,7 @@ function clone(obj) { }; Post.prototype.renderComments = function() { - var comment_limit, _ref, _ref1; + var comment_limit, ref, ref1; if (!this.row.comments && !this.commenting) { return []; } @@ -4643,12 +5020,12 @@ function clone(obj) { }, [ this.commenting ? h("div.comment-create", { enterAnimation: Animation.slideDown - }, this.field_comment.render()) : void 0, (_ref = this.row.comments) != null ? _ref.slice(0, +(comment_limit - 1) + 1 || 9e9).map((function(_this) { + }, this.field_comment.render()) : void 0, (ref = this.row.comments) != null ? ref.slice(0, +(comment_limit - 1) + 1 || 9e9).map((function(_this) { return function(comment) { - var comment_uri, owned, user_address, user_link, _ref1, _ref2; + var comment_uri, owned, ref1, ref2, user_address, user_link; user_address = comment.directory.replace("data/users/", ""); comment_uri = user_address + "_" + comment.comment_id; - owned = user_address === ((_ref1 = Page.user) != null ? _ref1.auth_address : void 0); + owned = user_address === ((ref1 = Page.user) != null ? ref1.auth_address : void 0); user_link = "?Profile/" + comment.hub + "/" + user_address + "/" + comment.cert_user_id; return h("div.comment", { id: comment_uri, @@ -4672,7 +5049,7 @@ function clone(obj) { onclick: _this.handleReplyClick, user_name: comment.user_name }, "Reply") - ]), owned ? _this.getEditableComment(comment_uri).render(comment.body) : ((_ref2 = comment.body) != null ? _ref2.length : void 0) > 5000 ? h("div.body.maxheight", { + ]), owned ? _this.getEditableComment(comment_uri).render(comment.body) : ((ref2 = comment.body) != null ? ref2.length : void 0) > 5000 ? h("div.body.maxheight", { innerHTML: Text.renderMarked(comment.body), afterCreate: Maxheight.apply }) : h("div.body", { @@ -4680,7 +5057,7 @@ function clone(obj) { }) ]); }; - })(this)) : void 0, ((_ref1 = this.row.comments) != null ? _ref1.length : void 0) > comment_limit ? h("a.more", { + })(this)) : void 0, ((ref1 = this.row.comments) != null ? ref1.length : void 0) > comment_limit ? h("a.more", { href: "#More", onclick: this.handleMoreCommentsClick, enterAnimation: Animation.slideDown, @@ -4690,8 +5067,8 @@ function clone(obj) { }; Post.prototype.render = function() { - var post_uri, site, _ref, _ref1, _ref2, _ref3; - _ref = this.row.key.split("-"), site = _ref[0], post_uri = _ref[1]; + var post_uri, ref, ref1, ref2, ref3, site; + ref = this.row.key.split("-"), site = ref[0], post_uri = ref[1]; return h("div.post", { key: this.row.key, enterAnimation: Animation.slideDown, @@ -4723,7 +5100,7 @@ function clone(obj) { }, "\u22EE") ]), this.owned ? this.editable_body.render(this.row.body) : h("div.body", { classes: { - maxheight: !this.row.selected && ((_ref1 = this.row.body) != null ? _ref1.length : void 0) > 3000 + maxheight: !this.row.selected && ((ref1 = this.row.body) != null ? ref1.length : void 0) > 3000 }, innerHTML: Text.renderMarked(this.row.body), afterCreate: Maxheight.apply, @@ -4734,7 +5111,7 @@ function clone(obj) { onclick: this.handleCommentClick }, "Comment"), h("a.like.link", { classes: { - active: (_ref2 = Page.user) != null ? _ref2.likes[post_uri] : void 0, + active: (ref2 = Page.user) != null ? ref2.likes[post_uri] : void 0, loading: this.submitting_like, "like-zero": this.row.likes === 0 }, @@ -4742,7 +5119,7 @@ function clone(obj) { onclick: this.handleLikeClick }, h("div.icon.icon-heart", { classes: { - active: (_ref3 = Page.user) != null ? _ref3.likes[post_uri] : void 0 + active: (ref3 = Page.user) != null ? ref3.likes[post_uri] : void 0 } }), this.row.likes ? this.row.likes : void 0) ]), this.renderComments() @@ -4758,25 +5135,25 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/PostCreate.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostCreate.coffee ---- */ (function() { var PostCreate, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - PostCreate = (function(_super) { - __extends(PostCreate, _super); + PostCreate = (function(superClass) { + extend(PostCreate, superClass); function PostCreate() { - this.render = __bind(this.render, this); - this.handleUploadClick = __bind(this.handleUploadClick, this); - this.handlePostSubmit = __bind(this.handlePostSubmit, this); - this.handleImageClose = __bind(this.handleImageClose, this); - this.handleUpload = __bind(this.handleUpload, this); - this.startEdit = __bind(this.startEdit, this); + this.render = bind(this.render, this); + this.handleUploadClick = bind(this.handleUploadClick, this); + this.handlePostSubmit = bind(this.handlePostSubmit, this); + this.handleImageClose = bind(this.handleImageClose, this); + this.handleUpload = bind(this.handleUpload, this); + this.startEdit = bind(this.startEdit, this); this.field_post = new Autosize({ placeholder: "Write something...", "class": "postfield", @@ -4815,7 +5192,7 @@ function clone(obj) { }; PostCreate.prototype.handlePostSubmit = function() { - var meta, _ref; + var meta, ref; this.field_post.loading = true; if (this.image.height) { meta = {}; @@ -4823,7 +5200,7 @@ function clone(obj) { } else { meta = null; } - Page.user.post(this.field_post.attrs.value, meta, (_ref = this.image.base64uri) != null ? _ref.replace(/.*base64,/, "") : void 0, (function(_this) { + Page.user.post(this.field_post.attrs.value, meta, (ref = this.image.base64uri) != null ? ref.replace(/.*base64,/, "") : void 0, (function(_this) { return function(res) { _this.field_post.loading = false; if (res) { @@ -4913,38 +5290,45 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/PostList.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostList.coffee ---- */ (function() { var PostList, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - PostList = (function(_super) { - __extends(PostList, _super); + PostList = (function(superClass) { + extend(PostList, superClass); function PostList() { - this.render = __bind(this.render, this); - this.storeMoreTag = __bind(this.storeMoreTag, this); - this.addScrollwatcher = __bind(this.addScrollwatcher, this); - this.handleMoreClick = __bind(this.handleMoreClick, this); - this.update = __bind(this.update, this); - this.queryLikes = __bind(this.queryLikes, this); - this.queryComments = __bind(this.queryComments, this); + this.render = bind(this.render, this); + this.storeMoreTag = bind(this.storeMoreTag, this); + this.addScrollwatcher = bind(this.addScrollwatcher, this); + this.handleMoreClick = bind(this.handleMoreClick, this); + this.update = bind(this.update, this); + this.queryLikes = bind(this.queryLikes, this); + this.queryComments = bind(this.queryComments, this); this.item_list = new ItemList(Post, "key"); this.posts = this.item_list.items; this.need_update = true; this.directories = []; this.loaded = false; this.filter_post_ids = null; + this.filter_hub = null; + this.filter_language_ids = null; this.limit = 10; + this.show_after_date = 1471946844; } PostList.prototype.queryComments = function(post_uris, cb) { var query; - query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added DESC"; + if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added ASC"; + } else { + query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added DESC"; + } return Page.cmd("dbQuery", [ query, { post_uri: post_uris @@ -4974,36 +5358,58 @@ function clone(obj) { if (this.filter_post_ids) { where += "AND post_id IN " + (Text.sqlIn(this.filter_post_ids)) + " "; } + if (this.filter_hub) { + where += "AND json.hub = '" + this.filter_hub + "' "; + } + if (this.filter_language_ids) { + where += "AND (post_id, post.json_id) IN " + this.filter_language_ids + " "; + } if (Page.local_storage.settings.hide_hello_zerome) { where += "AND post_id > 1 "; } - query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added DESC LIMIT " + (this.limit + 1); + if (Page.local_storage.settings.show_after) { + if (document.getElementById("show-after-date")) { + this.show_after_date = document.getElementById("show-after-date").value - 121; + } + where += "AND date_added > " + String(this.show_after_date) + " "; + } + if (Page.local_storage.settings.show_one_day_ago) { + where += "AND date_added > strftime('%s', 'now') - 3600*24 "; + } + if (Page.local_storage.settings.show_one_month_ago) { + where += "AND date_added > strftime('%s', 'now') - 3600*24*30 "; + } + if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added ASC LIMIT " + (this.limit + 1); + } else { + query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added DESC LIMIT " + (this.limit + 1); + } this.logStart("Update"); return Page.cmd("dbQuery", [query, param], (function(_this) { return function(rows) { - var items, post_uris, row, _i, _len; + var items, j, len, post_uris, row; items = []; post_uris = []; - for (_i = 0, _len = rows.length; _i < _len; _i++) { - row = rows[_i]; + for (j = 0, len = rows.length; j < len; j++) { + row = rows[j]; row["key"] = row["site"] + "-" + row["directory"].replace("data/users/", "") + "_" + row["post_id"]; row["post_uri"] = row["directory"].replace("data/users/", "") + "_" + row["post_id"]; post_uris.push(row["post_uri"]); } _this.queryComments(post_uris, function(comment_rows) { - var comment_db, comment_row, _j, _k, _len1, _len2, _name, _ref; + var comment_db, comment_row, k, l, len1, len2, name, ref; comment_db = {}; - for (_j = 0, _len1 = comment_rows.length; _j < _len1; _j++) { - comment_row = comment_rows[_j]; - if (comment_db[_name = comment_row.site + "/" + comment_row.post_uri] == null) { - comment_db[_name] = []; + for (k = 0, len1 = comment_rows.length; k < len1; k++) { + comment_row = comment_rows[k]; + if (comment_db[name = comment_row.site + "/" + comment_row.post_uri] == null) { + comment_db[name] = []; } comment_db[comment_row.site + "/" + comment_row.post_uri].push(comment_row); } - for (_k = 0, _len2 = rows.length; _k < _len2; _k++) { - row = rows[_k]; + for (l = 0, len2 = rows.length; l < len2; l++) { + row = rows[l]; row["comments"] = comment_db[row.site + "/" + row.post_uri]; - if (((_ref = _this.filter_post_ids) != null ? _ref.length : void 0) === 1 && row.post_id === parseInt(_this.filter_post_ids[0])) { + if (((ref = _this.filter_post_ids) != null ? ref.length : void 0) === 1 && row.post_id === parseInt(_this.filter_post_ids[0])) { row.selected = true; } } @@ -5016,14 +5422,14 @@ function clone(obj) { } }); return _this.queryLikes(post_uris, function(like_rows) { - var like_db, like_row, _j, _k, _len1, _len2; + var k, l, len1, len2, like_db, like_row; like_db = {}; - for (_j = 0, _len1 = like_rows.length; _j < _len1; _j++) { - like_row = like_rows[_j]; + for (k = 0, len1 = like_rows.length; k < len1; k++) { + like_row = like_rows[k]; like_db[like_row["post_uri"]] = like_row["likes"]; } - for (_k = 0, _len2 = rows.length; _k < _len2; _k++) { - row = rows[_k]; + for (l = 0, len2 = rows.length; l < len2; l++) { + row = rows[l]; row["likes"] = like_db[row["post_uri"]]; } _this.item_list.sync(rows); @@ -5042,10 +5448,10 @@ function clone(obj) { PostList.prototype.addScrollwatcher = function() { return setTimeout(((function(_this) { return function() { - var i, item, _i, _len, _ref; - _ref = Page.scrollwatcher.items; - for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { - item = _ref[i]; + var i, item, j, len, ref; + ref = Page.scrollwatcher.items; + for (i = j = 0, len = ref.length; j < len; i = ++j) { + item = ref[i]; if (item[1] === _this.tag_more) { Page.scrollwatcher.items.splice(i, 1); break; @@ -5094,8 +5500,8 @@ function clone(obj) { var err; try { return post.render(); - } catch (_error) { - err = _error; + } catch (error) { + err = error; h("div.error", ["Post render error:", err.message]); return Debug.formatException(err); } @@ -5119,27 +5525,27 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/PostMeta.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostMeta.coffee ---- */ (function() { var PostMeta, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; - - PostMeta = (function(_super) { - __extends(PostMeta, _super); - - function PostMeta(_at_post, _at_meta) { - this.post = _at_post; - this.meta = _at_meta; - this.render = __bind(this.render, this); - this.handleImageSettingsClick = __bind(this.handleImageSettingsClick, this); - this.handleImageDeleteClick = __bind(this.handleImageDeleteClick, this); - this.handleOptionalHelpClick = __bind(this.handleOptionalHelpClick, this); - this.handleImageClick = __bind(this.handleImageClick, this); - this.afterCreateImage = __bind(this.afterCreateImage, this); + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; + + PostMeta = (function(superClass) { + extend(PostMeta, superClass); + + function PostMeta(post, meta) { + this.post = post; + this.meta = meta; + this.render = bind(this.render, this); + this.handleImageSettingsClick = bind(this.handleImageSettingsClick, this); + this.handleImageDeleteClick = bind(this.handleImageDeleteClick, this); + this.handleOptionalHelpClick = bind(this.handleOptionalHelpClick, this); + this.handleImageClick = bind(this.handleImageClick, this); + this.afterCreateImage = bind(this.afterCreateImage, this); this; } @@ -5153,8 +5559,8 @@ function clone(obj) { _this.image_preview.optional_info = res; return Page.projector.scheduleRender(); }); - } catch (_error) { - e = _error; + } catch (error) { + e = error; _this.log("Image preview error: " + e); } return Page.projector.scheduleRender(); @@ -5163,8 +5569,8 @@ function clone(obj) { }; PostMeta.prototype.handleImageClick = function(e) { - var image, _ref; - if (this.image_preview.load_fullsize || ((_ref = this.image_preview.optional_info) != null ? _ref.is_downloaded : void 0)) { + var image, ref; + if (this.image_preview.load_fullsize || ((ref = this.image_preview.optional_info) != null ? ref.is_downloaded : void 0)) { Page.overlay.zoomImageTag(e.currentTarget, this.image_preview.width, this.image_preview.height); } else { this.image_preview.load_fullsize = true; @@ -5220,7 +5626,7 @@ function clone(obj) { } this.post.user.hasHelp((function(_this) { return function(helping) { - var _ref; + var ref; if (!_this.menu_image) { _this.menu_image = new Menu(); } @@ -5232,7 +5638,7 @@ function clone(obj) { }) ]); _this.menu_image.items.push(["---"]); - if ((_ref = _this.image_preview.optional_info) != null ? _ref.is_downloaded : void 0) { + if ((ref = _this.image_preview.optional_info) != null ? ref.is_downloaded : void 0) { _this.menu_image.items.push(["Delete image", _this.handleImageDeleteClick]); } else { _this.menu_image.items.push(["Show image", _this.handleImageClick, false]); @@ -5244,19 +5650,19 @@ function clone(obj) { }; PostMeta.prototype.render = function() { - var height, style_fullsize, style_preview, width, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8; + var height, ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, style_fullsize, style_preview, width; if (this.meta.img) { if (!this.image_preview) { this.image_preview = new ImagePreview(); this.image_preview.setPreviewData(this.meta.img); } - _ref = this.image_preview.getSize(530, 600), width = _ref[0], height = _ref[1]; - if ((_ref1 = this.image_preview) != null ? _ref1.preview_uri : void 0) { + ref = this.image_preview.getSize(530, 600), width = ref[0], height = ref[1]; + if ((ref1 = this.image_preview) != null ? ref1.preview_uri : void 0) { style_preview = "background-image: url(" + this.image_preview.preview_uri + ")"; } else { style_preview = ""; } - if (this.image_preview.load_fullsize || ((_ref2 = this.image_preview.optional_info) != null ? _ref2.is_downloaded : void 0)) { + if (this.image_preview.load_fullsize || ((ref2 = this.image_preview.optional_info) != null ? ref2.is_downloaded : void 0)) { style_fullsize = "background-image: url(" + (this.post.user.getPath()) + "/" + this.post.row.post_id + ".jpg)"; } else { style_fullsize = ""; @@ -5265,22 +5671,22 @@ function clone(obj) { afterCreate: this.afterCreateImage, style: "width: " + width + "px; height: " + height + "px; " + style_preview, classes: { - downloaded: (_ref3 = this.image_preview.optional_info) != null ? _ref3.is_downloaded : void 0, - hasinfo: ((_ref4 = this.image_preview.optional_info) != null ? _ref4.peer : void 0) !== null, + downloaded: (ref3 = this.image_preview.optional_info) != null ? ref3.is_downloaded : void 0, + hasinfo: ((ref4 = this.image_preview.optional_info) != null ? ref4.peer : void 0) !== null, loading: this.image_preview.loading } }, h("a.fullsize", { href: "#", onclick: this.handleImageClick, style: style_fullsize - }), Page.server_info.rev < 1700 ? h("small.oldversion", "You need ZeroNet 0.5.0 to view this image") : void 0, ((_ref5 = this.image_preview) != null ? _ref5.optional_info : void 0) ? h("a.show", { + }), Page.server_info.rev < 1700 ? h("small.oldversion", "You need ZeroNet 0.5.0 to view this image") : void 0, ((ref5 = this.image_preview) != null ? ref5.optional_info : void 0) ? h("a.show", { href: "#", onclick: this.handleImageClick - }, h("div.title", "Loading...\nShow image")) : void 0, ((_ref6 = this.image_preview) != null ? _ref6.optional_info : void 0) ? h("a.details", { + }, h("div.title", "Loading...\nShow image")) : void 0, ((ref6 = this.image_preview) != null ? ref6.optional_info : void 0) ? h("a.details", { href: "#Settings", onclick: Page.returnFalse, onmousedown: this.handleImageSettingsClick - }, [h("div.size", Text.formatSize((_ref7 = this.image_preview.optional_info) != null ? _ref7.size : void 0)), h("div.peers.icon-profile"), (_ref8 = this.image_preview.optional_info) != null ? _ref8.peer : void 0, h("a.image-settings", "\u22EE"), this.menu_image ? this.menu_image.render(".menu-right") : void 0]) : void 0); + }, [h("div.size", Text.formatSize((ref7 = this.image_preview.optional_info) != null ? ref7.size : void 0)), h("div.peers.icon-profile"), (ref8 = this.image_preview.optional_info) != null ? ref8.peer : void 0, h("a.image-settings", "\u22EE"), this.menu_image ? this.menu_image.render(".menu-right") : void 0]) : void 0); } }; @@ -5293,7 +5699,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/Trigger.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/Trigger.coffee ---- */ (function() { @@ -5344,7 +5750,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/User.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/User.coffee ---- */ (function() { @@ -5906,22 +6312,21 @@ function clone(obj) { }).call(this); - -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/UserList.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/UserList.coffee ---- */ (function() { var UserList, - __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - __hasProp = {}.hasOwnProperty; + bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + hasProp = {}.hasOwnProperty; - UserList = (function(_super) { - __extends(UserList, _super); + UserList = (function(superClass) { + extend(UserList, superClass); - function UserList(_at_type) { - this.type = _at_type != null ? _at_type : "new"; - this.render = __bind(this.render, this); + function UserList(type1) { + this.type = type1 != null ? type1 : "new"; + this.render = bind(this.render, this); this.item_list = new ItemList(User, "key"); this.users = this.item_list.items; this.need_update = true; @@ -5944,23 +6349,23 @@ function clone(obj) { query = "SELECT user.user_name, follow.*, user.*\nFROM follow\nLEFT JOIN user USING (auth_address, hub)\nWHERE\n follow.json_id = " + this.followed_by.row.json_id + " AND user.json_id IS NOT NULL\n\nUNION\n\nSELECT user.user_name, follow.*, user.*\nFROM follow\nLEFT JOIN json ON (json.directory = 'data/userdb/' || follow.auth_address)\nLEFT JOIN user ON (user.json_id = json.json_id)\nWHERE\n follow.json_id = " + this.followed_by.row.json_id + " AND user.json_id IS NOT NULL AND\n follow.date_added < " + (Time.timestamp() + 120) + "\nORDER BY date_added DESC\nLIMIT " + this.limit; } else if (this.type === "suggested") { followed_user_addresses = (function() { - var _ref, _results; - _ref = Page.user.followed_users; - _results = []; - for (key in _ref) { - val = _ref[key]; - _results.push(key.replace(/.*\//, "")); + var ref, results; + ref = Page.user.followed_users; + results = []; + for (key in ref) { + val = ref[key]; + results.push(key.replace(/.*\//, "")); } - return _results; + return results; })(); followed_user_directories = (function() { - var _i, _len, _results; - _results = []; - for (_i = 0, _len = followed_user_addresses.length; _i < _len; _i++) { - key = followed_user_addresses[_i]; - _results.push("data/users/" + key); + var i, len, results; + results = []; + for (i = 0, len = followed_user_addresses.length; i < len; i++) { + key = followed_user_addresses[i]; + results.push("data/users/" + key); } - return _results; + return results; })(); if (!followed_user_addresses.length) { return; @@ -5973,11 +6378,11 @@ function clone(obj) { } return Page.cmd("dbQuery", [query, params], (function(_this) { return function(rows) { - var followed_by_displayed, row, rows_by_user, user_rows, username, _i, _len; + var followed_by_displayed, i, len, row, rows_by_user, user_rows, username; rows_by_user = {}; followed_by_displayed = {}; - for (_i = 0, _len = rows.length; _i < _len; _i++) { - row = rows[_i]; + for (i = 0, len = rows.length; i < len; i++) { + row = rows[i]; if (row.json_cert_user_id) { row.cert_user_id = row.json_cert_user_id; row.auth_address = row.json_directory.replace("data/userdb/", "").replace("data/users/", ""); @@ -5987,16 +6392,16 @@ function clone(obj) { } if (row.followed_by) { row.followed_by = ((function() { - var _j, _len1, _ref, _results; - _ref = row.followed_by.split(","); - _results = []; - for (_j = 0, _len1 = _ref.length; _j < _len1; _j++) { - username = _ref[_j]; + var j, len1, ref, results; + ref = row.followed_by.split(","); + results = []; + for (j = 0, len1 = ref.length; j < len1; j++) { + username = ref[j]; if (!followed_by_displayed[username]) { - _results.push(username); + results.push(username); } } - return _results; + return results; })())[0]; followed_by_displayed[row.followed_by] = true; } @@ -6006,13 +6411,13 @@ function clone(obj) { } } user_rows = (function() { - var _results; - _results = []; + var results; + results = []; for (key in rows_by_user) { val = rows_by_user[key]; - _results.push(val); + results.push(val); } - return _results; + return results; })(); _this.item_list.sync(user_rows); _this.loading = false; @@ -6054,7 +6459,7 @@ function clone(obj) { }).call(this); -/* ---- /1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH/js/ZeroMe.coffee ---- */ +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ZeroMe.coffee ---- */ (function() { @@ -6088,6 +6493,7 @@ function clone(obj) { this.server_info = null; this.address = null; this.user = false; + this.user_hubs = {}; this.user_loaded = false; this.userdb = "1UDbADib99KE9d3qZ87NqJF2QLTHmMkoV"; this.cache_time = Time.timestamp(); @@ -6350,20 +6756,29 @@ function clone(obj) { } ], (function(_this) { return function(res) { - var i, len, row; + var i, len, row, user_row; if ((res != null ? res.length : void 0) > 0) { - _this.user = new User({ - hub: res[0]["hub"], - auth_address: _this.site_info.auth_address - }); - _this.user.row = res[0]; + _this.user_hubs = {}; for (i = 0, len = res.length; i < len; i++) { row = res[i]; + _this.log("Possible site for user", row.site); + _this.user_hubs[row.site] = row; if (row.site === row.hub) { - _this.user.row = row; + user_row = row; } } - _this.log("Choosen site for user", _this.user.row.site, _this.user.row); + if (_this.user_hubs[_this.local_storage.settings.hub]) { + row = _this.user_hubs[_this.local_storage.settings.hub]; + _this.log("Force hub", row.site); + user_row = row; + user_row.hub = row.site; + } + _this.log("Choosen site for user", user_row.site, user_row); + _this.user = new User({ + hub: user_row.hub, + auth_address: _this.site_info.auth_address + }); + _this.user.row = user_row; _this.user.updateInfo(cb); } else { _this.user = new AnonUser(); diff --git a/js/utils/Menu.coffee b/js/utils/Menu.coffee index 67e5617..e29ae21 100644 --- a/js/utils/Menu.coffee +++ b/js/utils/Menu.coffee @@ -61,7 +61,15 @@ class Menu else # Callback href = "#"+title onclick = @handleClick - h("a.menu-item", {href: href, onclick: onclick, key: title, classes: {"selected": selected}}, [title]) + if title == "Show posts after" + h("div.show-after", + h("a.menu-item", { + href: href, onclick: onclick, key: title, classes: {"selected": selected}}, [title]), + h("input#show-after-date", { + placeholder: "unix time" + })) + else + h("a.menu-item", {href: href, onclick: onclick, key: title, classes: {"selected": selected}}, [title]) render: (class_name="") => if @visible or @node @@ -73,6 +81,11 @@ window.Menu = Menu document.body.addEventListener "mouseup", (e) -> if not window.visible_menu or not window.visible_menu.node return false - if e.target != window.visible_menu.node.parentNode and e.target.parentNode != window.visible_menu.node and e.target.parentNode != window.visible_menu.node.parentNode and e.target.parentNode != window.visible_menu.node and e.target.parentNode.parentNode != window.visible_menu.node.parentNode + if e.target != window.visible_menu.node.parentNode and \ + e.target.parentNode != window.visible_menu.node and \ + e.target.parentNode != window.visible_menu.node.parentNode and \ + e.target.parentNode != window.visible_menu.node and \ + e.target.parentNode.parentNode != window.visible_menu.node and \ + e.target.parentNode.parentNode != window.visible_menu.node.parentNode window.visible_menu.hide() Page.projector.scheduleRender() From 1b78ba1886a83b7d9b446344e7f9ca84e3962fba Mon Sep 17 00:00:00 2001 From: BinChan Date: Tue, 13 Feb 2018 22:42:45 +0800 Subject: [PATCH 18/26] Remove chronological option, instead a user can set 'sort after' to 0 for that feature, add localSettings feature, and other improvement --- css/all.css | 2 +- js/ActivityList.coffee | 10 ++-- js/Head.coffee | 10 +--- js/PostList.coffee | 10 ++-- js/ZeroMe.coffee | 32 ++++++++++--- js/all.js | 103 ++++++++++++++++++++++++----------------- js/utils/Menu.coffee | 4 +- 7 files changed, 98 insertions(+), 73 deletions(-) diff --git a/css/all.css b/css/all.css index 8a730b2..83d9dfe 100644 --- a/css/all.css +++ b/css/all.css @@ -258,7 +258,7 @@ margin-bottom: 2px; margin-top: 2px; } -/* Drop menu */ +/* Drop menu show after */ .show-after { padding: 3px 0; diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 4c42dad..4441e0b 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -15,8 +15,7 @@ class ActivityList extends Class if @filter_language_ids where = "WHERE (comment_id, json_id) IN #{@filter_language_ids} AND date_added < #{Time.timestamp()+120} " else if @directories == "all" - if Page.local_storage.settings.sort_chronologically || \ - Page.local_storage.settings.show_one_month_ago || \ + if Page.local_storage.settings.show_one_month_ago || \ Page.local_storage.settings.show_one_day_ago || \ Page.local_storage.settings.show_after where = "WHERE date_added < #{Time.timestamp()+120} " @@ -32,9 +31,9 @@ class ActivityList extends Class if document.getElementById("show-after-date") this.show_after_date = document.getElementById("show-after-date").value - 121 where += "AND date_added > " + String(this.show_after_date) + " " - if Page.local_storage.settings.show_one_day_ago + else if Page.local_storage.settings.show_one_day_ago where += "AND date_added > strftime('%s', 'now') - 3600*24 " - if Page.local_storage.settings.show_one_month_ago + else if Page.local_storage.settings.show_one_month_ago where += "AND date_added > strftime('%s', 'now') - 3600*24*30 " query = """ @@ -76,8 +75,7 @@ class ActivityList extends Class LEFT JOIN follow USING (json_id) #{where} """ - if Page.local_storage.settings.sort_chronologically || \ - Page.local_storage.settings.show_one_month_ago || \ + if Page.local_storage.settings.show_one_month_ago || \ Page.local_storage.settings.show_one_day_ago || \ Page.local_storage.settings.show_after query += """ diff --git a/js/Head.coffee b/js/Head.coffee index ab215a4..889cf1e 100644 --- a/js/Head.coffee +++ b/js/Head.coffee @@ -48,21 +48,13 @@ class Head extends Class ), Page.local_storage.settings.hide_hello_zerome] @menu.items.push ["---"] @menu.items.push ["Show posts after", ( (item) => - Page.local_storage.settings.show_after = not Page.local_storage.settings.show_after + Page.local_storage.settings.show_after = document.getElementById("show-after-date").value item[2] = Page.local_storage.settings.show_after Page.projector.scheduleRender() Page.saveLocalStorage() Page.content.need_update = true return false ), Page.local_storage.settings.show_after] - @menu.items.push ["Show posts chronologically", ( (item) => - Page.local_storage.settings.sort_chronologically = not Page.local_storage.settings.sort_chronologically - item[2] = Page.local_storage.settings.sort_chronologically - Page.projector.scheduleRender() - Page.saveLocalStorage() - Page.content.need_update = true - return false - ), Page.local_storage.settings.sort_chronologically] @menu.items.push ["Show posts since one day ago", ( (item) => Page.local_storage.settings.show_one_day_ago = not Page.local_storage.settings.show_one_day_ago item[2] = Page.local_storage.settings.show_one_day_ago diff --git a/js/PostList.coffee b/js/PostList.coffee index 7ed2418..fc03ef9 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -12,8 +12,7 @@ class PostList extends Class @show_after_date = 1471946844 queryComments: (post_uris, cb) => - if Page.local_storage.settings.sort_chronologically || \ - Page.local_storage.settings.show_one_month_ago || \ + if Page.local_storage.settings.show_one_month_ago || \ Page.local_storage.settings.show_one_day_ago || \ Page.local_storage.settings.show_after query = " @@ -68,12 +67,11 @@ class PostList extends Class if document.getElementById("show-after-date") this.show_after_date = document.getElementById("show-after-date").value - 121 where += "AND date_added > " + String(this.show_after_date) + " " - if Page.local_storage.settings.show_one_day_ago + else if Page.local_storage.settings.show_one_day_ago where += "AND date_added > strftime('%s', 'now') - 3600*24 " - if Page.local_storage.settings.show_one_month_ago + else if Page.local_storage.settings.show_one_month_ago where += "AND date_added > strftime('%s', 'now') - 3600*24*30 " - if Page.local_storage.settings.sort_chronologically || \ - Page.local_storage.settings.show_one_month_ago || \ + if Page.local_storage.settings.show_one_month_ago || \ Page.local_storage.settings.show_one_day_ago || \ Page.local_storage.settings.show_after query = " diff --git a/js/ZeroMe.coffee b/js/ZeroMe.coffee index a99bf35..3edbf45 100644 --- a/js/ZeroMe.coffee +++ b/js/ZeroMe.coffee @@ -58,7 +58,7 @@ class ZeroMe extends ZeroFrame @projector.replace($("#Head"), @head.render) @projector.replace($("#Overlay"), @overlay.render) @projector.merge($("#Trigger"), @trigger.render) - @loadLocalStorage() + @loadSettings() # Update every minute to keep time since fields up-to date setInterval ( -> @@ -147,6 +147,17 @@ class ZeroMe extends ZeroFrame params[key] = val return "?"+Text.queryEncode(params) + loadSettings: -> + @on_site_info.then => + @cmd "userGetSettings", [], (res) => + if not res or res.error + @loadLocalStorage() + else + @local_storage = res + @local_storage.followed_users ?= {} + @local_storage.settings ?= {} + @local_storage.settings.show_after ?= 1471946844 + @on_local_storage.resolve(@local_storage) loadLocalStorage: -> @on_site_info.then => @@ -156,15 +167,22 @@ class ZeroMe extends ZeroFrame @local_storage ?= {} @local_storage.followed_users ?= {} @local_storage.settings ?= {} + @local_storage.show_after ?= 1471946844 @on_local_storage.resolve(@local_storage) - saveLocalStorage: (cb=null) -> - @logStart "Saved localstorage" + saveLocalStorage: (cb) -> if @local_storage - @cmd "wrapperSetLocalStorage", @local_storage, (res) => - @logEnd "Saved localstorage" - cb?(res) + if Page.server_info.rev > 2140 + @logStart "Saved local settings" + @cmd "userSetSettings", [@local_storage], (res) => + @logEnd "Saved local settings" + cb?(res) + else + @logStart "Saved localstorage" + @cmd "wrapperSetLocalStorage", @local_storage, (res) => + @logEnd "Saved localstorage" + cb?(res) onOpenWebsocket: (e) => @@ -213,7 +231,7 @@ class ZeroMe extends ZeroFrame if row.site == row.hub user_row = row - if @user_hubs[@local_storage.settings.hub] + if @user_hubs[@local_storage] and @user_hubs[@local_storage.settings.hub] row = @user_hubs[@local_storage.settings.hub] @log "Force hub", row.site user_row = row diff --git a/js/all.js b/js/all.js index 77e9e3b..b1fd091 100644 --- a/js/all.js +++ b/js/all.js @@ -1984,12 +1984,10 @@ function clone(obj) { return h("div.show-after", h("a.menu-item", { href: href, onclick: onclick, - key: title, - classes: { - "selected": selected - } + key: title }, [title]), h("input#show-after-date", { - placeholder: "unix time" + placeholder: "unix time", + value: selected })); } else { return h("a.menu-item", { @@ -2037,6 +2035,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Overlay.coffee ---- */ @@ -2969,7 +2968,7 @@ function clone(obj) { if (this.filter_language_ids) { where = "WHERE (comment_id, json_id) IN " + this.filter_language_ids + " AND date_added < " + (Time.timestamp() + 120) + " "; } else if (this.directories === "all") { - if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { where = "WHERE date_added < " + (Time.timestamp() + 120) + " "; } else { where = "WHERE date_added > " + (Time.timestamp() - 60 * 60 * 24 * 2) + " AND date_added < " + (Time.timestamp() + 120) + " "; @@ -2984,11 +2983,9 @@ function clone(obj) { this.show_after_date = document.getElementById("show-after-date").value - 121; } where += "AND date_added > " + String(this.show_after_date) + " "; - } - if (Page.local_storage.settings.show_one_day_ago) { + } else if (Page.local_storage.settings.show_one_day_ago) { where += "AND date_added > strftime('%s', 'now') - 3600*24 "; - } - if (Page.local_storage.settings.show_one_month_ago) { + } else if (Page.local_storage.settings.show_one_month_ago) { where += "AND date_added > strftime('%s', 'now') - 3600*24*30 "; } query = "SELECT\n 'comment' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n comment\nLEFT JOIN json USING (json_id)\n " + where; @@ -2998,7 +2995,7 @@ function clone(obj) { if (this.directories !== "all") { query += "\nUNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; } - if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { query += "\nORDER BY date_added ASC\nLIMIT " + (this.limit + 1); } else { query += "\nORDER BY date_added DESC\nLIMIT " + (this.limit + 1); @@ -3239,7 +3236,6 @@ function clone(obj) { }).call(this); - /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/AnonUser.coffee ---- */ @@ -4540,7 +4536,7 @@ function clone(obj) { _this.menu.items.push(["---"]); _this.menu.items.push([ "Show posts after", (function(item) { - Page.local_storage.settings.show_after = !Page.local_storage.settings.show_after; + Page.local_storage.settings.show_after = document.getElementById("show-after-date").value; item[2] = Page.local_storage.settings.show_after; Page.projector.scheduleRender(); Page.saveLocalStorage(); @@ -4548,16 +4544,6 @@ function clone(obj) { return false; }), Page.local_storage.settings.show_after ]); - _this.menu.items.push([ - "Show posts chronologically", (function(item) { - Page.local_storage.settings.sort_chronologically = !Page.local_storage.settings.sort_chronologically; - item[2] = Page.local_storage.settings.sort_chronologically; - Page.projector.scheduleRender(); - Page.saveLocalStorage(); - Page.content.need_update = true; - return false; - }), Page.local_storage.settings.sort_chronologically - ]); _this.menu.items.push([ "Show posts since one day ago", (function(item) { Page.local_storage.settings.show_one_day_ago = !Page.local_storage.settings.show_one_day_ago; @@ -5324,7 +5310,7 @@ function clone(obj) { PostList.prototype.queryComments = function(post_uris, cb) { var query; - if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added ASC"; } else { query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added DESC"; @@ -5372,14 +5358,12 @@ function clone(obj) { this.show_after_date = document.getElementById("show-after-date").value - 121; } where += "AND date_added > " + String(this.show_after_date) + " "; - } - if (Page.local_storage.settings.show_one_day_ago) { + } else if (Page.local_storage.settings.show_one_day_ago) { where += "AND date_added > strftime('%s', 'now') - 3600*24 "; - } - if (Page.local_storage.settings.show_one_month_ago) { + } else if (Page.local_storage.settings.show_one_month_ago) { where += "AND date_added > strftime('%s', 'now') - 3600*24*30 "; } - if (Page.local_storage.settings.sort_chronologically || Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added ASC LIMIT " + (this.limit + 1); } else { query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added DESC LIMIT " + (this.limit + 1); @@ -6547,7 +6531,7 @@ function clone(obj) { this.projector.replace($("#Head"), this.head.render); this.projector.replace($("#Overlay"), this.overlay.render); this.projector.merge($("#Trigger"), this.trigger.render); - this.loadLocalStorage(); + this.loadSettings(); return setInterval((function() { return Page.projector.scheduleRender(); }), 60 * 1000); @@ -6655,12 +6639,37 @@ function clone(obj) { return "?" + Text.queryEncode(params); }; + ZeroMe.prototype.loadSettings = function() { + return this.on_site_info.then((function(_this) { + return function() { + return _this.cmd("userGetSettings", [], function(res) { + var base1, base2, base3; + if (!res || res.error) { + return _this.loadLocalStorage(); + } else { + _this.local_storage = res; + if ((base1 = _this.local_storage).followed_users == null) { + base1.followed_users = {}; + } + if ((base2 = _this.local_storage).settings == null) { + base2.settings = {}; + } + if ((base3 = _this.local_storage.settings).show_after == null) { + base3.show_after = 1471946844; + } + return _this.on_local_storage.resolve(_this.local_storage); + } + }); + }; + })(this)); + }; + ZeroMe.prototype.loadLocalStorage = function() { return this.on_site_info.then((function(_this) { return function() { _this.logStart("Loaded localstorage"); return _this.cmd("wrapperGetLocalStorage", [], function(local_storage) { - var base1, base2; + var base1, base2, base3; _this.local_storage = local_storage; _this.logEnd("Loaded localstorage"); if (_this.local_storage == null) { @@ -6672,6 +6681,9 @@ function clone(obj) { if ((base2 = _this.local_storage).settings == null) { base2.settings = {}; } + if ((base3 = _this.local_storage).show_after == null) { + base3.show_after = 1471946844; + } return _this.on_local_storage.resolve(_this.local_storage); }); }; @@ -6679,17 +6691,24 @@ function clone(obj) { }; ZeroMe.prototype.saveLocalStorage = function(cb) { - if (cb == null) { - cb = null; - } - this.logStart("Saved localstorage"); if (this.local_storage) { - return this.cmd("wrapperSetLocalStorage", this.local_storage, (function(_this) { - return function(res) { - _this.logEnd("Saved localstorage"); - return typeof cb === "function" ? cb(res) : void 0; - }; - })(this)); + if (Page.server_info.rev > 2140) { + this.logStart("Saved local settings"); + return this.cmd("userSetSettings", [this.local_storage], (function(_this) { + return function(res) { + _this.logEnd("Saved local settings"); + return typeof cb === "function" ? cb(res) : void 0; + }; + })(this)); + } else { + this.logStart("Saved localstorage"); + return this.cmd("wrapperSetLocalStorage", this.local_storage, (function(_this) { + return function(res) { + _this.logEnd("Saved localstorage"); + return typeof cb === "function" ? cb(res) : void 0; + }; + })(this)); + } } }; @@ -6767,7 +6786,7 @@ function clone(obj) { user_row = row; } } - if (_this.user_hubs[_this.local_storage.settings.hub]) { + if (_this.user_hubs[_this.local_storage] && _this.user_hubs[_this.local_storage.settings.hub]) { row = _this.user_hubs[_this.local_storage.settings.hub]; _this.log("Force hub", row.site); user_row = row; diff --git a/js/utils/Menu.coffee b/js/utils/Menu.coffee index e29ae21..4febf1b 100644 --- a/js/utils/Menu.coffee +++ b/js/utils/Menu.coffee @@ -64,9 +64,9 @@ class Menu if title == "Show posts after" h("div.show-after", h("a.menu-item", { - href: href, onclick: onclick, key: title, classes: {"selected": selected}}, [title]), + href: href, onclick: onclick, key: title}, [title]), h("input#show-after-date", { - placeholder: "unix time" + placeholder: "unix time", value: selected })) else h("a.menu-item", {href: href, onclick: onclick, key: title, classes: {"selected": selected}}, [title]) From 7efeaea5c89ce01fee5f0e68877a5457afeeeb50 Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 14 Feb 2018 00:23:19 +0800 Subject: [PATCH 19/26] Setting show_after default value to '', small fix. --- js/ActivityList.coffee | 2 +- js/PostList.coffee | 2 +- js/ZeroMe.coffee | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 4441e0b..6584de5 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -9,7 +9,7 @@ class ActivityList extends Class @update_timer = null @filter_hub = null @filter_language_ids = null - @show_after_date = 1471946844 + @show_after_date = 0 queryActivities: (cb) -> if @filter_language_ids diff --git a/js/PostList.coffee b/js/PostList.coffee index fc03ef9..d768e83 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -9,7 +9,7 @@ class PostList extends Class @filter_hub = null @filter_language_ids = null @limit = 10 - @show_after_date = 1471946844 + @show_after_date = 0 queryComments: (post_uris, cb) => if Page.local_storage.settings.show_one_month_ago || \ diff --git a/js/ZeroMe.coffee b/js/ZeroMe.coffee index 3edbf45..9d5169a 100644 --- a/js/ZeroMe.coffee +++ b/js/ZeroMe.coffee @@ -156,7 +156,7 @@ class ZeroMe extends ZeroFrame @local_storage = res @local_storage.followed_users ?= {} @local_storage.settings ?= {} - @local_storage.settings.show_after ?= 1471946844 + @local_storage.settings.show_after ?= "" @on_local_storage.resolve(@local_storage) loadLocalStorage: -> @@ -167,7 +167,7 @@ class ZeroMe extends ZeroFrame @local_storage ?= {} @local_storage.followed_users ?= {} @local_storage.settings ?= {} - @local_storage.show_after ?= 1471946844 + @local_storage.settings.show_after ?= "" @on_local_storage.resolve(@local_storage) From 5067618ebeda5bfaa6195648e600332965d02877 Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 14 Feb 2018 00:58:51 +0800 Subject: [PATCH 20/26] Small fix --- js/ActivityList.coffee | 2 +- js/PostList.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 6584de5..0937d61 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -29,7 +29,7 @@ class ActivityList extends Class if Page.local_storage.settings.show_after if document.getElementById("show-after-date") - this.show_after_date = document.getElementById("show-after-date").value - 121 + this.show_after_date = document.getElementById("show-after-date").value - 1 where += "AND date_added > " + String(this.show_after_date) + " " else if Page.local_storage.settings.show_one_day_ago where += "AND date_added > strftime('%s', 'now') - 3600*24 " diff --git a/js/PostList.coffee b/js/PostList.coffee index d768e83..5ea0476 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -65,7 +65,7 @@ class PostList extends Class if Page.local_storage.settings.show_after if document.getElementById("show-after-date") - this.show_after_date = document.getElementById("show-after-date").value - 121 + this.show_after_date = document.getElementById("show-after-date").value - 1 where += "AND date_added > " + String(this.show_after_date) + " " else if Page.local_storage.settings.show_one_day_ago where += "AND date_added > strftime('%s', 'now') - 3600*24 " From fc59c1036583e83501481bbbaa2ecdae33e22651 Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 14 Feb 2018 12:58:49 +0800 Subject: [PATCH 21/26] Get to value from local_storage instead getElementById --- js/ActivityList.coffee | 3 +-- js/PostList.coffee | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 0937d61..b9dd4db 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -28,8 +28,7 @@ class ActivityList extends Class where = "WHERE json.directory IN #{Text.sqlIn(@directories)} AND date_added < #{Time.timestamp()+120} " if Page.local_storage.settings.show_after - if document.getElementById("show-after-date") - this.show_after_date = document.getElementById("show-after-date").value - 1 + this.show_after_date = Page.local_storage.settings.show_after - 1 where += "AND date_added > " + String(this.show_after_date) + " " else if Page.local_storage.settings.show_one_day_ago where += "AND date_added > strftime('%s', 'now') - 3600*24 " diff --git a/js/PostList.coffee b/js/PostList.coffee index 5ea0476..2cfd785 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -64,8 +64,7 @@ class PostList extends Class where += "AND post_id > 1 " if Page.local_storage.settings.show_after - if document.getElementById("show-after-date") - this.show_after_date = document.getElementById("show-after-date").value - 1 + this.show_after_date = Page.local_storage.settings.show_after - 1 where += "AND date_added > " + String(this.show_after_date) + " " else if Page.local_storage.settings.show_one_day_ago where += "AND date_added > strftime('%s', 'now') - 3600*24 " From f5654ede1eaa5ee8295594b82188981c7e0294a3 Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 14 Feb 2018 22:12:31 +0800 Subject: [PATCH 22/26] Generalize "Show since". --- css/Menu.css | 10 ++++-- css/all.css | 10 ++++-- js/ActivityList.coffee | 14 ++++---- js/Head.coffee | 16 +++------ js/PostList.coffee | 14 ++++---- js/ZeroMe.coffee | 2 ++ js/all.js | 82 +++++++++++++++++++++--------------------- js/utils/Menu.coffee | 7 ++++ 8 files changed, 83 insertions(+), 72 deletions(-) diff --git a/css/Menu.css b/css/Menu.css index a209f82..2b0a243 100644 --- a/css/Menu.css +++ b/css/Menu.css @@ -108,10 +108,10 @@ margin-top: 2px; /* Drop menu show after */ -.show-after { +.show-after, .show-since { padding: 3px 0; } -.show-after .menu-item { +.show-after .menu-item, .show-since .menu-item { display: inline; padding-right: 5px; } @@ -121,3 +121,9 @@ border: 1px solid transparent; border-bottom: 1px solid #333; padding: 1px 5px; } +.show-since #show-since-day { +width: 17px; +border: 1px solid transparent; +border-bottom: 1px solid #333; +padding: 1px 5px; +} diff --git a/css/all.css b/css/all.css index 83d9dfe..c3f45b4 100644 --- a/css/all.css +++ b/css/all.css @@ -260,10 +260,10 @@ margin-top: 2px; /* Drop menu show after */ -.show-after { +.show-after, .show-since { padding: 3px 0; } -.show-after .menu-item { +.show-after .menu-item, .show-since .menu-item { display: inline; padding-right: 5px; } @@ -273,6 +273,12 @@ border: 1px solid transparent; border-bottom: 1px solid #333; padding: 1px 5px; } +.show-since #show-since-day { +width: 17px; +border: 1px solid transparent; +border-bottom: 1px solid #333; +padding: 1px 5px; +} diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index b9dd4db..f2a17c3 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -10,13 +10,13 @@ class ActivityList extends Class @filter_hub = null @filter_language_ids = null @show_after_date = 0 + @show_since_day = 0 queryActivities: (cb) -> if @filter_language_ids where = "WHERE (comment_id, json_id) IN #{@filter_language_ids} AND date_added < #{Time.timestamp()+120} " else if @directories == "all" - if Page.local_storage.settings.show_one_month_ago || \ - Page.local_storage.settings.show_one_day_ago || \ + if Page.local_storage.settings.show_since || \ Page.local_storage.settings.show_after where = "WHERE date_added < #{Time.timestamp()+120} " else @@ -30,10 +30,9 @@ class ActivityList extends Class if Page.local_storage.settings.show_after this.show_after_date = Page.local_storage.settings.show_after - 1 where += "AND date_added > " + String(this.show_after_date) + " " - else if Page.local_storage.settings.show_one_day_ago - where += "AND date_added > strftime('%s', 'now') - 3600*24 " - else if Page.local_storage.settings.show_one_month_ago - where += "AND date_added > strftime('%s', 'now') - 3600*24*30 " + else if Page.local_storage.settings.show_since + this.show_since_day = Page.local_storage.settings.show_since + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " " query = """ SELECT @@ -74,8 +73,7 @@ class ActivityList extends Class LEFT JOIN follow USING (json_id) #{where} """ - if Page.local_storage.settings.show_one_month_ago || \ - Page.local_storage.settings.show_one_day_ago || \ + if Page.local_storage.settings.show_since || \ Page.local_storage.settings.show_after query += """ diff --git a/js/Head.coffee b/js/Head.coffee index 889cf1e..54f66c6 100644 --- a/js/Head.coffee +++ b/js/Head.coffee @@ -55,22 +55,14 @@ class Head extends Class Page.content.need_update = true return false ), Page.local_storage.settings.show_after] - @menu.items.push ["Show posts since one day ago", ( (item) => - Page.local_storage.settings.show_one_day_ago = not Page.local_storage.settings.show_one_day_ago - item[2] = Page.local_storage.settings.show_one_day_ago + @menu.items.push ["Show posts since", ( (item) => + Page.local_storage.settings.show_since = document.getElementById("show-since-day").value + item[2] = Page.local_storage.settings.show_since Page.projector.scheduleRender() Page.saveLocalStorage() Page.content.need_update = true return false - ), Page.local_storage.settings.show_one_day_ago] - @menu.items.push ["Show posts since one month ago", ( (item) => - Page.local_storage.settings.show_one_month_ago = not Page.local_storage.settings.show_month_day_ago - item[2] = Page.local_storage.settings.show_one_month_ago - Page.projector.scheduleRender() - Page.saveLocalStorage() - Page.content.need_update = true - return false - ), Page.local_storage.settings.show_one_month_ago] + ), Page.local_storage.settings.show_since] if (key for key of Page.user_hubs).length > 1 diff --git a/js/PostList.coffee b/js/PostList.coffee index 2cfd785..7e6ad4b 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -10,10 +10,10 @@ class PostList extends Class @filter_language_ids = null @limit = 10 @show_after_date = 0 + @show_since_day = 0 queryComments: (post_uris, cb) => - if Page.local_storage.settings.show_one_month_ago || \ - Page.local_storage.settings.show_one_day_ago || \ + if Page.local_storage.settings.show_since || \ Page.local_storage.settings.show_after query = " SELECT @@ -66,12 +66,10 @@ class PostList extends Class if Page.local_storage.settings.show_after this.show_after_date = Page.local_storage.settings.show_after - 1 where += "AND date_added > " + String(this.show_after_date) + " " - else if Page.local_storage.settings.show_one_day_ago - where += "AND date_added > strftime('%s', 'now') - 3600*24 " - else if Page.local_storage.settings.show_one_month_ago - where += "AND date_added > strftime('%s', 'now') - 3600*24*30 " - if Page.local_storage.settings.show_one_month_ago || \ - Page.local_storage.settings.show_one_day_ago || \ + else if Page.local_storage.settings.show_since + this.show_since_day = Page.local_storage.settings.show_since + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " " + if Page.local_storage.settings.show_since || \ Page.local_storage.settings.show_after query = " SELECT diff --git a/js/ZeroMe.coffee b/js/ZeroMe.coffee index 9d5169a..8f95309 100644 --- a/js/ZeroMe.coffee +++ b/js/ZeroMe.coffee @@ -157,6 +157,7 @@ class ZeroMe extends ZeroFrame @local_storage.followed_users ?= {} @local_storage.settings ?= {} @local_storage.settings.show_after ?= "" + @local_storage.settings.show_since ?= "" @on_local_storage.resolve(@local_storage) loadLocalStorage: -> @@ -168,6 +169,7 @@ class ZeroMe extends ZeroFrame @local_storage.followed_users ?= {} @local_storage.settings ?= {} @local_storage.settings.show_after ?= "" + @local_storage.settings.show_since ?= "" @on_local_storage.resolve(@local_storage) diff --git a/js/all.js b/js/all.js index b1fd091..338dc94 100644 --- a/js/all.js +++ b/js/all.js @@ -1989,6 +1989,15 @@ function clone(obj) { placeholder: "unix time", value: selected })); + } else if (title === "Show posts since") { + return h("div.show-since", h("a.menu-item", { + href: href, + onclick: onclick, + key: title + }, [title]), h("input#show-since-day", { + placeholder: " n ", + value: selected + }), " days ago"); } else { return h("a.menu-item", { href: href, @@ -2035,7 +2044,6 @@ function clone(obj) { }).call(this); - /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Overlay.coffee ---- */ @@ -2960,7 +2968,8 @@ function clone(obj) { this.update_timer = null; this.filter_hub = null; this.filter_language_ids = null; - this.show_after_date = 1471946844; + this.show_after_date = 0; + this.show_since_day = 0; } ActivityList.prototype.queryActivities = function(cb) { @@ -2968,7 +2977,7 @@ function clone(obj) { if (this.filter_language_ids) { where = "WHERE (comment_id, json_id) IN " + this.filter_language_ids + " AND date_added < " + (Time.timestamp() + 120) + " "; } else if (this.directories === "all") { - if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { where = "WHERE date_added < " + (Time.timestamp() + 120) + " "; } else { where = "WHERE date_added > " + (Time.timestamp() - 60 * 60 * 24 * 2) + " AND date_added < " + (Time.timestamp() + 120) + " "; @@ -2979,14 +2988,11 @@ function clone(obj) { where = "WHERE json.directory IN " + (Text.sqlIn(this.directories)) + " AND date_added < " + (Time.timestamp() + 120) + " "; } if (Page.local_storage.settings.show_after) { - if (document.getElementById("show-after-date")) { - this.show_after_date = document.getElementById("show-after-date").value - 121; - } + this.show_after_date = Page.local_storage.settings.show_after - 1; where += "AND date_added > " + String(this.show_after_date) + " "; - } else if (Page.local_storage.settings.show_one_day_ago) { - where += "AND date_added > strftime('%s', 'now') - 3600*24 "; - } else if (Page.local_storage.settings.show_one_month_ago) { - where += "AND date_added > strftime('%s', 'now') - 3600*24*30 "; + } else if (Page.local_storage.settings.show_since) { + this.show_since_day = Page.local_storage.settings.show_since; + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " "; } query = "SELECT\n 'comment' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n comment\nLEFT JOIN json USING (json_id)\n " + where; if (!this.filter_language_ids) { @@ -2995,7 +3001,7 @@ function clone(obj) { if (this.directories !== "all") { query += "\nUNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; } - if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { query += "\nORDER BY date_added ASC\nLIMIT " + (this.limit + 1); } else { query += "\nORDER BY date_added DESC\nLIMIT " + (this.limit + 1); @@ -3236,6 +3242,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/AnonUser.coffee ---- */ @@ -4545,24 +4552,14 @@ function clone(obj) { }), Page.local_storage.settings.show_after ]); _this.menu.items.push([ - "Show posts since one day ago", (function(item) { - Page.local_storage.settings.show_one_day_ago = !Page.local_storage.settings.show_one_day_ago; - item[2] = Page.local_storage.settings.show_one_day_ago; + "Show posts since", (function(item) { + Page.local_storage.settings.show_since = document.getElementById("show-since-day").value; + item[2] = Page.local_storage.settings.show_since; Page.projector.scheduleRender(); Page.saveLocalStorage(); Page.content.need_update = true; return false; - }), Page.local_storage.settings.show_one_day_ago - ]); - _this.menu.items.push([ - "Show posts since one month ago", (function(item) { - Page.local_storage.settings.show_one_month_ago = !Page.local_storage.settings.show_month_day_ago; - item[2] = Page.local_storage.settings.show_one_month_ago; - Page.projector.scheduleRender(); - Page.saveLocalStorage(); - Page.content.need_update = true; - return false; - }), Page.local_storage.settings.show_one_month_ago + }), Page.local_storage.settings.show_since ]); if (((function() { var results; @@ -5305,12 +5302,13 @@ function clone(obj) { this.filter_hub = null; this.filter_language_ids = null; this.limit = 10; - this.show_after_date = 1471946844; + this.show_after_date = 0; + this.show_since_day = 0; } PostList.prototype.queryComments = function(post_uris, cb) { var query; - if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added ASC"; } else { query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added DESC"; @@ -5354,16 +5352,13 @@ function clone(obj) { where += "AND post_id > 1 "; } if (Page.local_storage.settings.show_after) { - if (document.getElementById("show-after-date")) { - this.show_after_date = document.getElementById("show-after-date").value - 121; - } + this.show_after_date = Page.local_storage.settings.show_after - 1; where += "AND date_added > " + String(this.show_after_date) + " "; - } else if (Page.local_storage.settings.show_one_day_ago) { - where += "AND date_added > strftime('%s', 'now') - 3600*24 "; - } else if (Page.local_storage.settings.show_one_month_ago) { - where += "AND date_added > strftime('%s', 'now') - 3600*24*30 "; + } else if (Page.local_storage.settings.show_since) { + this.show_since_day = Page.local_storage.settings.show_since; + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " "; } - if (Page.local_storage.settings.show_one_month_ago || Page.local_storage.settings.show_one_day_ago || Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added ASC LIMIT " + (this.limit + 1); } else { query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added DESC LIMIT " + (this.limit + 1); @@ -5509,6 +5504,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostMeta.coffee ---- */ @@ -6643,7 +6639,7 @@ function clone(obj) { return this.on_site_info.then((function(_this) { return function() { return _this.cmd("userGetSettings", [], function(res) { - var base1, base2, base3; + var base1, base2, base3, base4; if (!res || res.error) { return _this.loadLocalStorage(); } else { @@ -6655,7 +6651,10 @@ function clone(obj) { base2.settings = {}; } if ((base3 = _this.local_storage.settings).show_after == null) { - base3.show_after = 1471946844; + base3.show_after = ""; + } + if ((base4 = _this.local_storage.settings).show_since == null) { + base4.show_since = ""; } return _this.on_local_storage.resolve(_this.local_storage); } @@ -6669,7 +6668,7 @@ function clone(obj) { return function() { _this.logStart("Loaded localstorage"); return _this.cmd("wrapperGetLocalStorage", [], function(local_storage) { - var base1, base2, base3; + var base1, base2, base3, base4; _this.local_storage = local_storage; _this.logEnd("Loaded localstorage"); if (_this.local_storage == null) { @@ -6681,8 +6680,11 @@ function clone(obj) { if ((base2 = _this.local_storage).settings == null) { base2.settings = {}; } - if ((base3 = _this.local_storage).show_after == null) { - base3.show_after = 1471946844; + if ((base3 = _this.local_storage.settings).show_after == null) { + base3.show_after = ""; + } + if ((base4 = _this.local_storage.settings).show_since == null) { + base4.show_since = ""; } return _this.on_local_storage.resolve(_this.local_storage); }); diff --git a/js/utils/Menu.coffee b/js/utils/Menu.coffee index 4febf1b..80acbc4 100644 --- a/js/utils/Menu.coffee +++ b/js/utils/Menu.coffee @@ -68,6 +68,13 @@ class Menu h("input#show-after-date", { placeholder: "unix time", value: selected })) + else if title == "Show posts since" + h("div.show-since", + h("a.menu-item", { + href: href, onclick: onclick, key: title}, [title]), + h("input#show-since-day", { + placeholder: " n ", value: selected + },)," days ago") else h("a.menu-item", {href: href, onclick: onclick, key: title, classes: {"selected": selected}}, [title]) From 899ff5eb524304e708246b0734f18b56ec3bb3fd Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 14 Feb 2018 23:15:12 +0800 Subject: [PATCH 23/26] Save language filter settings --- js/ContentFeed.coffee | 4 ++++ js/ZeroMe.coffee | 2 ++ js/all.js | 18 +++++++++++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index 0e92097..e2892c3 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -30,6 +30,9 @@ class ContentFeed extends Class @type = e.currentTarget.attributes.type.value if @type == "everyone" @filter_lang_list = {} + else if @type == "lang" + Page.local_storage.settings.filter_lang_list = @filter_lang_list + Page.saveLocalStorage() @post_list.limit = 10 @activity_list.limit = 10 @update() @@ -65,6 +68,7 @@ class ContentFeed extends Class return false renderFilterLanguage: => + @filter_lang_list = Page.local_storage.settings.filter_lang_list langs = Object.keys(@language_dict) h("div.menu-radio", diff --git a/js/ZeroMe.coffee b/js/ZeroMe.coffee index 8f95309..771b721 100644 --- a/js/ZeroMe.coffee +++ b/js/ZeroMe.coffee @@ -158,6 +158,7 @@ class ZeroMe extends ZeroFrame @local_storage.settings ?= {} @local_storage.settings.show_after ?= "" @local_storage.settings.show_since ?= "" + @local_storage.settings.filter_lang_list ?= {} @on_local_storage.resolve(@local_storage) loadLocalStorage: -> @@ -170,6 +171,7 @@ class ZeroMe extends ZeroFrame @local_storage.settings ?= {} @local_storage.settings.show_after ?= "" @local_storage.settings.show_since ?= "" + @local_storage.settings.filter_lang_list ?= {} @on_local_storage.resolve(@local_storage) diff --git a/js/all.js b/js/all.js index 338dc94..f3917d2 100644 --- a/js/all.js +++ b/js/all.js @@ -3242,7 +3242,6 @@ function clone(obj) { }).call(this); - /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/AnonUser.coffee ---- */ @@ -3647,6 +3646,9 @@ function clone(obj) { this.type = e.currentTarget.attributes.type.value; if (this.type === "everyone") { this.filter_lang_list = {}; + } else if (this.type === "lang") { + Page.local_storage.settings.filter_lang_list = this.filter_lang_list; + Page.saveLocalStorage(); } this.post_list.limit = 10; this.activity_list.limit = 10; @@ -3703,6 +3705,7 @@ function clone(obj) { ContentFeed.prototype.renderFilterLanguage = function() { var lang, langs; + this.filter_lang_list = Page.local_storage.settings.filter_lang_list; langs = Object.keys(this.language_dict); return h("div.menu-radio", h("a.all", { href: "#all", @@ -5504,7 +5507,6 @@ function clone(obj) { }).call(this); - /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostMeta.coffee ---- */ @@ -6639,7 +6641,7 @@ function clone(obj) { return this.on_site_info.then((function(_this) { return function() { return _this.cmd("userGetSettings", [], function(res) { - var base1, base2, base3, base4; + var base1, base2, base3, base4, base5; if (!res || res.error) { return _this.loadLocalStorage(); } else { @@ -6656,6 +6658,9 @@ function clone(obj) { if ((base4 = _this.local_storage.settings).show_since == null) { base4.show_since = ""; } + if ((base5 = _this.local_storage.settings).filter_lang_list == null) { + base5.filter_lang_list = {}; + } return _this.on_local_storage.resolve(_this.local_storage); } }); @@ -6668,7 +6673,7 @@ function clone(obj) { return function() { _this.logStart("Loaded localstorage"); return _this.cmd("wrapperGetLocalStorage", [], function(local_storage) { - var base1, base2, base3, base4; + var base1, base2, base3, base4, base5; _this.local_storage = local_storage; _this.logEnd("Loaded localstorage"); if (_this.local_storage == null) { @@ -6686,6 +6691,9 @@ function clone(obj) { if ((base4 = _this.local_storage.settings).show_since == null) { base4.show_since = ""; } + if ((base5 = _this.local_storage.settings).filter_lang_list == null) { + base5.filter_lang_list = {}; + } return _this.on_local_storage.resolve(_this.local_storage); }); }; @@ -6934,4 +6942,4 @@ function clone(obj) { window.Page.createProjector(); -}).call(this); \ No newline at end of file +}).call(this); From c020f013a912b8522c427becbd9eaaad93e9a879 Mon Sep 17 00:00:00 2001 From: BinChan Date: Thu, 15 Feb 2018 14:36:56 +0800 Subject: [PATCH 24/26] Setting "Show posts since 0 day" will still show posts in ordinary order, useful to view new posts without removing the timestamp (unix time) --- js/ActivityList.coffee | 23 +++++++++-------- js/Head.coffee | 16 ++++++------ js/PostList.coffee | 24 ++++++++++-------- js/all.js | 56 ++++++++++++++++++++++++------------------ 4 files changed, 67 insertions(+), 52 deletions(-) diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index f2a17c3..6fbbaa2 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -9,15 +9,16 @@ class ActivityList extends Class @update_timer = null @filter_hub = null @filter_language_ids = null - @show_after_date = 0 - @show_since_day = 0 + @show_after_date = "0" + @show_since_day = "0" queryActivities: (cb) -> if @filter_language_ids where = "WHERE (comment_id, json_id) IN #{@filter_language_ids} AND date_added < #{Time.timestamp()+120} " else if @directories == "all" - if Page.local_storage.settings.show_since || \ - Page.local_storage.settings.show_after + if (Page.local_storage.settings.show_since || \ + Page.local_storage.settings.show_after) && \ + Page.local_storage.settings.show_since != "0" where = "WHERE date_added < #{Time.timestamp()+120} " else where = "WHERE date_added > #{Time.timestamp()-60*60*24*2} AND date_added < #{Time.timestamp()+120} " @@ -27,12 +28,13 @@ class ActivityList extends Class else where = "WHERE json.directory IN #{Text.sqlIn(@directories)} AND date_added < #{Time.timestamp()+120} " - if Page.local_storage.settings.show_after + if Page.local_storage.settings.show_since + if Page.local_storage.settings.show_since != "0" + this.show_since_day = Page.local_storage.settings.show_since + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " " + else if Page.local_storage.settings.show_after this.show_after_date = Page.local_storage.settings.show_after - 1 where += "AND date_added > " + String(this.show_after_date) + " " - else if Page.local_storage.settings.show_since - this.show_since_day = Page.local_storage.settings.show_since - where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " " query = """ SELECT @@ -73,8 +75,9 @@ class ActivityList extends Class LEFT JOIN follow USING (json_id) #{where} """ - if Page.local_storage.settings.show_since || \ - Page.local_storage.settings.show_after + if (Page.local_storage.settings.show_since || \ + Page.local_storage.settings.show_after) && \ + Page.local_storage.settings.show_since != "0" query += """ ORDER BY date_added ASC diff --git a/js/Head.coffee b/js/Head.coffee index 54f66c6..939c7c0 100644 --- a/js/Head.coffee +++ b/js/Head.coffee @@ -47,14 +47,6 @@ class Head extends Class return false ), Page.local_storage.settings.hide_hello_zerome] @menu.items.push ["---"] - @menu.items.push ["Show posts after", ( (item) => - Page.local_storage.settings.show_after = document.getElementById("show-after-date").value - item[2] = Page.local_storage.settings.show_after - Page.projector.scheduleRender() - Page.saveLocalStorage() - Page.content.need_update = true - return false - ), Page.local_storage.settings.show_after] @menu.items.push ["Show posts since", ( (item) => Page.local_storage.settings.show_since = document.getElementById("show-since-day").value item[2] = Page.local_storage.settings.show_since @@ -63,6 +55,14 @@ class Head extends Class Page.content.need_update = true return false ), Page.local_storage.settings.show_since] + @menu.items.push ["Show posts after", ( (item) => + Page.local_storage.settings.show_after = document.getElementById("show-after-date").value + item[2] = Page.local_storage.settings.show_after + Page.projector.scheduleRender() + Page.saveLocalStorage() + Page.content.need_update = true + return false + ), Page.local_storage.settings.show_after] if (key for key of Page.user_hubs).length > 1 diff --git a/js/PostList.coffee b/js/PostList.coffee index 7e6ad4b..ce80f42 100644 --- a/js/PostList.coffee +++ b/js/PostList.coffee @@ -9,12 +9,13 @@ class PostList extends Class @filter_hub = null @filter_language_ids = null @limit = 10 - @show_after_date = 0 - @show_since_day = 0 + @show_after_date = "0" + @show_since_day = "0" queryComments: (post_uris, cb) => - if Page.local_storage.settings.show_since || \ - Page.local_storage.settings.show_after + if (Page.local_storage.settings.show_since || \ + Page.local_storage.settings.show_after) && \ + Page.local_storage.settings.show_since != "0" query = " SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site @@ -63,14 +64,17 @@ class PostList extends Class if Page.local_storage.settings.hide_hello_zerome where += "AND post_id > 1 " - if Page.local_storage.settings.show_after + if Page.local_storage.settings.show_since + if Page.local_storage.settings.show_since != "0" + this.show_since_day = Page.local_storage.settings.show_since + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " " + else if Page.local_storage.settings.show_after this.show_after_date = Page.local_storage.settings.show_after - 1 where += "AND date_added > " + String(this.show_after_date) + " " - else if Page.local_storage.settings.show_since - this.show_since_day = Page.local_storage.settings.show_since - where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " " - if Page.local_storage.settings.show_since || \ - Page.local_storage.settings.show_after + + if (Page.local_storage.settings.show_since || \ + Page.local_storage.settings.show_after) && \ + Page.local_storage.settings.show_since != "0" query = " SELECT * diff --git a/js/all.js b/js/all.js index f3917d2..d2cbda2 100644 --- a/js/all.js +++ b/js/all.js @@ -2968,8 +2968,8 @@ function clone(obj) { this.update_timer = null; this.filter_hub = null; this.filter_language_ids = null; - this.show_after_date = 0; - this.show_since_day = 0; + this.show_after_date = "0"; + this.show_since_day = "0"; } ActivityList.prototype.queryActivities = function(cb) { @@ -2977,7 +2977,7 @@ function clone(obj) { if (this.filter_language_ids) { where = "WHERE (comment_id, json_id) IN " + this.filter_language_ids + " AND date_added < " + (Time.timestamp() + 120) + " "; } else if (this.directories === "all") { - if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { + if ((Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) && Page.local_storage.settings.show_since !== "0") { where = "WHERE date_added < " + (Time.timestamp() + 120) + " "; } else { where = "WHERE date_added > " + (Time.timestamp() - 60 * 60 * 24 * 2) + " AND date_added < " + (Time.timestamp() + 120) + " "; @@ -2987,12 +2987,14 @@ function clone(obj) { } else { where = "WHERE json.directory IN " + (Text.sqlIn(this.directories)) + " AND date_added < " + (Time.timestamp() + 120) + " "; } - if (Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_since) { + if (Page.local_storage.settings.show_since !== "0") { + this.show_since_day = Page.local_storage.settings.show_since; + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " "; + } + } else if (Page.local_storage.settings.show_after) { this.show_after_date = Page.local_storage.settings.show_after - 1; where += "AND date_added > " + String(this.show_after_date) + " "; - } else if (Page.local_storage.settings.show_since) { - this.show_since_day = Page.local_storage.settings.show_since; - where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " "; } query = "SELECT\n 'comment' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n comment\nLEFT JOIN json USING (json_id)\n " + where; if (!this.filter_language_ids) { @@ -3001,7 +3003,7 @@ function clone(obj) { if (this.directories !== "all") { query += "\nUNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; } - if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { + if ((Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) && Page.local_storage.settings.show_since !== "0") { query += "\nORDER BY date_added ASC\nLIMIT " + (this.limit + 1); } else { query += "\nORDER BY date_added DESC\nLIMIT " + (this.limit + 1); @@ -3242,6 +3244,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/AnonUser.coffee ---- */ @@ -3982,6 +3985,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentProfile.coffee ---- */ @@ -4545,24 +4549,24 @@ function clone(obj) { ]); _this.menu.items.push(["---"]); _this.menu.items.push([ - "Show posts after", (function(item) { - Page.local_storage.settings.show_after = document.getElementById("show-after-date").value; - item[2] = Page.local_storage.settings.show_after; + "Show posts since", (function(item) { + Page.local_storage.settings.show_since = document.getElementById("show-since-day").value; + item[2] = Page.local_storage.settings.show_since; Page.projector.scheduleRender(); Page.saveLocalStorage(); Page.content.need_update = true; return false; - }), Page.local_storage.settings.show_after + }), Page.local_storage.settings.show_since ]); _this.menu.items.push([ - "Show posts since", (function(item) { - Page.local_storage.settings.show_since = document.getElementById("show-since-day").value; - item[2] = Page.local_storage.settings.show_since; + "Show posts after", (function(item) { + Page.local_storage.settings.show_after = document.getElementById("show-after-date").value; + item[2] = Page.local_storage.settings.show_after; Page.projector.scheduleRender(); Page.saveLocalStorage(); Page.content.need_update = true; return false; - }), Page.local_storage.settings.show_since + }), Page.local_storage.settings.show_after ]); if (((function() { var results; @@ -4669,6 +4673,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/Post.coffee ---- */ @@ -5305,13 +5310,13 @@ function clone(obj) { this.filter_hub = null; this.filter_language_ids = null; this.limit = 10; - this.show_after_date = 0; - this.show_since_day = 0; + this.show_after_date = "0"; + this.show_since_day = "0"; } PostList.prototype.queryComments = function(post_uris, cb) { var query; - if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { + if ((Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) && Page.local_storage.settings.show_since !== "0") { query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added ASC"; } else { query = "SELECT post_uri, comment.body, comment.date_added, comment.comment_id, json.cert_auth_type, json.cert_user_id, json.user_name, json.hub, json.directory, json.site FROM comment LEFT JOIN json USING (json_id) WHERE ? AND date_added < " + (Time.timestamp() + 120) + " ORDER BY date_added DESC"; @@ -5354,14 +5359,16 @@ function clone(obj) { if (Page.local_storage.settings.hide_hello_zerome) { where += "AND post_id > 1 "; } - if (Page.local_storage.settings.show_after) { + if (Page.local_storage.settings.show_since) { + if (Page.local_storage.settings.show_since !== "0") { + this.show_since_day = Page.local_storage.settings.show_since; + where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " "; + } + } else if (Page.local_storage.settings.show_after) { this.show_after_date = Page.local_storage.settings.show_after - 1; where += "AND date_added > " + String(this.show_after_date) + " "; - } else if (Page.local_storage.settings.show_since) { - this.show_since_day = Page.local_storage.settings.show_since; - where += "AND date_added > strftime('%s', 'now') - 3600*24*" + String(this.show_since_day) + " "; } - if (Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) { + if ((Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) && Page.local_storage.settings.show_since !== "0") { query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added ASC LIMIT " + (this.limit + 1); } else { query = "SELECT * FROM post LEFT JOIN json ON (post.json_id = json.json_id) " + where + " ORDER BY date_added DESC LIMIT " + (this.limit + 1); @@ -5507,6 +5514,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostMeta.coffee ---- */ From d008b39d28aaed28ea5004c1cc86d79f7c5e972a Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 5 Jun 2019 14:56:43 +0800 Subject: [PATCH 25/26] Updated from upstream --- README.md | 3 +++ content.json | 13 +++++++---- css/Button.css | 4 ++-- css/Comment.css | 6 +++-- css/Head.css | 4 ++-- css/dark.css | 50 ++++++++++++++++++++++++++++++++++++++++ css/mobile.css | 13 ++++------- dbschema.json | 2 +- index.html | 6 ++--- js/ActivityList.coffee | 3 +-- js/ContentFeed.coffee | 2 +- js/ContentProfile.coffee | 4 ++-- js/Post.coffee | 5 ++-- js/lib/marked.min.js | 6 ++--- js/utils/Autosize.coffee | 47 ++++++++++++++++++++++++------------- js/utils/Text.coffee | 13 +++++++---- languages/it.json | 26 ++++++++++----------- languages/sk.json | 8 ++++--- 18 files changed, 146 insertions(+), 69 deletions(-) create mode 100644 css/dark.css diff --git a/README.md b/README.md index 46cc391..224ffe9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,5 @@ # ZeroMe + Social network for ZeroNet + +![Screenshot](http://funkyimg.com/i/2BKNE.png) diff --git a/content.json b/content.json index 8180a9a..ea7e9a3 100644 --- a/content.json +++ b/content.json @@ -1,6 +1,7 @@ { "address": "1MeFqFfFFGQfa1J3gJyYYUvb5Lksczq7nH", "background-color": "#F2F4F6", + "background-color-dark": "#242424", "cloneable": true, "description": "Social site", "domain": "Me.ZeroNetwork.bit", @@ -78,6 +79,10 @@ "sha512": "dfd554eca364f1fb86ecedc98866638dee8c2118bedbf9b32fee797ec6b60fe4", "size": 3491 }, + "languages/sk.json": { + "sha512": "779e69b2a6750847438458971431b0406047784314c1c30a66f6b03091d378c1", + "size": 3518 + }, "languages/tr.json": { "sha512": "d9df6b218bcf359766ee3416a0cf4b4a3e9181601a7106957f674b22a79aa07a", "size": 3428 @@ -101,9 +106,9 @@ "postmessage_nonce_security": true, "settings": { "default_hubs": { - "1White24UrrwQrD86o6Vrc1apgZ1x1o51": { + "1MoonP8t4rk9QamBUPh5Aspkwa1Xhf5ux2": { "description": "Hub for ZeroMe users. Runner: Nofish", - "title": "White hub" + "title": "Moon hub" } } }, @@ -115,5 +120,5 @@ "title": "ZeroMe", "translate": ["js/all.js"], "viewport": "width=device-width, initial-scale=0.8", - "zeronet_version": "0.5.7" -} \ No newline at end of file + "zeronet_version": "0.6.0" +} diff --git a/css/Button.css b/css/Button.css index cc4a8bf..0dd8d6c 100644 --- a/css/Button.css +++ b/css/Button.css @@ -8,7 +8,7 @@ .button:active { transform: translateY(1px); transition: all 0.3s, transform none; box-shadow: inset 0px 5px 7px -3px rgba(212, 212, 212, 0.41); outline: none; transition: none } .button.loading { - color: rgba(0,0,0,0) !important; background: url(../img/loading.gif) no-repeat center center !important; border-color: rgba(0,0,0,0) !important; + color: rgba(0,0,0,0) !important; background: rgba(128, 128, 128, 0.5) url(../img/loading.gif) no-repeat center center !important; border-color: rgba(0,0,0,0) !important; transition: all 0.5s ease-out; pointer-events: none; transition-delay: 0.5s } @@ -24,7 +24,7 @@ padding: 12px 30px; border-radius: 3px; margin-top: 11px; background-color: #5d68ff; /*box-shadow: 0px 1px 4px rgba(93, 104, 255, 0.41);*/ border: none; border-bottom: 2px solid #4952c7; font-weight: bold; color: #ffffff; font-size: 12px; text-transform: uppercase; margin-left: 10px; } -.button-submit:hover { color: white; background-color: #6d78ff } +.button-submit:hover, .button-submit:focus { color: white; background-color: #6d78ff } .button-small { padding: 7px 20px; margin-left: 10px } .button-outline { background-color: white; border: 1px solid #EEE; border-bottom: 2px solid #EEE; color: #AAA; } diff --git a/css/Comment.css b/css/Comment.css index 2019e8b..547c99c 100644 --- a/css/Comment.css +++ b/css/Comment.css @@ -5,7 +5,9 @@ .comment-list .body { padding-top: 0px } .comment-list .body p { padding: 0px } -.comment-create textarea { width: 100%; margin-bottom: 11px; box-sizing: border-box; } +.comment-create { position: relative; } +.comment-create textarea { width: 100%; margin-bottom: 11px; box-sizing: border-box; padding-right: 90px; } +.comment-create .button-submit { right: 13px; position: absolute; bottom: 23px; } .comment { padding-top: 10px } .comment-list .comment .user { padding-bottom: 0px; white-space: nowrap; line-height: 15px; } .comment .body { padding-top: 4px; padding-bottom: 10px; } @@ -15,4 +17,4 @@ .comment .icon-reply:hover { opacity: 1; transition: none } .comment .user .name { line-height: 16px; } -.comment h1, .comment h2, .comment h3, .comment h4, .comment h5, .comment h6 { font-size: inherit; font-weight: bold } \ No newline at end of file +.comment h1, .comment h2, .comment h3, .comment h4, .comment h5, .comment h6 { font-size: inherit; font-weight: bold } diff --git a/css/Head.css b/css/Head.css index 12fa469..a93911a 100644 --- a/css/Head.css +++ b/css/Head.css @@ -11,7 +11,7 @@ .head .user .address { display: block } .head .settings { display: inline-block; height: 50px; width: 50px; text-align: center; vertical-align: middle; transition: all 0.3s; - border-left: 1px solid #EEE; line-height: 50px; font-size: 20px; color: #AAA; font-weight: normal; text-decoration: none; + border-left: 1px solid rgba(0, 0, 0, 0.05); line-height: 50px; font-size: 20px; color: #AAA; font-weight: normal; text-decoration: none; } .head .settings:hover { color: #5d68ff; background-color: #FAFAFA; transition: none } .head .settings:active { background-color: #F5F5F5; transition: none } @@ -20,4 +20,4 @@ @media screen and (max-width: 1100px) { .head .right { margin-right: 80px; } -} \ No newline at end of file +} diff --git a/css/dark.css b/css/dark.css new file mode 100644 index 0000000..812a02e --- /dev/null +++ b/css/dark.css @@ -0,0 +1,50 @@ +.theme-dark { background-color: #26242E; color: white; } +.theme-dark .head-container { background-color: #2b293e; } + +.theme-dark #Overlay.visible { background-color: rgba(53, 52, 60, 0.89); } + +.theme-dark a { color: #58dbec } +.theme-dark .menu-item { color: #000 } +.theme-dark .post .user .settings:hover { color: #FFF } + +.theme-dark .head .user .name { color: #58dbec } +.theme-dark .user .name { color: #58dbec } +.theme-dark .post-list-type a { color: #adadad; } +.theme-dark .post-list-type a:hover { color: #58dbec; border-bottom-color: #58dbec } +.theme-dark .post-list-type .active { color: #58dbec; border-bottom-color: #58dbec } + +.theme-dark .post-create .postfield { border-color: #4e5a5c; } +.theme-dark .post-create.editing { box-shadow: 0px 1px 13px 1px #111213 } + +.theme-dark .button-submit { color: #FFF } +.theme-dark .button-outline { color: #5e5a6d; } + +.theme-dark .post .body { color: #dcd9e5; } +.theme-dark .post { background-color: #302c3f; border: none; border-radius: 0px; } +.theme-dark .comment-list { background-color: #2c2939; border-top-color: #423d53 } +.theme-dark .post .img .fullsize { background-color: #33313c } +.theme-dark .post .reply-name { color: white } +.theme-dark .post .user .address, .theme-dark .post .added, .theme-dark .post .sep { color: #bdb5da } +.theme-dark .post .body a { color: #58dbec } +.theme-dark .post blockquote { border-left: 3px solid #47dbec; } + +.theme-dark .activity-list .items a { color: #a398c4 } +.theme-dark .activity { color: #8e899c } +.theme-dark .activity-list .bg-line { background-color: #38334b } +.theme-dark .activity-list .circle { border-color: #4b465a; background-color: #26242e } +.theme-dark .activity:last-child { background-color: #26242e; } + +.theme-dark input.text, .theme-dark textarea { background-color: #26242e; border-color: #4e5a5c; color: white; } +.theme-dark .card { box-shadow: 0px 1px 11px #26242e; background-color: #302c3f; } + +.theme-dark .button-follow:hover { background-color: rgba(74, 160, 177, 0.1) !important; border-color: #55cedf !important; color: #55cedf !important } +.theme-dark .users.gray .button-follow { border: 1px solid #3b8297 } +.theme-dark .user.notseeding .button-follow { border-color: #393251 } +.theme-dark h2.sep { border-top: 1px solid #495355; } + +.theme-dark .post code { background-color: #232323; border-color: #0A0A0A; color: #d3d3d3; } +.theme-dark .icon-heart.active { color: #58dbec; filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); } +.theme-dark .post .actions .link.active { color: #58dbec; } + +.theme-dark .button-follow-big:hover { background-color: #3b374a; } +.theme-dark .maxheight-limited:before { background: linear-gradient(rgba(38, 36, 46, 0), #302c3f 70%); } diff --git a/css/mobile.css b/css/mobile.css index 5536df7..41a5806 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -10,14 +10,12 @@ font-size: medium !important; .head-container { position: fixed; -background-color: #fff; width: 100%; height: 50px; z-index: 30; } .head { width: 100%; -background-color: #fff; } .head .logo { margin-left: 50px; @@ -35,7 +33,6 @@ margin-top: 60px; margin-bottom: 5px; } .col-center { -background-color: #f6f7f8; width: 100%; overflow: auto; padding-left: 5px; @@ -61,6 +58,9 @@ overflow-y: auto; z-index: 1; transition: 0.3s all cubic-bezier(0.77, 0, 0.175, 1); } +.theme-dark .col-left, .theme-dark .col-right { +background-color: #242424; +} .trigger-on .col-left, .trigger-on .col-right { left: 0px; box-shadow: 0px 0px 30px #999; @@ -74,13 +74,13 @@ top: 3px; width: 40px; height: 40px; z-index: 100; -border: 1px solid #bbb; +border: 1px solid rgba(187, 187, 187, 0.32); border-radius: 5px; } #Trigger .icon { background-image: url(../img/nav-icon.png); display: block; -border: 12px solid #fff; +border: 12px solid transparent; height: 16px; outline: none; border-radius: 5px; @@ -90,7 +90,6 @@ opacity: 1; filter: none; } .user.card { -background-color: #f6f7f8; box-shadow: none; margin-top: 10px; margin-left: -15px; @@ -101,8 +100,6 @@ margin-bottom: 0px; .more.small { padding: 10px; margin-bottom: 5px; -background-color: #fff; -border: 1px solid #eef0f1; border-radius: 5px; } .post-create .icon-image { diff --git a/dbschema.json b/dbschema.json index b60aefe..0085c5a 100644 --- a/dbschema.json +++ b/dbschema.json @@ -7,7 +7,7 @@ "to_json_table": [ "cert_auth_type", "cert_user_id" ], "to_table": ["user"] }, - ".+/data/userdb/users.json": { + ".+/data/userdb/users.*json": { "to_table": ["user"] }, ".+/data/users/.+/content.json": { diff --git a/index.html b/index.html index 4a07d78..cadf141 100644 --- a/index.html +++ b/index.html @@ -5,11 +5,11 @@ ZeroMe! - + - +
    @@ -21,7 +21,7 @@
    - + diff --git a/js/ActivityList.coffee b/js/ActivityList.coffee index 6fbbaa2..1e5d9cf 100644 --- a/js/ActivityList.coffee +++ b/js/ActivityList.coffee @@ -63,7 +63,6 @@ class ActivityList extends Class if @directories != "all" # Dont show follows in all users activity feed query += """ - UNION ALL SELECT @@ -168,7 +167,7 @@ class ActivityList extends Class body = [ h("a.link", {href: activity_user_link, onclick: @Page.handleLinkClick}, activity.user_name), " commented on ", h("a.link", {href: subject_user_link, onclick: @Page.handleLinkClick}, activity.subject.user_name), "'s ", - h("a.link", {href: subject_post_link, onclick: @Page.handleLinkClick}, _("post", "comment post")), ": #{activity.body}" + h("a.link", {href: subject_post_link, onclick: @Page.handleLinkClick}, _("post", "comment post")), ": #{activity.body[0..100]}" ] else if activity.type == "follow" body = [ diff --git a/js/ContentFeed.coffee b/js/ContentFeed.coffee index e2892c3..ffbd826 100644 --- a/js/ContentFeed.coffee +++ b/js/ContentFeed.coffee @@ -145,6 +145,7 @@ class ContentFeed extends Class @post_list.directories = ("data/users/#{key.split('/')[1]}" for key, followed of Page.user.followed_users) if Page.user.hub # Also show my posts @post_list.directories.push("data/users/"+Page.user.auth_address) + @post_list.filter_post_ids = null else if @type == "liked" @post_list.directories = ("data/users/#{like.split('_')[0]}" for like, _ of Page.user.likes) @post_list.filter_post_ids = (like.split('_')[1] for like, _ of Page.user.likes) @@ -193,7 +194,6 @@ class ContentFeed extends Class ) h("a.link", {href: "#Liked", onclick: @handleListTypeClick, type: "liked", classes: {active: @type == "liked"}}, "Liked") h("a.link", {href: "#Followed+users", onclick: @handleListTypeClick, type: "followed", classes: {active: @type == "followed"}}, "Followed users") - ), @post_list.render() ]), diff --git a/js/ContentProfile.coffee b/js/ContentProfile.coffee index ac86e62..dd2028b 100644 --- a/js/ContentProfile.coffee +++ b/js/ContentProfile.coffee @@ -206,7 +206,7 @@ class ContentProfile extends Class if @owned @editable_user_name.render(@user.row.user_name) else - h("a", {href: @user.getLink(), onclick: Page.handleLinkClick}, @user.row.user_name) + h("a", {href: @user.getLink(), style: "color: #{Text.toColor(@user.row.auth_address)}", onclick: Page.handleLinkClick}, @user.row.user_name) ), h("div.cert_user_id", @user.row.cert_user_id) if @owned @@ -251,4 +251,4 @@ class ContentProfile extends Class @need_update = true Page.projector.scheduleRender() -window.ContentProfile = ContentProfile \ No newline at end of file +window.ContentProfile = ContentProfile diff --git a/js/Post.coffee b/js/Post.coffee index dbf6101..8be814d 100644 --- a/js/Post.coffee +++ b/js/Post.coffee @@ -5,7 +5,7 @@ class Post extends Class @submitting_like = false @owned = false @editable_comments = {} - @field_comment = new Autosize({placeholder: "Add your comment", onsubmit: @handleCommentSubmit}) + @field_comment = new Autosize({placeholder: "Add your comment", onsubmit: @handleCommentSubmit, title_submit: "Send"}) @comment_limit = 3 @menu = null @meta = null @@ -74,6 +74,7 @@ class Post extends Class return false handleCommentSubmit: => + if not @field_comment.attrs.value then return timer_loading = setTimeout ( => @field_comment.loading = true ), 100 # Only add loading message if takes more than 100ms [site, post_uri] = @row.key.split("-") Page.user.comment site, post_uri, @field_comment.attrs.value, (res) => @@ -244,4 +245,4 @@ class Post extends Class @renderComments() ]) -window.Post = Post \ No newline at end of file +window.Post = Post diff --git a/js/lib/marked.min.js b/js/lib/marked.min.js index a5164c4..041938d 100644 --- a/js/lib/marked.min.js +++ b/js/lib/marked.min.js @@ -1,6 +1,6 @@ /** * marked - a markdown parser - * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked + * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked */ -(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^
    /i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
    "+(escaped?code:escape(code,true))+"\n
    "}return'
    '+(escaped?code:escape(code,true))+"\n
    \n"};Renderer.prototype.blockquote=function(quote){return"
    \n"+quote+"
    \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); \ No newline at end of file +!function(e){"use strict";var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:f,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:f,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b.defaults,this.rules=k.normal,this.options.pedantic?this.rules=k.pedantic:this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}k._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,k._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,k.def=i(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d{1,9}\.)/,k.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,k.item=i(k.item,"gm").replace(/bull/g,k.bullet).getRegex(),k.list=i(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=//,k.html=i(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=i(k.paragraph).replace("hr",k.hr).replace("heading",k.heading).replace("lheading",k.lheading).replace("tag",k._tag).getRegex(),k.blockquote=i(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=d({},k),k.gfm=d({},k.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),k.gfm.paragraph=i(k.paragraph).replace("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|").getRegex(),k.tables=d({},k.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),k.pedantic=d({},k.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=k,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,b;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1 ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:f,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:f,text:/^(`+|[^`])[\s\S]*?(?=[\\?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",k._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|`(?!`)|[^\[\]\\`])*?/,n._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=d({},n),n.pedantic=d({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=d({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:i(n.text).replace("]|","~]|").replace("|$","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|$").getRegex()}),n.gfm.url=i(n.gfm.url,"i").replace("email",n.gfm._extended_email).getRegex(),n.breaks=d({},n.gfm,{br:i(n.br).replace("{2,}","*").getRegex(),text:i(n.gfm.text).replace("{2,}","*").getRegex()}),p.rules=n,p.output=function(e,t,n){return new p(t,n).output(e)},p.prototype.output=function(e){for(var t,n,r,s,i,l,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=u(i[1]);else if(i=this.rules.tag.exec(e))!this.inLink&&/^
    /i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):u(i[0]):i[0];else if(i=this.rules.link.exec(e)){var a=m(i[2],"()");if(-1$/,"$1"),o+=this.outputLink(i,{href:p.escapes(r),title:p.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(u(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=u(this.mangle(i[1]))):n=u(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(i[0]):o+=this.renderer.text(u(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=u(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=u(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},p.escapes=function(e){return e?e.replace(p.rules._escapes,"$1"):e},p.prototype.outputLink=function(e,t){var n=t.href,r=t.title?u(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,u(e[1]))},p.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},p.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s'+(n?e:u(e,!0))+"\n":"
    "+(n?e:u(e,!0))+"
    "},r.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.checkbox=function(e){return" "},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='
    "},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,d({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop()},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},u.escapeTest=/[&<>"']/,u.escapeReplace=/[&<>"']/g,u.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},u.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,u.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(){}function d(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.lengthAn error occurred:

    "+u(e.message+"",!0)+"
    ";throw e}}f.exec=f,b.options=b.setOptions=function(e){return d(b.defaults,e),b},b.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},b.defaults=b.getDefaults(),b.Parser=h,b.parser=h.parse,b.Renderer=r,b.TextRenderer=s,b.Lexer=a,b.lexer=a.lex,b.InlineLexer=p,b.inlineLexer=p.output,b.Slugger=t,b.parse=b,"undefined"!=typeof module&&"object"==typeof exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):e.marked=b}(this||("undefined"!=typeof window?window:global)); diff --git a/js/utils/Autosize.coffee b/js/utils/Autosize.coffee index 9fc412c..bb45d1d 100644 --- a/js/utils/Autosize.coffee +++ b/js/utils/Autosize.coffee @@ -3,12 +3,14 @@ class Autosize extends Class @node = null @attrs.classes ?= {} - @attrs.classes.loading = false - @attrs.oninput = @handleInput - @attrs.onkeydown = @handleKeydown - @attrs.afterCreate = @storeNode - @attrs.rows = 1 - @attrs.disabled = false + @attrs.classes.loading ?= false + @attrs.oninput ?= @handleInput + @attrs.onkeydown ?= @handleKeydown + @attrs.afterCreate ?= @storeNode + @attrs.rows ?= 1 + @attrs.disabled ?= false + @attrs.value ?= "" + @attrs.title_submit ?= null @property 'loading', get: -> @attrs.classes.loading @@ -49,22 +51,35 @@ class Autosize extends Class RateLimit 300, @autoHeight handleKeydown: (e=null) => - if e.which == 13 and not e.shiftKey and @attrs.onsubmit and @attrs.value.trim() - @attrs.onsubmit() - setTimeout ( => - @autoHeight() - ), 100 - return false + if e.which == 13 and e.ctrlKey and @attrs.onsubmit and @attrs.value.trim() + @submit() + + submit: => + @attrs.onsubmit() + setTimeout ( => + @autoHeight() + ), 100 + return false render: (body=null) => - if body and @attrs.value == undefined + if body and !@attrs.value @setValue(body) if @loading attrs = clone(@attrs) #attrs.value = "Submitting..." attrs.disabled = true - h("textarea.autosize", attrs) + tag_textarea = h("textarea.autosize", attrs) else - h("textarea.autosize", @attrs) + tag_textarea = h("textarea.autosize", @attrs) + + return [ + tag_textarea, + if @attrs.title_submit + h( + "a.button.button.button-submit.button-small", + {href: "#Submit", onclick: @submit, classes: @attrs.classes}, + @attrs.title_submit + ) + ] -window.Autosize = Autosize \ No newline at end of file +window.Autosize = Autosize diff --git a/js/utils/Text.coffee b/js/utils/Text.coffee index 44681bc..b869ef5 100644 --- a/js/utils/Text.coffee +++ b/js/utils/Text.coffee @@ -1,6 +1,6 @@ class MarkedRenderer extends marked.Renderer image: (href, title, text) -> - return ("![#{text}](#{href})") + return "![#{text}](#{href})" class Text toColor: (text, saturation=30, lightness=50) -> @@ -8,8 +8,10 @@ class Text for i in [0..text.length-1] hash += text.charCodeAt(i)*i hash = hash % 1777 - return "hsl(" + (hash % 360) + ",#{saturation}%,#{lightness}%)"; - + if Page.server_info?.user_settings?.theme == "dark" + return "hsl(" + (hash % 360) + ",#{saturation + 5}%,#{lightness + 15}%)"; + else + return "hsl(" + (hash % 360) + ",#{saturation}%,#{lightness}%)"; renderMarked: (text, options={}) => if not text @@ -20,7 +22,8 @@ class Text options["renderer"] = marked_renderer text = @fixReply(text) text = marked(text, options) - text = text.replace(/(@[^\x00-\x1f^\x21-\x2f^\x3a-\x40^\x5b-\x60^\x7b-\x7f]{1,16}):/g, '$1:') # Highlight usernames + text = text.replace(/
    (.*?)<\/a>/g, '$1') # Disable email auto-convert + text = text.replace(/(\s|>|^)(@[^\s]{1,50}):/g, '$1$2:') # Highlight usernames return @fixHtmlLinks text renderLinks: (text) => @@ -28,7 +31,7 @@ class Text text = text.replace /(https?:\/\/[^\s)]+)/g, (match) -> return "#{match}" # UnSanitize & -> & in links text = text.replace(/\n/g, '
    ') - text = text.replace(/(@[^\x00-\x1f^\x21-\x2f^\x3a-\x40^\x5b-\x60^\x7b-\x7f]{1,16}):/g, '$1:') + text = text.replace(/(\s|>|^)(@[^\s]{1,50}):/g, '$1$2:') text = @fixHtmlLinks(text) return text diff --git a/languages/it.json b/languages/it.json index abf553c..d76b33e 100644 --- a/languages/it.json +++ b/languages/it.json @@ -11,44 +11,44 @@ "Unfollow": "Smetti di seguire", "Help distribute this user's images": "Aiuta a distribuire le immagini di questo utente", "Following": "Seguendo", - "Activity feed": "Feed di attività", + "Activity feed": "Note dell'attività", "Show more...": "Mostra ancora...", - "Mute ": "Silenzia questo utente", + "Mute ": "Silenzia ", " started following ": " iniziato a seguire: ", " commented on ": " commentato su ", " liked ": " approva ", "'s ": " ", "_(post, like post)": "_(messaggio, approva messaggio)", - "_(post, comment post)": "_(messaggio, messaggio commento)", + "_(post, comment post)": "_(messaggio, commenta messaggio)", "Cancel": "Annulla", "Save": "Salva", "Delete": "Cancella", - "User's profile site not loaded to your client yet.": "Il sito del profilo dell'utente non è ancora stato caricato sul tuo client.", + "User's profile site not loaded to your client yet.": "Il sito dell'utente non è ancora stato caricato sul tuo client.", "Download user's site": "Scarica il sito dell'utente", "Browse all \\u203A": "Naviga tutti \\u203A", "New users": "Nuovi utenti", - "Suggested users": "Usenti suggeriti", + "Suggested users": "Utenti suggeriti", "Create new profile": "Crea nuovo profilo", "Creating new profile...": "Creazione nuovo profilo...", "Checking user on selected hub...": "Controllo utente sull'hub selezionato...", - "User \" + Page.site_info.cert_user_id + \" already exists on this hub": "Utente \" + Page.site_info.cert_user_id + \" esiste già su questo hub", + "User \" + Page.site_info.cert_user_id + \" already exists on this hub": "L'utente \" + Page.site_info.cert_user_id + \" esiste già su questo hub", "Select ID...": "Seleziona ID ...", "Seeded HUBs": "HUB mantenuti", "Available HUBs": "HUB disponibili", "(With this you choose where is your profile stored. There is no difference on content and you will able to reach all users from any hub)": - "(Con questo tu scegli dove il tuo profilo è salvato. Non c'è differenza sul contenuto, e sarai in grado di raggiungere tutti gli utenti in ogni hub)", + "(Con questo si sceglie dove salvare il profilo. Non c'è differenza sul contenuto e sarai in grado di raggiungere tutti gli utenti da ogni hub)", "Random ZeroNet user": "Utente ZeroNet casuale", "Hello ZeroMe!": "Ciao ZeroMe!", "Loading...\\nShow image": "Caricamento...\\nMostra immagine", "Help distribute this user's new images": "Aiuta a distribuire le nuove immagini di questo utente", - "Delete image": "Cancella immagina", + "Delete image": "Cancella immagine", "Show image": "Mostra immagine", "'s new images": " nuove immagini", @@ -59,14 +59,14 @@ "Everyone": "Tutti", "Followed users": "Utenti seguiti", "Show more posts...": "Mostra altri messaggi...", - "Show more comments...": "Mostra altri contenuti...", + "Show more comments...": "Mostra altri commenti...", "No posts yet": "Ancora nessun messaggio", "Let's follow some users!": "Inizia a seguire alcuni utenti!", - "Select user to post new content": "Seleziona utente per mettere nuovo contenuto", + "Select user to post new content": "Seleziona un utente per inserire nuovo contenuto", "Write something...": "Scrivi qualcosa...", "Submit new post": "Invia nuovo messaggio", - "Invalid image, only jpg format supported": "Immagine non valida, supportato solo formato jpg", + "Invalid image, only jpg format supported": "Immagine non valida, supportato solo il formato jpg", "Follow in newsfeed": "Segui il feed delle novità", @@ -77,6 +77,6 @@ " minutes ago": " minuti fa", " hours ago": " ore fa", " days ago": " giorni fa", - "on ": "a", - "Just now": "Proprio ora" + "on ": "a ", + "Just now": "Adesso" } diff --git a/languages/sk.json b/languages/sk.json index ddbf200..9644a74 100644 --- a/languages/sk.json +++ b/languages/sk.json @@ -42,10 +42,10 @@ "(With this you choose where is your profile stored. There is no difference on content and you will able to reach all users from any hub)": "(S týmto si zvolíš kde bude tvoj profil uložený. Žiadny rozdiel medzi obsahom nieje a budeš vidieť všetkých používateľov z ostatných hub-ov)", - "Random ZeroNet user": "Náhodný ZeroNetpoužívateľ", + "Random ZeroNet user": "Náhodný ZeroNet používateľ", "Hello ZeroMe!": "Ahoj ZeroMe!", - "Loading...\\nShow image": "Načítava sa...\\nKép mutatása", + "Loading...\\nShow image": "Načítava sa...\\nUkázať Obrázok", "Help distribute this user's new images": "Pomôcť s distribúciou obrázkov tohto používateľa", "Delete image": "Vymazať obrázok", "Show image": "Ukázať obrázok", @@ -77,5 +77,7 @@ " hours ago": " hodín dozadu", " days ago": " dní dozadu", "on ": "", - "Just now": "Teraz" + "Just now": "Teraz", + "Liked": "Like-nuté", + "Followed by ": "Sledovaný/á používateľom " } From e459d0089906c0336cb673e0874aa3151c977602 Mon Sep 17 00:00:00 2001 From: BinChan Date: Wed, 5 Jun 2019 17:02:44 +0800 Subject: [PATCH 26/26] Tweak css, import mobile UI, change dark theme. --- css/all.css | 89 ++++++++++++++++++++++++------ css/dark.css | 69 ++++++++++++------------ css/mobile.css | 9 ++-- js/ZeroMe.coffee | 6 +-- js/all.js | 137 ++++++++++++++++++++++++++++++++++++----------- 5 files changed, 222 insertions(+), 88 deletions(-) diff --git a/css/all.css b/css/all.css index c3f45b4..43ffa02 100644 --- a/css/all.css +++ b/css/all.css @@ -36,7 +36,7 @@ .button:active { -webkit-transform: translateY(1px); -moz-transform: translateY(1px); -o-transform: translateY(1px); -ms-transform: translateY(1px); transform: translateY(1px) ; -webkit-transition: all 0.3s, transform none; -moz-transition: all 0.3s, transform none; -o-transition: all 0.3s, transform none; -ms-transition: all 0.3s, transform none; transition: all 0.3s, transform none ; -webkit-box-shadow: inset 0px 5px 7px -3px rgba(212, 212, 212, 0.41); -moz-box-shadow: inset 0px 5px 7px -3px rgba(212, 212, 212, 0.41); -o-box-shadow: inset 0px 5px 7px -3px rgba(212, 212, 212, 0.41); -ms-box-shadow: inset 0px 5px 7px -3px rgba(212, 212, 212, 0.41); box-shadow: inset 0px 5px 7px -3px rgba(212, 212, 212, 0.41) ; outline: none; -webkit-transition: none ; -moz-transition: none ; -o-transition: none ; -ms-transition: none ; transition: none } .button.loading { - color: rgba(0,0,0,0) !important; background: url(../img/loading.gif) no-repeat center center !important; border-color: rgba(0,0,0,0) !important; + color: rgba(0,0,0,0) !important; background: rgba(128, 128, 128, 0.5) url(../img/loading.gif) no-repeat center center !important; border-color: rgba(0,0,0,0) !important; -webkit-transition: all 0.5s ease-out; -moz-transition: all 0.5s ease-out; -o-transition: all 0.5s ease-out; -ms-transition: all 0.5s ease-out; transition: all 0.5s ease-out ; pointer-events: none; transition-delay: 0.5s } @@ -52,7 +52,7 @@ padding: 12px 30px; -webkit-border-radius: 3px; -moz-border-radius: 3px; -o-border-radius: 3px; -ms-border-radius: 3px; border-radius: 3px ; margin-top: 11px; background-color: #5d68ff; /*box-shadow: 0px 1px 4px rgba(93, 104, 255, 0.41);*/ border: none; border-bottom: 2px solid #4952c7; font-weight: bold; color: #ffffff; font-size: 12px; text-transform: uppercase; margin-left: 10px; } -.button-submit:hover { color: white; background-color: #6d78ff } +.button-submit:hover, .button-submit:focus { color: white; background-color: #6d78ff } .button-small { padding: 7px 20px; margin-left: 10px } .button-outline { background-color: white; border: 1px solid #EEE; border-bottom: 2px solid #EEE; color: #AAA; } @@ -70,7 +70,9 @@ .comment-list .body { padding-top: 0px } .comment-list .body p { padding: 0px } -.comment-create textarea { width: 100%; margin-bottom: 11px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box ; } +.comment-create { position: relative; } +.comment-create textarea { width: 100%; margin-bottom: 11px; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; -o-box-sizing: border-box; -ms-box-sizing: border-box; box-sizing: border-box ; padding-right: 90px; } +.comment-create .button-submit { right: 13px; position: absolute; bottom: 23px; } .comment { padding-top: 10px } .comment-list .comment .user { padding-bottom: 0px; white-space: nowrap; line-height: 15px; } .comment .body { padding-top: 4px; padding-bottom: 10px; } @@ -83,6 +85,7 @@ .comment h1, .comment h2, .comment h3, .comment h4, .comment h5, .comment h6 { font-size: inherit; font-weight: bold } + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Editable.css ---- */ @@ -113,7 +116,7 @@ .head .user .address { display: block } .head .settings { display: inline-block; height: 50px; width: 50px; text-align: center; vertical-align: middle; -webkit-transition: all 0.3s; -moz-transition: all 0.3s; -o-transition: all 0.3s; -ms-transition: all 0.3s; transition: all 0.3s ; - border-left: 1px solid #EEE; line-height: 50px; font-size: 20px; color: #AAA; font-weight: normal; text-decoration: none; + border-left: 1px solid rgba(0, 0, 0, 0.05); line-height: 50px; font-size: 20px; color: #AAA; font-weight: normal; text-decoration: none; } .head .settings:hover { color: #5d68ff; background-color: #FAFAFA; -webkit-transition: none ; -moz-transition: none ; -o-transition: none ; -ms-transition: none ; transition: none } .head .settings:active { background-color: #F5F5F5; -webkit-transition: none ; -moz-transition: none ; -o-transition: none ; -ms-transition: none ; transition: none } @@ -125,6 +128,7 @@ } + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/Hub.css ---- */ @@ -591,6 +595,63 @@ h5 { font-weight: normal; color: rgba(0, 0, 0, 0.5) } +/* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/dark.css ---- */ + + +.theme-dark { background-color: #1b1b1b; color: #ccc; } +.theme-dark .head-container { background-color: #242424; } + +.theme-dark #Overlay.visible { background-color: rgba(53, 52, 60, 0.89); } + +.theme-dark a { color: #a69988 } +.theme-dark .menu-item { color: #000 } +.theme-dark .post .user .settings:hover { color: #ccc } + +.theme-dark .head .user .name { color: #a69988 } +.theme-dark .user .name { color: #a69988 } +.theme-dark .post-list-type a { color: #adadad; } +.theme-dark .post-list-type a:hover { color: #a69988; border-bottom-color: #a69988 } +.theme-dark .post-list-type .active { color: #a69988; border-bottom-color: #a69988 } + +.theme-dark .post-create .postfield { border-color: #333; } +.theme-dark .post-create.editing { -webkit-box-shadow: 0px 1px 13px 1px #111213 ; -moz-box-shadow: 0px 1px 13px 1px #111213 ; -o-box-shadow: 0px 1px 13px 1px #111213 ; -ms-box-shadow: 0px 1px 13px 1px #111213 ; box-shadow: 0px 1px 13px 1px #111213 } + +.theme-dark .button-submit { color: #ccc } +.theme-dark .button-outline { color: #333; } + +.theme-dark .post .body { color: #dcd9e5; } +.theme-dark .post { background-color: #242424; border: none; -webkit-border-radius: 0px; -moz-border-radius: 0px; -o-border-radius: 0px; -ms-border-radius: 0px; border-radius: 0px ; } +.theme-dark .comment-list { background-color: #242424; border-top-color: #333 } +.theme-dark .post .img .fullsize { background-color: #333 } +.theme-dark .post .reply-name { color: #ccc } +.theme-dark .post .user .address { color: #ccc } +.theme-dark .post .added, .theme-dark .post .sep { color: #a69988 } +.theme-dark .post .body a { color: #a69988 } +.theme-dark .post blockquote { border-left: 3px solid #444; } + +.theme-dark .activity-list .items a { color: #a69988 } +.theme-dark .activity { color: #ccc } +.theme-dark .activity-list .bg-line { background-color: #444 } +.theme-dark .activity-list .circle { border-color: #333; background-color: #1b1b1b } +.theme-dark .activity:last-child { background-color: #1b1b1b; } + +.theme-dark input.text, .theme-dark textarea { background-color: #1b1b1b; border-color: #333; color: #ccc; } +.theme-dark .card { -webkit-box-shadow: 0px 1px 11px #1b1b1b; -moz-box-shadow: 0px 1px 11px #1b1b1b; -o-box-shadow: 0px 1px 11px #1b1b1b; -ms-box-shadow: 0px 1px 11px #1b1b1b; box-shadow: 0px 1px 11px #1b1b1b ; background-color: #242424; } + +.theme-dark .button-follow:hover { background-color: rgba(74, 160, 177, 0.1) !important; border-color: #444 !important; color: #55cedf !important } +.theme-dark .users.gray .button-follow { border: 1px solid #3b8297 } +.theme-dark .user.notseeding .button-follow { border-color: #393251 } +.theme-dark h2.sep { border-top: 1px solid #333; } + +.theme-dark .post code { background-color: #232323; border-color: #0A0A0A; color: #d3d3d3; } +.theme-dark .icon-heart.active { color: #a69988; -webkit-filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); -moz-filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); -o-filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); -ms-filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5) ; } +.theme-dark .post .actions .link.active { color: #a69988; } + +.theme-dark .button-follow-big:hover { background-color: #444; } +.theme-dark .maxheight-limited:before { background: -webkit-linear-gradient(rgba(38, 36, 46, 0), #242424 70%);background: -moz-linear-gradient(rgba(38, 36, 46, 0), #242424 70%);background: -o-linear-gradient(rgba(38, 36, 46, 0), #242424 70%);background: -ms-linear-gradient(rgba(38, 36, 46, 0), #242424 70%);background: linear-gradient(rgba(38, 36, 46, 0), #242424 70%); } + + + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/css/fonts.css ---- */ @@ -742,21 +803,20 @@ font-size: medium !important; .head-container { position: fixed; -background-color: #fff; width: 100%; height: 50px; z-index: 30; } .head { width: 100%; -background-color: #fff; } .head .logo { -margin-left: 50px; +margin-left: 5px; position: absolute; z-index: 1; } .right { +margin-right: 0px !important; position: fixed; right: 0; top: 0; @@ -767,7 +827,6 @@ margin-top: 60px; margin-bottom: 5px; } .col-center { -background-color: #f6f7f8; width: 100%; overflow: auto; padding-left: 5px; @@ -793,6 +852,9 @@ overflow-y: auto; z-index: 1; -webkit-transition: 0.3s all cubic-bezier(0.77, 0, 0.175, 1); -moz-transition: 0.3s all cubic-bezier(0.77, 0, 0.175, 1); -o-transition: 0.3s all cubic-bezier(0.77, 0, 0.175, 1); -ms-transition: 0.3s all cubic-bezier(0.77, 0, 0.175, 1); transition: 0.3s all cubic-bezier(0.77, 0, 0.175, 1) ; } +.theme-dark .col-left, .theme-dark .col-right { +background-color: #242424; +} .trigger-on .col-left, .trigger-on .col-right { left: 0px; -webkit-box-shadow: 0px 0px 30px #999; -moz-box-shadow: 0px 0px 30px #999; -o-box-shadow: 0px 0px 30px #999; -ms-box-shadow: 0px 0px 30px #999; box-shadow: 0px 0px 30px #999 ; @@ -801,18 +863,18 @@ left: 0px; #Trigger { display: block; position: fixed; -left: 5px; +left: 2px; top: 3px; -width: 40px; +width: 33px; height: 40px; z-index: 100; -border: 1px solid #bbb; +border: 1px solid transparent; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; border-radius: 5px ; } #Trigger .icon { background-image: url(../img/nav-icon.png); display: block; -border: 12px solid #fff; +border: 12px solid transparent; height: 16px; outline: none; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; border-radius: 5px ; @@ -822,7 +884,6 @@ opacity: 1; -webkit-filter: none; -moz-filter: none; -o-filter: none; -ms-filter: none; filter: none ; } .user.card { -background-color: #f6f7f8; -webkit-box-shadow: none; -moz-box-shadow: none; -o-box-shadow: none; -ms-box-shadow: none; box-shadow: none ; margin-top: 10px; margin-left: -15px; @@ -833,8 +894,6 @@ margin-bottom: 0px; .more.small { padding: 10px; margin-bottom: 5px; -background-color: #fff; -border: 1px solid #eef0f1; -webkit-border-radius: 5px; -moz-border-radius: 5px; -o-border-radius: 5px; -ms-border-radius: 5px; border-radius: 5px ; } .post-create .icon-image { diff --git a/css/dark.css b/css/dark.css index 812a02e..a86baeb 100644 --- a/css/dark.css +++ b/css/dark.css @@ -1,50 +1,51 @@ -.theme-dark { background-color: #26242E; color: white; } -.theme-dark .head-container { background-color: #2b293e; } +.theme-dark { background-color: #1b1b1b; color: #ccc; } +.theme-dark .head-container { background-color: #242424; } .theme-dark #Overlay.visible { background-color: rgba(53, 52, 60, 0.89); } -.theme-dark a { color: #58dbec } +.theme-dark a { color: #a69988 } .theme-dark .menu-item { color: #000 } -.theme-dark .post .user .settings:hover { color: #FFF } +.theme-dark .post .user .settings:hover { color: #ccc } -.theme-dark .head .user .name { color: #58dbec } -.theme-dark .user .name { color: #58dbec } +.theme-dark .head .user .name { color: #a69988 } +.theme-dark .user .name { color: #a69988 } .theme-dark .post-list-type a { color: #adadad; } -.theme-dark .post-list-type a:hover { color: #58dbec; border-bottom-color: #58dbec } -.theme-dark .post-list-type .active { color: #58dbec; border-bottom-color: #58dbec } +.theme-dark .post-list-type a:hover { color: #a69988; border-bottom-color: #a69988 } +.theme-dark .post-list-type .active { color: #a69988; border-bottom-color: #a69988 } -.theme-dark .post-create .postfield { border-color: #4e5a5c; } +.theme-dark .post-create .postfield { border-color: #333; } .theme-dark .post-create.editing { box-shadow: 0px 1px 13px 1px #111213 } -.theme-dark .button-submit { color: #FFF } -.theme-dark .button-outline { color: #5e5a6d; } +.theme-dark .button-submit { color: #ccc } +.theme-dark .button-outline { color: #333; } .theme-dark .post .body { color: #dcd9e5; } -.theme-dark .post { background-color: #302c3f; border: none; border-radius: 0px; } -.theme-dark .comment-list { background-color: #2c2939; border-top-color: #423d53 } -.theme-dark .post .img .fullsize { background-color: #33313c } -.theme-dark .post .reply-name { color: white } -.theme-dark .post .user .address, .theme-dark .post .added, .theme-dark .post .sep { color: #bdb5da } -.theme-dark .post .body a { color: #58dbec } -.theme-dark .post blockquote { border-left: 3px solid #47dbec; } - -.theme-dark .activity-list .items a { color: #a398c4 } -.theme-dark .activity { color: #8e899c } -.theme-dark .activity-list .bg-line { background-color: #38334b } -.theme-dark .activity-list .circle { border-color: #4b465a; background-color: #26242e } -.theme-dark .activity:last-child { background-color: #26242e; } - -.theme-dark input.text, .theme-dark textarea { background-color: #26242e; border-color: #4e5a5c; color: white; } -.theme-dark .card { box-shadow: 0px 1px 11px #26242e; background-color: #302c3f; } - -.theme-dark .button-follow:hover { background-color: rgba(74, 160, 177, 0.1) !important; border-color: #55cedf !important; color: #55cedf !important } +.theme-dark .post { background-color: #242424; border: none; border-radius: 0px; } +.theme-dark .comment-list { background-color: #242424; border-top-color: #333 } +.theme-dark .post .img .fullsize { background-color: #333 } +.theme-dark .post .reply-name { color: #ccc } +.theme-dark .post .user .address { color: #ccc } +.theme-dark .post .added, .theme-dark .post .sep { color: #a69988 } +.theme-dark .post .body a { color: #a69988 } +.theme-dark .post blockquote { border-left: 3px solid #444; } + +.theme-dark .activity-list .items a { color: #a69988 } +.theme-dark .activity { color: #ccc } +.theme-dark .activity-list .bg-line { background-color: #444 } +.theme-dark .activity-list .circle { border-color: #333; background-color: #1b1b1b } +.theme-dark .activity:last-child { background-color: #1b1b1b; } + +.theme-dark input.text, .theme-dark textarea { background-color: #1b1b1b; border-color: #333; color: #ccc; } +.theme-dark .card { box-shadow: 0px 1px 11px #1b1b1b; background-color: #242424; } + +.theme-dark .button-follow:hover { background-color: rgba(74, 160, 177, 0.1) !important; border-color: #444 !important; color: #55cedf !important } .theme-dark .users.gray .button-follow { border: 1px solid #3b8297 } .theme-dark .user.notseeding .button-follow { border-color: #393251 } -.theme-dark h2.sep { border-top: 1px solid #495355; } +.theme-dark h2.sep { border-top: 1px solid #333; } .theme-dark .post code { background-color: #232323; border-color: #0A0A0A; color: #d3d3d3; } -.theme-dark .icon-heart.active { color: #58dbec; filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); } -.theme-dark .post .actions .link.active { color: #58dbec; } +.theme-dark .icon-heart.active { color: #a69988; filter: sepia(1) hue-rotate(504deg) brightness(0.75) saturate(5); } +.theme-dark .post .actions .link.active { color: #a69988; } -.theme-dark .button-follow-big:hover { background-color: #3b374a; } -.theme-dark .maxheight-limited:before { background: linear-gradient(rgba(38, 36, 46, 0), #302c3f 70%); } +.theme-dark .button-follow-big:hover { background-color: #444; } +.theme-dark .maxheight-limited:before { background: linear-gradient(rgba(38, 36, 46, 0), #242424 70%); } diff --git a/css/mobile.css b/css/mobile.css index 41a5806..e0628d6 100644 --- a/css/mobile.css +++ b/css/mobile.css @@ -18,11 +18,12 @@ z-index: 30; width: 100%; } .head .logo { -margin-left: 50px; +margin-left: 5px; position: absolute; z-index: 1; } .right { +margin-right: 0px !important; position: fixed; right: 0; top: 0; @@ -69,12 +70,12 @@ box-shadow: 0px 0px 30px #999; #Trigger { display: block; position: fixed; -left: 5px; +left: 2px; top: 3px; -width: 40px; +width: 33px; height: 40px; z-index: 100; -border: 1px solid rgba(187, 187, 187, 0.32); +border: 1px solid transparent; border-radius: 5px; } #Trigger .icon { diff --git a/js/ZeroMe.coffee b/js/ZeroMe.coffee index 771b721..c30cd82 100644 --- a/js/ZeroMe.coffee +++ b/js/ZeroMe.coffee @@ -53,7 +53,7 @@ class ZeroMe extends ZeroFrame @on_loaded.then => @log "onloaded" window.requestAnimationFrame -> - document.body.className = "loaded" + document.body.classList.add("loaded") @projector.replace($("#Head"), @head.render) @projector.replace($("#Overlay"), @overlay.render) @@ -130,7 +130,7 @@ class ZeroMe extends ZeroFrame @history_state["scrollTop"] = 0 @on_loaded.resolved = false - document.body.className = "" + document.body.classList.remove("loaded") @setUrl e.currentTarget.search return false @@ -296,7 +296,7 @@ class ZeroMe extends ZeroFrame if not params.state.url params.state.url = params.href.replace /.*\?/, "" @on_loaded.resolved = false - document.body.className = "" + document.body.classList.remove("loaded") window.scroll(window.pageXOffset, params.state.scrollTop or 0) @route(params.state.url or "") else diff --git a/js/all.js b/js/all.js index d2cbda2..88df6cc 100644 --- a/js/all.js +++ b/js/all.js @@ -57,6 +57,7 @@ }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Dollar.coffee ---- */ @@ -70,6 +71,7 @@ }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Promise.coffee ---- */ @@ -200,6 +202,7 @@ }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Property.coffee ---- */ @@ -211,6 +214,7 @@ }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/Prototypes.coffee ---- */ @@ -238,6 +242,7 @@ }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/RateLimitCb.coffee ---- */ @@ -318,6 +323,7 @@ }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/lib/anime.min.js ---- */ @@ -1147,10 +1153,11 @@ function clone(obj) { /** * marked - a markdown parser - * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed) - * https://github.com/chjj/marked + * Copyright (c) 2011-2018, Christopher Jeffrey. (MIT Licensed) + * https://github.com/markedjs/marked */ -(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",//)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"
    "+(escaped?code:escape(code,true))+"\n
    "}return'
    '+(escaped?code:escape(code,true))+"\n
    \n"};Renderer.prototype.blockquote=function(quote){return"
    \n"+quote+"
    \n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"'+text+"\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"\n"};Renderer.prototype.listitem=function(text){return"
  • "+text+"
  • \n"};Renderer.prototype.paragraph=function(text){return"

    "+text+"

    \n"};Renderer.prototype.table=function(header,body){return"\n"+"\n"+header+"\n"+"\n"+body+"\n"+"
    \n"};Renderer.prototype.tablerow=function(content){return"\n"+content+"\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"\n"};Renderer.prototype.strong=function(text){return""+text+""};Renderer.prototype.em=function(text){return""+text+""};Renderer.prototype.codespan=function(text){return""+text+""};Renderer.prototype.br=function(){return this.options.xhtml?"
    ":"
    "};Renderer.prototype.del=function(text){return""+text+""};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0){return""}}var out='
    ";return out};Renderer.prototype.image=function(href,title,text){var out=''+text+'":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i/g,">").replace(/"/g,""").replace(/'/g,"'")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;iAn error occured:

    "+escape(e.message+"",true)+"
    "}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof module!=="undefined"&&typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}()); +!function(e){"use strict";var k={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:f,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,nptable:f,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:f,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading| {0,3}>|<\/?(?:tag)(?: +|\n|\/?>)|<(?:script|pre|style|!--))[^\n]+)*)/,text:/^[^\n]+/};function a(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||b.defaults,this.rules=k.normal,this.options.pedantic?this.rules=k.pedantic:this.options.gfm&&(this.options.tables?this.rules=k.tables:this.rules=k.gfm)}k._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,k._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,k.def=i(k.def).replace("label",k._label).replace("title",k._title).getRegex(),k.bullet=/(?:[*+-]|\d{1,9}\.)/,k.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,k.item=i(k.item,"gm").replace(/bull/g,k.bullet).getRegex(),k.list=i(k.list).replace(/bull/g,k.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+k.def.source+")").getRegex(),k._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",k._comment=//,k.html=i(k.html,"i").replace("comment",k._comment).replace("tag",k._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),k.paragraph=i(k.paragraph).replace("hr",k.hr).replace("heading",k.heading).replace("lheading",k.lheading).replace("tag",k._tag).getRegex(),k.blockquote=i(k.blockquote).replace("paragraph",k.paragraph).getRegex(),k.normal=d({},k),k.gfm=d({},k.normal,{fences:/^ {0,3}(`{3,}|~{3,})([^`\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,paragraph:/^/,heading:/^ *(#{1,6}) +([^\n]+?) *#* *(?:\n+|$)/}),k.gfm.paragraph=i(k.paragraph).replace("(?!","(?!"+k.gfm.fences.source.replace("\\1","\\2")+"|"+k.list.source.replace("\\1","\\3")+"|").getRegex(),k.tables=d({},k.gfm,{nptable:/^ *([^|\n ].*\|.*)\n *([-:]+ *\|[-| :]*)(?:\n((?:.*[^>\n ].*(?:\n|$))*)\n*|$)/,table:/^ *\|(.+)\n *\|?( *[-:]+[-| :]*)(?:\n((?: *[^>\n ].*(?:\n|$))*)\n*|$)/}),k.pedantic=d({},k.normal,{html:i("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",k._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/}),a.rules=k,a.lex=function(e,t){return new a(t).lex(e)},a.prototype.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n"),this.token(e,!0)},a.prototype.token=function(e,t){var n,r,s,i,l,o,a,h,p,u,c,g,f,d,m,b;for(e=e.replace(/^ +$/gm,"");e;)if((s=this.rules.newline.exec(e))&&(e=e.substring(s[0].length),1 ?/gm,""),this.token(s,t),this.tokens.push({type:"blockquote_end"});else if(s=this.rules.list.exec(e)){for(e=e.substring(s[0].length),a={type:"list_start",ordered:d=1<(i=s[2]).length,start:d?+i:"",loose:!1},this.tokens.push(a),n=!(h=[]),f=(s=s[0].match(this.rules.item)).length,c=0;c?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:f,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(href(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^\*([^\s*"<\[])\*(?!\*)|^_([^\s][\s\S]*?[^\s_])_(?!_|[^\spunctuation])|^_([^\s_][\s\S]*?[^\s])_(?!_|[^\spunctuation])|^\*([^\s"<\[][\s\S]*?[^\s*])\*(?!\*)|^\*([^\s*"<\[][\s\S]*?[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:f,text:/^(`+|[^`])[\s\S]*?(?=[\\?@\\[^_{|}~",n.em=i(n.em).replace(/punctuation/g,n._punctuation).getRegex(),n._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,n._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,n._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,n.autolink=i(n.autolink).replace("scheme",n._scheme).replace("email",n._email).getRegex(),n._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,n.tag=i(n.tag).replace("comment",k._comment).replace("attribute",n._attribute).getRegex(),n._label=/(?:\[[^\[\]]*\]|\\[\[\]]?|`[^`]*`|`(?!`)|[^\[\]\\`])*?/,n._href=/\s*(<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*)/,n._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,n.link=i(n.link).replace("label",n._label).replace("href",n._href).replace("title",n._title).getRegex(),n.reflink=i(n.reflink).replace("label",n._label).getRegex(),n.normal=d({},n),n.pedantic=d({},n.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:i(/^!?\[(label)\]\((.*?)\)/).replace("label",n._label).getRegex(),reflink:i(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",n._label).getRegex()}),n.gfm=d({},n.normal,{escape:i(n.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:i(n.text).replace("]|","~]|").replace("|$","|https?://|ftp://|www\\.|[a-zA-Z0-9.!#$%&'*+/=?^_`{\\|}~-]+@|$").getRegex()}),n.gfm.url=i(n.gfm.url,"i").replace("email",n.gfm._extended_email).getRegex(),n.breaks=d({},n.gfm,{br:i(n.br).replace("{2,}","*").getRegex(),text:i(n.gfm.text).replace("{2,}","*").getRegex()}),p.rules=n,p.output=function(e,t,n){return new p(t,n).output(e)},p.prototype.output=function(e){for(var t,n,r,s,i,l,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=u(i[1]);else if(i=this.rules.tag.exec(e))!this.inLink&&/^
    /i.test(i[0])&&(this.inLink=!1),!this.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(i[0])?this.inRawBlock=!0:this.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(i[0])&&(this.inRawBlock=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):u(i[0]):i[0];else if(i=this.rules.link.exec(e)){var a=m(i[2],"()");if(-1$/,"$1"),o+=this.outputLink(i,{href:p.escapes(r),title:p.escapes(s)}),this.inLink=!1}else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),!(t=this.links[t.toLowerCase()])||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[6]||i[5]||i[4]||i[3]||i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(u(i[2].trim(),!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),r="@"===i[2]?"mailto:"+(n=u(this.mangle(i[1]))):n=u(i[1]),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.text.exec(e))e=e.substring(i[0].length),this.inRawBlock?o+=this.renderer.text(i[0]):o+=this.renderer.text(u(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else{if("@"===i[2])r="mailto:"+(n=u(i[0]));else{for(;l=i[0],i[0]=this.rules._backpedal.exec(i[0])[0],l!==i[0];);n=u(i[0]),r="www."===i[1]?"http://"+n:n}e=e.substring(i[0].length),o+=this.renderer.link(r,null,n)}return o},p.escapes=function(e){return e?e.replace(p.rules._escapes,"$1"):e},p.prototype.outputLink=function(e,t){var n=t.href,r=t.title?u(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,u(e[1]))},p.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},p.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,s=0;s'+(n?e:u(e,!0))+"\n":"
    "+(n?e:u(e,!0))+"
    "},r.prototype.blockquote=function(e){return"
    \n"+e+"
    \n"},r.prototype.html=function(e){return e},r.prototype.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},r.prototype.hr=function(){return this.options.xhtml?"
    \n":"
    \n"},r.prototype.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},r.prototype.listitem=function(e){return"
  • "+e+"
  • \n"},r.prototype.checkbox=function(e){return" "},r.prototype.paragraph=function(e){return"

    "+e+"

    \n"},r.prototype.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},r.prototype.tablerow=function(e){return"\n"+e+"\n"},r.prototype.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},r.prototype.strong=function(e){return""+e+""},r.prototype.em=function(e){return""+e+""},r.prototype.codespan=function(e){return""+e+""},r.prototype.br=function(){return this.options.xhtml?"
    ":"
    "},r.prototype.del=function(e){return""+e+""},r.prototype.link=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r='
    "},r.prototype.image=function(e,t,n){if(null===(e=l(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},r.prototype.text=function(e){return e},s.prototype.strong=s.prototype.em=s.prototype.codespan=s.prototype.del=s.prototype.text=function(e){return e},s.prototype.link=s.prototype.image=function(e,t,n){return""+n},s.prototype.br=function(){return""},h.parse=function(e,t){return new h(t).parse(e)},h.prototype.parse=function(e){this.inline=new p(e.links,this.options),this.inlineText=new p(e.links,d({},this.options,{renderer:new s})),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},h.prototype.next=function(){return this.token=this.tokens.pop()},h.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},h.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},h.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,c(this.inlineText.output(this.token.text)),this.slugger);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,s="",i="";for(n="",e=0;e?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t))for(var n=t;this.seen[n]++,t=n+"-"+this.seen[n],this.seen.hasOwnProperty(t););return this.seen[t]=0,t},u.escapeTest=/[&<>"']/,u.escapeReplace=/[&<>"']/g,u.replacements={"&":"&","<":"<",">":">",'"':""","'":"'"},u.escapeTestNoEncode=/[<>"']|&(?!#?\w+;)/,u.escapeReplaceNoEncode=/[<>"']|&(?!#?\w+;)/g;var o={},g=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function f(){}function d(e){for(var t,n,r=1;rt)n.splice(t);else for(;n.lengthAn error occurred:

    "+u(e.message+"",!0)+"
    ";throw e}}f.exec=f,b.options=b.setOptions=function(e){return d(b.defaults,e),b},b.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new r,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tables:!0,xhtml:!1}},b.defaults=b.getDefaults(),b.Parser=h,b.parser=h.parse,b.Renderer=r,b.TextRenderer=s,b.Lexer=a,b.lexer=a.lex,b.InlineLexer=p,b.inlineLexer=p.output,b.Slugger=t,b.parse=b,"undefined"!=typeof module&&"object"==typeof exports?module.exports=b:"function"==typeof define&&define.amd?define(function(){return b}):e.marked=b}(this||("undefined"!=typeof window?window:global)); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Animation.coffee ---- */ @@ -1413,6 +1420,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Autosize.coffee ---- */ @@ -1426,9 +1434,10 @@ function clone(obj) { extend(Autosize, superClass); function Autosize(attrs1) { - var base; + var base, base1, base2, base3, base4, base5, base6, base7, base8; this.attrs = attrs1 != null ? attrs1 : {}; this.render = bind(this.render, this); + this.submit = bind(this.submit, this); this.handleKeydown = bind(this.handleKeydown, this); this.handleInput = bind(this.handleInput, this); this.autoHeight = bind(this.autoHeight, this); @@ -1438,12 +1447,30 @@ function clone(obj) { if ((base = this.attrs).classes == null) { base.classes = {}; } - this.attrs.classes.loading = false; - this.attrs.oninput = this.handleInput; - this.attrs.onkeydown = this.handleKeydown; - this.attrs.afterCreate = this.storeNode; - this.attrs.rows = 1; - this.attrs.disabled = false; + if ((base1 = this.attrs.classes).loading == null) { + base1.loading = false; + } + if ((base2 = this.attrs).oninput == null) { + base2.oninput = this.handleInput; + } + if ((base3 = this.attrs).onkeydown == null) { + base3.onkeydown = this.handleKeydown; + } + if ((base4 = this.attrs).afterCreate == null) { + base4.afterCreate = this.storeNode; + } + if ((base5 = this.attrs).rows == null) { + base5.rows = 1; + } + if ((base6 = this.attrs).disabled == null) { + base6.disabled = false; + } + if ((base7 = this.attrs).value == null) { + base7.value = ""; + } + if ((base8 = this.attrs).title_submit == null) { + base8.title_submit = null; + } } Autosize.property('loading', { @@ -1514,32 +1541,43 @@ function clone(obj) { if (e == null) { e = null; } - if (e.which === 13 && !e.shiftKey && this.attrs.onsubmit && this.attrs.value.trim()) { - this.attrs.onsubmit(); - setTimeout(((function(_this) { - return function() { - return _this.autoHeight(); - }; - })(this)), 100); - return false; + if (e.which === 13 && e.ctrlKey && this.attrs.onsubmit && this.attrs.value.trim()) { + return this.submit(); } }; + Autosize.prototype.submit = function() { + this.attrs.onsubmit(); + setTimeout(((function(_this) { + return function() { + return _this.autoHeight(); + }; + })(this)), 100); + return false; + }; + Autosize.prototype.render = function(body) { - var attrs; + var attrs, tag_textarea; if (body == null) { body = null; } - if (body && this.attrs.value === void 0) { + if (body && !this.attrs.value) { this.setValue(body); } if (this.loading) { attrs = clone(this.attrs); attrs.disabled = true; - return h("textarea.autosize", attrs); + tag_textarea = h("textarea.autosize", attrs); } else { - return h("textarea.autosize", this.attrs); + tag_textarea = h("textarea.autosize", this.attrs); } + return [ + tag_textarea, this.attrs.title_submit ? h("a.button.button.button-submit.button-small", { + href: "#Submit", + onclick: this.submit, + classes: this.attrs.classes + }, this.attrs.title_submit) : void 0 + ]; }; return Autosize; @@ -1551,6 +1589,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Debug.coffee ---- */ @@ -1584,6 +1623,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Editable.coffee ---- */ @@ -1695,6 +1735,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/ImagePreview.coffee ---- */ @@ -1794,6 +1835,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/ItemList.coffee ---- */ @@ -1847,6 +1889,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Maxheight.coffee ---- */ @@ -1883,6 +1926,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Menu.coffee ---- */ @@ -2044,6 +2088,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Overlay.coffee ---- */ @@ -2162,6 +2207,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Scrollwatcher.coffee ---- */ @@ -2221,6 +2267,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Text.coffee ---- */ @@ -2253,7 +2300,7 @@ function clone(obj) { } Text.prototype.toColor = function(text, saturation, lightness) { - var hash, i, j, ref; + var hash, i, j, ref, ref1, ref2; if (saturation == null) { saturation = 30; } @@ -2265,7 +2312,11 @@ function clone(obj) { hash += text.charCodeAt(i) * i; hash = hash % 1777; } - return "hsl(" + (hash % 360) + ("," + saturation + "%," + lightness + "%)"); + if (((ref1 = Page.server_info) != null ? (ref2 = ref1.user_settings) != null ? ref2.theme : void 0 : void 0) === "dark") { + return "hsl(" + (hash % 360) + ("," + (saturation + 5) + "%," + (lightness + 15) + "%)"); + } else { + return "hsl(" + (hash % 360) + ("," + saturation + "%," + lightness + "%)"); + } }; Text.prototype.renderMarked = function(text, options) { @@ -2281,7 +2332,8 @@ function clone(obj) { options["renderer"] = marked_renderer; text = this.fixReply(text); text = marked(text, options); - text = text.replace(/(@[^\x00-\x1f^\x21-\x2f^\x3a-\x40^\x5b-\x60^\x7b-\x7f]{1,16}):/g, '$1:'); + text = text.replace(/
    (.*?)<\/a>/g, '$1'); + text = text.replace(/(\s|>|^)(@[^\s]{1,50}):/g, '$1$2:'); return this.fixHtmlLinks(text); }; @@ -2291,7 +2343,7 @@ function clone(obj) { return "" + match + ""; }); text = text.replace(/\n/g, '
    '); - text = text.replace(/(@[^\x00-\x1f^\x21-\x2f^\x3a-\x40^\x5b-\x60^\x7b-\x7f]{1,16}):/g, '$1:'); + text = text.replace(/(\s|>|^)(@[^\s]{1,50}):/g, '$1$2:'); text = this.fixHtmlLinks(text); return text; }; @@ -2502,6 +2554,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Time.coffee ---- */ @@ -2570,6 +2623,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Translate.coffee ---- */ @@ -2581,6 +2635,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/Uploadable.coffee ---- */ @@ -2788,6 +2843,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/utils/ZeroFrame.coffee ---- */ @@ -2942,6 +2998,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ActivityList.coffee ---- */ @@ -3001,7 +3058,7 @@ function clone(obj) { query += "\nUNION ALL\n\nSELECT\n 'post_like' AS type, json.*,\n json.site || \"/\" || post_uri AS subject, '' AS body, date_added,\n NULL AS subject_auth_address, NULL AS subject_hub, NULL AS subject_user_name\nFROM\n json\nLEFT JOIN post_like USING (json_id)\n " + where; } if (this.directories !== "all") { - query += "\nUNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; + query += "UNION ALL\n\nSELECT\n 'follow' AS type, json.*,\n follow.hub || \"/\" || follow.auth_address AS subject, '' AS body, date_added,\n follow.auth_address AS subject_auth_address, follow.hub AS subject_hub, follow.user_name AS subject_user_name\nFROM\n json\nLEFT JOIN follow USING (json_id)\n " + where; } if ((Page.local_storage.settings.show_since || Page.local_storage.settings.show_after) && Page.local_storage.settings.show_since !== "0") { query += "\nORDER BY date_added ASC\nLIMIT " + (this.limit + 1); @@ -3150,7 +3207,7 @@ function clone(obj) { }, activity.subject.user_name), "'s ", h("a.link", { href: subject_post_link, onclick: this.Page.handleLinkClick - }, _("post", "comment post")), ": " + activity.body + }, _("post", "comment post")), ": " + activity.body.slice(0, 101) ]; } else if (activity.type === "follow") { body = [ @@ -3337,6 +3394,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentCreateProfile.coffee ---- */ @@ -3596,6 +3654,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentFeed.coffee ---- */ @@ -3842,6 +3901,7 @@ function clone(obj) { if (Page.user.hub) { this.post_list.directories.push("data/users/" + Page.user.auth_address); } + this.post_list.filter_post_ids = null; } else if (this.type === "liked") { this.post_list.directories = (function() { var ref, results; @@ -4262,6 +4322,7 @@ function clone(obj) { style: "color: " + (Text.toColor(this.user.row.auth_address)) }, this.owned ? this.editable_user_name.render(this.user.row.user_name) : h("a", { href: this.user.getLink(), + style: "color: " + (Text.toColor(this.user.row.auth_address)), onclick: Page.handleLinkClick }, this.user.row.user_name)), h("div.cert_user_id", this.user.row.cert_user_id), this.owned ? h("div.intro-full", this.editable_intro.render(this.user.row.intro)) : h("div.intro-full", { innerHTML: Text.renderMarked(this.user.row.intro) @@ -4309,6 +4370,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ContentUsers.coffee ---- */ @@ -4462,6 +4524,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/Head.coffee ---- */ @@ -4711,7 +4774,8 @@ function clone(obj) { this.editable_comments = {}; this.field_comment = new Autosize({ placeholder: "Add your comment", - onsubmit: this.handleCommentSubmit + onsubmit: this.handleCommentSubmit, + title_submit: "Send" }); this.comment_limit = 3; this.menu = null; @@ -4832,6 +4896,9 @@ function clone(obj) { Post.prototype.handleCommentSubmit = function() { var post_uri, ref, site, timer_loading; + if (!this.field_comment.attrs.value) { + return; + } timer_loading = setTimeout(((function(_this) { return function() { return _this.field_comment.loading = true; @@ -5126,6 +5193,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostCreate.coffee ---- */ @@ -5281,6 +5349,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/PostList.coffee ---- */ @@ -5689,6 +5758,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/Trigger.coffee ---- */ @@ -5740,6 +5810,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/User.coffee ---- */ @@ -6302,6 +6373,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/UserList.coffee ---- */ @@ -6449,6 +6521,7 @@ function clone(obj) { }).call(this); + /* ---- /1FZWQJgwcgeK5mUFsKA3JnxuQyjdZ5ErP2/js/ZeroMe.coffee ---- */ @@ -6530,7 +6603,7 @@ function clone(obj) { return function() { _this.log("onloaded"); return window.requestAnimationFrame(function() { - return document.body.className = "loaded"; + return document.body.classList.add("loaded"); }); }; })(this)); @@ -6624,7 +6697,7 @@ function clone(obj) { window.scroll(window.pageXOffset, 0); this.history_state["scrollTop"] = 0; this.on_loaded.resolved = false; - document.body.className = ""; + document.body.classList.remove("loaded"); this.setUrl(e.currentTarget.search); return false; } @@ -6868,7 +6941,7 @@ function clone(obj) { params.state.url = params.href.replace(/.*\?/, ""); } this.on_loaded.resolved = false; - document.body.className = ""; + document.body.classList.remove("loaded"); window.scroll(window.pageXOffset, params.state.scrollTop || 0); return this.route(params.state.url || ""); }