Merge branch 'ccd0' into v3

Conflicts:
	builds/crx.crx
	src/General/Index.coffee
	src/Miscellaneous/Keybinds.coffee
This commit is contained in:
Zixaphir 2014-04-12 18:02:25 -07:00
commit 4b3f4d1baf
13 changed files with 163 additions and 52 deletions

View File

@ -1,3 +1,10 @@
### v1.7.8
*2014-04-12*
**ccd0**
- Some keybind bugfixes.
- Begin work toward compatibility with new URLs.
### v1.7.7
*2014-04-10*

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.7.7 - 2014-04-10
* 4chan X - Version 1.7.8 - 2014-04-12
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE

View File

@ -1,6 +1,6 @@
// ==UserScript==
// @name 4chan X
// @version 1.7.7
// @version 1.7.8
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X

View File

@ -1,7 +1,7 @@
// Generated by CoffeeScript
// ==UserScript==
// @name 4chan X
// @version 1.7.7
// @version 1.7.8
// @minGMVer 1.14
// @minFFVer 26
// @namespace 4chan-X
@ -24,7 +24,7 @@
// ==/UserScript==
/*
* 4chan X - Version 1.7.7 - 2014-04-10
* 4chan X - Version 1.7.8 - 2014-04-12
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -333,8 +333,8 @@
'Open Gallery': ['g', 'Opens the gallery.'],
'fappeTyme': ['f', 'Fappe Tyme.'],
'werkTyme': ['Shift+w', 'Werk Tyme'],
'Front page': ['0', 'Jump to page 0.'],
'Open front page': ['Shift+0', 'Open page 0 in a new tab.'],
'Front page': ['0', 'Jump to front page.'],
'Open front page': ['Shift+0', 'Open front page in a new tab.'],
'Next page': ['Shift+Right', 'Jump to the next page.'],
'Previous page': ['Shift+Left', 'Jump to the previous page.'],
'Search form': ['Ctrl+Alt+s', 'Focus the search field on the board index.'],
@ -376,7 +376,7 @@
doc = d.documentElement;
g = {
VERSION: '1.7.7',
VERSION: '1.7.8',
NAMESPACE: '4chan X.',
boards: {}
};
@ -3098,6 +3098,7 @@
return +window.location.pathname.split('/')[2];
},
userPageNav: function(pageNum) {
Navigate.pushState(pageNum === 0 ? './' : pageNum);
if (Conf['Refreshed Navigation'] && Conf['Index Mode'] !== 'all pages') {
return Index.update(pageNum);
} else {
@ -3108,7 +3109,7 @@
if (Index.currentPage === pageNum && !Index.root.parentElement) {
return;
}
history.pushState(null, '', pageNum === 0 ? './' : pageNum);
Navigate.pushState(pageNum === 0 ? './' : pageNum);
return Index.pageLoad(pageNum);
},
pageLoad: function(pageNum) {
@ -11865,7 +11866,7 @@
return Conf[hotkey] = key;
},
keydown: function(e) {
var key, notification, notifications, op, target, thread, threadRoot, _i, _len, _ref;
var form, key, notification, notifications, op, target, thread, threadRoot, _i, _len, _ref;
if (!(key = Keybinds.keyCode(e))) {
return;
}
@ -11953,7 +11954,9 @@
ThreadUpdater.update();
break;
case 'index':
Index.update();
if (Conf['JSON Navigation']) {
Index.update();
}
}
break;
case Conf['Watch']:
@ -11979,7 +11982,7 @@
});
break;
case Conf['Front page']:
if (g.VIEW === 'index') {
if (Conf['JSON Navigation'] && g.VIEW === 'index') {
Index.userPageNav(0);
} else {
window.location = "/" + g.BOARD + "/";
@ -11989,19 +11992,39 @@
$.open("/" + g.BOARD + "/");
break;
case Conf['Next page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
if (g.VIEW !== 'index') {
return;
}
$('.next button', Index.pagelist).click();
if (Conf['JSON Navigation']) {
if (Conf['Index Mode'] !== 'all pages') {
$('.next button', Index.pagelist).click();
}
} else {
if (form = $('.next form')) {
window.location = form.action;
}
}
break;
case Conf['Previous page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
if (g.VIEW !== 'index') {
return;
}
$('.prev button', Index.pagelist).click();
if (Conf['JSON Navigation']) {
if (Conf['Index Mode'] !== 'all pages') {
$('.prev button', Index.pagelist).click();
}
} else {
if (form = $('.prev form')) {
window.location = form.action;
}
}
break;
case Conf['Search form']:
Index.searchInput.focus();
if (Conf['JSON Navigation']) {
Index.searchInput.focus();
} else {
$.id('search-btn').click();
}
break;
case Conf['Paged mode']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'paged')) {
@ -12027,6 +12050,19 @@
}
Index.cycleSortType();
break;
case Conf['Open catalog']:
if (Conf['External Catalog']) {
window.location = CatalogLinks.external(g.BOARD.ID);
} else {
if (!Conf['JSON Navigation']) {
return window.location = "/" + g.BOARD + "/catalog";
}
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'catalog')) {
return;
}
Index.setIndexMode('catalog');
}
break;
case Conf['Next thread']:
if (g.VIEW !== 'index') {
return;
@ -12801,7 +12837,7 @@
if (threadID) {
view = 'thread';
} else {
pageNum = view;
pageNum = +view;
view = 'index';
}
path = this.pathname;
@ -12810,9 +12846,8 @@
}
Navigate.makeBreadCrumb(this.href, view, boardID, threadID);
if (this.id !== 'popState') {
history.pushState(null, '', path);
Navigate.pushState(path);
}
Navigate.path = this.pathname;
Navigate.setMode(this);
if (!(view === 'index' && 'index' === g.VIEW && boardID === g.BOARD.ID)) {
Navigate.disconnect();
@ -12936,6 +12971,10 @@
return Main.handleErrors(errors);
}
},
pushState: function(path) {
history.pushState(null, '', path);
return Navigate.path = window.location.pathname;
},
popstate: function() {
var a;
a = $.el('a', {
@ -13542,6 +13581,7 @@
g.VIEW = (function() {
switch (pathname[2]) {
case 'res':
case 'thread':
return 'thread';
case 'catalog':
return 'catalog';

View File

@ -1,6 +1,6 @@
{
"name": "4chan X",
"version": "1.7.7",
"version": "1.7.8",
"manifest_version": 2,
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"icons": {

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.7.7 - 2014-04-10
* 4chan X - Version 1.7.8 - 2014-04-12
*
* Licensed under the MIT license.
* https://github.com/ccd0/4chan-x/blob/master/LICENSE
@ -309,8 +309,8 @@
'Open Gallery': ['g', 'Opens the gallery.'],
'fappeTyme': ['f', 'Fappe Tyme.'],
'werkTyme': ['Shift+w', 'Werk Tyme'],
'Front page': ['0', 'Jump to page 0.'],
'Open front page': ['Shift+0', 'Open page 0 in a new tab.'],
'Front page': ['0', 'Jump to front page.'],
'Open front page': ['Shift+0', 'Open front page in a new tab.'],
'Next page': ['Shift+Right', 'Jump to the next page.'],
'Previous page': ['Shift+Left', 'Jump to the previous page.'],
'Search form': ['Ctrl+Alt+s', 'Focus the search field on the board index.'],
@ -352,7 +352,7 @@
doc = d.documentElement;
g = {
VERSION: '1.7.7',
VERSION: '1.7.8',
NAMESPACE: '4chan X.',
boards: {}
};
@ -3159,6 +3159,7 @@
return +window.location.pathname.split('/')[2];
},
userPageNav: function(pageNum) {
Navigate.pushState(pageNum === 0 ? './' : pageNum);
if (Conf['Refreshed Navigation'] && Conf['Index Mode'] !== 'all pages') {
return Index.update(pageNum);
} else {
@ -3169,7 +3170,7 @@
if (Index.currentPage === pageNum && !Index.root.parentElement) {
return;
}
history.pushState(null, '', pageNum === 0 ? './' : pageNum);
Navigate.pushState(pageNum === 0 ? './' : pageNum);
return Index.pageLoad(pageNum);
},
pageLoad: function(pageNum) {
@ -11881,7 +11882,7 @@
return Conf[hotkey] = key;
},
keydown: function(e) {
var key, notification, notifications, op, target, thread, threadRoot, _i, _len, _ref;
var form, key, notification, notifications, op, target, thread, threadRoot, _i, _len, _ref;
if (!(key = Keybinds.keyCode(e))) {
return;
}
@ -11969,7 +11970,9 @@
ThreadUpdater.update();
break;
case 'index':
Index.update();
if (Conf['JSON Navigation']) {
Index.update();
}
}
break;
case Conf['Watch']:
@ -11995,7 +11998,7 @@
});
break;
case Conf['Front page']:
if (g.VIEW === 'index') {
if (Conf['JSON Navigation'] && g.VIEW === 'index') {
Index.userPageNav(0);
} else {
window.location = "/" + g.BOARD + "/";
@ -12005,19 +12008,39 @@
$.open("/" + g.BOARD + "/");
break;
case Conf['Next page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
if (g.VIEW !== 'index') {
return;
}
$('.next button', Index.pagelist).click();
if (Conf['JSON Navigation']) {
if (Conf['Index Mode'] !== 'all pages') {
$('.next button', Index.pagelist).click();
}
} else {
if (form = $('.next form')) {
window.location = form.action;
}
}
break;
case Conf['Previous page']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'all pages')) {
if (g.VIEW !== 'index') {
return;
}
$('.prev button', Index.pagelist).click();
if (Conf['JSON Navigation']) {
if (Conf['Index Mode'] !== 'all pages') {
$('.prev button', Index.pagelist).click();
}
} else {
if (form = $('.prev form')) {
window.location = form.action;
}
}
break;
case Conf['Search form']:
Index.searchInput.focus();
if (Conf['JSON Navigation']) {
Index.searchInput.focus();
} else {
$.id('search-btn').click();
}
break;
case Conf['Paged mode']:
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'paged')) {
@ -12043,6 +12066,19 @@
}
Index.cycleSortType();
break;
case Conf['Open catalog']:
if (Conf['External Catalog']) {
window.location = CatalogLinks.external(g.BOARD.ID);
} else {
if (!Conf['JSON Navigation']) {
return window.location = "/" + g.BOARD + "/catalog";
}
if (!(g.VIEW === 'index' && Conf['Index Mode'] !== 'catalog')) {
return;
}
Index.setIndexMode('catalog');
}
break;
case Conf['Next thread']:
if (g.VIEW !== 'index') {
return;
@ -12822,7 +12858,7 @@
if (threadID) {
view = 'thread';
} else {
pageNum = view;
pageNum = +view;
view = 'index';
}
path = this.pathname;
@ -12831,9 +12867,8 @@
}
Navigate.makeBreadCrumb(this.href, view, boardID, threadID);
if (this.id !== 'popState') {
history.pushState(null, '', path);
Navigate.pushState(path);
}
Navigate.path = this.pathname;
Navigate.setMode(this);
if (!(view === 'index' && 'index' === g.VIEW && boardID === g.BOARD.ID)) {
Navigate.disconnect();
@ -12957,6 +12992,10 @@
return Main.handleErrors(errors);
}
},
pushState: function(path) {
history.pushState(null, '', path);
return Navigate.path = window.location.pathname;
},
popstate: function() {
var a;
a = $.el('a', {
@ -13561,6 +13600,7 @@
g.VIEW = (function() {
switch (pathname[2]) {
case 'res':
case 'thread':
return 'thread';
case 'catalog':
return 'catalog';

View File

@ -1,7 +1,7 @@
<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
<app appid='lacclbnghgdicfifcamcmcnilckjamag'>
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.7' />
<updatecheck codebase='https://ccd0.github.io/4chan-x/builds/crx.crx' version='1.7.8' />
</app>
</gupdate>

View File

@ -1,6 +1,6 @@
{
"name": "4chan-X",
"version": "1.7.7",
"version": "1.7.8",
"description": "Cross-browser userscript for maximum lurking on 4chan.",
"meta": {
"name": "4chan X",

View File

@ -672,11 +672,11 @@ vp-replace
# Board Navigation
'Front page': [
'0'
'Jump to page 0.'
'Jump to front page.'
]
'Open front page': [
'Shift+0'
'Open page 0 in a new tab.'
'Open front page in a new tab.'
]
'Next page': [
'Shift+Right'

View File

@ -404,6 +404,7 @@ Index =
+window.location.pathname.split('/')[2]
userPageNav: (pageNum) ->
Navigate.pushState if pageNum is 0 then './' else pageNum
if Conf['Refreshed Navigation'] and Conf['Index Mode'] isnt 'all pages'
Index.update pageNum
else
@ -411,7 +412,7 @@ Index =
pageNav: (pageNum) ->
return if Index.currentPage is pageNum and not Index.root.parentElement
history.pushState null, '', if pageNum is 0 then './' else pageNum
Navigate.pushState if pageNum is 0 then './' else pageNum
Index.pageLoad pageNum
pageLoad: (pageNum) ->

View File

@ -8,7 +8,7 @@ Main =
return if g.BOARD.ID in ['z', 'fk']
g.VIEW =
switch pathname[2]
when 'res'
when 'res', 'thread'
'thread'
when 'catalog'
'catalog'

View File

@ -232,7 +232,7 @@ Navigate =
if threadID
view = 'thread'
else
pageNum = view
pageNum = +view
view = 'index' # path is "/boardID/". See the problem?
path = @pathname
@ -240,8 +240,7 @@ Navigate =
Navigate.makeBreadCrumb @href, view, boardID, threadID
history.pushState null, '', path unless @id is 'popState'
Navigate.path = @pathname
Navigate.pushState path unless @id is 'popState'
Navigate.setMode @
@ -353,6 +352,10 @@ Navigate =
Main.handleErrors errors if errors
pushState: (path) ->
history.pushState null, '', path
Navigate.path = window.location.pathname
popstate: ->
a = $.el 'a',
href: window.location

View File

@ -70,7 +70,7 @@ Keybinds =
when 'thread'
ThreadUpdater.update()
when 'index'
Index.update()
if Conf['JSON Navigation'] then Index.update()
when Conf['Watch']
ThreadWatcher.toggle thread
# Images
@ -86,20 +86,33 @@ Keybinds =
FappeTyme.cb.toggle.call {name: 'werk'}
# Board Navigation
when Conf['Front page']
if g.VIEW is 'index'
if Conf['JSON Navigation'] and g.VIEW is 'index'
Index.userPageNav 0
else
window.location = "/#{g.BOARD}/"
when Conf['Open front page']
$.open "/#{g.BOARD}/"
when Conf['Next page']
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages'
$('.next button', Index.pagelist).click()
return unless g.VIEW is 'index'
if Conf['JSON Navigation']
if Conf['Index Mode'] isnt 'all pages'
$('.next button', Index.pagelist).click()
else
if form = $ '.next form'
window.location = form.action
when Conf['Previous page']
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'all pages'
$('.prev button', Index.pagelist).click()
return unless g.VIEW is 'index'
if Conf['JSON Navigation']
if Conf['Index Mode'] isnt 'all pages'
$('.prev button', Index.pagelist).click()
else
if form = $ '.prev form'
window.location = form.action
when Conf['Search form']
Index.searchInput.focus()
if Conf['JSON Navigation']
Index.searchInput.focus()
else
$.id('search-btn').click()
when Conf['Paged mode']
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'paged'
Index.setIndexMode 'paged'
@ -112,6 +125,13 @@ Keybinds =
when Conf['Cycle sort type']
return unless g.VIEW is 'index'
Index.cycleSortType()
when Conf['Open catalog']
if Conf['External Catalog']
window.location = CatalogLinks.external(g.BOARD.ID)
else
return window.location = "/#{g.BOARD}/catalog" unless Conf['JSON Navigation']
return unless g.VIEW is 'index' and Conf['Index Mode'] isnt 'catalog'
Index.setIndexMode 'catalog'
# Thread Navigation
when Conf['Next thread']
return if g.VIEW isnt 'index'