Merge branch 'v3' into Av2

Conflicts:
	builds/4chan-X.js
	builds/appchan-x.user.js
	builds/crx/script.js
	src/General/Config.coffee
	src/Monitoring/ThreadWatcher.coffee
This commit is contained in:
Zixaphir 2013-05-07 21:09:24 -07:00
commit 7396b327c8
8 changed files with 58 additions and 46 deletions

View File

@ -1,3 +1,7 @@
seaweedchan:
- Add `Centered links` option for header
- Add `Persistent Thread Watcher` option
### 1.1.15 - 2013-05-07 ### 1.1.15 - 2013-05-07
seaweedchan: seaweedchan:
- Fix update and download urls for Greasemonkey - Fix update and download urls for Greasemonkey

View File

@ -186,6 +186,7 @@
'Thread Stats': [true, 'Display reply and image count.'], 'Thread Stats': [true, 'Display reply and image count.'],
'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'], 'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'],
'Thread Watcher': [true, 'Bookmark threads.'], 'Thread Watcher': [true, 'Bookmark threads.'],
'Persistent Thread Watcher': [false, 'Opens the thread watcher by default.'],
'Auto Watch': [true, 'Automatically watch threads you start.'], 'Auto Watch': [true, 'Automatically watch threads you start.'],
'Auto Watch Reply': [false, 'Automatically watch threads you reply to.'] 'Auto Watch Reply': [false, 'Automatically watch threads you reply to.']
}, },
@ -332,7 +333,6 @@
'Fixed Header': true, 'Fixed Header': true,
'Header auto-hide': false, 'Header auto-hide': false,
'Bottom Header': false, 'Bottom Header': false,
'Hide Header': false,
'Header catalog links': false, 'Header catalog links': false,
'Bottom Board List': true, 'Bottom Board List': true,
'Custom Board Navigation': true 'Custom Board Navigation': true
@ -3674,21 +3674,24 @@
}); });
this.barFixedToggler = barFixedToggler.firstElementChild; this.barFixedToggler = barFixedToggler.firstElementChild;
this.barPositionToggler = barPositionToggler.firstElementChild; this.barPositionToggler = barPositionToggler.firstElementChild;
this.linkJustifyToggler = linkJustifyToggler.firstElementChild;
this.headerToggler = headerToggler.firstElementChild; this.headerToggler = headerToggler.firstElementChild;
this.footerToggler = footerToggler.firstElementChild; this.footerToggler = footerToggler.firstElementChild;
this.customNavToggler = customNavToggler.firstElementChild; this.customNavToggler = customNavToggler.firstElementChild;
$.on(this.menuButton, 'click', this.menuToggle); $.on(this.menuButton, 'click', this.menuToggle);
$.on(this.barFixedToggler, 'change', this.toggleBarFixed); $.on(this.barFixedToggler, 'change', this.toggleBarFixed);
$.on(this.barPositionToggler, 'change', this.toggleBarPosition); $.on(this.barPositionToggler, 'change', this.toggleBarPosition);
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
$.on(this.headerToggler, 'change', this.toggleBarVisibility); $.on(this.headerToggler, 'change', this.toggleBarVisibility);
$.on(this.footerToggler, 'change', this.toggleFooterVisibility); $.on(this.footerToggler, 'change', this.toggleFooterVisibility);
$.on(this.customNavToggler, 'change', this.toggleCustomNav); $.on(this.customNavToggler, 'change', this.toggleCustomNav);
$.on(editCustomNav, 'click', this.editCustomNav); $.on(editCustomNav, 'click', this.editCustomNav);
this.setBarFixed(Conf['Fixed Header']); this.setBarFixed(Conf['Fixed Header']);
this.setBarVisibility(Conf['Header auto-hide']); this.setBarVisibility(Conf['Header auto-hide']);
this.setLinkJustify(Conf['Centered links']);
$.sync('Fixed Header', Header.setBarFixed); $.sync('Fixed Header', Header.setBarFixed);
$.sync('Bottom Header', Header.setBarPosition); $.sync('Bottom Header', Header.setBarPosition);
$.sync('Header auto-hide', Header.setBarVisibility); $.sync('Centered links', Header.setLinkJustify);
$.event('AddMenuEntry', { $.event('AddMenuEntry', {
type: 'header', type: 'header',
el: $.el('span', { el: $.el('span', {
@ -14470,24 +14473,22 @@
} }
}, },
checkUpdate: function() { checkUpdate: function() {
var freq, items, now; var now;
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) { if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
return; return;
} }
now = Date.now(); now = Date.now();
freq = 6 * $.HOUR; return $.get('lastchecked', 0, function(_arg) {
items = { var lastchecked;
lastupdate: 0,
lastchecked: 0 lastchecked = _arg.lastchecked;
}; if (lastchecked > now - $.DAY) {
return $.get(items, function(items) {
if (items.lastupdate > now - freq || items.lastchecked > now - $.DAY) {
return; return;
} }
return $.ready(function() { return $.ready(function() {
$.on(window, 'message', Main.message); $.on(window, 'message', Main.message);
$.set('lastUpdate', now); $.set('lastchecked', now);
return $.add(d.head, $.el('script', { return $.add(d.head, $.el('script', {
src: 'https://github.com/zixaphir/appchan-x/raw/Av2/latest.js' src: 'https://github.com/zixaphir/appchan-x/raw/Av2/latest.js'
})); }));

View File

@ -186,6 +186,7 @@
'Thread Stats': [true, 'Display reply and image count.'], 'Thread Stats': [true, 'Display reply and image count.'],
'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'], 'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'],
'Thread Watcher': [true, 'Bookmark threads.'], 'Thread Watcher': [true, 'Bookmark threads.'],
'Persistent Thread Watcher': [false, 'Opens the thread watcher by default.'],
'Auto Watch': [true, 'Automatically watch threads you start.'], 'Auto Watch': [true, 'Automatically watch threads you start.'],
'Auto Watch Reply': [false, 'Automatically watch threads you reply to.'] 'Auto Watch Reply': [false, 'Automatically watch threads you reply to.']
}, },
@ -333,7 +334,6 @@
'Fixed Header': true, 'Fixed Header': true,
'Header auto-hide': false, 'Header auto-hide': false,
'Bottom Header': false, 'Bottom Header': false,
'Hide Header': false,
'Header catalog links': false, 'Header catalog links': false,
'Bottom Board List': true, 'Bottom Board List': true,
'Custom Board Navigation': true 'Custom Board Navigation': true
@ -3670,21 +3670,24 @@
}); });
this.barFixedToggler = barFixedToggler.firstElementChild; this.barFixedToggler = barFixedToggler.firstElementChild;
this.barPositionToggler = barPositionToggler.firstElementChild; this.barPositionToggler = barPositionToggler.firstElementChild;
this.linkJustifyToggler = linkJustifyToggler.firstElementChild;
this.headerToggler = headerToggler.firstElementChild; this.headerToggler = headerToggler.firstElementChild;
this.footerToggler = footerToggler.firstElementChild; this.footerToggler = footerToggler.firstElementChild;
this.customNavToggler = customNavToggler.firstElementChild; this.customNavToggler = customNavToggler.firstElementChild;
$.on(this.menuButton, 'click', this.menuToggle); $.on(this.menuButton, 'click', this.menuToggle);
$.on(this.barFixedToggler, 'change', this.toggleBarFixed); $.on(this.barFixedToggler, 'change', this.toggleBarFixed);
$.on(this.barPositionToggler, 'change', this.toggleBarPosition); $.on(this.barPositionToggler, 'change', this.toggleBarPosition);
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
$.on(this.headerToggler, 'change', this.toggleBarVisibility); $.on(this.headerToggler, 'change', this.toggleBarVisibility);
$.on(this.footerToggler, 'change', this.toggleFooterVisibility); $.on(this.footerToggler, 'change', this.toggleFooterVisibility);
$.on(this.customNavToggler, 'change', this.toggleCustomNav); $.on(this.customNavToggler, 'change', this.toggleCustomNav);
$.on(editCustomNav, 'click', this.editCustomNav); $.on(editCustomNav, 'click', this.editCustomNav);
this.setBarFixed(Conf['Fixed Header']); this.setBarFixed(Conf['Fixed Header']);
this.setBarVisibility(Conf['Header auto-hide']); this.setBarVisibility(Conf['Header auto-hide']);
this.setLinkJustify(Conf['Centered links']);
$.sync('Fixed Header', Header.setBarFixed); $.sync('Fixed Header', Header.setBarFixed);
$.sync('Bottom Header', Header.setBarPosition); $.sync('Bottom Header', Header.setBarPosition);
$.sync('Header auto-hide', Header.setBarVisibility); $.sync('Centered links', Header.setLinkJustify);
$.event('AddMenuEntry', { $.event('AddMenuEntry', {
type: 'header', type: 'header',
el: $.el('span', { el: $.el('span', {
@ -14489,24 +14492,22 @@
} }
}, },
checkUpdate: function() { checkUpdate: function() {
var freq, items, now; var now;
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) { if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
return; return;
} }
now = Date.now(); now = Date.now();
freq = 7 * $.DAY; return $.get('lastchecked', 0, function(_arg) {
items = { var lastchecked;
lastupdate: 0,
lastchecked: 0 lastchecked = _arg.lastchecked;
}; if (lastchecked > now - $.DAY) {
return $.get(items, function(items) {
if (items.lastupdate > now - freq || items.lastchecked > now - $.DAY) {
return; return;
} }
return $.ready(function() { return $.ready(function() {
$.on(window, 'message', Main.message); $.on(window, 'message', Main.message);
$.set('lastUpdate', now); $.set('lastchecked', now);
return $.add(d.head, $.el('script', { return $.add(d.head, $.el('script', {
src: 'https://github.com/zixaphir/appchan-x/raw/Av2/latest.js' src: 'https://github.com/zixaphir/appchan-x/raw/Av2/latest.js'
})); }));

View File

@ -168,6 +168,7 @@
'Thread Stats': [true, 'Display reply and image count.'], 'Thread Stats': [true, 'Display reply and image count.'],
'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'], 'Updater and Stats in Header': [true, 'Places the thread updater and thread stats in the header instead of floating them.'],
'Thread Watcher': [true, 'Bookmark threads.'], 'Thread Watcher': [true, 'Bookmark threads.'],
'Persistent Thread Watcher': [false, 'Opens the thread watcher by default.'],
'Auto Watch': [true, 'Automatically watch threads you start.'], 'Auto Watch': [true, 'Automatically watch threads you start.'],
'Auto Watch Reply': [false, 'Automatically watch threads you reply to.'] 'Auto Watch Reply': [false, 'Automatically watch threads you reply to.']
}, },
@ -314,7 +315,6 @@
'Fixed Header': true, 'Fixed Header': true,
'Header auto-hide': false, 'Header auto-hide': false,
'Bottom Header': false, 'Bottom Header': false,
'Hide Header': false,
'Header catalog links': false, 'Header catalog links': false,
'Bottom Board List': true, 'Bottom Board List': true,
'Custom Board Navigation': true 'Custom Board Navigation': true
@ -3672,21 +3672,24 @@
}); });
this.barFixedToggler = barFixedToggler.firstElementChild; this.barFixedToggler = barFixedToggler.firstElementChild;
this.barPositionToggler = barPositionToggler.firstElementChild; this.barPositionToggler = barPositionToggler.firstElementChild;
this.linkJustifyToggler = linkJustifyToggler.firstElementChild;
this.headerToggler = headerToggler.firstElementChild; this.headerToggler = headerToggler.firstElementChild;
this.footerToggler = footerToggler.firstElementChild; this.footerToggler = footerToggler.firstElementChild;
this.customNavToggler = customNavToggler.firstElementChild; this.customNavToggler = customNavToggler.firstElementChild;
$.on(this.menuButton, 'click', this.menuToggle); $.on(this.menuButton, 'click', this.menuToggle);
$.on(this.barFixedToggler, 'change', this.toggleBarFixed); $.on(this.barFixedToggler, 'change', this.toggleBarFixed);
$.on(this.barPositionToggler, 'change', this.toggleBarPosition); $.on(this.barPositionToggler, 'change', this.toggleBarPosition);
$.on(this.linkJustifyToggler, 'change', this.toggleLinkJustify);
$.on(this.headerToggler, 'change', this.toggleBarVisibility); $.on(this.headerToggler, 'change', this.toggleBarVisibility);
$.on(this.footerToggler, 'change', this.toggleFooterVisibility); $.on(this.footerToggler, 'change', this.toggleFooterVisibility);
$.on(this.customNavToggler, 'change', this.toggleCustomNav); $.on(this.customNavToggler, 'change', this.toggleCustomNav);
$.on(editCustomNav, 'click', this.editCustomNav); $.on(editCustomNav, 'click', this.editCustomNav);
this.setBarFixed(Conf['Fixed Header']); this.setBarFixed(Conf['Fixed Header']);
this.setBarVisibility(Conf['Header auto-hide']); this.setBarVisibility(Conf['Header auto-hide']);
this.setLinkJustify(Conf['Centered links']);
$.sync('Fixed Header', Header.setBarFixed); $.sync('Fixed Header', Header.setBarFixed);
$.sync('Bottom Header', Header.setBarPosition); $.sync('Bottom Header', Header.setBarPosition);
$.sync('Header auto-hide', Header.setBarVisibility); $.sync('Centered links', Header.setLinkJustify);
$.event('AddMenuEntry', { $.event('AddMenuEntry', {
type: 'header', type: 'header',
el: $.el('span', { el: $.el('span', {
@ -14474,24 +14477,22 @@
} }
}, },
checkUpdate: function() { checkUpdate: function() {
var freq, items, now; var now;
if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) { if (!(Conf['Check for Updates'] && Main.isThisPageLegit())) {
return; return;
} }
now = Date.now(); now = Date.now();
freq = 7 * $.DAY; return $.get('lastchecked', 0, function(_arg) {
items = { var lastchecked;
lastupdate: 0,
lastchecked: 0 lastchecked = _arg.lastchecked;
}; if (lastchecked > now - $.DAY) {
return $.get(items, function(items) {
if (items.lastupdate > now - freq || items.lastchecked > now - $.DAY) {
return; return;
} }
return $.ready(function() { return $.ready(function() {
$.on(window, 'message', Main.message); $.on(window, 'message', Main.message);
$.set('lastUpdate', now); $.set('lastchecked', now);
return $.add(d.head, $.el('script', { return $.add(d.head, $.el('script', {
src: 'https://github.com/zixaphir/appchan-x/raw/Av2/latest.js' src: 'https://github.com/zixaphir/appchan-x/raw/Av2/latest.js'
})); }));

View File

@ -229,6 +229,10 @@ Config =
true true
'Bookmark threads.' 'Bookmark threads.'
] ]
'Persistent Thread Watcher': [
false
'Opens the thread watcher by default.'
]
'Auto Watch': [ 'Auto Watch': [
true true
'Automatically watch threads you start.' 'Automatically watch threads you start.'
@ -771,7 +775,6 @@ http://iqdb.org/?url=%TURL
'Fixed Header': true 'Fixed Header': true
'Header auto-hide': false 'Header auto-hide': false
'Bottom Header': false 'Bottom Header': false
'Hide Header': false
'Header catalog links': false 'Header catalog links': false
'Bottom Board List': true 'Bottom Board List': true
'Custom Board Navigation': true 'Custom Board Navigation': true

View File

@ -21,6 +21,7 @@ Header =
@barFixedToggler = barFixedToggler.firstElementChild @barFixedToggler = barFixedToggler.firstElementChild
@barPositionToggler = barPositionToggler.firstElementChild @barPositionToggler = barPositionToggler.firstElementChild
@linkJustifyToggler = linkJustifyToggler.firstElementChild
@headerToggler = headerToggler.firstElementChild @headerToggler = headerToggler.firstElementChild
@footerToggler = footerToggler.firstElementChild @footerToggler = footerToggler.firstElementChild
@customNavToggler = customNavToggler.firstElementChild @customNavToggler = customNavToggler.firstElementChild
@ -28,6 +29,7 @@ Header =
$.on @menuButton, 'click', @menuToggle $.on @menuButton, 'click', @menuToggle
$.on @barFixedToggler, 'change', @toggleBarFixed $.on @barFixedToggler, 'change', @toggleBarFixed
$.on @barPositionToggler, 'change', @toggleBarPosition $.on @barPositionToggler, 'change', @toggleBarPosition
$.on @linkJustifyToggler, 'change', @toggleLinkJustify
$.on @headerToggler, 'change', @toggleBarVisibility $.on @headerToggler, 'change', @toggleBarVisibility
$.on @footerToggler, 'change', @toggleFooterVisibility $.on @footerToggler, 'change', @toggleFooterVisibility
$.on @customNavToggler, 'change', @toggleCustomNav $.on @customNavToggler, 'change', @toggleCustomNav
@ -35,10 +37,11 @@ Header =
@setBarFixed Conf['Fixed Header'] @setBarFixed Conf['Fixed Header']
@setBarVisibility Conf['Header auto-hide'] @setBarVisibility Conf['Header auto-hide']
@setLinkJustify Conf['Centered links']
$.sync 'Fixed Header', Header.setBarFixed $.sync 'Fixed Header', Header.setBarFixed
$.sync 'Bottom Header', Header.setBarPosition $.sync 'Bottom Header', Header.setBarPosition
$.sync 'Header auto-hide', Header.setBarVisibility $.sync 'Centered links', Header.setLinkJustify
$.event 'AddMenuEntry', $.event 'AddMenuEntry',
type: 'header' type: 'header'

View File

@ -289,21 +289,13 @@ Main =
checkUpdate: -> checkUpdate: ->
return unless Conf['Check for Updates'] and Main.isThisPageLegit() return unless Conf['Check for Updates'] and Main.isThisPageLegit()
# Check for updates after:
# - 6 hours since the last update on Opera because it lacks auto-updating.
# - 7 days since the last update on Chrome/Firefox.
# After that, check for updates every day if we still haven't updated.
now = Date.now() now = Date.now()
freq = <% if (type === 'userjs') { %>6 * $.HOUR<% } else { %>7 * $.DAY<% } %> $.get 'lastchecked', 0, ({lastchecked}) ->
items = if (lastchecked > now - $.DAY)
lastupdate: 0
lastchecked: 0
$.get items, (items) ->
if items.lastupdate > now - freq or items.lastchecked > now - $.DAY
return return
$.ready -> $.ready ->
$.on window, 'message', Main.message $.on window, 'message', Main.message
$.set 'lastUpdate', now $.set 'lastchecked', now
$.add d.head, $.el 'script', $.add d.head, $.el 'script',
src: '<%= meta.repo %>raw/<%= meta.mainBranch %>/latest.js' src: '<%= meta.repo %>raw/<%= meta.mainBranch %>/latest.js'

View File

@ -126,6 +126,13 @@ a {
border-width: 0; border-width: 0;
transition: all .1s .05s ease-in-out; transition: all .1s .05s ease-in-out;
} }
:root.centered-links #header-bar {
text-align: center;
}
:root.centered-links #custom-board-list {
position: relative;
left: 80px;
}
.fixed.top #header-bar { .fixed.top #header-bar {
border-bottom-width: 1px; border-bottom-width: 1px;
} }