Merge branch 'v3' of git://github.com/MayhemYDG/4chan-x into v3

Conflicts:
	CHANGELOG.md
	package.json
	src/General/Config.coffee
This commit is contained in:
Zixaphir 2013-12-16 12:56:09 -07:00
commit a719bbde38
8 changed files with 243 additions and 104 deletions

View File

@ -1,10 +1,11 @@
**MayhemYDG**: **MayhemYDG**:
- Fix 4chan X breaking in threads following a 4chan markup change. - Fix 4chan X breaking in threads following a 4chan markup change.
- Minor cooldown fix: - Minor cooldown fix:
- You cannot post an image reply immediately after a non-image reply anymore. - You cannot post an image reply immediately after a non-image reply anymore.
- **New option**: `Auto-hide header on scroll`. - **New option**: `Auto-hide header on scroll`.
- Added support for `4cdn.org`. - Added support for `4cdn.org`.
- More index navigation improvements: - Index navigation improvements:
- Searching in the index is now possible and will show matched OPs by: - Searching in the index is now possible and will show matched OPs by:
<ul> <ul>
<li> comment <li> comment
@ -22,8 +23,9 @@
</ul> </ul>
- The elapsed time since the last index refresh is now indicated at the top of the index. - The elapsed time since the last index refresh is now indicated at the top of the index.
- New setting: `Show replies`, enabled by default. Disable it to only show OPs in the index. - New setting: `Show replies`, enabled by default. Disable it to only show OPs in the index.
- The index refreshing notification will now only appear on initial page load with slow connections. - New setting: `Anchor Hidden Threads`, enabled by default. Hidden threads will be moved at the end of the index to fill the first pages.
- Index navigation improvements: - New setting: `Refreshed Navigation`, disabled by default. When enabled, navigating through pages will refresh the index.
- The last index refresh timer will now indicate the last time the index changed from 4chan's side, instead of the last time you refreshed the index.
- You can now refresh the index page you are on with the refresh shortcut in the header bar or the same keybind for refreshing threads. - You can now refresh the index page you are on with the refresh shortcut in the header bar or the same keybind for refreshing threads.
- You can now switch between paged and all-threads index modes via the "Index Navigation" header sub-menu:<br> - You can now switch between paged and all-threads index modes via the "Index Navigation" header sub-menu:<br>
![index navigation](img/changelog/3.12.0/0.png) ![index navigation](img/changelog/3.12.0/0.png)
@ -36,6 +38,7 @@
<li> File count <li> File count
</ul> </ul>
- Navigating across index pages is now instantaneous. - Navigating across index pages is now instantaneous.
- The index refreshing notification will now only appear on initial page load with slow connections.
- Added a keybind to open the catalog search field on index pages. - Added a keybind to open the catalog search field on index pages.
- Minor cooldown fix: - Minor cooldown fix:
- You cannot post an image reply immediately after a non-image reply anymore. - You cannot post an image reply immediately after a non-image reply anymore.

View File

@ -1,5 +1,5 @@
/* /*
* 4chan X - Version 1.2.43 - 2013-12-09 * 4chan X - Version 1.2.43 - 2013-12-16
* *
* 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

File diff suppressed because one or more lines are too long

View File

@ -493,6 +493,7 @@ http://iqdb.org/?url=%TURL
#//archive.foolz.us/%board/search/image/%MD5/;text:View same on foolz /%board/ #//archive.foolz.us/%board/search/image/%MD5/;text:View same on foolz /%board/
#//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/ #//archive.installgentoo.net/%board/image/%MD5;text:View same on installgentoo /%board/
""" """
'sageEmoji': '4chan SS' 'sageEmoji': '4chan SS'
'emojiPos': 'before' 'emojiPos': 'before'
@ -503,6 +504,8 @@ http://iqdb.org/?url=%TURL
'Index Mode': 'paged' 'Index Mode': 'paged'
'Index Sort': 'bump' 'Index Sort': 'bump'
'Show Replies': true 'Show Replies': true
'Anchor Hidden Threads': true
'Refreshed Navigation': false
Header: Header:
'Fixed Header': true 'Fixed Header': true

View File

@ -37,18 +37,33 @@ Index =
$.on input, 'change', @cb.sort $.on input, 'change', @cb.sort
repliesEntry = repliesEntry =
el: $.el 'label', innerHTML: '<input type=checkbox name="Show Replies"> Show replies' el: $.el 'label',
input = repliesEntry.el.firstChild innerHTML: '<input type=checkbox name="Show Replies"> Show replies'
input.checked = Conf['Show Replies'] anchorEntry =
$.on input, 'change', $.cb.checked el: $.el 'label',
$.on input, 'change', @cb.replies innerHTML: '<input type=checkbox name="Anchor Hidden Threads"> Anchor hidden threads'
title: 'Move hidden threads at the end of the index.'
refNavEntry =
el: $.el 'label',
innerHTML: '<input type=checkbox name="Refreshed Navigation"> Refreshed navigation'
title: 'Refresh index when navigating through pages.'
for label in [repliesEntry, anchorEntry, refNavEntry]
input = label.el.firstChild
{name} = input
input.checked = Conf[name]
$.on input, 'change', $.cb.checked
switch name
when 'Show Replies'
$.on input, 'change', @cb.replies
when 'Anchor Hidden Threads'
$.on input, 'change', @cb.sort
$.event 'AddMenuEntry', $.event 'AddMenuEntry',
type: 'header' type: 'header'
el: $.el 'span', el: $.el 'span',
textContent: 'Index Navigation' textContent: 'Index Navigation'
order: 90 order: 90
subEntries: [modeEntry, sortEntry, repliesEntry] subEntries: [modeEntry, sortEntry, repliesEntry, anchorEntry, refNavEntry]
$.addClass doc, 'index-loading' $.addClass doc, 'index-loading'
@update() @update()
@ -110,13 +125,18 @@ Index =
return return
return if a.textContent is 'Catalog' return if a.textContent is 'Catalog'
e.preventDefault() e.preventDefault()
Index.pageNav +a.pathname.split('/')[2] Index.userPageNav +a.pathname.split('/')[2]
scrollToIndex: -> scrollToIndex: ->
Header.scrollToIfNeeded Index.root Header.scrollToIfNeeded Index.root
getCurrentPage: -> getCurrentPage: ->
+window.location.pathname.split('/')[2] +window.location.pathname.split('/')[2]
userPageNav: (pageNum) ->
if Conf['Refreshed Navigation'] and Conf['Index Mode'] is 'paged'
Index.update pageNum
else
Index.pageNav pageNum
pageNav: (pageNum) -> pageNav: (pageNum) ->
return if Index.currentPage is pageNum return if Index.currentPage is pageNum
history.pushState null, '', if pageNum is 0 then './' else pageNum history.pushState null, '', if pageNum is 0 then './' else pageNum
@ -173,7 +193,7 @@ Index =
$.before a, strong $.before a, strong
$.add strong, a $.add strong, a
update: -> update: (pageNum) ->
return unless navigator.onLine return unless navigator.onLine
Index.req?.abort() Index.req?.abort()
Index.notice?.close() Index.notice?.close()
@ -188,13 +208,15 @@ Index =
return unless Index.req and !Index.notice return unless Index.req and !Index.notice
Index.notice = new Notice 'info', 'Refreshing index...' Index.notice = new Notice 'info', 'Refreshing index...'
), 5 * $.SECOND - (Date.now() - now) ), 5 * $.SECOND - (Date.now() - now)
pageNum = null if typeof pageNum isnt 'number' # event
onload = (e) -> Index.load e, pageNum
Index.req = $.ajax "//a.4cdn.org/#{g.BOARD}/catalog.json", Index.req = $.ajax "//a.4cdn.org/#{g.BOARD}/catalog.json",
onabort: Index.load onabort: onload
onloadend: Index.load onloadend: onload
, ,
whenModified: true whenModified: true
$.addClass Index.button, 'fa-spin' $.addClass Index.button, 'fa-spin'
load: (e) -> load: (e, pageNum) ->
$.rmClass Index.button, 'fa-spin' $.rmClass Index.button, 'fa-spin'
{req, notice} = Index {req, notice} = Index
delete Index.req delete Index.req
@ -206,7 +228,10 @@ Index =
return return
try try
Index.parse JSON.parse req.response if req.status is 200 if req.status is 200
Index.parse JSON.parse(req.response), pageNum
else if req.status is 304 and pageNum?
Index.pageNav pageNum
catch err catch err
c.error 'Index failure:', err.stack c.error 'Index failure:', err.stack
# network error or non-JSON content for example. # network error or non-JSON content for example.
@ -224,15 +249,18 @@ Index =
setTimeout notice.close, $.SECOND setTimeout notice.close, $.SECOND
timeEl = $ '#index-last-refresh', Index.navLinks timeEl = $ '#index-last-refresh', Index.navLinks
timeEl.dataset.utc = e.timeStamp <% if (type === 'userscript') { %>/ 1000<% } %> timeEl.dataset.utc = Date.parse req.getResponseHeader 'Last-Modified'
RelativeDates.update timeEl RelativeDates.update timeEl
Index.scrollToIndex() Index.scrollToIndex()
parse: (pages) -> parse: (pages, pageNum) ->
Index.parseThreadList pages Index.parseThreadList pages
Index.buildThreads() Index.buildThreads()
Index.sort() Index.sort()
Index.buildIndex()
Index.buildPagelist() Index.buildPagelist()
if pageNum?
Index.pageNav pageNum
return
Index.buildIndex()
Index.setPage() Index.setPage()
parseThreadList: (pages) -> parseThreadList: (pages) ->
Index.pagesNum = pages.length Index.pagesNum = pages.length
@ -318,15 +346,15 @@ Index =
Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1] Index.sortedNodes.push Index.nodes[i], Index.nodes[i + 1]
if Index.isSearching if Index.isSearching
Index.sortedNodes = Index.querySearch(Index.searchInput.value) or Index.sortedNodes Index.sortedNodes = Index.querySearch(Index.searchInput.value) or Index.sortedNodes
# Put the sticky threads on top of the index. # Sticky threads
Index.sortOnTop (thread) -> thread.isSticky
# Highlighted threads
Index.sortOnTop((thread) -> thread.isOnTop) if Conf['Filter']
# Non-hidden threads
Index.sortOnTop((thread) -> !thread.isHidden) if Conf['Anchor Hidden Threads']
sortOnTop: (match) ->
offset = 0 offset = 0
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isSticky for threadRoot, i in Index.sortedNodes by 2 when match Get.threadFromRoot threadRoot
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
return unless Conf['Filter']
# Put the highlighted thread & <hr> on top of the index
# while keeping the original order they appear in.
offset = 0
for threadRoot, i in Index.sortedNodes by 2 when Get.threadFromRoot(threadRoot).isOnTop
Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)... Index.sortedNodes.splice offset++ * 2, 0, Index.sortedNodes.splice(i, 2)...
return return
buildIndex: -> buildIndex: ->

View File

@ -666,10 +666,15 @@ a.hide-announcement {
max-width: 75%; max-width: 75%;
padding-bottom: 16px; padding-bottom: 16px;
} }
/* Fappe Tyme */
.fappeTyme .thread > .noFile, .fappeTyme .thread > .noFile,
.fappeTyme .threadContainer > .noFile { .fappeTyme .threadContainer > .noFile {
display: none; display: none;
} }
/* Werk Tyme */
.werkTyme .post .file {
display: none;
}
/* Index/Reply Navigation */ /* Index/Reply Navigation */
#navlinks { #navlinks {

View File

@ -87,7 +87,7 @@ Keybinds =
# Board Navigation # Board Navigation
when Conf['Front page'] when Conf['Front page']
if g.VIEW is 'index' if g.VIEW is 'index'
Index.pageNav 0 Index.userPageNav 0
else else
window.location = "/#{g.BOARD}/" window.location = "/#{g.BOARD}/"
when Conf['Open front page'] when Conf['Open front page']