Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3
Conflicts: src/config.coffee src/features.coffee We don't actually use the "Header", so the "move header to bottom" setting has been removed as it wouldn't do anything.
This commit is contained in:
commit
a0ef2f4076
@ -1,3 +1,8 @@
|
|||||||
|
### 3.0.2 - *2013-04-09*
|
||||||
|
|
||||||
|
- Added a setting in the Header's menu to move it at the bottom of the screen.
|
||||||
|
- Added Cooldown setting back in.
|
||||||
|
- Fixed the Header going above posts when following quotelinks for example.
|
||||||
- Fixed a bug where dead quotelinks would disappear.
|
- Fixed a bug where dead quotelinks would disappear.
|
||||||
|
|
||||||
### 3.0.1 - *2013-04-08*
|
### 3.0.1 - *2013-04-08*
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.field {
|
.field {
|
||||||
|
background-color: #FFF;
|
||||||
border: 1px solid #CCC;
|
border: 1px solid #CCC;
|
||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
@ -97,18 +98,34 @@ a[href="javascript:;"] {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
#header {
|
#header {
|
||||||
top: 0;
|
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
#header.top {
|
||||||
|
top: 0;
|
||||||
|
}
|
||||||
|
#header.bottom {
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
#header-bar {
|
#header-bar {
|
||||||
border-width: 0 0 1px;
|
border-width: 0;
|
||||||
display: -webkit-flex;
|
display: -webkit-flex;
|
||||||
display: flex;
|
display: flex;
|
||||||
padding: 3px 4px 4px;
|
padding: 3px 4px 4px;
|
||||||
position: relative;
|
position: relative;
|
||||||
transition: all .1s .05s ease-in-out;
|
transition: all .1s .05s ease-in-out;
|
||||||
}
|
}
|
||||||
|
#header.top #header-bar {
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
}
|
||||||
|
#header.bottom #header-bar {
|
||||||
|
box-shadow: 0 -1px 2px rgba(0, 0, 0, .15);
|
||||||
|
border-top-width: 1px;
|
||||||
|
}
|
||||||
|
#header.bottom .menu-button i {
|
||||||
|
border-top: none;
|
||||||
|
border-bottom: 6px solid;
|
||||||
|
}
|
||||||
#board-list {
|
#board-list {
|
||||||
-webkit-flex: 1;
|
-webkit-flex: 1;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -116,26 +133,49 @@ a[href="javascript:;"] {
|
|||||||
}
|
}
|
||||||
#header-bar.autohide:not(:hover) {
|
#header-bar.autohide:not(:hover) {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
|
transition: all .8s .6s cubic-bezier(.55, .055, .675, .19);
|
||||||
|
}
|
||||||
|
#header.top #header-bar.autohide:not(:hover) {
|
||||||
margin-bottom: -1em;
|
margin-bottom: -1em;
|
||||||
-webkit-transform: translateY(-100%);
|
-webkit-transform: translateY(-100%);
|
||||||
transform: translateY(-100%);
|
transform: translateY(-100%);
|
||||||
transition: all .8s .6s cubic-bezier(.55, .055, .675, .19);
|
}
|
||||||
|
#header.bottom #header-bar.autohide:not(:hover) {
|
||||||
|
-webkit-transform: translateY(100%);
|
||||||
|
transform: translateY(100%);
|
||||||
}
|
}
|
||||||
#toggle-header-bar {
|
#toggle-header-bar {
|
||||||
cursor: n-resize;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: -8px;
|
|
||||||
height: 10px;
|
height: 10px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
#header-bar.autohide:not(:hover) #toggle-header-bar, #toggle-header-bar:hover {
|
#header.top #toggle-header-bar {
|
||||||
bottom: -16px;
|
cursor: n-resize;
|
||||||
|
bottom: -8px;
|
||||||
|
}
|
||||||
|
#header.bottom #toggle-header-bar {
|
||||||
|
cursor: s-resize;
|
||||||
|
top: -8px;
|
||||||
|
}
|
||||||
|
#header-bar.autohide:not(:hover) #toggle-header-bar,
|
||||||
|
#toggle-header-bar:hover {
|
||||||
height: 18px;
|
height: 18px;
|
||||||
}
|
}
|
||||||
#header-bar.autohide #toggle-header-bar {
|
#header.top #header-bar.autohide:not(:hover) #toggle-header-bar,
|
||||||
|
#header.top #toggle-header-bar:hover {
|
||||||
|
bottom: -16px;
|
||||||
|
}
|
||||||
|
#header.bottom #header-bar.autohide:not(:hover) #toggle-header-bar,
|
||||||
|
#header.bottom #toggle-header-bar:hover {
|
||||||
|
top: -16px;
|
||||||
|
}
|
||||||
|
#header.top #header-bar.autohide #toggle-header-bar {
|
||||||
cursor: s-resize;
|
cursor: s-resize;
|
||||||
}
|
}
|
||||||
|
#header.bottom #header-bar.autohide #toggle-header-bar {
|
||||||
|
cursor: n-resize;
|
||||||
|
}
|
||||||
#header-bar a:not(.entry) {
|
#header-bar a:not(.entry) {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
@ -163,6 +203,12 @@ a[href="javascript:;"] {
|
|||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
|
#header.bottom #notifications {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
.notification {
|
.notification {
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
@ -427,7 +473,7 @@ a[href="javascript:;"] {
|
|||||||
max-height: 300px;
|
max-height: 300px;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
}
|
}
|
||||||
.qphl > .post {
|
.qphl {
|
||||||
outline: 2px solid rgba(216, 94, 49, .7);
|
outline: 2px solid rgba(216, 94, 49, .7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "4chan-X",
|
"name": "4chan-X",
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"description": "Cross-browser extension for productive lurking on 4chan.",
|
"description": "Cross-browser extension for productive lurking on 4chan.",
|
||||||
"meta": {
|
"meta": {
|
||||||
"name": "4chan X",
|
"name": "4chan X",
|
||||||
|
|||||||
@ -229,6 +229,10 @@ Config =
|
|||||||
true
|
true
|
||||||
'Hide the normal post form.'
|
'Hide the normal post form.'
|
||||||
]
|
]
|
||||||
|
'Cooldown': [
|
||||||
|
true
|
||||||
|
'Prevent "flood detected" errors.'
|
||||||
|
]
|
||||||
|
|
||||||
'Quote Links':
|
'Quote Links':
|
||||||
'Quote Backlinks': [
|
'Quote Backlinks': [
|
||||||
|
|||||||
@ -6,6 +6,9 @@ Header =
|
|||||||
id: 'shortcuts'
|
id: 'shortcuts'
|
||||||
@hover = $.el 'div',
|
@hover = $.el 'div',
|
||||||
id: 'hoverUI'
|
id: 'hoverUI'
|
||||||
|
|
||||||
|
$.on window, 'load hashchange', Header.hashScroll
|
||||||
|
|
||||||
$.asap (-> d.body), ->
|
$.asap (-> d.body), ->
|
||||||
return unless Main.isThisPageLegit()
|
return unless Main.isThisPageLegit()
|
||||||
# Wait for #boardNavMobile instead of #boardNavDesktop,
|
# Wait for #boardNavMobile instead of #boardNavDesktop,
|
||||||
@ -88,6 +91,17 @@ Header =
|
|||||||
custom.hidden = !showBoardList
|
custom.hidden = !showBoardList
|
||||||
full.hidden = showBoardList
|
full.hidden = showBoardList
|
||||||
|
|
||||||
|
hashScroll: ->
|
||||||
|
return unless post = $.id @location.hash[1..]
|
||||||
|
Header.scrollToPost post
|
||||||
|
|
||||||
|
scrollToPost: (post) ->
|
||||||
|
{top} = post.getBoundingClientRect()
|
||||||
|
unless Conf['Bottom header']
|
||||||
|
headRect = Header.bar.getBoundingClientRect()
|
||||||
|
top += - headRect.top - headRect.height
|
||||||
|
(if $.engine is 'webkit' then d.body else doc).scrollTop += top
|
||||||
|
|
||||||
addShortcut: (el) ->
|
addShortcut: (el) ->
|
||||||
shortcut = $.el 'span',
|
shortcut = $.el 'span',
|
||||||
className: 'shortcut'
|
className: 'shortcut'
|
||||||
@ -1871,8 +1885,11 @@ Keybinds =
|
|||||||
location.href = url
|
location.href = url
|
||||||
|
|
||||||
hl: (delta, thread) ->
|
hl: (delta, thread) ->
|
||||||
headRect = Header.bar.getBoundingClientRect()
|
if Conf['Bottom header']
|
||||||
topMargin = headRect.top + headRect.height
|
topMargin = 0
|
||||||
|
else
|
||||||
|
headRect = Header.toggle.getBoundingClientRect()
|
||||||
|
topMargin = headRect.top + headRect.height
|
||||||
if postEl = $ '.reply.highlight', thread
|
if postEl = $ '.reply.highlight', thread
|
||||||
$.rmClass postEl, 'highlight'
|
$.rmClass postEl, 'highlight'
|
||||||
rect = postEl.getBoundingClientRect()
|
rect = postEl.getBoundingClientRect()
|
||||||
@ -1936,8 +1953,11 @@ Nav =
|
|||||||
Nav.scroll +1
|
Nav.scroll +1
|
||||||
|
|
||||||
getThread: (full) ->
|
getThread: (full) ->
|
||||||
headRect = Header.bar.getBoundingClientRect()
|
if Conf['Bottom header']
|
||||||
topMargin = headRect.top + headRect.height
|
topMargin = 0
|
||||||
|
else
|
||||||
|
headRect = Header.toggle.getBoundingClientRect()
|
||||||
|
topMargin = headRect.top + headRect.height
|
||||||
threads = $$ '.thread:not([hidden])'
|
threads = $$ '.thread:not([hidden])'
|
||||||
for thread, i in threads
|
for thread, i in threads
|
||||||
rect = thread.getBoundingClientRect()
|
rect = thread.getBoundingClientRect()
|
||||||
@ -2717,7 +2737,7 @@ QuotePreview =
|
|||||||
# Remove the clone that's in the qp from the array.
|
# Remove the clone that's in the qp from the array.
|
||||||
posts.pop()
|
posts.pop()
|
||||||
for post in posts
|
for post in posts
|
||||||
$.addClass post.nodes.root, 'qphl'
|
$.addClass post.nodes.post, 'qphl'
|
||||||
|
|
||||||
quoterID = $.x('ancestor::*[@id][1]', @).id.match(/\d+$/)[0]
|
quoterID = $.x('ancestor::*[@id][1]', @).id.match(/\d+$/)[0]
|
||||||
clone = Get.postFromRoot qp.firstChild
|
clone = Get.postFromRoot qp.firstChild
|
||||||
@ -2736,7 +2756,7 @@ QuotePreview =
|
|||||||
|
|
||||||
return unless Conf['Quote Highlighting']
|
return unless Conf['Quote Highlighting']
|
||||||
for post in [post].concat post.clones
|
for post in [post].concat post.clones
|
||||||
$.rmClass post.nodes.root, 'qphl'
|
$.rmClass post.nodes.post, 'qphl'
|
||||||
return
|
return
|
||||||
|
|
||||||
QuoteBacklink =
|
QuoteBacklink =
|
||||||
@ -3205,8 +3225,15 @@ ImageExpand =
|
|||||||
name: 'Image Expansion'
|
name: 'Image Expansion'
|
||||||
cb: @node
|
cb: @node
|
||||||
node: ->
|
node: ->
|
||||||
return unless @file and @file.isImage
|
return unless @file?.isImage
|
||||||
$.on @file.thumb.parentNode, 'click', ImageExpand.cb.toggle
|
{thumb} = @file
|
||||||
|
$.on thumb.parentNode, 'click', ImageExpand.cb.toggle
|
||||||
|
if @isClone and $.hasClass thumb, 'expanding'
|
||||||
|
# If we clone a post where the image is still loading,
|
||||||
|
# make it loading in the clone too.
|
||||||
|
ImageExpand.contract @
|
||||||
|
ImageExpand.expand @
|
||||||
|
return
|
||||||
if ImageExpand.on and !@isHidden
|
if ImageExpand.on and !@isHidden
|
||||||
ImageExpand.expand @
|
ImageExpand.expand @
|
||||||
cb:
|
cb:
|
||||||
@ -3256,8 +3283,15 @@ ImageExpand =
|
|||||||
return unless rect.top <= 0 or rect.left <= 0
|
return unless rect.top <= 0 or rect.left <= 0
|
||||||
# Scroll back to the thumbnail when contracting the image
|
# Scroll back to the thumbnail when contracting the image
|
||||||
# to avoid being left miles away from the relevant post.
|
# to avoid being left miles away from the relevant post.
|
||||||
|
<<<<<<< HEAD
|
||||||
headRect = Header.bar.getBoundingClientRect()
|
headRect = Header.bar.getBoundingClientRect()
|
||||||
top = rect.top - headRect.top - headRect.height
|
top = rect.top - headRect.top - headRect.height
|
||||||
|
=======
|
||||||
|
{top} = rect
|
||||||
|
unless Conf['Bottom header']
|
||||||
|
headRect = Header.toggle.getBoundingClientRect()
|
||||||
|
top += - headRect.top - headRect.height
|
||||||
|
>>>>>>> 354f566672b2dc8a556c33d6a24c0ec33ee995c8
|
||||||
root = if $.engine is 'webkit' then d.body else doc
|
root = if $.engine is 'webkit' then d.body else doc
|
||||||
root.scrollTop += top if rect.top < 0
|
root.scrollTop += top if rect.top < 0
|
||||||
root.scrollLeft = 0 if rect.left < 0
|
root.scrollLeft = 0 if rect.left < 0
|
||||||
@ -3480,7 +3514,7 @@ ExpandComment =
|
|||||||
post = Get.postFromNode @
|
post = Get.postFromNode @
|
||||||
ExpandComment.expand post
|
ExpandComment.expand post
|
||||||
expand: (post) ->
|
expand: (post) ->
|
||||||
if post.nodes.longComment
|
if post.nodes.longComment and !post.nodes.longComment.parentNode
|
||||||
$.replace post.nodes.shortComment, post.nodes.longComment
|
$.replace post.nodes.shortComment, post.nodes.longComment
|
||||||
post.nodes.comment = post.nodes.longComment
|
post.nodes.comment = post.nodes.longComment
|
||||||
return
|
return
|
||||||
@ -3666,13 +3700,13 @@ Unread =
|
|||||||
defaultValue: 0
|
defaultValue: 0
|
||||||
Unread.addPosts posts
|
Unread.addPosts posts
|
||||||
if (hash = location.hash.match /\d+/) and post = @posts[hash[0]]
|
if (hash = location.hash.match /\d+/) and post = @posts[hash[0]]
|
||||||
post.nodes.root.scrollIntoView()
|
Header.scrollToPost post.nodes.root
|
||||||
else if Unread.posts.length
|
else if Unread.posts.length
|
||||||
# Scroll to before the first unread post.
|
# Scroll to before the first unread post.
|
||||||
$.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root).scrollIntoView false
|
$.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root).scrollIntoView false
|
||||||
else if posts.length
|
else if posts.length
|
||||||
# Scroll to the last read post.
|
# Scroll to the last read post.
|
||||||
posts[posts.length - 1].nodes.root.scrollIntoView()
|
Header.scrollToPost posts[posts.length - 1].nodes.root
|
||||||
$.on d, 'ThreadUpdate', Unread.onUpdate
|
$.on d, 'ThreadUpdate', Unread.onUpdate
|
||||||
$.on d, 'scroll visibilitychange', Unread.read
|
$.on d, 'scroll visibilitychange', Unread.read
|
||||||
$.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line']
|
$.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line']
|
||||||
@ -4174,7 +4208,7 @@ ThreadUpdater =
|
|||||||
if Conf['Bottom Scroll']
|
if Conf['Bottom Scroll']
|
||||||
(if $.engine is 'webkit' then d.body else doc).scrollTop = d.body.clientHeight
|
(if $.engine is 'webkit' then d.body else doc).scrollTop = d.body.clientHeight
|
||||||
else
|
else
|
||||||
nodes[0].scrollIntoView()
|
Header.scrollToPost nodes[0]
|
||||||
|
|
||||||
$.queueTask ->
|
$.queueTask ->
|
||||||
# Enable 4chan features.
|
# Enable 4chan features.
|
||||||
|
|||||||
@ -133,6 +133,7 @@ QR =
|
|||||||
|
|
||||||
cooldown:
|
cooldown:
|
||||||
init: ->
|
init: ->
|
||||||
|
return unless Conf['Cooldown']
|
||||||
board = g.BOARD.ID
|
board = g.BOARD.ID
|
||||||
QR.cooldown.types =
|
QR.cooldown.types =
|
||||||
thread: switch board
|
thread: switch board
|
||||||
@ -149,6 +150,7 @@ QR =
|
|||||||
QR.cooldown.start()
|
QR.cooldown.start()
|
||||||
$.sync "cooldown.#{board}", QR.cooldown.sync
|
$.sync "cooldown.#{board}", QR.cooldown.sync
|
||||||
start: ->
|
start: ->
|
||||||
|
return unless Conf['Cooldown']
|
||||||
return if QR.cooldown.isCounting
|
return if QR.cooldown.isCounting
|
||||||
QR.cooldown.isCounting = true
|
QR.cooldown.isCounting = true
|
||||||
QR.cooldown.count()
|
QR.cooldown.count()
|
||||||
@ -159,6 +161,7 @@ QR =
|
|||||||
QR.cooldown.cooldowns[id] = cooldowns[id]
|
QR.cooldown.cooldowns[id] = cooldowns[id]
|
||||||
QR.cooldown.start()
|
QR.cooldown.start()
|
||||||
set: (data) ->
|
set: (data) ->
|
||||||
|
return unless Conf['Cooldown']
|
||||||
{req, post, isReply, delay} = data
|
{req, post, isReply, delay} = data
|
||||||
start = if req then req.uploadEndTime else Date.now()
|
start = if req then req.uploadEndTime else Date.now()
|
||||||
if delay
|
if delay
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user