Merge branch 'master' of https://github.com/seaweedchan/4chan-x into v3
This commit is contained in:
commit
e4bdad43c7
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,3 +1,15 @@
|
||||
### v1.2.4
|
||||
*2013-05-14*
|
||||
|
||||
**seaweedchan**:
|
||||
- Don't let QR shortcut close a Persistent QR
|
||||
- Don't let Reply to Thread link close the QR -- it should only do what it implies
|
||||
|
||||
**zixaphir**:
|
||||
- Add board selection to archiver options
|
||||
- Fix bug where image hover would close when hitting Enter while typing
|
||||
- Add `Quoted Title` option which adds (!) text to title when user is quoted
|
||||
|
||||
### v1.2.3
|
||||
*2013-05-14*
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 4chan X - Version 1.2.3 - 2013-05-14
|
||||
* 4chan X - Version 1.2.4 - 2013-05-15
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name 4chan X
|
||||
// @version 1.2.3
|
||||
// @version 1.2.4
|
||||
// @namespace 4chan-X
|
||||
// @description Cross-browser userscript for maximum lurking on 4chan.
|
||||
// @license MIT; https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "4chan X",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"manifest_version": 2,
|
||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||
"icons": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
postMessage({version:'1.2.3'},'*')
|
||||
postMessage({version:'1.2.4'},'*')
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "4chan-X",
|
||||
"version": "1.2.3",
|
||||
"version": "1.2.4",
|
||||
"description": "Cross-browser userscript for maximum lurking on 4chan.",
|
||||
"meta": {
|
||||
"name": "4chan X",
|
||||
|
||||
@ -8,6 +8,11 @@ Filter =
|
||||
|
||||
for key of Config.filter
|
||||
@filters[key] = []
|
||||
if Conf[key] is undefined
|
||||
# XXX hopefully tmp fix for the rare people getting this mysterious error:
|
||||
# "Filter" initialization crashed. TypeError: Cannot call method 'split' of undefined
|
||||
$.delete key
|
||||
continue
|
||||
for filter in Conf[key].split '\n'
|
||||
continue if filter[0] is '#'
|
||||
|
||||
@ -272,4 +277,4 @@ Filter =
|
||||
ta = $ 'textarea', section
|
||||
tl = ta.textLength
|
||||
ta.setSelectionRange tl, tl
|
||||
ta.focus()
|
||||
ta.focus()
|
||||
|
||||
@ -293,6 +293,10 @@ Config =
|
||||
true
|
||||
'Show notifications on successful post creation or file uploading.'
|
||||
]
|
||||
'Captcha Warning Notifications': [
|
||||
true
|
||||
'When disabled, shows a red border on the CAPTCHA input until a key is pressed instead of a notification.'
|
||||
]
|
||||
|
||||
'Quote Links':
|
||||
'Quote Backlinks': [
|
||||
@ -332,8 +336,8 @@ Config =
|
||||
'Add \'(You)\' to quotes linking to your posts.'
|
||||
]
|
||||
'Quoted Title': [
|
||||
'Change the page title to reflect you\'ve been quoted.'
|
||||
false
|
||||
'Change the page title to reflect you\'ve been quoted.'
|
||||
]
|
||||
'Highlight Posts Quoting You': [
|
||||
false
|
||||
|
||||
@ -18,7 +18,8 @@ Main =
|
||||
|
||||
$.get Conf, Main.initFeatures
|
||||
|
||||
$.asap (-> d.head and $('link[rel="shortcut icon"]', d.head) or d.readyState in ['interactive', 'complete']),\
|
||||
$.on d, '4chanMainInit', Main.initStyle
|
||||
$.asap (-> d.head and $('title', d.head) or d.readyState in ['interactive', 'complete']),
|
||||
Main.initStyle
|
||||
|
||||
initFeatures: (items) ->
|
||||
@ -26,6 +27,7 @@ Main =
|
||||
|
||||
pathname = location.pathname.split '/'
|
||||
g.BOARD = new Board pathname[1]
|
||||
return if g.BOARD.ID is 'z'
|
||||
g.VIEW =
|
||||
switch pathname[2]
|
||||
when 'res'
|
||||
@ -131,7 +133,8 @@ Main =
|
||||
$.ready Main.initReady
|
||||
|
||||
initStyle: ->
|
||||
return unless Main.isThisPageLegit()
|
||||
$.off d, '4chanMainInit', Main.initStyle
|
||||
return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x'
|
||||
# disable the mobile layout
|
||||
$('link[href*=mobile]', d.head)?.disabled = true
|
||||
<% if (type === 'crx') { %>
|
||||
@ -223,6 +226,10 @@ Main =
|
||||
|
||||
return
|
||||
|
||||
try
|
||||
localStorage.getItem '4chan-settings'
|
||||
catch err
|
||||
new Notification 'warning', 'Cookies need to be enabled on 4chan for <%= meta.name %> to properly function.', 30
|
||||
|
||||
$.event '4chanXInitFinished'
|
||||
Main.checkUpdate()
|
||||
|
||||
@ -154,6 +154,8 @@ Settings =
|
||||
Conf[db] = boards: {}
|
||||
# Make sure to export the most recent data.
|
||||
$.get Conf, (Conf) ->
|
||||
# XXX don't export archives.
|
||||
delete Conf['archives']
|
||||
data.Conf = Conf
|
||||
Settings.export now, data
|
||||
return
|
||||
|
||||
@ -738,6 +738,9 @@ input.field.tripped:not(:hover):not(:focus) {
|
||||
width: 100%;
|
||||
margin: 1px 0 0;
|
||||
}
|
||||
.captcha-input.error:focus {
|
||||
border-color: rgb(255,0,0) !important;
|
||||
}
|
||||
.field {
|
||||
-moz-box-sizing: border-box;
|
||||
margin: 0px;
|
||||
|
||||
@ -35,12 +35,6 @@
|
||||
background-color: #282A2E;
|
||||
border-color: #111;
|
||||
}
|
||||
:root.tomorrow #qr select {
|
||||
color: #C5C8C6;
|
||||
}
|
||||
:root.tomorrow #qr option {
|
||||
color: #000;
|
||||
}
|
||||
:root.tomorrow .qr-preview {
|
||||
background-color: rgba(255, 255, 255, .15);
|
||||
}
|
||||
|
||||
@ -59,8 +59,13 @@ class DataBoard
|
||||
val or defaultValue
|
||||
|
||||
clean: ->
|
||||
for boardID of @data.boards
|
||||
@deleteIfEmpty {boardID}
|
||||
for boardID, val of @data.boards
|
||||
# XXX tmp fix for users that had the `null`
|
||||
# value for a board with the Unread features:
|
||||
unless val
|
||||
delete @data.boards[boardID]
|
||||
else
|
||||
@deleteIfEmpty {boardID}
|
||||
|
||||
now = Date.now()
|
||||
if (@data.lastChecked or 0) < now - 2 * $.HOUR
|
||||
|
||||
@ -5,7 +5,11 @@ Sauce =
|
||||
links = []
|
||||
for link in Conf['sauces'].split '\n'
|
||||
continue if link[0] is '#'
|
||||
links.push @createSauceLink link.trim()
|
||||
try
|
||||
links.push @createSauceLink link.trim()
|
||||
catch err
|
||||
# Don't add random text plz.
|
||||
continue
|
||||
return unless links.length
|
||||
@links = links
|
||||
@link = $.el 'a', target: '_blank'
|
||||
@ -39,4 +43,4 @@ Sauce =
|
||||
for link in Sauce.links
|
||||
# \u00A0 is nbsp
|
||||
nodes.push $.tn('\u00A0'), link @, Sauce.link.cloneNode true
|
||||
$.add @file.info, nodes
|
||||
$.add @file.info, nodes
|
||||
|
||||
@ -30,8 +30,7 @@ Unread =
|
||||
for ID, post of Unread.thread.posts
|
||||
posts.push post if post.isReply
|
||||
Unread.addPosts posts
|
||||
return unless Conf['Scroll to Last Read Post']
|
||||
Unread.scroll()
|
||||
Unread.scroll() if Conf['Scroll to Last Read Post']
|
||||
|
||||
scroll: ->
|
||||
# Let the header's onload callback handle it.
|
||||
@ -44,15 +43,11 @@ Unread =
|
||||
break if prevID is post.ID
|
||||
prevID = post.ID
|
||||
break unless post.isHidden
|
||||
onload = -> root.scrollIntoView false
|
||||
else
|
||||
# Scroll to the last read post.
|
||||
posts = Object.keys Unread.thread.posts
|
||||
post = Unread.thread.posts[posts[posts.length - 1]]
|
||||
onload = -> Header.scrollToPost post.nodes.root
|
||||
# Prevent the browser to scroll back to
|
||||
# the previous scroll location on page load.
|
||||
$.on window, 'load', onload
|
||||
root.scrollIntoView false
|
||||
return
|
||||
# Scroll to the last read post.
|
||||
posts = Object.keys Unread.thread.posts
|
||||
Header.scrollToPost Unread.thread.posts[posts[posts.length - 1]].nodes.root
|
||||
|
||||
sync: ->
|
||||
lastReadPost = Unread.db.get
|
||||
|
||||
@ -11,13 +11,14 @@ QR =
|
||||
title: 'Quick Reply'
|
||||
href: 'javascript:;'
|
||||
$.on sc, 'click', ->
|
||||
if !QR.nodes or QR.nodes.el.hidden
|
||||
if Conf['Persistent QR'] or !QR.nodes or QR.nodes.el.hidden
|
||||
$.event 'CloseMenu'
|
||||
QR.open()
|
||||
QR.nodes.com.focus()
|
||||
$.rmClass @, 'disabled'
|
||||
else
|
||||
QR.close()
|
||||
$.toggleClass @, 'disabled'
|
||||
$.addClass @, 'disabled'
|
||||
|
||||
Header.addShortcut sc
|
||||
|
||||
@ -40,14 +41,11 @@ QR =
|
||||
title: title
|
||||
className: "qr-link"
|
||||
$.on link, 'click', ->
|
||||
if !QR.nodes or QR.nodes.el.hidden
|
||||
$.event 'CloseMenu'
|
||||
QR.open()
|
||||
QR.nodes.com.focus()
|
||||
if Conf['QR Shortcut']
|
||||
$.rmClass $('.qr-shortcut'), 'disabled'
|
||||
else
|
||||
QR.close()
|
||||
$.event 'CloseMenu'
|
||||
QR.open()
|
||||
QR.nodes.com.focus()
|
||||
if Conf['QR Shortcut']
|
||||
$.rmClass $('.qr-shortcut'), 'disabled'
|
||||
|
||||
$.before $.id('postForm'), link
|
||||
|
||||
@ -95,6 +93,8 @@ QR =
|
||||
QR.cleanNotifications()
|
||||
d.activeElement.blur()
|
||||
$.rmClass QR.nodes.el, 'dump'
|
||||
unless Conf['Captcha Warning Notifications']
|
||||
$.rmClass QR.captcha.nodes.input, 'error'
|
||||
if Conf['QR Shortcut']
|
||||
$.toggleClass $('.qr-shortcut'), 'disabled'
|
||||
for i in QR.posts
|
||||
@ -128,8 +128,16 @@ QR =
|
||||
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
|
||||
# Focus the captcha input on captcha error.
|
||||
QR.captcha.nodes.input.focus()
|
||||
if Conf['Captcha Warning Notifications']
|
||||
QR.notifications.push new Notification 'warning', el
|
||||
else
|
||||
$.addClass QR.captcha.nodes.input, 'error'
|
||||
$.on QR.captcha.nodes.input, 'keydown', ->
|
||||
$.rmClass QR.captcha.nodes.input, 'error'
|
||||
else
|
||||
QR.notifications.push new Notification 'warning', el
|
||||
alert el.textContent if d.hidden
|
||||
QR.notifications.push new Notification 'warning', el
|
||||
|
||||
notifications: []
|
||||
cleanNotifications: ->
|
||||
for notification in QR.notifications
|
||||
@ -1025,13 +1033,13 @@ QR =
|
||||
{challenge, response} = QR.captcha.getOne()
|
||||
err = 'No valid captcha.' unless response
|
||||
|
||||
QR.cleanNotifications()
|
||||
if err
|
||||
# stop auto-posting
|
||||
QR.cooldown.auto = false
|
||||
QR.status()
|
||||
QR.error err
|
||||
return
|
||||
QR.cleanNotifications()
|
||||
|
||||
# Enable auto-posting if we have stuff to post, disable it otherwise.
|
||||
QR.cooldown.auto = QR.posts.length > 1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user