diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fe4b98eb..f43c0d8f2 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### v1.7.6 +*2014-04-10* + **ccd0** - `Loop in New Tab` (enabled by default) causes videos opened in a separate tab to loop, and applies your settings for inline expanded videos to them. diff --git a/LICENSE b/LICENSE index 3fb6b3131..ee2642a94 100755 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ /* -* 4chan X - Version 1.7.5 - 2014-04-09 +* 4chan X - Version 1.7.6 - 2014-04-10 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE diff --git a/builds/4chan-X.meta.js b/builds/4chan-X.meta.js index 331118141..67d9fe315 100755 --- a/builds/4chan-X.meta.js +++ b/builds/4chan-X.meta.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 4chan X -// @version 1.7.5 +// @version 1.7.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 3a357e5c7..abe6f200f 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -1,7 +1,7 @@ // Generated by CoffeeScript // ==UserScript== // @name 4chan X -// @version 1.7.5 +// @version 1.7.6 // @minGMVer 1.14 // @minFFVer 26 // @namespace 4chan-X @@ -24,7 +24,7 @@ // ==/UserScript== /* -* 4chan X - Version 1.7.5 - 2014-04-09 +* 4chan X - Version 1.7.6 - 2014-04-10 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -106,7 +106,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, InfiniScroll, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, c, d, doc, g, + var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, InfiniScroll, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, Video, c, d, doc, g, __slice = [].slice, __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; }, __hasProp = {}.hasOwnProperty, @@ -183,9 +183,10 @@ 'Image Prefetching': [false, 'Preload images'], 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'], 'Werk Tyme': [false, 'Hide all post images.'], - 'Autoplay': [true, 'Videos begin playing immediately when opened inline.'], - 'Show Controls': [true, 'Show native seek and volume controls on videos. Contract videos when dragged to the left.'], - 'Allow Sound': [true, 'Allow sound in inline videos.'] + 'Autoplay': [true, 'Videos begin playing immediately when opened.'], + 'Show Controls': [true, 'Show controls on videos expanded inline. Turn this off if you want to contract videos by clicking on them.'], + 'Allow Sound': [true, 'Allow sound in videos.'], + 'Loop in New Tab': [true, 'Loop videos opened in their own tabs, and apply settings for inline expanded videos to them.'] }, 'Menu': { 'Menu': [true, 'Add a drop-down menu to posts.'], @@ -370,7 +371,7 @@ doc = d.documentElement; g = { - VERSION: '1.7.5', + VERSION: '1.7.6', NAMESPACE: '4chan X.', boards: {} }; @@ -7645,7 +7646,7 @@ ImageExpand.setupVideoControls(clone); if (!clone.origin.file.fullImage.paused) { return $.queueTask(function() { - return ImageExpand.startVideo(clone); + return Video.start(clone.file.fullImage); }); } } else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) { @@ -7770,9 +7771,6 @@ el = post.file.fullImage = $.el((isVideo ? 'video' : 'img'), { className: 'full-image' }); - if (isVideo) { - el.loop = true; - } $.on(el, 'error', ImageExpand.error); el.src = src || post.file.URL; } @@ -7816,11 +7814,7 @@ post.file.isExpanded = true; if (post.file.isVideo) { ImageExpand.setupVideoControls(post); - post.file.fullImage.muted = !Conf['Allow Sound']; - post.file.fullImage.controls = Conf['Show Controls']; - if (Conf['Autoplay'] && !disableAutoplay) { - return ImageExpand.startVideo(post); - } + return Video.configure(post.file.fullImage, disableAutoplay); } }, videoCB: { @@ -7877,23 +7871,6 @@ } return $.add(file.text, file.videoControls); }, - startVideo: function(post) { - var controls, file, video; - file = post.file; - video = file.fullImage; - controls = video.controls; - video.controls = false; - video.play(); - if (controls) { - return $.asap((function() { - return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded; - }), function() { - if (file.isExpanded) { - return video.controls = true; - } - }, 500); - } - }, error: function() { var URL, post, src, timeoutID; post = Get.postFromNode(this); @@ -8275,6 +8252,33 @@ } }; + Video = { + configure: function(video, disableAutoplay) { + video.loop = true; + video.muted = !Conf['Allow Sound']; + video.controls = Conf['Show Controls']; + video.autoplay = false; + if (Conf['Autoplay'] && !disableAutoplay) { + return Video.start(video); + } else { + return video.pause(); + } + }, + start: function(video) { + var controls; + controls = video.controls; + video.controls = false; + video.play(); + if (controls) { + return $.asap((function() { + return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !d.contains(video); + }), function() { + return video.controls = true; + }, 500); + } + } + }; + Linkify = { init: function() { var type, _i, _len, _ref; @@ -13325,7 +13329,7 @@ return $.on(d, '4chanMainInit', Main.initStyle); }, initFeatures: function() { - var err, feature, name, _i, _len, _ref, _ref1; + var err, feature, name, video, _i, _len, _ref, _ref1; switch (location.hostname) { case 'a.4cdn.org': return; @@ -13333,6 +13337,18 @@ Report.init(); return; case 'i.4cdn.org': + if (Conf['Loop in New Tab'] && (video = $('video'))) { + Video.configure(video); + $.on(video, 'click', function() { + if (!video.controls) { + if (video.paused) { + return video.play(); + } else { + return video.pause(); + } + } + }); + } $.ready(function() { var URL, pathname, _ref; if (Conf['404 Redirect'] && ((_ref = d.title) === '4chan - Temporarily Offline' || _ref === '4chan - 404 Not Found')) { diff --git a/builds/crx.crx b/builds/crx.crx index 10fcc766e..397cc1634 100644 Binary files a/builds/crx.crx and b/builds/crx.crx differ diff --git a/builds/crx/manifest.json b/builds/crx/manifest.json index 8e088662e..e5c493f6c 100755 --- a/builds/crx/manifest.json +++ b/builds/crx/manifest.json @@ -1,6 +1,6 @@ { "name": "4chan X", - "version": "1.7.5", + "version": "1.7.6", "manifest_version": 2, "description": "Cross-browser userscript for maximum lurking on 4chan.", "icons": { diff --git a/builds/crx/script.js b/builds/crx/script.js index 2bb009b31..7c193ad53 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -1,6 +1,6 @@ // Generated by CoffeeScript /* -* 4chan X - Version 1.7.5 - 2014-04-09 +* 4chan X - Version 1.7.6 - 2014-04-10 * * Licensed under the MIT license. * https://github.com/ccd0/4chan-x/blob/master/LICENSE @@ -82,7 +82,7 @@ 'use strict'; (function() { - var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, InfiniScroll, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, c, d, doc, g, + var $, $$, Anonymize, ArchiveLink, AutoGIF, Banner, Board, Build, Callbacks, CatalogLinks, Clone, Conf, Config, CustomCSS, DataBoard, DeleteLink, Dice, DownloadLink, Emoji, ExpandComment, ExpandThread, FappeTyme, Favicon, FileInfo, Filter, Fourchan, Gallery, Get, Header, IDColor, ImageExpand, ImageHover, ImageLoader, Index, InfiniScroll, Keybinds, Linkify, Main, Menu, Nav, Navigate, Notice, PSAHiding, Polyfill, Post, PostHiding, QR, QuoteBacklink, QuoteCT, QuoteInline, QuoteOP, QuotePreview, QuoteStrikeThrough, QuoteThreading, QuoteYou, Quotify, RandomAccessList, Recursive, Redirect, RelativeDates, RemoveSpoilers, Report, ReportLink, RevealSpoilers, Sauce, Settings, SimpleDict, Thread, ThreadExcerpt, ThreadHiding, ThreadStats, ThreadUpdater, ThreadWatcher, Time, TrashQueue, UI, Unread, Video, c, d, doc, g, __slice = [].slice, __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; }, __hasProp = {}.hasOwnProperty, @@ -159,9 +159,10 @@ 'Image Prefetching': [false, 'Preload images'], 'Fappe Tyme': [false, 'Hide posts without images. *hint* *hint*'], 'Werk Tyme': [false, 'Hide all post images.'], - 'Autoplay': [true, 'Videos begin playing immediately when opened inline.'], - 'Show Controls': [true, 'Show native seek and volume controls on videos. Contract videos when dragged to the left.'], - 'Allow Sound': [true, 'Allow sound in inline videos.'] + 'Autoplay': [true, 'Videos begin playing immediately when opened.'], + 'Show Controls': [true, 'Show controls on videos expanded inline. Turn this off if you want to contract videos by clicking on them.'], + 'Allow Sound': [true, 'Allow sound in videos.'], + 'Loop in New Tab': [true, 'Loop videos opened in their own tabs, and apply settings for inline expanded videos to them.'] }, 'Menu': { 'Menu': [true, 'Add a drop-down menu to posts.'], @@ -346,7 +347,7 @@ doc = d.documentElement; g = { - VERSION: '1.7.5', + VERSION: '1.7.6', NAMESPACE: '4chan X.', boards: {} }; @@ -7664,7 +7665,7 @@ ImageExpand.setupVideoControls(clone); if (!clone.origin.file.fullImage.paused) { return $.queueTask(function() { - return ImageExpand.startVideo(clone); + return Video.start(clone.file.fullImage); }); } } else if (ImageExpand.on && !this.isHidden && (Conf['Expand spoilers'] || !this.file.isSpoiler) && (Conf['Expand videos'] || !this.file.isVideo)) { @@ -7789,9 +7790,6 @@ el = post.file.fullImage = $.el((isVideo ? 'video' : 'img'), { className: 'full-image' }); - if (isVideo) { - el.loop = true; - } $.on(el, 'error', ImageExpand.error); el.src = src || post.file.URL; } @@ -7835,11 +7833,7 @@ post.file.isExpanded = true; if (post.file.isVideo) { ImageExpand.setupVideoControls(post); - post.file.fullImage.muted = !Conf['Allow Sound']; - post.file.fullImage.controls = Conf['Show Controls']; - if (Conf['Autoplay'] && !disableAutoplay) { - return ImageExpand.startVideo(post); - } + return Video.configure(post.file.fullImage, disableAutoplay); } }, videoCB: { @@ -7896,23 +7890,6 @@ } return $.add(file.text, file.videoControls); }, - startVideo: function(post) { - var controls, file, video; - file = post.file; - video = file.fullImage; - controls = video.controls; - video.controls = false; - video.play(); - if (controls) { - return $.asap((function() { - return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !file.isExpanded; - }), function() { - if (file.isExpanded) { - return video.controls = true; - } - }, 500); - } - }, error: function() { var URL, post, src, timeoutID; post = Get.postFromNode(this); @@ -8272,6 +8249,33 @@ } }; + Video = { + configure: function(video, disableAutoplay) { + video.loop = true; + video.muted = !Conf['Allow Sound']; + video.controls = Conf['Show Controls']; + video.autoplay = false; + if (Conf['Autoplay'] && !disableAutoplay) { + return Video.start(video); + } else { + return video.pause(); + } + }, + start: function(video) { + var controls; + controls = video.controls; + video.controls = false; + video.play(); + if (controls) { + return $.asap((function() { + return (video.readyState >= 3 && video.currentTime <= Math.max(0.1, video.duration - 0.5)) || !d.contains(video); + }), function() { + return video.controls = true; + }, 500); + } + } + }; + Linkify = { init: function() { var type, _i, _len, _ref; @@ -13325,7 +13329,7 @@ return $.on(d, '4chanMainInit', Main.initStyle); }, initFeatures: function() { - var err, feature, name, _i, _len, _ref, _ref1; + var err, feature, name, video, _i, _len, _ref, _ref1; switch (location.hostname) { case 'a.4cdn.org': return; @@ -13333,6 +13337,18 @@ Report.init(); return; case 'i.4cdn.org': + if (Conf['Loop in New Tab'] && (video = $('video'))) { + Video.configure(video); + $.on(video, 'click', function() { + if (!video.controls) { + if (video.paused) { + return video.play(); + } else { + return video.pause(); + } + } + }); + } $.ready(function() { var URL, pathname, _ref; if (Conf['404 Redirect'] && ((_ref = d.title) === '4chan - Temporarily Offline' || _ref === '4chan - 404 Not Found')) { diff --git a/builds/updates.xml b/builds/updates.xml index e4cf9342c..bcefebdd5 100644 --- a/builds/updates.xml +++ b/builds/updates.xml @@ -1,7 +1,7 @@ - + diff --git a/package.json b/package.json index be58424c9..30e8f826c 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "4chan-X", - "version": "1.7.5", + "version": "1.7.6", "description": "Cross-browser userscript for maximum lurking on 4chan.", "meta": { "name": "4chan X",