diff --git a/builds/appchan-x.js b/builds/appchan-x.js index 9bc1130a8..934e98197 100644 --- a/builds/appchan-x.js +++ b/builds/appchan-x.js @@ -69,6 +69,7 @@ 'Linkification': { 'Linkify': [true, 'Convert text into links where applicable.'], 'Embedding': [true, 'Embed supported services.'], + 'Auto-embed': [false, 'Auto-embed Linkify Embeds.'], 'Link Title': [true, 'Replace the link of a supported site with its actual title. Currently Supported: YouTube, Vimeo, SoundCloud'] }, 'Filtering': { @@ -11070,7 +11071,7 @@ regString: /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi, cypher: $.el('div'), node: function() { - var a, child, cypher, cypherText, data, embedder, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; + var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2; if (this.isClone && Conf['Embedding']) { _ref = $$('.embedder', this.nodes.comment); @@ -11146,6 +11147,13 @@ } $.replace(node, nodes); } + if (Conf['Auto-embed']) { + embeds = $$('.embedder', this.nodes.comment); + for (_m = 0, _len4 = embeds.length; _m < _len4; _m++) { + embed = embeds[_m]; + embed.click(); + } + } }, toggle: function() { var el, embed, items, style, type, url; @@ -11170,7 +11178,7 @@ 'embedHeight': Config['embedHeight'] }; $.get(items, function(items) { - return el.style.cssText = "border: 0; width: " + item[0] + "px; height: " + item[1] + "px"; + return el.style.cssText = "border: 0; width: " + items['embedWidth'] + "px; height: " + items['embedHeight'] + "px"; }); } this.textContent = '(unembed)'; @@ -11272,7 +11280,7 @@ if (!Conf['Embedding']) { return [a]; } - titles = []; + titles = {}; callbacks = function() { var title; diff --git a/builds/appchan-x.user.js b/builds/appchan-x.user.js index 7856aafbe..fea0fb943 100644 --- a/builds/appchan-x.user.js +++ b/builds/appchan-x.user.js @@ -69,6 +69,7 @@ 'Linkification': { 'Linkify': [true, 'Convert text into links where applicable.'], 'Embedding': [true, 'Embed supported services.'], + 'Auto-embed': [false, 'Auto-embed Linkify Embeds.'], 'Link Title': [true, 'Replace the link of a supported site with its actual title. Currently Supported: YouTube, Vimeo, SoundCloud'] }, 'Filtering': { @@ -11061,7 +11062,7 @@ regString: /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi, cypher: $.el('div'), node: function() { - var a, child, cypher, cypherText, data, embedder, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; + var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2; if (this.isClone && Conf['Embedding']) { _ref = $$('.embedder', this.nodes.comment); @@ -11137,6 +11138,13 @@ } $.replace(node, nodes); } + if (Conf['Auto-embed']) { + embeds = $$('.embedder', this.nodes.comment); + for (_m = 0, _len4 = embeds.length; _m < _len4; _m++) { + embed = embeds[_m]; + embed.click(); + } + } }, toggle: function() { var el, embed, items, style, type, url; @@ -11161,7 +11169,7 @@ 'embedHeight': Config['embedHeight'] }; $.get(items, function(items) { - return el.style.cssText = "border: 0; width: " + item[0] + "px; height: " + item[1] + "px"; + return el.style.cssText = "border: 0; width: " + items['embedWidth'] + "px; height: " + items['embedHeight'] + "px"; }); } this.textContent = '(unembed)'; @@ -11263,7 +11271,7 @@ if (!Conf['Embedding']) { return [a]; } - titles = []; + titles = {}; callbacks = function() { var title; diff --git a/builds/appchan-x.zip b/builds/appchan-x.zip index 3e4d41812..a0da81420 100644 Binary files a/builds/appchan-x.zip and b/builds/appchan-x.zip differ diff --git a/builds/crx.crx b/builds/crx.crx index a129728bd..daf373bd8 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/script.js b/builds/crx/script.js index 0ab414f5b..d80187216 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -48,6 +48,7 @@ 'Linkification': { 'Linkify': [true, 'Convert text into links where applicable.'], 'Embedding': [true, 'Embed supported services.'], + 'Auto-embed': [false, 'Auto-embed Linkify Embeds.'], 'Link Title': [true, 'Replace the link of a supported site with its actual title. Currently Supported: YouTube, Vimeo, SoundCloud'] }, 'Filtering': { @@ -11011,7 +11012,7 @@ regString: /(\b([a-z]+:\/\/|[a-z]{3,}\.[-a-z0-9]+\.[a-z]+|[-a-z0-9]+\.[a-z]|[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-z]{3,}:[a-z0-9?]|[a-z0-9._%+-:]+@[a-z0-9.-]+\.[a-z0-9])[^\s'"]+)/gi, cypher: $.el('div'), node: function() { - var a, child, cypher, cypherText, data, embedder, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2; + var a, child, cypher, cypherText, data, embed, embedder, embeds, i, index, len, link, links, lookahead, name, next, node, nodes, snapshot, spoiler, text, _i, _j, _k, _l, _len, _len1, _len2, _len3, _len4, _m, _ref, _ref1, _ref2; if (this.isClone && Conf['Embedding']) { _ref = $$('.embedder', this.nodes.comment); @@ -11087,6 +11088,13 @@ } $.replace(node, nodes); } + if (Conf['Auto-embed']) { + embeds = $$('.embedder', this.nodes.comment); + for (_m = 0, _len4 = embeds.length; _m < _len4; _m++) { + embed = embeds[_m]; + embed.click(); + } + } }, toggle: function() { var el, embed, items, style, type, url; @@ -11111,7 +11119,7 @@ 'embedHeight': Config['embedHeight'] }; $.get(items, function(items) { - return el.style.cssText = "border: 0; width: " + item[0] + "px; height: " + item[1] + "px"; + return el.style.cssText = "border: 0; width: " + items['embedWidth'] + "px; height: " + items['embedHeight'] + "px"; }); } this.textContent = '(unembed)'; @@ -11213,7 +11221,7 @@ if (!Conf['Embedding']) { return [a]; } - titles = []; + titles = {}; callbacks = function() { var title; diff --git a/src/config.coffee b/src/config.coffee index c288c144f..480988602 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -71,6 +71,10 @@ Config = true 'Embed supported services.' ] + 'Auto-embed': [ + false + 'Auto-embed Linkify Embeds.' + ] 'Link Title': [ true 'Replace the link of a supported site with its actual title. Currently Supported: YouTube, Vimeo, SoundCloud' diff --git a/src/features.coffee b/src/features.coffee index f05998ece..18389b7e3 100644 --- a/src/features.coffee +++ b/src/features.coffee @@ -4037,6 +4037,11 @@ Linkify = $.add nodes, child $.replace node, nodes + + if Conf['Auto-embed'] + embeds = $$ '.embedder', @nodes.comment + for embed in embeds + embed.click() return toggle: -> @@ -4068,7 +4073,7 @@ Linkify = 'embedWidth': Config['embedWidth'] 'embedHeight': Config['embedHeight'] $.get items, (items) -> - el.style.cssText = "border: 0; width: #{item[0]}px; height: #{item[1]}px" + el.style.cssText = "border: 0; width: #{items['embedWidth']}px; height: #{items['embedHeight']}px" @textContent = '(unembed)' @@ -4136,7 +4141,7 @@ Linkify = embedder: (a) -> return [a] unless Conf['Embedding'] - titles = [] + titles = {} callbacks = -> a.textContent = switch @status