Merge Zixaphir X
This commit is contained in:
commit
663dbe3bb2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -170,6 +170,10 @@ a[href="javascript:;"] {
|
||||
text-decoration: none;
|
||||
padding: 1px;
|
||||
}
|
||||
#header-bar input {
|
||||
margin: 0;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
#shortcuts:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ Header =
|
||||
type: 'header'
|
||||
el: $.el 'span',
|
||||
textContent: 'Header'
|
||||
order: 105
|
||||
order: 107
|
||||
subEntries: [
|
||||
{el: barFixedToggler}
|
||||
{el: headerToggler}
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
ThreadStats =
|
||||
init: ->
|
||||
return if g.VIEW isnt 'thread' or !Conf['Thread Stats']
|
||||
@dialog = UI.dialog 'thread-stats', 'bottom: 0; left: 0;', """
|
||||
<div class=move><span id=post-count>0</span> / <span id=file-count>0</span></div>
|
||||
"""
|
||||
@dialog = sc = $.el 'span',
|
||||
innerHTML: "<span id=post-count>0</span> / <span id=file-count>0</span></div>"
|
||||
|
||||
@postCountEl = $ '#post-count', @dialog
|
||||
@fileCountEl = $ '#file-count', @dialog
|
||||
@postCountEl = $ '#post-count', sc
|
||||
@fileCountEl = $ '#file-count', sc
|
||||
|
||||
Header.addShortcut sc
|
||||
|
||||
Thread::callbacks.push
|
||||
name: 'Thread Stats'
|
||||
cb: @node
|
||||
|
||||
node: ->
|
||||
postCount = 0
|
||||
fileCount = 0
|
||||
@ -20,11 +22,12 @@ ThreadStats =
|
||||
ThreadStats.thread = @
|
||||
ThreadStats.update postCount, fileCount
|
||||
$.on d, 'ThreadUpdate', ThreadStats.onUpdate
|
||||
$.add d.body, ThreadStats.dialog
|
||||
|
||||
onUpdate: (e) ->
|
||||
return if e.detail[404]
|
||||
{postCount, fileCount} = e.detail
|
||||
ThreadStats.update postCount, fileCount
|
||||
|
||||
update: (postCount, fileCount) ->
|
||||
{thread, postCountEl, fileCountEl} = ThreadStats
|
||||
postCountEl.textContent = postCount
|
||||
|
||||
@ -2,24 +2,47 @@ ThreadUpdater =
|
||||
init: ->
|
||||
return if g.VIEW isnt 'thread' or !Conf['Thread Updater']
|
||||
|
||||
html = ''
|
||||
checked = if Conf['Auto Update'] then 'checked' else ''
|
||||
@dialog = sc = $.el 'span',
|
||||
innerHTML: "
|
||||
<input name='Auto Update This' type=checkbox #{checked}><span id=update-status></span> <span id=update-timer></span>"
|
||||
|
||||
@timer = $ '#update-timer', sc
|
||||
@status = $ '#update-status', sc
|
||||
|
||||
$.on @timer, 'click', ThreadUpdater.update
|
||||
$.on @status, 'click', ThreadUpdater.update
|
||||
|
||||
@checkPostCount = 0
|
||||
|
||||
Header.addShortcut sc
|
||||
|
||||
subEntries = []
|
||||
for name, conf of Config.updater.checkbox
|
||||
checked = if Conf[name] then 'checked' else ''
|
||||
html += "<div><label title='#{conf[1]}'><input name='#{name}' type=checkbox #{checked}> #{name}</label></div>"
|
||||
el = $.el 'label',
|
||||
title: "#{conf[1]}"
|
||||
innerHTML: "<input name='#{name}' type=checkbox #{checked}> #{name}"
|
||||
input = el.firstElementChild
|
||||
$.on input, 'change', $.cb.checked
|
||||
if input.name is 'Scroll BG'
|
||||
$.on input, 'change', ThreadUpdater.cb.scrollBG
|
||||
ThreadUpdater.cb.scrollBG()
|
||||
subEntries.push el: el
|
||||
|
||||
checked = if Conf['Auto Update'] then 'checked' else ''
|
||||
html = """
|
||||
<div class=move><span id=update-status></span> <span id=update-timer></span></div>
|
||||
#{html}
|
||||
<div><label title='Controls whether *this* thread automatically updates or not'><input type=checkbox name='Auto Update This' #{checked}> Auto Update This</label></div>
|
||||
<div><label><input type=number name=Interval class=field min=5 value=#{Conf['Interval']}> Refresh rate (s)</label></div>
|
||||
<div><input value='Update' type=button name='Update'></div>
|
||||
"""
|
||||
settings = $.el 'span',
|
||||
innerHTML: '<a href=javascript:;>Interval</a>'
|
||||
|
||||
@dialog = UI.dialog 'updater', 'bottom: 0; right: 0;', html
|
||||
@timer = $ '#update-timer', @dialog
|
||||
@status = $ '#update-status', @dialog
|
||||
@checkPostCount = 0
|
||||
$.on settings, 'click', @intervalShortcut
|
||||
|
||||
subEntries.push el: settings
|
||||
|
||||
$.event 'AddMenuEntry',
|
||||
type: 'header'
|
||||
el: $.el 'span',
|
||||
textContent: 'Updater'
|
||||
order: 110
|
||||
subEntries: subEntries
|
||||
|
||||
Thread::callbacks.push
|
||||
name: 'Thread Updater'
|
||||
@ -32,28 +55,19 @@ ThreadUpdater =
|
||||
ThreadUpdater.outdateCount = 0
|
||||
ThreadUpdater.lastModified = '0'
|
||||
|
||||
for input in $$ 'input', ThreadUpdater.dialog
|
||||
if input.type is 'checkbox'
|
||||
$.on input, 'change', $.cb.checked
|
||||
switch input.name
|
||||
when 'Scroll BG'
|
||||
$.on input, 'change', ThreadUpdater.cb.scrollBG
|
||||
ThreadUpdater.cb.scrollBG()
|
||||
when 'Auto Update This'
|
||||
$.on input, 'change', ThreadUpdater.cb.autoUpdate
|
||||
$.event 'change', null, input
|
||||
when 'Interval'
|
||||
$.on input, 'change', ThreadUpdater.cb.interval
|
||||
ThreadUpdater.cb.interval.call input
|
||||
when 'Update'
|
||||
$.on input, 'click', ThreadUpdater.update
|
||||
ThreadUpdater.cb.interval.call $.el 'input', value: Conf['Interval']
|
||||
|
||||
input = $ 'input', ThreadUpdater.dialog
|
||||
|
||||
$.on input, 'change', $.cb.checked
|
||||
$.on input, 'change', ThreadUpdater.cb.autoUpdate
|
||||
$.event 'change', null, input
|
||||
|
||||
$.on window, 'online offline', ThreadUpdater.cb.online
|
||||
$.on d, 'QRPostSuccessful', ThreadUpdater.cb.post
|
||||
$.on d, 'visibilitychange', ThreadUpdater.cb.visibility
|
||||
|
||||
ThreadUpdater.cb.online()
|
||||
$.add d.body, ThreadUpdater.dialog
|
||||
|
||||
###
|
||||
http://freesound.org/people/pierrecartoons1979/sounds/90112/
|
||||
@ -151,6 +165,11 @@ ThreadUpdater =
|
||||
else
|
||||
i
|
||||
|
||||
intervalShortcut: ->
|
||||
Settings.open 'Advanced'
|
||||
settings = $.id 'fourchanx-settings'
|
||||
$('input[name=Interval]', settings).focus()
|
||||
|
||||
set: (name, text, klass) ->
|
||||
el = ThreadUpdater[name]
|
||||
if node = el.firstChild
|
||||
@ -270,7 +289,7 @@ ThreadUpdater =
|
||||
|
||||
scroll = Conf['Auto Scroll'] and ThreadUpdater.scrollBG() and
|
||||
ThreadUpdater.root.getBoundingClientRect().bottom - doc.clientHeight < 25
|
||||
|
||||
|
||||
for key, post of posts
|
||||
continue unless posts.hasOwnProperty key
|
||||
if post.cb
|
||||
|
||||
@ -459,6 +459,13 @@ Settings =
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Thread Updater <span class=warning #{if Conf['Thread Updater'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<div>
|
||||
Intervale: <input name=Interval value=#{Conf['Interval']}
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>
|
||||
<label><input type=checkbox name='Custom CSS' #{if Conf['Custom CSS'] then 'checked' else ''}> Custom CSS</label>
|
||||
@ -469,7 +476,7 @@ Settings =
|
||||
"""
|
||||
items = {}
|
||||
inputs = {}
|
||||
for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']
|
||||
for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss', 'Interval']
|
||||
input = $ "[name=#{name}]", section
|
||||
items[name] = Conf[name]
|
||||
inputs[name] = input
|
||||
@ -497,11 +504,12 @@ Settings =
|
||||
for key, val of items
|
||||
input = inputs[key]
|
||||
input.value = val
|
||||
unless ['usercss', 'emojiPos', 'archiver'].contains name
|
||||
unless ['usercss', 'emojiPos', 'archiver', 'Interval'].contains key
|
||||
$.on input, event, Settings[key]
|
||||
Settings[key].call input
|
||||
return
|
||||
|
||||
$.on $('input[name=Interval]', section), 'input', ThreadUpdater.cb.interval
|
||||
$.on $('input[name="Custom CSS"]', section), 'change', Settings.togglecss
|
||||
$.on $.id('apply-css'), 'click', Settings.usercss
|
||||
boardnav: ->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user