Merge branch 'next'

This commit is contained in:
ccd0 2016-05-13 19:01:22 -07:00
commit 55b3e9fc9e
6 changed files with 52 additions and 21 deletions

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -11,10 +11,22 @@ 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 (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,

View File

@ -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'

View File

@ -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': [
@ -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