This commit is contained in:
Zixaphir 2013-05-20 16:59:06 -07:00
commit dd4520fecf
24 changed files with 261 additions and 8066 deletions

View File

@ -1,20 +0,0 @@
// ==UserScript==
// @name 4chan x
// @namespace aeosynth
// @version 1.0.11
// @description Cross-browser userscript for maximum lurking on 4chan.
// @copyright 2013-2013 Zixaphir <zixaphirmoxphar@gmail.com>
// @copyright 2013-2013 Jordan Bates <saudrapsmann@gmail.com>
// @copyright 2009-2011 James Campos <james.r.campos@gmail.com>
// @copyright 2012-2013 Nicolas Stepien <stepien.nicolas@gmail.com>
// @license MIT; http://en.wikipedia.org/wiki/Mit_license
// @match *://*.4chan.org/*
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_openInTab
// @run-at document-start
// @updateURL https://github.com/seaweedchan/4chan-x/raw/stable/4chan_x.meta.js
// @downloadURL https://github.com/seaweedchan/4chan-x/raw/stable/4chan_x.user.js
// @icon data:image/gif;base64,R0lGODlhYAAQAJEAAGbMM////wAAAP///yH5BAEAAAMALAAAAABgABAAAAL8nI+py+0Po5y02ruEFmh7PnxbJ3KecR4pqoWr2iajIgR2AIb3bu43WPPhdENiLmg7Jn25EODZFDwBTSIPJRwir1tuElvshrNf1RR4lv2QPZzmG9zA16c4uO3+WeVl55Qq9RdVZlc4p3VYdcfXBpSo0ufyJ1gVx2j0huhmWKSW1Xhpd0czSZVBhucl1Hj6acVkBNnZIcggdgh7y0qTFIoaOypTqoiZCTpjiRwp66jp8RhsVmrq2bzbsbz3AcxpDfztBxUIVT0qij0LtsoN3c1MSx5eSQiNTqzL7mzed+4khfZPBrIRL1jEoFHCRYw6A1usKGiiQwgMFCtalFAAADs=
// ==/UserScript==

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,40 @@
### v1.2.8
*2013-05-20*
**MayhemYDG**:
- Tiny fixes
**seaweedchan**:
- New image expansion option: `Advance on contract`. Advances to next post unless Fappe Tyme is enabled (temporary)
- Change `.qr-link` to `.qr-link-container` and `.qr-link>a` to `.qr-link`
**Wohlfe**:
- Add /pol/ archiving for FoolzaShit
### v1.2.7
*2013-05-18*
**seaweedchan**:
- Update /q/'s posting cooldown
- Make "___ omitted. Click here to view." text change when thread is expanded.
- Restrict "Reply to Thread" click event to the link itself
- Fix Nyafuu being undefined
### v1.2.6
*2013-05-16*
**seaweedchan**:
- Fix bug with theme switching
### v1.2.5
*2013-05-15*
**seaweedchan**:
- New option `Captcha Warning Notifications`
- When disabled, shows a red border around the captcha to indicate captcha errors. Goes back to normal when any key is pressed.
- Color Quick Reply's inputs in Tomorrow to match the theme
- Revert some of Mayhem's changes that caused new bugs
### v1.2.4 ### v1.2.4
*2013-05-14* *2013-05-14*

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.2.4 - 2013-05-15 * 4chan X - Version 1.2.8 - 2013-05-20
* *
* Licensed under the MIT license. * Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE * https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
// ==UserScript== // ==UserScript==
// @name 4chan X // @name 4chan X
// @version 1.2.4 // @version 1.2.8
// @namespace 4chan-X // @namespace 4chan-X
// @description Cross-browser userscript for maximum lurking on 4chan. // @description Cross-browser userscript for maximum lurking on 4chan.
// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE // @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "4chan X", "name": "4chan X",
"version": "1.2.4", "version": "1.2.8",
"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

View File

@ -1 +1 @@
postMessage({version:'1.2.4'},'*') postMessage({version:'1.2.8'},'*')

View File

@ -1,6 +1,6 @@
{ {
"name": "4chan-X", "name": "4chan-X",
"version": "1.2.4", "version": "1.2.8",
"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",
@ -28,7 +28,7 @@
"grunt-contrib-compress": "~0.5.0", "grunt-contrib-compress": "~0.5.0",
"grunt-contrib-concat": "~0.3.0", "grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1", "grunt-contrib-copy": "~0.4.1",
"grunt-contrib-watch": "~0.4.2", "grunt-contrib-watch": "~0.4.3",
"grunt-shell": "~0.2.2" "grunt-shell": "~0.2.2"
}, },
"repository": { "repository": {

View File

@ -56,6 +56,7 @@ Redirect =
'files': ['hr', 'tg', 'tv', 'x'] 'files': ['hr', 'tg', 'tv', 'x']
'Nyafuu': 'Nyafuu':
'domain': 'archive.nyafuu.org'
'http': true 'http': true
'https': true 'https': true
'software': 'foolfuuka' 'software': 'foolfuuka'
@ -82,7 +83,7 @@ Redirect =
'http': true 'http': true
'https': true 'https': true
'software': 'foolfuuka' 'software': 'foolfuuka'
'boards': ['adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 's', 's4s', 't', 'trv', 'y'] 'boards': ['adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 'pol', 's', 's4s', 't', 'trv', 'y']
'files': ['adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 's', 's4s', 't', 'trv', 'y'] 'files': ['adv', 'asp', 'cm', 'e', 'i', 'lgbt', 'n', 'o', 'p', 's', 's4s', 't', 'trv', 'y']
'Install Gentoo': 'Install Gentoo':
@ -105,8 +106,8 @@ Redirect =
'domain': 'archive.heinessen.com' 'domain': 'archive.heinessen.com'
'http': true 'http': true
'software': 'fuuka' 'software': 'fuuka'
'boards': ['an', 'fit', 'k', 'mlp', 'r9k', 'toy', 'x'] 'boards': ['an', 'fit', 'k', 'mlp', 'r9k', 'toy']
'files': ['an', 'k', 'toy', 'x'] 'files': ['an', 'k', 'toy']
'warosu': 'warosu':
'domain': 'fuuka.warosu.org' 'domain': 'fuuka.warosu.org'

View File

@ -377,7 +377,11 @@ Config =
true true
'Expand all images only from current position to thread end.' 'Expand all images only from current position to thread end.'
] ]
'Advance on contract': [
false
'Advance to next post when contracting an expanded image.'
]
filter: filter:
name: """ name: """
# Filter any namefags: # Filter any namefags:

View File

@ -78,7 +78,7 @@ Get =
# Stop here if the container has been removed while loading. # Stop here if the container has been removed while loading.
return unless root.parentNode return unless root.parentNode
clone = post.addClone context clone = post.addClone context
Main.callbackNodes Post, [clone] Main.callbackNodes Clone, [clone]
# Get rid of the side arrows. # Get rid of the side arrows.
{nodes} = clone {nodes} = clone

View File

@ -19,7 +19,7 @@ Main =
$.get Conf, Main.initFeatures $.get Conf, Main.initFeatures
$.on d, '4chanMainInit', Main.initStyle $.on d, '4chanMainInit', Main.initStyle
$.asap (-> d.head and $('title', d.head) or d.readyState in ['interactive', 'complete']), $.asap (-> d.head and $('link[rel="shortcut icon"]', d.head) or d.readyState in ['interactive', 'complete']),
Main.initStyle Main.initStyle
initFeatures: (items) -> initFeatures: (items) ->
@ -27,7 +27,7 @@ Main =
pathname = location.pathname.split '/' pathname = location.pathname.split '/'
g.BOARD = new Board pathname[1] g.BOARD = new Board pathname[1]
return if g.BOARD.ID is 'z' return if g.BOARD.ID in ['z', 'fk']
g.VIEW = g.VIEW =
switch pathname[2] switch pathname[2]
when 'res' when 'res'

View File

@ -692,7 +692,7 @@ a.hide-announcement {
border-width: 1px; border-width: 1px;
border-style: solid; border-style: solid;
} }
.qr-link { .qr-link-container {
text-align: center; text-align: center;
} }
.persona { .persona {

View File

@ -3,9 +3,6 @@
background-color: #282A2E; background-color: #282A2E;
border-color: #111; border-color: #111;
} }
:root.tomorrow .field:focus {
border-color: #000;
}
/* Header */ /* Header */
:root.tomorrow #header-bar, :root.tomorrow #notifications { :root.tomorrow #header-bar, :root.tomorrow #notifications {
@ -38,6 +35,15 @@
:root.tomorrow .qr-preview { :root.tomorrow .qr-preview {
background-color: rgba(255, 255, 255, .15); background-color: rgba(255, 255, 255, .15);
} }
:root.tomorrow #qr .field {
background-color: rgb(26, 27, 29);
color: rgb(197,200,198);
border-color: rgb(40, 41, 42);
}
:root.tomorrow #qr .field:focus {
border-color: rgb(129, 162, 190) !important;
background-color: rgb(30,32,36);
}
/* Menu */ /* Menu */
:root.tomorrow #menu { :root.tomorrow #menu {

View File

@ -81,7 +81,14 @@ $.ajax = (url, callbacks, opts={}) ->
r.setRequestHeader key, val r.setRequestHeader key, val
$.extend r, callbacks $.extend r, callbacks
$.extend r.upload, upCallbacks $.extend r.upload, upCallbacks
r.withCredentials = cred try
# Firefox throws an error if you try
# to set this on a synchronous XHR.
# Only cookies from the remote domain
# are used in a request withCredentials.
r.withCredentials = cred
catch err
# do nothing
r.send form r.send form
r r
@ -90,17 +97,21 @@ $.cache = do ->
(url, cb) -> (url, cb) ->
if req = reqs[url] if req = reqs[url]
if req.readyState is 4 if req.readyState is 4
cb.call req cb.call req, req.evt
else else
req.callbacks.push cb req.callbacks.push cb
return return
rm = -> delete reqs[url] rm = -> delete reqs[url]
req = $.ajax url, try
onload: (e) -> req = $.ajax url,
cb.call @, e for cb in @callbacks onload: (e) ->
delete @callbacks cb.call @, e for cb in @callbacks
onabort: rm @evt = e
onerror: rm delete @callbacks
onabort: rm
onerror: rm
catch err
return
req.callbacks = [cb] req.callbacks = [cb]
reqs[url] = req reqs[url] = req

View File

@ -62,7 +62,7 @@ class DataBoard
for boardID, val of @data.boards for boardID, val of @data.boards
# XXX tmp fix for users that had the `null` # XXX tmp fix for users that had the `null`
# value for a board with the Unread features: # value for a board with the Unread features:
unless val if typeof @data.boards[boardID] isnt 'object'
delete @data.boards[boardID] delete @data.boards[boardID]
else else
@deleteIfEmpty {boardID} @deleteIfEmpty {boardID}

View File

@ -68,7 +68,10 @@ ImageExpand =
ImageExpand.expand post ImageExpand.expand post
return return
ImageExpand.contract post ImageExpand.contract post
rect = post.nodes.root.getBoundingClientRect() rect = if Conf['Advance on contract'] and !($.hasClass doc, 'fappeTyme')
post.nodes.root.nextSibling.getBoundingClientRect()
else
post.nodes.root.getBoundingClientRect()
return unless rect.top <= 0 or rect.left <= 0 return unless rect.top <= 0 or rect.left <= 0
{top} = rect {top} = rect

View File

@ -31,7 +31,7 @@ DeleteLink =
el: div el: div
order: 40 order: 40
open: (post) -> open: (post) ->
return false if post.isDead return false if post.isDead or post.board.ID is 'q'
DeleteLink.post = post DeleteLink.post = post
node = div.firstChild node = div.firstChild
node.textContent = 'Delete' node.textContent = 'Delete'
@ -86,10 +86,7 @@ DeleteLink =
delete DeleteLink.cooldown.counting delete DeleteLink.cooldown.counting
return return
DeleteLink.cooldown.counting = post DeleteLink.cooldown.counting = post
length = if post.board.ID is 'q' length = 30
600
else
30
seconds = Math.ceil (length * $.SECOND - (Date.now() - post.info.date)) / $.SECOND seconds = Math.ceil (length * $.SECOND - (Date.now() - post.info.date)) / $.SECOND
DeleteLink.cooldown.count post, seconds, length, node DeleteLink.cooldown.count post, seconds, length, node
count: (post, seconds, length, node) -> count: (post, seconds, length, node) ->

View File

@ -31,19 +31,19 @@ ExpandThread =
thread.isExpanded = true thread.isExpanded = true
return return
thread.isExpanded = 'loading' thread.isExpanded = 'loading'
a.textContent = a.textContent.replace '+', '× Loading...' a.textContent = a.textContent.replace '+', '...'
$.cache "//api.4chan.org/#{thread.board}/res/#{thread}.json", -> $.cache "//api.4chan.org/#{thread.board}/res/#{thread}.json", ->
ExpandThread.parse @, thread, a ExpandThread.parse @, thread, a
when 'loading' when 'loading'
thread.isExpanded = false thread.isExpanded = false
return unless a return unless a
a.textContent = a.textContent.replace '× Loading...', '+' a.textContent = a.textContent.replace '...', '+'
when true when true
thread.isExpanded = false thread.isExpanded = false
if a if a
a.textContent = a.textContent.replace '-', '+' a.textContent = a.textContent.replace('-', '+').replace('hide', 'view').replace('expanded', 'omitted')
#goddamit moot #goddamit moot
num = if thread.isSticky num = if thread.isSticky
1 1
@ -71,7 +71,7 @@ ExpandThread =
return return
thread.isExpanded = true thread.isExpanded = true
a.textContent = a.textContent.replace '× Loading...', '-' a.textContent = a.textContent.replace('...', '-').replace('view', 'hide').replace('omitted', 'expanded')
posts = JSON.parse(req.response).posts posts = JSON.parse(req.response).posts
if spoilerRange = posts[0].custom_spoiler if spoilerRange = posts[0].custom_spoiler

View File

@ -131,7 +131,7 @@ Unread =
Unread.db.set Unread.db.set
boardID: Unread.thread.board.ID boardID: Unread.thread.board.ID
threadID: Unread.thread.ID threadID: Unread.thread.ID
val: Unread.lastReadPost val: Unread.lastReadPost
setLine: (force) -> setLine: (force) ->
return unless d.hidden or force is true return unless d.hidden or force is true

View File

@ -37,10 +37,9 @@ QR =
return unless QR.postingIsEnabled return unless QR.postingIsEnabled
link = $.el 'h1', link = $.el 'h1',
innerHTML: "<a href=javascript:;>#{title = if g.VIEW is 'thread' then 'Reply to Thread' else 'Start a Thread'}</a>" innerHTML: "<a href=javascript:; class='qr-link'>#{if g.VIEW is 'thread' then 'Reply to Thread' else 'Start a Thread'}</a>"
title: title className: "qr-link-container"
className: "qr-link" $.on link.firstChild, 'click', ->
$.on link, 'click', ->
$.event 'CloseMenu' $.event 'CloseMenu'
QR.open() QR.open()
QR.nodes.com.focus() QR.nodes.com.focus()
@ -248,7 +247,7 @@ QR =
else 300 else 300
sage: if board is 'q' then 600 else 60 sage: if board is 'q' then 600 else 60
file: if board is 'q' then 300 else 30 file: if board is 'q' then 300 else 30
post: if board is 'q' then 60 else 30 post: if board is 'q' then 150 else 30
QR.cooldown.upSpd = 0 QR.cooldown.upSpd = 0
QR.cooldown.upSpdAccuracy = .5 QR.cooldown.upSpdAccuracy = .5
$.get "cooldown.#{board}", {}, (item) -> $.get "cooldown.#{board}", {}, (item) ->