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
|
### v1.2.3
|
||||||
*2013-05-14*
|
*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.
|
* 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
@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name 4chan X
|
// @name 4chan X
|
||||||
// @version 1.2.3
|
// @version 1.2.4
|
||||||
// @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
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"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 +1 @@
|
|||||||
postMessage({version:'1.2.3'},'*')
|
postMessage({version:'1.2.4'},'*')
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan-X",
|
"name": "4chan-X",
|
||||||
"version": "1.2.3",
|
"version": "1.2.4",
|
||||||
"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",
|
||||||
|
|||||||
@ -8,6 +8,11 @@ Filter =
|
|||||||
|
|
||||||
for key of Config.filter
|
for key of Config.filter
|
||||||
@filters[key] = []
|
@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'
|
for filter in Conf[key].split '\n'
|
||||||
continue if filter[0] is '#'
|
continue if filter[0] is '#'
|
||||||
|
|
||||||
@ -272,4 +277,4 @@ Filter =
|
|||||||
ta = $ 'textarea', section
|
ta = $ 'textarea', section
|
||||||
tl = ta.textLength
|
tl = ta.textLength
|
||||||
ta.setSelectionRange tl, tl
|
ta.setSelectionRange tl, tl
|
||||||
ta.focus()
|
ta.focus()
|
||||||
|
|||||||
@ -293,6 +293,10 @@ Config =
|
|||||||
true
|
true
|
||||||
'Show notifications on successful post creation or file uploading.'
|
'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 Links':
|
||||||
'Quote Backlinks': [
|
'Quote Backlinks': [
|
||||||
@ -332,8 +336,8 @@ Config =
|
|||||||
'Add \'(You)\' to quotes linking to your posts.'
|
'Add \'(You)\' to quotes linking to your posts.'
|
||||||
]
|
]
|
||||||
'Quoted Title': [
|
'Quoted Title': [
|
||||||
'Change the page title to reflect you\'ve been quoted.'
|
|
||||||
false
|
false
|
||||||
|
'Change the page title to reflect you\'ve been quoted.'
|
||||||
]
|
]
|
||||||
'Highlight Posts Quoting You': [
|
'Highlight Posts Quoting You': [
|
||||||
false
|
false
|
||||||
|
|||||||
@ -18,7 +18,8 @@ Main =
|
|||||||
|
|
||||||
$.get Conf, Main.initFeatures
|
$.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
|
Main.initStyle
|
||||||
|
|
||||||
initFeatures: (items) ->
|
initFeatures: (items) ->
|
||||||
@ -26,6 +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'
|
||||||
g.VIEW =
|
g.VIEW =
|
||||||
switch pathname[2]
|
switch pathname[2]
|
||||||
when 'res'
|
when 'res'
|
||||||
@ -131,7 +133,8 @@ Main =
|
|||||||
$.ready Main.initReady
|
$.ready Main.initReady
|
||||||
|
|
||||||
initStyle: ->
|
initStyle: ->
|
||||||
return unless Main.isThisPageLegit()
|
$.off d, '4chanMainInit', Main.initStyle
|
||||||
|
return if !Main.isThisPageLegit() or $.hasClass doc, 'fourchan-x'
|
||||||
# disable the mobile layout
|
# disable the mobile layout
|
||||||
$('link[href*=mobile]', d.head)?.disabled = true
|
$('link[href*=mobile]', d.head)?.disabled = true
|
||||||
<% if (type === 'crx') { %>
|
<% if (type === 'crx') { %>
|
||||||
@ -223,6 +226,10 @@ Main =
|
|||||||
|
|
||||||
return
|
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'
|
$.event '4chanXInitFinished'
|
||||||
Main.checkUpdate()
|
Main.checkUpdate()
|
||||||
|
|||||||
@ -154,6 +154,8 @@ Settings =
|
|||||||
Conf[db] = boards: {}
|
Conf[db] = boards: {}
|
||||||
# Make sure to export the most recent data.
|
# Make sure to export the most recent data.
|
||||||
$.get Conf, (Conf) ->
|
$.get Conf, (Conf) ->
|
||||||
|
# XXX don't export archives.
|
||||||
|
delete Conf['archives']
|
||||||
data.Conf = Conf
|
data.Conf = Conf
|
||||||
Settings.export now, data
|
Settings.export now, data
|
||||||
return
|
return
|
||||||
|
|||||||
@ -738,6 +738,9 @@ input.field.tripped:not(:hover):not(:focus) {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
margin: 1px 0 0;
|
margin: 1px 0 0;
|
||||||
}
|
}
|
||||||
|
.captcha-input.error:focus {
|
||||||
|
border-color: rgb(255,0,0) !important;
|
||||||
|
}
|
||||||
.field {
|
.field {
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
|
|||||||
@ -35,12 +35,6 @@
|
|||||||
background-color: #282A2E;
|
background-color: #282A2E;
|
||||||
border-color: #111;
|
border-color: #111;
|
||||||
}
|
}
|
||||||
:root.tomorrow #qr select {
|
|
||||||
color: #C5C8C6;
|
|
||||||
}
|
|
||||||
:root.tomorrow #qr option {
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
:root.tomorrow .qr-preview {
|
:root.tomorrow .qr-preview {
|
||||||
background-color: rgba(255, 255, 255, .15);
|
background-color: rgba(255, 255, 255, .15);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,8 +59,13 @@ class DataBoard
|
|||||||
val or defaultValue
|
val or defaultValue
|
||||||
|
|
||||||
clean: ->
|
clean: ->
|
||||||
for boardID of @data.boards
|
for boardID, val of @data.boards
|
||||||
@deleteIfEmpty {boardID}
|
# 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()
|
now = Date.now()
|
||||||
if (@data.lastChecked or 0) < now - 2 * $.HOUR
|
if (@data.lastChecked or 0) < now - 2 * $.HOUR
|
||||||
|
|||||||
@ -5,7 +5,11 @@ Sauce =
|
|||||||
links = []
|
links = []
|
||||||
for link in Conf['sauces'].split '\n'
|
for link in Conf['sauces'].split '\n'
|
||||||
continue if link[0] is '#'
|
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
|
return unless links.length
|
||||||
@links = links
|
@links = links
|
||||||
@link = $.el 'a', target: '_blank'
|
@link = $.el 'a', target: '_blank'
|
||||||
@ -39,4 +43,4 @@ Sauce =
|
|||||||
for link in Sauce.links
|
for link in Sauce.links
|
||||||
# \u00A0 is nbsp
|
# \u00A0 is nbsp
|
||||||
nodes.push $.tn('\u00A0'), link @, Sauce.link.cloneNode true
|
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
|
for ID, post of Unread.thread.posts
|
||||||
posts.push post if post.isReply
|
posts.push post if post.isReply
|
||||||
Unread.addPosts posts
|
Unread.addPosts posts
|
||||||
return unless Conf['Scroll to Last Read Post']
|
Unread.scroll() if Conf['Scroll to Last Read Post']
|
||||||
Unread.scroll()
|
|
||||||
|
|
||||||
scroll: ->
|
scroll: ->
|
||||||
# Let the header's onload callback handle it.
|
# Let the header's onload callback handle it.
|
||||||
@ -44,15 +43,11 @@ Unread =
|
|||||||
break if prevID is post.ID
|
break if prevID is post.ID
|
||||||
prevID = post.ID
|
prevID = post.ID
|
||||||
break unless post.isHidden
|
break unless post.isHidden
|
||||||
onload = -> root.scrollIntoView false
|
root.scrollIntoView false
|
||||||
else
|
return
|
||||||
# Scroll to the last read post.
|
# Scroll to the last read post.
|
||||||
posts = Object.keys Unread.thread.posts
|
posts = Object.keys Unread.thread.posts
|
||||||
post = Unread.thread.posts[posts[posts.length - 1]]
|
Header.scrollToPost Unread.thread.posts[posts[posts.length - 1]].nodes.root
|
||||||
onload = -> Header.scrollToPost post.nodes.root
|
|
||||||
# Prevent the browser to scroll back to
|
|
||||||
# the previous scroll location on page load.
|
|
||||||
$.on window, 'load', onload
|
|
||||||
|
|
||||||
sync: ->
|
sync: ->
|
||||||
lastReadPost = Unread.db.get
|
lastReadPost = Unread.db.get
|
||||||
|
|||||||
@ -11,13 +11,14 @@ QR =
|
|||||||
title: 'Quick Reply'
|
title: 'Quick Reply'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.on sc, 'click', ->
|
$.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'
|
$.event 'CloseMenu'
|
||||||
QR.open()
|
QR.open()
|
||||||
QR.nodes.com.focus()
|
QR.nodes.com.focus()
|
||||||
|
$.rmClass @, 'disabled'
|
||||||
else
|
else
|
||||||
QR.close()
|
QR.close()
|
||||||
$.toggleClass @, 'disabled'
|
$.addClass @, 'disabled'
|
||||||
|
|
||||||
Header.addShortcut sc
|
Header.addShortcut sc
|
||||||
|
|
||||||
@ -40,14 +41,11 @@ QR =
|
|||||||
title: title
|
title: title
|
||||||
className: "qr-link"
|
className: "qr-link"
|
||||||
$.on link, 'click', ->
|
$.on link, 'click', ->
|
||||||
if !QR.nodes or QR.nodes.el.hidden
|
$.event 'CloseMenu'
|
||||||
$.event 'CloseMenu'
|
QR.open()
|
||||||
QR.open()
|
QR.nodes.com.focus()
|
||||||
QR.nodes.com.focus()
|
if Conf['QR Shortcut']
|
||||||
if Conf['QR Shortcut']
|
$.rmClass $('.qr-shortcut'), 'disabled'
|
||||||
$.rmClass $('.qr-shortcut'), 'disabled'
|
|
||||||
else
|
|
||||||
QR.close()
|
|
||||||
|
|
||||||
$.before $.id('postForm'), link
|
$.before $.id('postForm'), link
|
||||||
|
|
||||||
@ -95,6 +93,8 @@ QR =
|
|||||||
QR.cleanNotifications()
|
QR.cleanNotifications()
|
||||||
d.activeElement.blur()
|
d.activeElement.blur()
|
||||||
$.rmClass QR.nodes.el, 'dump'
|
$.rmClass QR.nodes.el, 'dump'
|
||||||
|
unless Conf['Captcha Warning Notifications']
|
||||||
|
$.rmClass QR.captcha.nodes.input, 'error'
|
||||||
if Conf['QR Shortcut']
|
if Conf['QR Shortcut']
|
||||||
$.toggleClass $('.qr-shortcut'), 'disabled'
|
$.toggleClass $('.qr-shortcut'), 'disabled'
|
||||||
for i in QR.posts
|
for i in QR.posts
|
||||||
@ -128,8 +128,16 @@ QR =
|
|||||||
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
|
if QR.captcha.isEnabled and /captcha|verification/i.test el.textContent
|
||||||
# Focus the captcha input on captcha error.
|
# Focus the captcha input on captcha error.
|
||||||
QR.captcha.nodes.input.focus()
|
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
|
alert el.textContent if d.hidden
|
||||||
QR.notifications.push new Notification 'warning', el
|
|
||||||
notifications: []
|
notifications: []
|
||||||
cleanNotifications: ->
|
cleanNotifications: ->
|
||||||
for notification in QR.notifications
|
for notification in QR.notifications
|
||||||
@ -1025,13 +1033,13 @@ QR =
|
|||||||
{challenge, response} = QR.captcha.getOne()
|
{challenge, response} = QR.captcha.getOne()
|
||||||
err = 'No valid captcha.' unless response
|
err = 'No valid captcha.' unless response
|
||||||
|
|
||||||
|
QR.cleanNotifications()
|
||||||
if err
|
if err
|
||||||
# stop auto-posting
|
# stop auto-posting
|
||||||
QR.cooldown.auto = false
|
QR.cooldown.auto = false
|
||||||
QR.status()
|
QR.status()
|
||||||
QR.error err
|
QR.error err
|
||||||
return
|
return
|
||||||
QR.cleanNotifications()
|
|
||||||
|
|
||||||
# Enable auto-posting if we have stuff to post, disable it otherwise.
|
# Enable auto-posting if we have stuff to post, disable it otherwise.
|
||||||
QR.cooldown.auto = QR.posts.length > 1
|
QR.cooldown.auto = QR.posts.length > 1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user