Merge branch 'ccd0' into v3
Conflicts: CHANGELOG.md LICENSE builds/4chan-X.user.js builds/crx.crx builds/crx/script.js src/General/Config.coffee src/General/css/style.css src/Images/Gallery.coffee src/Images/ImageExpand.coffee
This commit is contained in:
commit
28eebe0183
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,5 +3,6 @@ node_modules/
|
|||||||
*.db
|
*.db
|
||||||
tmp-crx/
|
tmp-crx/
|
||||||
tmp-userscript/
|
tmp-userscript/
|
||||||
|
testbuilds/
|
||||||
builds/4chan-X.zip
|
builds/4chan-X.zip
|
||||||
Gruntfile.js
|
Gruntfile.js
|
||||||
|
|||||||
31
CHANGELOG.md
31
CHANGELOG.md
@ -1,5 +1,31 @@
|
|||||||
<<<<<<< HEAD
|
### v1.7.7
|
||||||
=======
|
*2014-04-10*
|
||||||
|
|
||||||
|
**fgts**
|
||||||
|
- Update archive list.
|
||||||
|
|
||||||
|
### 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.
|
||||||
|
|
||||||
|
### v1.7.5
|
||||||
|
*2014-04-09*
|
||||||
|
**ccd0**
|
||||||
|
- Add WebM support to gallery (currently no controls).
|
||||||
|
- Add PDF support to gallery, disabled by default. Enable with `PDF in Gallery`.
|
||||||
|
|
||||||
|
### v1.7.4
|
||||||
|
*2014-04-08*
|
||||||
|
|
||||||
|
**Nebukazar**
|
||||||
|
- `Quote Threading` disabled by default
|
||||||
|
- Added missing titles to Header icons
|
||||||
|
|
||||||
|
**ccd0**
|
||||||
|
- Fix bug in gallery introduced in 1.7.3.
|
||||||
|
|
||||||
### v1.7.3
|
### v1.7.3
|
||||||
*2014-04-07*
|
*2014-04-07*
|
||||||
|
|
||||||
@ -13,7 +39,6 @@
|
|||||||
### v1.7.2
|
### v1.7.2
|
||||||
*2014-04-07*
|
*2014-04-07*
|
||||||
|
|
||||||
>>>>>>> ccd0
|
|
||||||
**ccd0**
|
**ccd0**
|
||||||
- Restore thread expansion with JSON navigation disabled.
|
- Restore thread expansion with JSON navigation disabled.
|
||||||
|
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* 4chan X - Version 1.7.3 - 2014-04-10
|
* 4chan X - Version 1.7.7 - 2014-04-10
|
||||||
*
|
*
|
||||||
* Licensed under the MIT license.
|
* Licensed under the MIT license.
|
||||||
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
|
||||||
|
|||||||
10263
builds/4chan-X.js
10263
builds/4chan-X.js
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.7.3
|
// @version 1.7.7
|
||||||
// @minGMVer 1.14
|
// @minGMVer 1.14
|
||||||
// @minFFVer 26
|
// @minFFVer 26
|
||||||
// @namespace 4chan-X
|
// @namespace 4chan-X
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
"version": "1.7.3",
|
"version": "1.7.7",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||||
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
|
||||||
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.3' />
|
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.7' />
|
||||||
</app>
|
</app>
|
||||||
</gupdate>
|
</gupdate>
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,62 +0,0 @@
|
|||||||
function GM_openInTab(_url) {
|
|
||||||
self.port.emit("GM_openInTab", _url);
|
|
||||||
return; // Should return the Window object
|
|
||||||
};
|
|
||||||
|
|
||||||
function GM_setValue(_name, _value) {
|
|
||||||
localStorage[_name] = _value;
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
function GM_getValue(_name, _default) {
|
|
||||||
if (localStorage[_name] === null && _default === null) return null;
|
|
||||||
return (localStorage[_name] || _default);
|
|
||||||
};
|
|
||||||
|
|
||||||
function GM_deleteValue(_name) {
|
|
||||||
localStorage.removeItem(_name);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
function GM_listValues() {
|
|
||||||
return Object.keys(localStorage);
|
|
||||||
};
|
|
||||||
|
|
||||||
function GM_setClipboard(_text) {
|
|
||||||
self.port.emit("GM_setClipboard", _text);
|
|
||||||
};
|
|
||||||
|
|
||||||
//Deprecated
|
|
||||||
function GM_log(_message) {
|
|
||||||
console.log(_message);
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
function GM_xmlhttpRequest(_details) {
|
|
||||||
//Ugly hack? Race condition? Memory leak?
|
|
||||||
_onload = _details.onload;
|
|
||||||
_context = _details.context;
|
|
||||||
self.port.emit("GM_xmlhttpRequest", _details);
|
|
||||||
};
|
|
||||||
|
|
||||||
self.port.on("callback_GM_xmlhttpRequest", function(_response) {
|
|
||||||
_response.context = _context;
|
|
||||||
_onload(_response);
|
|
||||||
});
|
|
||||||
|
|
||||||
function GM_addStyle(_css) {
|
|
||||||
self.port.emit("GM_addStyle", _css);
|
|
||||||
}
|
|
||||||
|
|
||||||
var GM_info = new Object();
|
|
||||||
GM_info.version = '1.15';
|
|
||||||
GM_info.scriptWillUpdate = true;
|
|
||||||
|
|
||||||
//To do
|
|
||||||
function GM_registerMenuCommand(_caption, _commandFunc, _accessKey) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.port.on("load-userscript", function(_script) {
|
|
||||||
eval(_script);
|
|
||||||
});
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 185 B |
Binary file not shown.
|
Before Width: | Height: | Size: 232 B |
@ -1,82 +0,0 @@
|
|||||||
var data = require("sdk/self").data;
|
|
||||||
var Request = require("sdk/request").Request;
|
|
||||||
var tabs = require("sdk/tabs");
|
|
||||||
var system = require("sdk/system");
|
|
||||||
if (system.platform !== 'android') {
|
|
||||||
// Clipboard is not supported on Android
|
|
||||||
var clipboard = require("sdk/clipboard");
|
|
||||||
}
|
|
||||||
var pageMod = require("sdk/page-mod");
|
|
||||||
pageMod.PageMod({
|
|
||||||
include: ["*.4chan.org", "*.4cdn.org"],
|
|
||||||
contentScriptFile: data.url("greaseshim.js"),
|
|
||||||
contentScriptWhen: "start",
|
|
||||||
onAttach: function(worker) {
|
|
||||||
worker.port.emit("load-userscript", data.load("4chan-X.user.js"));
|
|
||||||
|
|
||||||
//GM_openInTab
|
|
||||||
worker.port.on("GM_openInTab", function(url) {
|
|
||||||
tabs.open(url);
|
|
||||||
});
|
|
||||||
|
|
||||||
//GM_setClipboard
|
|
||||||
worker.port.on("GM_setClipboard", function(text) {
|
|
||||||
if (system.platform !== 'android') {
|
|
||||||
// Clipboard is not supported on Android
|
|
||||||
clipboard.set(text);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//GM_xmlhttpRequest
|
|
||||||
worker.port.on("GM_xmlhttpRequest", function(details) {
|
|
||||||
request = new Object();
|
|
||||||
request.url = details.url;
|
|
||||||
if (details.headers) {
|
|
||||||
request.headers = details.headers;
|
|
||||||
if (details.headers["Content-Type"]) {request.contentType = details.headers["Content-Type"]};
|
|
||||||
};
|
|
||||||
if (details.data) {request.content = encodeURIComponent(details.data)};
|
|
||||||
if (details.overrideMimeType) {request.overrideMimeType = details.overrideMimeType};
|
|
||||||
|
|
||||||
request.onComplete = function(response) {
|
|
||||||
response.finalUrl = details.url;
|
|
||||||
response.responseText = response.text;
|
|
||||||
for (var headerName in response.headers) {
|
|
||||||
_string = headerName + ": " + response.headers[headerName] + " \n";
|
|
||||||
response.responseHeaders += _string;
|
|
||||||
}
|
|
||||||
response.readyState = 4;
|
|
||||||
worker.port.emit("callback_GM_xmlhttpRequest", response);
|
|
||||||
}
|
|
||||||
|
|
||||||
xhr = Request(request);
|
|
||||||
|
|
||||||
switch(details.method){
|
|
||||||
case "GET":
|
|
||||||
xhr.get();
|
|
||||||
break;
|
|
||||||
case "POST":
|
|
||||||
xhr.post();
|
|
||||||
break;
|
|
||||||
case "HEAD":
|
|
||||||
xhr.head();
|
|
||||||
break;
|
|
||||||
case "PUT":
|
|
||||||
xhr.put();
|
|
||||||
break;
|
|
||||||
default: xhr.get();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//GM_addStyle
|
|
||||||
worker.port.on("GM_addStyle", function(css) {
|
|
||||||
tabs.activeTab.attach({
|
|
||||||
contentScript: "var style = document.createElement('style');" +
|
|
||||||
"style.type = 'text/css';" +
|
|
||||||
"style.innerHTML = '" + css + "';" +
|
|
||||||
"document.head.appendChild(style);"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "4chanx",
|
|
||||||
"title": "4chan X",
|
|
||||||
"id": "72DAF86E-9689-11E3-8BA3-F4B66188709B",
|
|
||||||
"description": "Adds various features to 4chan.",
|
|
||||||
"author": "Spittie",
|
|
||||||
"license": "MIT",
|
|
||||||
"version": "1.4.1"
|
|
||||||
}
|
|
||||||
@ -1,12 +0,0 @@
|
|||||||
var main = require("./main");
|
|
||||||
|
|
||||||
exports["test main"] = function(assert) {
|
|
||||||
assert.pass("Unit test running!");
|
|
||||||
};
|
|
||||||
|
|
||||||
exports["test main async"] = function(assert, done) {
|
|
||||||
assert.pass("async Unit test running!");
|
|
||||||
done();
|
|
||||||
};
|
|
||||||
|
|
||||||
require("sdk/test").run(exports);
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan-X",
|
"name": "4chan-X",
|
||||||
"version": "1.7.3",
|
"version": "1.7.7",
|
||||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||||
"meta": {
|
"meta": {
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
|
|||||||
@ -95,8 +95,8 @@
|
|||||||
"http": true,
|
"http": true,
|
||||||
"https": true,
|
"https": true,
|
||||||
"software": "foolfuuka",
|
"software": "foolfuuka",
|
||||||
"boards": ["cm", "hm", "r", "soc", "y"],
|
"boards": ["cm", "h", "hc", "hm", "r", "s", "soc", "y"],
|
||||||
"files": ["cm", "hm", "r", "soc", "y"]
|
"files": ["cm", "h", "hc", "hm", "r", "s", "soc", "y"]
|
||||||
}, {
|
}, {
|
||||||
"uid": 16,
|
"uid": 16,
|
||||||
"name": "maware",
|
"name": "maware",
|
||||||
|
|||||||
@ -155,6 +155,10 @@ Config =
|
|||||||
true
|
true
|
||||||
'Adds a simple and cute image gallery.'
|
'Adds a simple and cute image gallery.'
|
||||||
]
|
]
|
||||||
|
'PDF in Gallery': [
|
||||||
|
false
|
||||||
|
'Show PDF files in gallery.'
|
||||||
|
]
|
||||||
'Sauce': [
|
'Sauce': [
|
||||||
true
|
true
|
||||||
'Add sauce links to images.'
|
'Add sauce links to images.'
|
||||||
@ -193,15 +197,19 @@ Config =
|
|||||||
]
|
]
|
||||||
'Autoplay': [
|
'Autoplay': [
|
||||||
true
|
true
|
||||||
'Videos begin playing immediately when opened inline.'
|
'Videos begin playing immediately when opened.'
|
||||||
]
|
]
|
||||||
'Show Controls': [
|
'Show Controls': [
|
||||||
true
|
true
|
||||||
'Show native seek and volume controls on videos. Contract videos when dragged to the left.'
|
'Show controls on videos expanded inline. Turn this off if you want to contract videos by clicking on them.'
|
||||||
]
|
]
|
||||||
'Allow Sound': [
|
'Allow Sound': [
|
||||||
true
|
true
|
||||||
'Allow sound in inline videos.'
|
'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':
|
||||||
@ -380,7 +388,7 @@ Config =
|
|||||||
'Highlights own posts if Quote Markers are enabled.'
|
'Highlights own posts if Quote Markers are enabled.'
|
||||||
]
|
]
|
||||||
'Quote Threading': [
|
'Quote Threading': [
|
||||||
true
|
false
|
||||||
'Thread conversations'
|
'Thread conversations'
|
||||||
]
|
]
|
||||||
'Mark Quotes of You': [
|
'Mark Quotes of You': [
|
||||||
@ -396,6 +404,7 @@ Config =
|
|||||||
'Add \'(Cross-thread)\' to cross-threads quotes.'
|
'Add \'(Cross-thread)\' to cross-threads quotes.'
|
||||||
'Highlights own posts if Quote Markers are enabled.'
|
'Highlights own posts if Quote Markers are enabled.'
|
||||||
]
|
]
|
||||||
|
|
||||||
imageExpansion:
|
imageExpansion:
|
||||||
'Fit width': [
|
'Fit width': [
|
||||||
false
|
false
|
||||||
|
|||||||
@ -49,6 +49,11 @@ Main =
|
|||||||
Report.init()
|
Report.init()
|
||||||
return
|
return
|
||||||
when 'i.4cdn.org'
|
when 'i.4cdn.org'
|
||||||
|
if Conf['Loop in New Tab'] and video = $ 'video'
|
||||||
|
Video.configure video
|
||||||
|
$.on video, 'click', ->
|
||||||
|
if !video.controls
|
||||||
|
if video.paused then video.play() else video.pause()
|
||||||
$.ready ->
|
$.ready ->
|
||||||
if Conf['404 Redirect'] and d.title in ['4chan - Temporarily Offline', '4chan - 404 Not Found']
|
if Conf['404 Redirect'] and d.title in ['4chan - Temporarily Offline', '4chan - 404 Not Found']
|
||||||
Redirect.init()
|
Redirect.init()
|
||||||
|
|||||||
@ -4,6 +4,7 @@ Settings =
|
|||||||
link = $.el 'a',
|
link = $.el 'a',
|
||||||
className: 'settings-link fa fa-wrench'
|
className: 'settings-link fa fa-wrench'
|
||||||
textContent: 'Settings'
|
textContent: 'Settings'
|
||||||
|
title: '4chan X Settings'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.on link, 'click', Settings.open
|
$.on link, 'click', Settings.open
|
||||||
|
|
||||||
|
|||||||
@ -1465,16 +1465,20 @@ div.boardTitle {
|
|||||||
/* Flex > Non-Flex child max-width and overflow fix (Firefox only?) */
|
/* Flex > Non-Flex child max-width and overflow fix (Firefox only?) */
|
||||||
width: 1%;
|
width: 1%;
|
||||||
}
|
}
|
||||||
:root:not(.gal-fit-height) .gal-image {
|
:root:not(.gal-fit-height):not(.gal-pdf) .gal-image {
|
||||||
overflow-y: scroll !important;
|
overflow-y: scroll !important;
|
||||||
}
|
}
|
||||||
:root:not(.gal-fit-width) .gal-image {
|
:root:not(.gal-fit-width):not(.gal-pdf) .gal-image {
|
||||||
overflow-x: scroll !important;
|
overflow-x: scroll !important;
|
||||||
}
|
}
|
||||||
.gal-image a {
|
.gal-image a {
|
||||||
margin: auto;
|
margin: auto;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
}
|
}
|
||||||
|
:root.gal-pdf .gal-image a {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
.gal-fit-width .gal-image video,
|
.gal-fit-width .gal-image video,
|
||||||
.gal-fit-width .gal-image img {
|
.gal-fit-width .gal-image img {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
@ -1483,11 +1487,22 @@ div.boardTitle {
|
|||||||
.gal-fit-height .gal-image img {
|
.gal-fit-height .gal-image img {
|
||||||
max-height: 95vh;
|
max-height: 95vh;
|
||||||
}
|
}
|
||||||
|
.gal-image iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
.gal-buttons {
|
.gal-buttons {
|
||||||
font-size: 2em;
|
font-size: 2em;
|
||||||
margin-right: 10px;
|
margin-right: 3px;
|
||||||
|
padding-left: 7px;
|
||||||
|
padding-right: 7px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
}
|
}
|
||||||
|
:root.gal-pdf .gal-buttons {
|
||||||
|
top: 40px;
|
||||||
|
background: rgba(0,0,0,0.6) !important;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
.gal-buttons i {
|
.gal-buttons i {
|
||||||
vertical-align: baseline;
|
vertical-align: baseline;
|
||||||
border-top-width: .4em;
|
border-top-width: .4em;
|
||||||
@ -1507,12 +1522,12 @@ div.boardTitle {
|
|||||||
.gal-name,
|
.gal-name,
|
||||||
.gal-count {
|
.gal-count {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
right: 178px;
|
right: 195px;
|
||||||
}
|
}
|
||||||
.gal-hide-thumbnails .gal-buttons,
|
.gal-hide-thumbnails .gal-buttons,
|
||||||
.gal-hide-thumbnails .gal-count,
|
.gal-hide-thumbnails .gal-count,
|
||||||
.gal-hide-thumbnails .gal-name {
|
.gal-hide-thumbnails .gal-name {
|
||||||
right: 28px;
|
right: 44px;
|
||||||
}
|
}
|
||||||
.gal-name {
|
.gal-name {
|
||||||
bottom: 6px;
|
bottom: 6px;
|
||||||
@ -1527,6 +1542,10 @@ div.boardTitle {
|
|||||||
.gal-buttons .menu-button:hover {
|
.gal-buttons .menu-button:hover {
|
||||||
color: rgb(95, 95, 101) !important;
|
color: rgb(95, 95, 101) !important;
|
||||||
}
|
}
|
||||||
|
:root.gal-pdf .gal-close:hover,
|
||||||
|
:root.gal-pdf .gal-buttons .menu-button:hover {
|
||||||
|
color: rgb(204, 204, 204) !important;
|
||||||
|
}
|
||||||
.gal-count {
|
.gal-count {
|
||||||
bottom: 27px;
|
bottom: 27px;
|
||||||
background: rgba(0,0,0,0.6) !important;
|
background: rgba(0,0,0,0.6) !important;
|
||||||
@ -1534,21 +1553,21 @@ div.boardTitle {
|
|||||||
padding: 1px 5px 2px 5px;
|
padding: 1px 5px 2px 5px;
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
}
|
}
|
||||||
:root:not(.gal-fit-width) .gal-name {
|
:root:not(.gal-fit-width):not(.gal-pdf) .gal-name {
|
||||||
bottom: 23px !important;
|
bottom: 23px !important;
|
||||||
}
|
}
|
||||||
:root:not(.gal-fit-width) .gal-count {
|
:root:not(.gal-fit-width):not(.gal-pdf) .gal-count {
|
||||||
bottom: 44px !important;
|
bottom: 44px !important;
|
||||||
}
|
}
|
||||||
:root:not(.gal-fit-height):not(.gal-hide-thumbnails) .gal-buttons,
|
:root.gal-fit-height:not(.gal-pdf):not(.gal-hide-thumbnails) .gal-buttons,
|
||||||
:root:not(.gal-fit-height):not(.gal-hide-thumbnails) .gal-name,
|
:root.gal-fit-height:not(.gal-pdf):not(.gal-hide-thumbnails) .gal-name,
|
||||||
:root:not(.gal-fit-height):not(.gal-hide-thumbnails) .gal-count {
|
:root.gal-fit-height:not(.gal-pdf):not(.gal-hide-thumbnails) .gal-count {
|
||||||
right: 195px !important;
|
right: 178px !important;
|
||||||
}
|
}
|
||||||
:root.gal-hide-thumbnails:not(.gal-fit-height) .gal-buttons,
|
:root.gal-hide-thumbnails:.gal-fit-height:not(.gal-pdf) .gal-buttons,
|
||||||
:root.gal-hide-thumbnails:not(.gal-fit-height) .gal-name,
|
:root.gal-hide-thumbnails:.gal-fit-height:not(.gal-pdf) .gal-name,
|
||||||
:root.gal-hide-thumbnails:not(.gal-fit-height) .gal-count {
|
:root.gal-hide-thumbnails:.gal-fit-height:not(.gal-pdf) .gal-count {
|
||||||
right: 44px !important;
|
right: 28px !important;
|
||||||
}
|
}
|
||||||
@media screen and (resolution: 1dppx) {
|
@media screen and (resolution: 1dppx) {
|
||||||
.fa-bars {
|
.fa-bars {
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
postMessage({version:'<%= version %>'},'*')
|
|
||||||
@ -18,7 +18,7 @@ Gallery =
|
|||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return unless @file?.isImage
|
return unless @file
|
||||||
if Gallery.nodes
|
if Gallery.nodes
|
||||||
Gallery.generateThumb $ '.file', @nodes.root
|
Gallery.generateThumb $ '.file', @nodes.root
|
||||||
Gallery.nodes.total.textContent = Gallery.images.length
|
Gallery.nodes.total.textContent = Gallery.images.length
|
||||||
@ -64,8 +64,7 @@ Gallery =
|
|||||||
|
|
||||||
{cb} = Gallery
|
{cb} = Gallery
|
||||||
$.on nodes.frame, 'click', cb.blank
|
$.on nodes.frame, 'click', cb.blank
|
||||||
$.on nodes.current, 'click', cb.download
|
$.on nodes.next, 'click', cb.advance
|
||||||
$.on nodes.next, 'click', cb.next
|
|
||||||
$.on ($ '.gal-prev', dialog), 'click', cb.prev
|
$.on ($ '.gal-prev', dialog), 'click', cb.prev
|
||||||
$.on ($ '.gal-next', dialog), 'click', cb.next
|
$.on ($ '.gal-next', dialog), 'click', cb.next
|
||||||
$.on ($ '.gal-close', dialog), 'click', cb.close
|
$.on ($ '.gal-close', dialog), 'click', cb.close
|
||||||
@ -105,13 +104,14 @@ Gallery =
|
|||||||
|
|
||||||
generateThumb: (file) ->
|
generateThumb: (file) ->
|
||||||
post = Get.postFromNode file
|
post = Get.postFromNode file
|
||||||
|
return unless post.file and (post.file.isImage or post.file.isVideo or Conf['PDF in Gallery'])
|
||||||
title = ($ '.fileText a', file).textContent
|
title = ($ '.fileText a', file).textContent
|
||||||
|
|
||||||
thumb = $.el 'a',
|
thumb = $.el 'a',
|
||||||
className: 'gal-thumb'
|
className: 'gal-thumb'
|
||||||
href: post.file.URL
|
href: post.file.URL
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
title = title
|
title: title
|
||||||
|
|
||||||
thumb.dataset.id = Gallery.images.length
|
thumb.dataset.id = Gallery.images.length
|
||||||
thumb.dataset.post = $('a[title="Highlight this post"]', post.nodes.info).href
|
thumb.dataset.post = $('a[title="Highlight this post"]', post.nodes.info).href
|
||||||
@ -133,8 +133,10 @@ Gallery =
|
|||||||
cb = switch key
|
cb = switch key
|
||||||
when 'Esc', Conf['Open Gallery']
|
when 'Esc', Conf['Open Gallery']
|
||||||
Gallery.cb.close
|
Gallery.cb.close
|
||||||
when 'Right', 'Enter'
|
when 'Right'
|
||||||
Gallery.cb.next
|
Gallery.cb.next
|
||||||
|
when 'Enter'
|
||||||
|
Gallery.cb.advance
|
||||||
when 'Left', ''
|
when 'Left', ''
|
||||||
Gallery.cb.prev
|
Gallery.cb.prev
|
||||||
|
|
||||||
@ -153,9 +155,15 @@ Gallery =
|
|||||||
$.rmClass el, 'gal-highlight' if el = $ '.gal-highlight', Gallery.thumbs
|
$.rmClass el, 'gal-highlight' if el = $ '.gal-highlight', Gallery.thumbs
|
||||||
$.addClass @, 'gal-highlight'
|
$.addClass @, 'gal-highlight'
|
||||||
|
|
||||||
file = $.el (if @dataset.isVideo then 'video' else 'img'),
|
elType = if @dataset.isVideo then 'video' else if /\.pdf$/.test(@href) then 'iframe' else 'img'
|
||||||
|
(if elType is 'iframe' then $.addClass else $.rmClass) doc, 'gal-pdf'
|
||||||
|
file = $.el elType,
|
||||||
src: name.href = @href
|
src: name.href = @href
|
||||||
title: name.download = name.textContent = @title
|
title: name.download = name.textContent = @title
|
||||||
|
if elType is 'video'
|
||||||
|
img.loop = true
|
||||||
|
img.autoplay = Conf['Autoplay']
|
||||||
|
img.muted = !Conf['Allow Sound']
|
||||||
|
|
||||||
if @dataset.isVideo
|
if @dataset.isVideo
|
||||||
file.muted = !Conf['Allow Sound']
|
file.muted = !Conf['Allow Sound']
|
||||||
@ -164,6 +172,7 @@ Gallery =
|
|||||||
file.loop = true
|
file.loop = true
|
||||||
|
|
||||||
$.extend file.dataset, @dataset
|
$.extend file.dataset, @dataset
|
||||||
|
nodes.current.pause?()
|
||||||
$.replace nodes.current, file
|
$.replace nodes.current, file
|
||||||
nodes.count.textContent = +@dataset.id + 1
|
nodes.count.textContent = +@dataset.id + 1
|
||||||
nodes.current = file
|
nodes.current = file
|
||||||
@ -192,18 +201,14 @@ Gallery =
|
|||||||
delete post.file.fullImage
|
delete post.file.fullImage
|
||||||
|
|
||||||
src = @src.split '/'
|
src = @src.split '/'
|
||||||
if src[2] is 'images.4chan.org'
|
if src[2] is 'i.4cdn.org'
|
||||||
URL = Redirect.to 'file',
|
URL = Redirect.to 'file',
|
||||||
boardID: src[3]
|
boardID: src[3]
|
||||||
filename: src[5]
|
filename: src[5]
|
||||||
if URL
|
if URL
|
||||||
thumb.href = URL
|
thumb.href = URL
|
||||||
return unless Gallery.nodes.current is img
|
return unless Gallery.nodes.current is img
|
||||||
revived = $.el 'img',
|
img.src = URL
|
||||||
src: URL
|
|
||||||
title: img.title
|
|
||||||
$.extend revived.dataset, img.dataset
|
|
||||||
$.replace img, revived
|
|
||||||
return
|
return
|
||||||
if g.DEAD or post.isDead or post.file.isDead
|
if g.DEAD or post.isDead or post.file.isDead
|
||||||
return
|
return
|
||||||
@ -222,10 +227,14 @@ Gallery =
|
|||||||
|
|
||||||
prev: -> Gallery.cb.open.call Gallery.images[+Gallery.nodes.current.dataset.id - 1]
|
prev: -> Gallery.cb.open.call Gallery.images[+Gallery.nodes.current.dataset.id - 1]
|
||||||
next: -> Gallery.cb.open.call Gallery.images[+Gallery.nodes.current.dataset.id + 1]
|
next: -> Gallery.cb.open.call Gallery.images[+Gallery.nodes.current.dataset.id + 1]
|
||||||
|
advance:-> if Gallery.nodes.current.paused then Gallery.nodes.current.play() else Gallery.cb.next()
|
||||||
|
pause: -> if Gallery.nodes.current.nodeType is 'VIDEO'
|
||||||
|
if Gallery.nodes.current.paused then Gallery.nodes.current.play() else Gallery.nodes.current.pause()
|
||||||
toggle: -> (if Gallery.nodes then Gallery.cb.close else Gallery.build)()
|
toggle: -> (if Gallery.nodes then Gallery.cb.close else Gallery.build)()
|
||||||
blank: (e) -> Gallery.cb.close() if e.target is @
|
blank: (e) -> Gallery.cb.close() if e.target is @
|
||||||
|
|
||||||
close: ->
|
close: ->
|
||||||
|
Gallery.nodes.current.pause?()
|
||||||
$.rm Gallery.nodes.el
|
$.rm Gallery.nodes.el
|
||||||
delete Gallery.nodes
|
delete Gallery.nodes
|
||||||
d.body.style.overflow = ''
|
d.body.style.overflow = ''
|
||||||
|
|||||||
@ -28,9 +28,10 @@ ImageExpand =
|
|||||||
clone = @
|
clone = @
|
||||||
ImageExpand.setupVideoControls clone
|
ImageExpand.setupVideoControls clone
|
||||||
unless clone.origin.file.fullImage.paused
|
unless clone.origin.file.fullImage.paused
|
||||||
$.queueTask -> ImageExpand.startVideo clone
|
$.queueTask -> Video.start clone.file.fullImage
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
else if ImageExpand.on and !@isHidden and
|
else if ImageExpand.on and !@isHidden and
|
||||||
(Conf['Expand spoilers'] or !@file.isSpoiler) and
|
(Conf['Expand spoilers'] or !@file.isSpoiler) and
|
||||||
(Conf['Expand videos'] or !@file.isVideo)
|
(Conf['Expand videos'] or !@file.isVideo)
|
||||||
@ -152,10 +153,8 @@ ImageExpand =
|
|||||||
$.rmClass post.file.thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
post.file.isExpanded = true
|
post.file.isExpanded = true
|
||||||
if post.file.isVideo
|
if post.file.isVideo
|
||||||
post.file.fullImage.muted = !Conf['Allow Sound']
|
|
||||||
post.file.fullImage.controls = Conf['Show Controls']
|
|
||||||
ImageExpand.setupVideoControls post
|
ImageExpand.setupVideoControls post
|
||||||
ImageExpand.startVideo post if Conf['Autoplay'] and not disableAutoplay
|
Video.configure post.file.fullImage, disableAutoplay
|
||||||
|
|
||||||
videoCB: do ->
|
videoCB: do ->
|
||||||
# dragging to the left contracts the video
|
# dragging to the left contracts the video
|
||||||
@ -193,17 +192,6 @@ ImageExpand =
|
|||||||
$.add file.videoControls, [$.tn('\u00A0'), contract]
|
$.add file.videoControls, [$.tn('\u00A0'), contract]
|
||||||
$.add file.text, file.videoControls
|
$.add file.text, file.videoControls
|
||||||
|
|
||||||
startVideo: (post) ->
|
|
||||||
video = (file = post.file).fullImage
|
|
||||||
{controls} = video
|
|
||||||
video.controls = false
|
|
||||||
video.play()
|
|
||||||
# Hacky workaround for Firefox forever-loading bug for very short videos
|
|
||||||
if controls
|
|
||||||
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !file.isExpanded), ->
|
|
||||||
video.controls = true if file.isExpanded
|
|
||||||
, 500
|
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
post = Get.postFromNode @
|
post = Get.postFromNode @
|
||||||
$.rm @
|
$.rm @
|
||||||
|
|||||||
21
src/Images/Video.coffee
Normal file
21
src/Images/Video.coffee
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Video =
|
||||||
|
configure: (video, disableAutoplay) ->
|
||||||
|
video.loop = true
|
||||||
|
video.muted = !Conf['Allow Sound']
|
||||||
|
video.controls = Conf['Show Controls']
|
||||||
|
video.autoplay = false
|
||||||
|
if Conf['Autoplay'] and not disableAutoplay
|
||||||
|
Video.start video
|
||||||
|
else
|
||||||
|
video.pause()
|
||||||
|
|
||||||
|
start: (video) ->
|
||||||
|
{controls} = video
|
||||||
|
video.controls = false
|
||||||
|
video.play()
|
||||||
|
# Hacky workaround for Firefox forever-loading bug for very short videos
|
||||||
|
if controls
|
||||||
|
$.asap (-> (video.readyState >= 3 and video.currentTime <= Math.max 0.1, (video.duration - 0.5)) or !d.contains video), ->
|
||||||
|
video.controls = true
|
||||||
|
, 500
|
||||||
|
|
||||||
@ -5,6 +5,7 @@ ThreadWatcher =
|
|||||||
@shortcut = sc = $.el 'a',
|
@shortcut = sc = $.el 'a',
|
||||||
id: 'watcher-link'
|
id: 'watcher-link'
|
||||||
textContent: 'Watcher'
|
textContent: 'Watcher'
|
||||||
|
title: 'Thread Watcher'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
className: 'disabled fa fa-eye'
|
className: 'disabled fa fa-eye'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user