Add Mayhem X's Header and options to disable it.
This commit is contained in:
parent
40165ef7e8
commit
1276c542f2
File diff suppressed because one or more lines are too long
@ -62,7 +62,7 @@ a[href="javascript:;"] {
|
|||||||
#fourchanx-settings,
|
#fourchanx-settings,
|
||||||
#qp, #ihover,
|
#qp, #ihover,
|
||||||
#updater, #thread-stats,
|
#updater, #thread-stats,
|
||||||
#navlinks, #header,
|
#navlinks, #boardNavDesktop.fixed,
|
||||||
#watcher,
|
#watcher,
|
||||||
#qr {
|
#qr {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -91,7 +91,7 @@ a[href="javascript:;"] {
|
|||||||
#watcher:hover {
|
#watcher:hover {
|
||||||
z-index: 20;
|
z-index: 20;
|
||||||
}
|
}
|
||||||
#header {
|
#boardNavDesktop.fixed {
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
#watcher {
|
#watcher {
|
||||||
@ -103,46 +103,46 @@ a[href="javascript:;"] {
|
|||||||
-moz-box-sizing: border-box;
|
-moz-box-sizing: border-box;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
#header {
|
#boardNavDesktop.fixed {
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
}
|
}
|
||||||
#header.top {
|
#boardNavDesktop.fixed.top {
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
#header.bottom {
|
#boardNavDesktop.fixed.bottom {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
}
|
}
|
||||||
#header-bar {
|
#boardNavDesktop {
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
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 {
|
#boardNavDesktop.fixed.top {
|
||||||
border-bottom-width: 1px;
|
border-bottom-width: 1px;
|
||||||
}
|
}
|
||||||
#header.bottom #header-bar {
|
#boardNavDesktop.fixed.bottom {
|
||||||
box-shadow: 0 -1px 2px rgba(0, 0, 0, .15);
|
box-shadow: 0 -1px 2px rgba(0, 0, 0, .15);
|
||||||
border-top-width: 1px;
|
border-top-width: 1px;
|
||||||
}
|
}
|
||||||
#header.bottom .menu-button i {
|
#boardNavDesktop.fixed.bottom .menu-button i {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
border-bottom: 6px solid;
|
border-bottom: 6px solid;
|
||||||
}
|
}
|
||||||
#board-list {
|
#board-list {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
#header-bar.autohide:not(:hover) {
|
#boardNavDesktop.fixed.autohide:not(:hover) {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
transition: all .8s .6s cubic-bezier(.55, .055, .675, .19);
|
transition: all .8s .6s cubic-bezier(.55, .055, .675, .19);
|
||||||
}
|
}
|
||||||
#header.top #header-bar.autohide:not(:hover) {
|
#boardNavDesktop.fixed.top.autohide:not(:hover) {
|
||||||
margin-bottom: -1em;
|
margin-bottom: -1em;
|
||||||
-webkit-transform: translateY(-100%);
|
-webkit-transform: translateY(-100%);
|
||||||
transform: translateY(-100%);
|
transform: translateY(-100%);
|
||||||
}
|
}
|
||||||
#header.bottom #header-bar.autohide:not(:hover) {
|
#boardNavDesktop.fixed.bottom.autohide:not(:hover) {
|
||||||
-webkit-transform: translateY(100%);
|
-webkit-transform: translateY(100%);
|
||||||
transform: translateY(100%);
|
transform: translateY(100%);
|
||||||
}
|
}
|
||||||
@ -152,33 +152,22 @@ a[href="javascript:;"] {
|
|||||||
height: 10px;
|
height: 10px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
}
|
}
|
||||||
#header.top #toggle-header-bar {
|
#boardNavDesktop:not(.fixed) #toggle-header-bar {
|
||||||
cursor: n-resize;
|
display: none;
|
||||||
bottom: -8px;
|
|
||||||
}
|
}
|
||||||
#header.bottom #toggle-header-bar {
|
#boardNavDesktop.fixed #toggle-header-bar {
|
||||||
cursor: s-resize;
|
|
||||||
top: -8px;
|
|
||||||
}
|
|
||||||
#header-bar.autohide:not(:hover) #toggle-header-bar,
|
|
||||||
#toggle-header-bar:hover {
|
|
||||||
height: 18px;
|
|
||||||
}
|
|
||||||
#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;
|
|
||||||
}
|
|
||||||
#header.bottom #header-bar.autohide #toggle-header-bar {
|
|
||||||
cursor: n-resize;
|
cursor: n-resize;
|
||||||
}
|
}
|
||||||
#header-bar a:not(.entry) {
|
#boardNavDesktop.fixed.top #toggle-header-bar {
|
||||||
|
top: 100%;
|
||||||
|
}
|
||||||
|
#boardNavDesktop.fixed.bottom #toggle-header-bar {
|
||||||
|
bottom: 100%;
|
||||||
|
}
|
||||||
|
##boardNavDesktop.fixed #header-bar.autohide #toggle-header-bar {
|
||||||
|
cursor: s-resize;
|
||||||
|
}
|
||||||
|
#boardNavDesktop a:not(.entry) {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
}
|
}
|
||||||
@ -204,12 +193,10 @@ a[href="javascript:;"] {
|
|||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
transition: all .8s .6s cubic-bezier(.55, .055, .675, .19);
|
||||||
}
|
}
|
||||||
#header.bottom #notifications {
|
.top:not(.autohide) ~ #notifications {
|
||||||
position: fixed;
|
top: 2em;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
.notification {
|
.notification {
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
|
|||||||
@ -13,6 +13,10 @@ Config =
|
|||||||
false
|
false
|
||||||
'Compatibility between <%= meta.name %> and 4chan\'s inline extension is NOT guaranteed.'
|
'Compatibility between <%= meta.name %> and 4chan\'s inline extension is NOT guaranteed.'
|
||||||
]
|
]
|
||||||
|
'Fixed Header': [
|
||||||
|
false
|
||||||
|
'Mayhem X\'s Fixed Header (kinda).'
|
||||||
|
]
|
||||||
'Custom Board Navigation': [
|
'Custom Board Navigation': [
|
||||||
true
|
true
|
||||||
'Show custom links instead of the full board list.'
|
'Show custom links instead of the full board list.'
|
||||||
@ -364,7 +368,9 @@ http://iqdb.org/?url=%TURL
|
|||||||
#//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/
|
#//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
'Custom CSS': false
|
'Custom CSS': false
|
||||||
|
|
||||||
|
'Bottom header': false
|
||||||
|
|
||||||
'Header auto-hide': false
|
'Header auto-hide': false
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,28 @@ Header =
|
|||||||
id: 'shortcuts'
|
id: 'shortcuts'
|
||||||
@hover = $.el 'div',
|
@hover = $.el 'div',
|
||||||
id: 'hoverUI'
|
id: 'hoverUI'
|
||||||
|
@toggle = $.el 'div',
|
||||||
|
id: 'toggle-header-bar'
|
||||||
|
|
||||||
$.on window, 'load hashchange', Header.hashScroll
|
$.on @toggle, 'mousedown', @toggleBarVisibility
|
||||||
|
$.on window, 'load hashchange', Header.hashScroll
|
||||||
|
|
||||||
|
@positionToggler = $.el 'label',
|
||||||
|
innerHTML: "<input type=checkbox #{if Conf['Bottom header'] then 'checked' else ''}> Bottom header"
|
||||||
|
$.on @positionToggler.firstElementChild, 'change', @toggleBarPosition
|
||||||
|
$.event 'AddMenuEntry',
|
||||||
|
type: 'header'
|
||||||
|
el: @positionToggler
|
||||||
|
order: 108
|
||||||
|
|
||||||
|
@headerToggler = $.el 'label',
|
||||||
|
innerHTML: "<input type=checkbox #{if Conf['Header auto-hide'] then 'checked' else ''}> Auto-hide header"
|
||||||
|
$.on @headerToggler.firstElementChild, 'change', @toggleBarVisibility
|
||||||
|
|
||||||
|
$.event 'AddMenuEntry',
|
||||||
|
type: 'header'
|
||||||
|
el: @headerToggler
|
||||||
|
order: 109
|
||||||
|
|
||||||
$.on d, 'CreateNotification', @createNotification
|
$.on d, 'CreateNotification', @createNotification
|
||||||
|
|
||||||
@ -21,17 +41,21 @@ Header =
|
|||||||
$.add d.body, Header.hover
|
$.add d.body, Header.hover
|
||||||
|
|
||||||
setBoardList: ->
|
setBoardList: ->
|
||||||
|
|
||||||
Header.nav = nav = $.id 'boardNavDesktop'
|
Header.nav = nav = $.id 'boardNavDesktop'
|
||||||
if a = $ "a[href*='/#{g.BOARD}/']", nav
|
if a = $ "a[href*='/#{g.BOARD}/']", nav
|
||||||
a.className = 'current'
|
a.className = 'current'
|
||||||
|
|
||||||
fullBoardList = $.el 'span',
|
fullBoardList = $.el 'span',
|
||||||
id: 'full-board-list'
|
id: 'full-board-list'
|
||||||
hidden: true
|
hidden: true
|
||||||
|
|
||||||
customBoardList = $.el 'span',
|
customBoardList = $.el 'span',
|
||||||
id: 'custom-board-list'
|
id: 'custom-board-list'
|
||||||
|
|
||||||
|
Header.fixedHeader nav if Conf['Fixed Header']
|
||||||
|
|
||||||
$.add fullBoardList, [nav.childNodes...]
|
$.add fullBoardList, [nav.childNodes...]
|
||||||
$.add nav, [customBoardList, fullBoardList, Header.shortcuts, $ '#navtopright', fullBoardList]
|
$.add nav, [customBoardList, fullBoardList, Header.shortcuts, $('#navtopright', fullBoardList), Header.toggle]
|
||||||
$.add d.body, Header.bar
|
$.add d.body, Header.bar
|
||||||
|
|
||||||
if Conf['Custom Board Navigation']
|
if Conf['Custom Board Navigation']
|
||||||
@ -46,6 +70,16 @@ Header =
|
|||||||
$.rm $ '#custom-board-list', nav
|
$.rm $ '#custom-board-list', nav
|
||||||
fullBoardList.hidden = false
|
fullBoardList.hidden = false
|
||||||
|
|
||||||
|
fixedHeader: (nav) ->
|
||||||
|
$.addClass nav, 'fixed'
|
||||||
|
$.addClass nav, 'dialog'
|
||||||
|
|
||||||
|
@setBarPosition Conf['Bottom header']
|
||||||
|
$.sync 'Bottom header', @setBarPosition
|
||||||
|
|
||||||
|
@setBarVisibility Conf['Header auto-hide']
|
||||||
|
$.sync 'Header auto-hide', @setBarVisibility
|
||||||
|
|
||||||
generateBoardList: (text) ->
|
generateBoardList: (text) ->
|
||||||
list = $ '#custom-board-list', Header.nav
|
list = $ '#custom-board-list', Header.nav
|
||||||
list.innerHTML = null
|
list.innerHTML = null
|
||||||
@ -93,6 +127,26 @@ Header =
|
|||||||
custom.hidden = !showBoardList
|
custom.hidden = !showBoardList
|
||||||
full.hidden = showBoardList
|
full.hidden = showBoardList
|
||||||
|
|
||||||
|
setBarPosition: (bottom) ->
|
||||||
|
$.event 'CloseMenu'
|
||||||
|
Header.positionToggler.firstElementChild.checked = bottom
|
||||||
|
if bottom
|
||||||
|
$.addClass Header.nav, 'bottom'
|
||||||
|
$.rmClass Header.nav, 'top'
|
||||||
|
else
|
||||||
|
$.addClass Header.nav, 'top'
|
||||||
|
$.rmClass Header.nav, 'bottom'
|
||||||
|
|
||||||
|
toggleBarPosition: ->
|
||||||
|
bottom = @checked
|
||||||
|
Header.setBarPosition bottom
|
||||||
|
Conf['Bottom header'] = bottom
|
||||||
|
$.set 'Bottom header', bottom
|
||||||
|
|
||||||
|
setBarVisibility: (hide) ->
|
||||||
|
Header.headerToggler.firstElementChild.checked = hide
|
||||||
|
(if hide then $.addClass else $.rmClass) Header.nav, 'autohide'
|
||||||
|
|
||||||
hashScroll: ->
|
hashScroll: ->
|
||||||
return unless post = $.id @location.hash[1..]
|
return unless post = $.id @location.hash[1..]
|
||||||
return if (Get.postFromRoot post).isHidden
|
return if (Get.postFromRoot post).isHidden
|
||||||
@ -105,6 +159,20 @@ Header =
|
|||||||
top += - headRect.top - headRect.height
|
top += - headRect.top - headRect.height
|
||||||
(if $.engine is 'webkit' then d.body else doc).scrollTop += top
|
(if $.engine is 'webkit' then d.body else doc).scrollTop += top
|
||||||
|
|
||||||
|
toggleBarVisibility: (e) ->
|
||||||
|
return if e.type is 'mousedown' and e.button isnt 0 # not LMB
|
||||||
|
hide = if @nodeName is 'INPUT'
|
||||||
|
@checked
|
||||||
|
else
|
||||||
|
!$.hasClass Header.nav, 'autohide'
|
||||||
|
Header.setBarVisibility hide
|
||||||
|
message = if hide
|
||||||
|
'The header bar will automatically hide itself.'
|
||||||
|
else
|
||||||
|
'The header bar will remain visible.'
|
||||||
|
new Notification 'info', message, 2
|
||||||
|
$.set 'Header auto-hide', hide
|
||||||
|
|
||||||
addShortcut: (el) ->
|
addShortcut: (el) ->
|
||||||
shortcut = $.el 'span',
|
shortcut = $.el 'span',
|
||||||
className: 'shortcut'
|
className: 'shortcut'
|
||||||
@ -264,7 +332,7 @@ Settings =
|
|||||||
|
|
||||||
Settings.overlay = overlay = $.el 'div',
|
Settings.overlay = overlay = $.el 'div',
|
||||||
id: 'overlay'
|
id: 'overlay'
|
||||||
|
|
||||||
Settings.dialog = dialog = $.el 'div',
|
Settings.dialog = dialog = $.el 'div',
|
||||||
id: 'fourchanx-settings'
|
id: 'fourchanx-settings'
|
||||||
className: 'dialog'
|
className: 'dialog'
|
||||||
@ -1889,7 +1957,7 @@ Keybinds =
|
|||||||
location.href = url
|
location.href = url
|
||||||
|
|
||||||
hl: (delta, thread) ->
|
hl: (delta, thread) ->
|
||||||
if Conf['Bottom header']
|
if Conf['Fixed Header'] and Conf['Bottom header']
|
||||||
topMargin = 0
|
topMargin = 0
|
||||||
else
|
else
|
||||||
headRect = Header.bar.getBoundingClientRect()
|
headRect = Header.bar.getBoundingClientRect()
|
||||||
@ -4084,7 +4152,7 @@ ThreadUpdater =
|
|||||||
unless d.hidden
|
unless d.hidden
|
||||||
# Lower the max refresh rate limit on visible tabs.
|
# Lower the max refresh rate limit on visible tabs.
|
||||||
j = Math.min j, 7
|
j = Math.min j, 7
|
||||||
ThreadUpdater.seconds =
|
ThreadUpdater.seconds =
|
||||||
if Conf['Optional Increase']
|
if Conf['Optional Increase']
|
||||||
Math.max i, [0, 5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]
|
Math.max i, [0, 5, 10, 15, 20, 30, 60, 90, 120, 240, 300][j]
|
||||||
else
|
else
|
||||||
@ -4533,7 +4601,7 @@ Linkify =
|
|||||||
|
|
||||||
embedder: (a) ->
|
embedder: (a) ->
|
||||||
return [a] unless Conf['Embedding']
|
return [a] unless Conf['Embedding']
|
||||||
|
|
||||||
callbacks = ->
|
callbacks = ->
|
||||||
a.textContent = switch @status
|
a.textContent = switch @status
|
||||||
when 200, 304
|
when 200, 304
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user