Backport fixes from master branch

This commit is contained in:
Zixaphir 2014-03-20 09:37:27 -07:00
parent af87eea3fb
commit 18db3994b6
6 changed files with 203 additions and 243 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.4.1 - 2014-03-15
* 4chan X - Version 1.4.1 - 2014-03-20
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE

View File

@ -24,7 +24,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.4.1 - 2014-03-15
* 4chan X - Version 1.4.1 - 2014-03-20
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -8453,28 +8453,26 @@
if (Conf['Comment Expansion']) {
ExpandComment.callbacks.push(this.node);
}
if (Conf['Title Link']) {
$.sync('CachedTitles', Linkify.titleSync);
}
return Post.callbacks.push({
name: 'Linkify',
cb: this.node
});
},
node: function() {
var data, el, end, endNode, i, index, items, length, link, links, node, result, saved, snapshot, space, test, word, _i, _len, _ref;
if (this.isClone) {
if (Conf['Embedding']) {
i = 0;
items = $$('.embed', this.nodes.comment);
while (el = items[i++]) {
$.on(el, 'click', Linkify.cb.toggle);
if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
}
events: function(post) {
var el, i, items;
i = 0;
items = $$('.embedder', post.nodes.comment);
while (el = items[i++]) {
$.on(el, 'click', Linkify.cb.toggle);
if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
return;
}
},
node: function() {
var data, end, endNode, i, index, length, link, links, node, result, saved, snapshot, space, test, word;
if (this.isClone) {
return (Conf['Embedding'] ? Linkify.events(this) : null);
}
if (!Linkify.regString.test(this.info.comment)) {
return;
@ -8486,7 +8484,7 @@
links = [];
while (node = snapshot.snapshotItem(i++)) {
data = node.data;
if (node.parentElement.nodeName === "A" || !data) {
if (!data || node.parentElement.nodeName === "A") {
continue;
}
while (result = test.exec(data)) {
@ -8518,25 +8516,20 @@
}
}
}
_ref = links.reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
this.nodes.links.push(Linkify.makeLink(link, this));
link.detach();
i = links.length;
while (i--) {
link = links[i];
Linkify.embedProcess(Linkify.makeLink(link, this));
}
if (!(Conf['Embedding'] || Conf['Link Title'])) {
return;
}
links = this.nodes.links;
i = 0;
while (link = links[i++]) {
if (data = Linkify.services(link)) {
if (Conf['Embedding']) {
Linkify.embed(data);
}
if (Conf['Link Title']) {
Linkify.title(data);
}
},
embedProcess: function(link) {
var data;
if (data = Linkify.services(link)) {
if (Conf['Embedding']) {
Linkify.embed(data);
}
if (Conf['Link Title']) {
return Linkify.title(data);
}
}
},
@ -8549,7 +8542,7 @@
return range;
},
makeLink: function(range) {
var a, char, i, text;
var a, i, t, text;
text = range.toString();
i = 0;
while (/[(\[{<>]/.test(text.charAt(i))) {
@ -8565,8 +8558,8 @@
}
}
i = 0;
while (/[)\]}>.,]/.test(char = text.charAt(text.length - (1 + i)))) {
if (!(/[.,]/.test(char) || (text.match(/[()\[\]{}<>]/g)).length % 2)) {
while (/[)\]}>.,]/.test(t = text.charAt(text.length - (1 + i)))) {
if (!(/[.,]/.test(t) || (text.match(/[()\[\]{}<>]/g)).length % 2)) {
break;
}
i++;
@ -8591,6 +8584,7 @@
});
$.add(a, range.extractContents());
range.insertNode(a);
range.detach();
return a;
},
services: function(link) {
@ -8599,10 +8593,9 @@
_ref = Linkify.types;
for (key in _ref) {
type = _ref[key];
if (!(match = type.regExp.exec(href))) {
continue;
if (match = type.regExp.exec(href)) {
return [key, match[1], match[2], link];
}
return [key, match[1], match[2], link];
}
},
embed: function(data) {
@ -8631,7 +8624,7 @@
if (Conf['Auto-embed']) {
Linkify.cb.toggle.call(embed);
}
data.push(embed);
return data.push(embed);
},
title: function(data) {
var embed, err, key, link, options, service, title, titles, uid;
@ -8649,9 +8642,9 @@
}
} else {
try {
$.cache(service.api(uid), function() {
return title = Linkify.cb.title(this, data);
}, {
return $.cache(service.api(uid), (function() {
return Linkify.cb.title(this, data);
}), {
responseType: 'json'
});
} catch (_error) {
@ -8659,17 +8652,9 @@
if (link) {
link.innerHTML = "[" + key + "] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>";
}
return;
}
if (title) {
titles[uid] = [title, Date.now()];
return $.set('CachedTitles', titles);
}
}
},
titleSync: function(value) {
return Conf['CachedTitles'] = value;
},
cb: {
toggle: function() {
var string, _ref;
@ -8695,26 +8680,26 @@
$.addClass(el, a.dataset.key);
return el;
},
title: function(response, data) {
var embed, key, link, options, service, text, uid;
title: function(req, data) {
var embed, key, link, options, service, status, text, uid;
key = data[0], uid = data[1], options = data[2], link = data[3], embed = data[4];
status = req.status;
service = Linkify.types[key].title;
switch (response.status) {
case 200:
case 304:
text = "" + (service.text(response.response));
if (Conf['Embedding']) {
embed.dataset.title = text;
}
break;
case 404:
text = "[" + key + "] Not Found";
break;
case 403:
text = "[" + key + "] Forbidden or Private";
break;
default:
text = "[" + key + "] " + this.status + "'d";
text = "[" + key + "] " + ((function() {
switch (status) {
case 200:
case 304:
return service.text(req.response);
case 404:
return "Not Found";
case 403:
return "Forbidden or Private";
default:
return "" + status + "'d";
}
})());
if (Conf['Embedding'] && (status === 200 || status === 304)) {
embed.dataset.title = text;
}
if (link) {
return link.textContent = text;
@ -12460,8 +12445,8 @@
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation']) {
return;
}
$.on(window, 'popstate', Navigate.popstate);
$.ready(function() {
$.on(window, 'popstate', Navigate.popstate);
Navigate.makeBreadCrumb(window.location, g.VIEW, g.BOARD.ID, g.THREADID);
return $.add(Index.navLinks, Navigate.el);
});
@ -12674,7 +12659,9 @@
Index.update();
}
}
e.preventDefault();
if (e != null) {
e.preventDefault();
}
return;
}
$.addClass(Index.button, 'fa-spin');
@ -12682,7 +12669,7 @@
if ('f' === boardID || 'f' === g.BOARD.ID) {
return;
}
if (e) {
if (e != null) {
e.preventDefault();
}
if (Index.isSearching) {
@ -13645,11 +13632,10 @@
});
$.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
}
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) {
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
Main.initThread();
} else {
$.event('4chanXInitFinished');
}
$.event('4chanXInitFinished');
test = $.el('span');
test.classList.add('a', 'b');
if (test.className !== 'a b') {
@ -13704,7 +13690,6 @@
}
Thread.callbacks.execute(threads);
Post.callbacks.execute(posts);
$.event('4chanXInitFinished');
}
return $.get('previousversion', null, function(_arg) {
var changelog, el, previousversion;

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.4.1 - 2014-03-15
* 4chan X - Version 1.4.1 - 2014-03-20
*
* Licensed under the MIT license.
* https://github.com/Spittie/4chan-x/blob/master/LICENSE
@ -8468,28 +8468,26 @@
if (Conf['Comment Expansion']) {
ExpandComment.callbacks.push(this.node);
}
if (Conf['Title Link']) {
$.sync('CachedTitles', Linkify.titleSync);
}
return Post.callbacks.push({
name: 'Linkify',
cb: this.node
});
},
node: function() {
var data, el, end, endNode, i, index, items, length, link, links, node, result, saved, snapshot, space, test, word, _i, _len, _ref;
if (this.isClone) {
if (Conf['Embedding']) {
i = 0;
items = $$('.embed', this.nodes.comment);
while (el = items[i++]) {
$.on(el, 'click', Linkify.cb.toggle);
if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
}
events: function(post) {
var el, i, items;
i = 0;
items = $$('.embedder', post.nodes.comment);
while (el = items[i++]) {
$.on(el, 'click', Linkify.cb.toggle);
if ($.hasClass(el, 'embedded')) {
Linkify.cb.toggle.call(el);
}
return;
}
},
node: function() {
var data, end, endNode, i, index, length, link, links, node, result, saved, snapshot, space, test, word;
if (this.isClone) {
return (Conf['Embedding'] ? Linkify.events(this) : null);
}
if (!Linkify.regString.test(this.info.comment)) {
return;
@ -8501,7 +8499,7 @@
links = [];
while (node = snapshot.snapshotItem(i++)) {
data = node.data;
if (node.parentElement.nodeName === "A" || !data) {
if (!data || node.parentElement.nodeName === "A") {
continue;
}
while (result = test.exec(data)) {
@ -8533,25 +8531,20 @@
}
}
}
_ref = links.reverse();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
link = _ref[_i];
this.nodes.links.push(Linkify.makeLink(link, this));
link.detach();
i = links.length;
while (i--) {
link = links[i];
Linkify.embedProcess(Linkify.makeLink(link, this));
}
if (!(Conf['Embedding'] || Conf['Link Title'])) {
return;
}
links = this.nodes.links;
i = 0;
while (link = links[i++]) {
if (data = Linkify.services(link)) {
if (Conf['Embedding']) {
Linkify.embed(data);
}
if (Conf['Link Title']) {
Linkify.title(data);
}
},
embedProcess: function(link) {
var data;
if (data = Linkify.services(link)) {
if (Conf['Embedding']) {
Linkify.embed(data);
}
if (Conf['Link Title']) {
return Linkify.title(data);
}
}
},
@ -8564,7 +8557,7 @@
return range;
},
makeLink: function(range) {
var a, char, i, text;
var a, i, t, text;
text = range.toString();
i = 0;
while (/[(\[{<>]/.test(text.charAt(i))) {
@ -8580,8 +8573,8 @@
}
}
i = 0;
while (/[)\]}>.,]/.test(char = text.charAt(text.length - (1 + i)))) {
if (!(/[.,]/.test(char) || (text.match(/[()\[\]{}<>]/g)).length % 2)) {
while (/[)\]}>.,]/.test(t = text.charAt(text.length - (1 + i)))) {
if (!(/[.,]/.test(t) || (text.match(/[()\[\]{}<>]/g)).length % 2)) {
break;
}
i++;
@ -8606,6 +8599,7 @@
});
$.add(a, range.extractContents());
range.insertNode(a);
range.detach();
return a;
},
services: function(link) {
@ -8614,10 +8608,9 @@
_ref = Linkify.types;
for (key in _ref) {
type = _ref[key];
if (!(match = type.regExp.exec(href))) {
continue;
if (match = type.regExp.exec(href)) {
return [key, match[1], match[2], link];
}
return [key, match[1], match[2], link];
}
},
embed: function(data) {
@ -8646,7 +8639,7 @@
if (Conf['Auto-embed']) {
Linkify.cb.toggle.call(embed);
}
data.push(embed);
return data.push(embed);
},
title: function(data) {
var embed, err, key, link, options, service, title, titles, uid;
@ -8664,9 +8657,9 @@
}
} else {
try {
$.cache(service.api(uid), function() {
return title = Linkify.cb.title(this, data);
}, {
return $.cache(service.api(uid), (function() {
return Linkify.cb.title(this, data);
}), {
responseType: 'json'
});
} catch (_error) {
@ -8674,17 +8667,9 @@
if (link) {
link.innerHTML = "[" + key + "] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>";
}
return;
}
if (title) {
titles[uid] = [title, Date.now()];
return $.set('CachedTitles', titles);
}
}
},
titleSync: function(value) {
return Conf['CachedTitles'] = value;
},
cb: {
toggle: function() {
var string, _ref;
@ -8710,26 +8695,26 @@
$.addClass(el, a.dataset.key);
return el;
},
title: function(response, data) {
var embed, key, link, options, service, text, uid;
title: function(req, data) {
var embed, key, link, options, service, status, text, uid;
key = data[0], uid = data[1], options = data[2], link = data[3], embed = data[4];
status = req.status;
service = Linkify.types[key].title;
switch (response.status) {
case 200:
case 304:
text = "" + (service.text(response.response));
if (Conf['Embedding']) {
embed.dataset.title = text;
}
break;
case 404:
text = "[" + key + "] Not Found";
break;
case 403:
text = "[" + key + "] Forbidden or Private";
break;
default:
text = "[" + key + "] " + this.status + "'d";
text = "[" + key + "] " + ((function() {
switch (status) {
case 200:
case 304:
return service.text(req.response);
case 404:
return "Not Found";
case 403:
return "Forbidden or Private";
default:
return "" + status + "'d";
}
})());
if (Conf['Embedding'] && (status === 200 || status === 304)) {
embed.dataset.title = text;
}
if (link) {
return link.textContent = text;
@ -12471,11 +12456,16 @@
Navigate = {
path: window.location.pathname,
init: function() {
var popstateHack;
if (g.BOARD.ID === 'f' || !Conf['JSON Navigation']) {
return;
}
popstateHack = function() {
$.off(window, 'popstate', popstateHack);
return $.on(window, 'popstate', Navigate.popstate);
};
$.on(window, 'popstate', popstateHack);
$.ready(function() {
$.on(window, 'popstate', Navigate.popstate);
Navigate.makeBreadCrumb(window.location, g.VIEW, g.BOARD.ID, g.THREADID);
return $.add(Index.navLinks, Navigate.el);
});
@ -12688,7 +12678,9 @@
Index.update();
}
}
e.preventDefault();
if (e != null) {
e.preventDefault();
}
return;
}
$.addClass(Index.button, 'fa-spin');
@ -12696,7 +12688,7 @@
if ('f' === boardID || 'f' === g.BOARD.ID) {
return;
}
if (e) {
if (e != null) {
e.preventDefault();
}
if (Index.isSearching) {
@ -13657,11 +13649,10 @@
});
$.before(styleSelector.previousSibling, [$.tn('['), passLink, $.tn(']\u00A0\u00A0')]);
}
if (!(Conf['JSON Navigation'] && g.VIEW === 'index')) {
if (!Conf['JSON Navigation'] || g.VIEW === 'thread') {
Main.initThread();
} else {
$.event('4chanXInitFinished');
}
$.event('4chanXInitFinished');
try {
return localStorage.getItem('4chan-settings');
} catch (_error) {
@ -13701,7 +13692,6 @@
}
Thread.callbacks.execute(threads);
Post.callbacks.execute(posts);
$.event('4chanXInitFinished');
}
return $.get('previousversion', null, function(_arg) {
var changelog, el, previousversion;

View File

@ -187,10 +187,10 @@ Main =
$.before styleSelector.previousSibling, [$.tn '['; passLink, $.tn ']\u00A0\u00A0']
# Parse HTML or skip it and start building from JSON.
unless Conf['JSON Navigation'] and g.VIEW is 'index'
if !Conf['JSON Navigation'] or g.VIEW is 'thread'
Main.initThread()
else
$.event '4chanXInitFinished'
$.event '4chanXInitFinished'
<% if (type === 'userscript') { %>
test = $.el 'span'
@ -233,8 +233,6 @@ Main =
Thread.callbacks.execute threads
Post.callbacks.execute posts
$.event '4chanXInitFinished'
$.get 'previousversion', null, ({previousversion}) ->
return if previousversion is g.VERSION
if previousversion

View File

@ -3,9 +3,18 @@ Navigate =
init: ->
return if g.BOARD.ID is 'f' or !Conf['JSON Navigation']
<% if (type === 'crx') { %>
# blink/webkit throw a popstate on page load. Not what we want.
popstateHack = ->
$.off window, 'popstate', popstateHack
$.on window, 'popstate', Navigate.popstate
$.on window, 'popstate', popstateHack
<% } else { %>
$.on window, 'popstate', Navigate.popstate
<% } %>
$.ready ->
# blink/webkit throw a popstate on page load. Not what we want.
$.on window, 'popstate', Navigate.popstate
Navigate.makeBreadCrumb window.location, g.VIEW, g.BOARD.ID, g.THREADID
$.add Index.navLinks, Navigate.el
@ -173,8 +182,7 @@ Navigate =
navigate: (e) ->
return if @hostname isnt 'boards.4chan.org' or window.location.hostname is 'rs.4chan.org'
if e
if e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0) # Not simply a left click
return
return if e.shiftKey or e.ctrlKey or (e.type is 'click' and e.button isnt 0) # Not simply a left click
if @pathname is Navigate.path
if g.VIEW is 'thread'
@ -182,7 +190,7 @@ Navigate =
else
unless Index.searchTest()
Index.update()
e.preventDefault()
e?.preventDefault()
return
$.addClass Index.button, 'fa-spin'
@ -190,7 +198,7 @@ Navigate =
[_, boardID, view, threadID] = @pathname.split '/'
return if 'f' in [boardID, g.BOARD.ID]
e.preventDefault() if e
e?.preventDefault()
Index.clearSearch() if Index.isSearching
Navigate.title = -> return

View File

@ -5,35 +5,30 @@ Linkify =
if Conf['Comment Expansion']
ExpandComment.callbacks.push @node
if Conf['Title Link']
$.sync 'CachedTitles', Linkify.titleSync
Post.callbacks.push
name: 'Linkify'
cb: @node
events: (post) ->
i = 0
items = $$ '.embedder', post.nodes.comment
while el = items[i++]
$.on el, 'click', Linkify.cb.toggle
Linkify.cb.toggle.call el if $.hasClass el, 'embedded'
return
node: ->
if @isClone
if Conf['Embedding']
i = 0
items = $$ '.embed', @nodes.comment
while el = items[i++]
$.on el, 'click', Linkify.cb.toggle
Linkify.cb.toggle.call el if $.hasClass el, 'embedded'
return
return (if Conf['Embedding'] then Linkify.events @ else null) if @isClone
return unless Linkify.regString.test @info.comment
test = /[^\s'"]+/g
space = /[\s'"]/
test = /[^\s'"]+/g
space = /[\s'"]/
snapshot = $.X './/br|.//text()', @nodes.comment
i = 0
links = []
while node = snapshot.snapshotItem i++
{data} = node
continue if node.parentElement.nodeName is "A" or not data
continue if !data or node.parentElement.nodeName is "A"
while result = test.exec data
{index} = result
@ -58,41 +53,33 @@ Linkify =
i--
break
if Linkify.regString.exec word
links.push Linkify.makeRange node, endNode, index, length
links.push Linkify.makeRange node, endNode, index, length if Linkify.regString.exec word
break unless test.lastIndex and node is endNode
for link in links.reverse()
@nodes.links.push Linkify.makeLink link, @
link.detach()
return unless Conf['Embedding'] or Conf['Link Title']
{links} = @nodes
i = 0
while link = links[i++]
if data = Linkify.services link
Linkify.embed data if Conf['Embedding']
Linkify.title data if Conf['Link Title']
i = links.length
while i--
link = links[i]
Linkify.embedProcess Linkify.makeLink link, @
return
embedProcess: (link) ->
if data = Linkify.services link
Linkify.embed data if Conf['Embedding']
Linkify.title data if Conf['Link Title']
regString: ///(
# http, magnet, ftp, etc
(https?|mailto|git|magnet|ftp|irc):(
[a-z\d%/]
)
|
# This should account for virtually all links posted without http:
| # This should account for virtually all links posted without http:
[-a-z\d]+[.](
aero|asia|biz|cat|com|coop|info|int|jobs|mobi|museum|name|net|org|post|pro|tel|travel|xxx|edu|gov|mil|[a-z]{2}
)(/|(?!.))
|
# IPv4 Addresses
| # IPv4 Addresses
[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}\.[\d]{1,3}
|
# E-mails
| # E-mails
[-\w\d.@]+@[a-z\d.-]+\.[a-z\d]
)///i
@ -105,7 +92,7 @@ Linkify =
makeLink: (range) ->
text = range.toString()
# Clean leading brackets, >
# Clean start of range
i = 0
i++ while /[(\[{<>]/.test text.charAt i
@ -115,10 +102,10 @@ Linkify =
range.setStart range.startContainer, range.startOffset + i if i
# Clean hanging brackets, commas, periods
# Clean end of range
i = 0
while /[)\]}>.,]/.test char = text.charAt text.length - (1 + i)
break unless /[.,]/.test(char) or (text.match /[()\[\]{}<>]/g).length % 2
while /[)\]}>.,]/.test t = text.charAt text.length - (1 + i)
break unless /[.,]/.test(t) or (text.match /[()\[\]{}<>]/g).length % 2
i++
if i
@ -128,6 +115,7 @@ Linkify =
if i
range.setEnd range.endContainer, range.endOffset - i
# Make our link 'valid' if it is formatted incorrectly.
unless /(https?|mailto|git|magnet|ftp|irc):/.test text
text = (
if /@/.test text
@ -141,15 +129,17 @@ Linkify =
rel: 'nofollow noreferrer'
target: '_blank'
href: text
# Insert the range into the anchor, the anchor into the range's DOM location, and destroy the range.
$.add a, range.extractContents()
range.insertNode a
range.detach()
a
services: (link) ->
href = link.href
for key, type of Linkify.types
continue unless match = type.regExp.exec href
{href} = link
for key, type of Linkify.types when match = type.regExp.exec href
return [key, match[1], match[2], link]
return
@ -161,9 +151,7 @@ Linkify =
href: 'javascript:;'
textContent: '(embed)'
for name, value of {key, href, uid, options}
embed.dataset[name] = value
embed.dataset[name] = value for name, value of {key, href, uid, options}
embed.dataset.nodedata = link.innerHTML
$.addClass link, "#{embed.dataset.key}"
@ -171,13 +159,10 @@ Linkify =
$.on embed, 'click', Linkify.cb.toggle
$.after link, [$.tn(' '), embed]
if Conf['Auto-embed']
Linkify.cb.toggle.call embed
Linkify.cb.toggle.call embed if Conf['Auto-embed']
data.push embed
return
title: (data) ->
[key, uid, options, link, embed] = data
return unless service = Linkify.types[key].title
@ -190,20 +175,11 @@ Linkify =
embed.dataset.title = title[0]
else
try
$.cache service.api(uid),
-> title = Linkify.cb.title @, data
,
responseType: 'json'
$.cache service.api(uid), (-> Linkify.cb.title @, data), responseType: 'json'
catch err
if link
link.innerHTML = "[#{key}] <span class=warning>Title Link Blocked</span> (are you using NoScript?)</a>"
return
if title
titles[uid] = [title, Date.now()]
$.set 'CachedTitles', titles
titleSync: (value) ->
Conf['CachedTitles'] = value
cb:
toggle: ->
@ -239,21 +215,24 @@ Linkify =
return el
title: (response, data) ->
title: (req, data) ->
[key, uid, options, link, embed] = data
{status} = req
service = Linkify.types[key].title
switch response.status
text = "[#{key}] #{switch status
when 200, 304
text = "#{service.text response.response}"
if Conf['Embedding']
embed.dataset.title = text
service.text req.response
when 404
text = "[#{key}] Not Found"
"Not Found"
when 403
text = "[#{key}] Forbidden or Private"
"Forbidden or Private"
else
text = "[#{key}] #{@status}'d"
link.textContent = text if link
"#{status}'d"
}"
embed.dataset.title = text if Conf['Embedding'] and status in [200, 304]
link.textContent = text if link
types:
audio: