From 25d25cfb49218213eaf81312cc1592fccd007415 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 10 May 2016 15:30:30 -0700 Subject: [PATCH 1/7] Make flags appear in inlined cross-board quotes. #578 --- src/classes/Fetcher.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/classes/Fetcher.coffee b/src/classes/Fetcher.coffee index 18a7e2098..e93335578 100644 --- a/src/classes/Fetcher.coffee +++ b/src/classes/Fetcher.coffee @@ -28,6 +28,14 @@ class Fetcher if postID is @quoter.ID and boardID is @quoter.board.ID $.addClass quote, 'forwardlink' + # Set up flag CSS for cross-board links to boards with flags + if clone.nodes.flag and not (Fetcher.flagCSS or= $ 'link[href^="//s.4cdn.org/css/flags."]') + cssVersion = $('link[href^="//s.4cdn.org/css/"]')?.href.match(/\d+(?=\.css$)|$/)[0] or Date.now() + Fetcher.flagCSS = $.el 'link', + rel: 'stylesheet' + href: "//s.4cdn.org/css/flags.#{cssVersion}.css" + $.add d.head, Fetcher.flagCSS + $.rmAll @root $.add @root, nodes.root $.event 'PostsInserted' From e920679a4eb8a0c94c3ce4845682e5e413d5a263 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 10 May 2016 16:55:14 -0700 Subject: [PATCH 2/7] Turn 'Restart when Opened' off by default. #159 --- src/config/Config.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/Config.coffee b/src/config/Config.coffee index 60f236d4f..aea391bdc 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -255,7 +255,7 @@ Config = 'Videos begin playing immediately when opened.' ] 'Restart when Opened': [ - true + false 'Restart GIFs and WebMs when you hover over or expand them.' ] 'Show Controls': [ From 0aadc302a7f2114a063a57d3c7bc935d2dc1a62b Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 10 May 2016 17:14:07 -0700 Subject: [PATCH 3/7] Add a data-type attribute to menus to indicate what type (post, header, thread watcher, gallery) they are. --- src/General/UI.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/General/UI.coffee b/src/General/UI.coffee index 960402825..ec7ce109e 100644 --- a/src/General/UI.coffee +++ b/src/General/UI.coffee @@ -33,6 +33,7 @@ class Menu className: 'dialog' id: 'menu' tabIndex: 0 + menu.dataset.type = @type $.on menu, 'click', (e) -> e.stopPropagation() $.on menu, 'keydown', @keybinds menu From 9a42bf454ea09b746dbc9c77ddeeb89b857e6f84 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Tue, 10 May 2016 17:52:26 -0700 Subject: [PATCH 4/7] Prefer filename to poster name as thread excerpt. --- src/General/Get.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/src/General/Get.coffee b/src/General/Get.coffee index 3a2a56000..d84abb957 100644 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -4,6 +4,7 @@ Get = excerpt = "/#{thread.board}/ - " + ( OP.info.subject?.trim() or OP.info.commentDisplay.replace(/\n+/g, ' // ') or + OP.file?.name or OP.info.nameBlock) return "#{excerpt[...70]}..." if excerpt.length > 73 excerpt From adf1d4716bf7e4d1b7e83e27af40366a8dfc0fda Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 11 May 2016 23:39:22 -0700 Subject: [PATCH 5/7] Turn archive links into quotelinks. #512 --- src/Quotelinks/Quotify.coffee | 13 +++++++++++++ src/config/Config.coffee | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 958597c33..0bd0e40d3 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -11,10 +11,23 @@ Quotify = node: -> return if @isClone + for link in $$ 'a.linkify', @nodes.comment + Quotify.parseArchiveLink.call @, link for deadlink in $$ '.deadlink', @nodes.comment Quotify.parseDeadlink.call @, deadlink return + parseArchiveLink: (link) -> + return unless Redirect.archives.some (o) -> link.host is o.domain + return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?/) + boardID = m[1] + threadID = m[2] + postID = link.hash.match(/^#p?(\d+)$|$/)[1] or threadID + if Redirect.to 'post', {boardID, postID} + $.addClass link, 'quotelink' + $.extend link.dataset, {boardID, threadID, postID} + @nodes.quotelinks.push link + parseDeadlink: (deadlink) -> if $.hasClass deadlink.parentNode, 'prettyprint' # Don't quotify deadlinks inside code tags, diff --git a/src/config/Config.coffee b/src/config/Config.coffee index aea391bdc..44c11e7e3 100644 --- a/src/config/Config.coffee +++ b/src/config/Config.coffee @@ -547,7 +547,7 @@ Config = ] 'Resurrect Quotes': [ true - 'Link dead quotes to the archives.' + 'Link dead quotes to the archives, and support inlining/previewing of archive links like quote links.' ] 'Remember Your Posts': [ true From cc69f4a3da57c70f14761866cd546a5b8cfe0ba1 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Thu, 12 May 2016 00:00:55 -0700 Subject: [PATCH 6/7] Drop domain check for archive links. --- src/Quotelinks/Quotify.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Quotelinks/Quotify.coffee b/src/Quotelinks/Quotify.coffee index 0bd0e40d3..6fa611cbb 100644 --- a/src/Quotelinks/Quotify.coffee +++ b/src/Quotelinks/Quotify.coffee @@ -18,8 +18,7 @@ Quotify = return parseArchiveLink: (link) -> - return unless Redirect.archives.some (o) -> link.host is o.domain - return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?/) + return unless (m = link.pathname.match /^\/([^/]+)\/thread\/S?(\d+)\/?$/) boardID = m[1] threadID = m[2] postID = link.hash.match(/^#p?(\d+)$|$/)[1] or threadID From ab05716f20c4c81a10765f9d43d67926af97048c Mon Sep 17 00:00:00 2001 From: ccd0 Date: Fri, 13 May 2016 17:57:00 -0700 Subject: [PATCH 7/7] Update Loopvid embedding. --- src/Linkification/Embedding.coffee | 47 ++++++++++++++++++------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/Linkification/Embedding.coffee b/src/Linkification/Embedding.coffee index 17e42171b..03777f728 100644 --- a/src/Linkification/Embedding.coffee +++ b/src/Linkification/Embedding.coffee @@ -254,13 +254,16 @@ Embedding = el , key: 'Loopvid' - regExp: /^\w+:\/\/(?:www\.)?loopvid.appspot.com\/#?((?:pf|kd|lv|gd|gh|db|dx|nn|cp|wu|ig|ky|mf|pc|gc)\/[\w\-\/]+(,[\w\-\/]+)*|fc\/\w+\/\d+)/ + regExp: /^\w+:\/\/(?:www\.)?loopvid.appspot.com\/#?((?:pf|kd|lv|gd|gh|db|dx|nn|cp|wu|ig|ky|mf|m2|pc|1c|pi|wl|ko|gc)\/[\w\-\/]+(?:,[\w\-\/]+)*|fc\/\w+\/\d+|https?:\/\/.+)/ style: 'max-width: 80vw; max-height: 80vh;' el: (a) -> el = $.el 'video', controls: true preload: 'auto' loop: true + if /^http/.test a.dataset.uid + $.add el, $.el 'source', src: a.dataset.uid + return el [_, host, names] = a.dataset.uid.match /(\w+)\/(.*)/ types = switch host when 'gd', 'wu', 'fc' then [''] @@ -269,25 +272,31 @@ Embedding = for name in names.split ',' for type in types base = "#{name}#{type}" - url = switch host + urls = switch host # list from src/common.py at http://loopvid.appspot.com/source.html - when 'pf' then "https://web.archive.org/web/2/http://a.pomf.se/#{base}" - when 'kd' then "http://kastden.org/loopvid/#{base}" - when 'lv' then "http://kastden.org/_loopvid_media/lv/#{base}" - when 'gd' then "https://docs.google.com/uc?export=download&id=#{base}" - when 'gh' then "https://googledrive.com/host/#{base}" - when 'db' then "https://dl.dropboxusercontent.com/u/#{base}" - when 'dx' then "https://dl.dropboxusercontent.com/#{base}" - when 'nn' then "http://naenara.eu/loopvids/#{base}" - when 'cp' then "https://copy.com/#{base}" - when 'wu' then "http://webmup.com/#{base}/vid.webm" - when 'ig' then "https://i.imgur.com/#{base}" - when 'ky' then "https://kiyo.me/#{base}" - when 'mf' then "https://d.maxfile.ro/#{base}" - when 'pc' then "http://a.pomf.cat/#{base}" - when 'fc' then "//i.4cdn.org/#{base}.webm" - when 'gc' then "https://#{type}.gfycat.com/#{name}.webm" - $.add el, $.el 'source', src: url + when 'pf' then ["https://kastden.org/_loopvid_media/pf/#{base}", "https://web.archive.org/web/2/http://a.pomf.se/#{base}"] + when 'kd' then ["http://kastden.org/loopvid/#{base}"] + when 'lv' then ["http://lv.kastden.org/#{base}"] + when 'gd' then ["https://docs.google.com/uc?export=download&id=#{base}"] + when 'gh' then ["https://googledrive.com/host/#{base}"] + when 'db' then ["https://dl.dropboxusercontent.com/u/#{base}"] + when 'dx' then ["https://dl.dropboxusercontent.com/#{base}"] + when 'nn' then ["http://naenara.eu/loopvids/#{base}"] + when 'cp' then ["https://copy.com/#{base}"] + when 'wu' then ["http://webmup.com/#{base}/vid.webm"] + when 'ig' then ["https://i.imgur.com/#{base}"] + when 'ky' then ["https://kiyo.me/#{base}"] + when 'mf' then ["https://kastden.org/_loopvid_media/mf/#{base}", "https://web.archive.org/web/2/https://d.maxfile.ro/#{base}"] + when 'm2' then ["https://kastden.org/_loopvid_media/m2/#{base}"] + when 'pc' then ["http://a.pomf.cat/#{base}"] + when '1c' then ["http://b.1339.cf/#{base}"] + when 'pi' then ["https://u.pomf.is/#{base}"] + when 'wl' then ["http://webm.land/media/#{base}"] + when 'ko' then ["https://kordy.kastden.org/loopvid/#{base}"] + when 'fc' then ["//i.4cdn.org/#{base}.webm"] + when 'gc' then ["https://#{type}.gfycat.com/#{name}.webm"] + for url in urls + $.add el, $.el 'source', src: url el , key: 'Openings.moe'