Begin work on supporting other imageboards.
This commit is contained in:
parent
39792ad2ca
commit
2fb01f85b6
2
Makefile
2
Makefile
@ -32,7 +32,7 @@ $(eval $(shell node tools/pkgvars.js))
|
||||
version = $(shell node -p "JSON.parse(require('fs').readFileSync('version.json')).version")
|
||||
|
||||
source_directories := \
|
||||
globals config css platform classes \
|
||||
globals config css platform classes site \
|
||||
Archive Filtering General Images Linkification \
|
||||
Menu Miscellaneous Monitoring Posting Quotelinks \
|
||||
main
|
||||
|
||||
@ -1049,3 +1049,7 @@ Config =
|
||||
'Max Replies': 1000
|
||||
|
||||
'Autohiding Scrollbar': false
|
||||
|
||||
siteSoftware: """
|
||||
4chan.org yotsuba
|
||||
"""
|
||||
|
||||
@ -100,6 +100,9 @@ Main =
|
||||
new Notice 'info', el, 15
|
||||
|
||||
initFeatures: ->
|
||||
Site.init()
|
||||
return unless Site.software
|
||||
|
||||
{hostname, search} = location
|
||||
pathname = location.pathname.split /\/+/
|
||||
g.BOARD = new Board pathname[1] unless hostname is 'www.4chan.org'
|
||||
|
||||
1
src/site/SW.js
Normal file
1
src/site/SW.js
Normal file
@ -0,0 +1 @@
|
||||
SW = {};
|
||||
1
src/site/SW.tinyboard.coffee
Normal file
1
src/site/SW.tinyboard.coffee
Normal file
@ -0,0 +1 @@
|
||||
SW.tinyboard = {}
|
||||
1
src/site/SW.yotsuba.coffee
Normal file
1
src/site/SW.yotsuba.coffee
Normal file
@ -0,0 +1 @@
|
||||
SW.yotsuba = {}
|
||||
13
src/site/Site.coffee
Normal file
13
src/site/Site.coffee
Normal file
@ -0,0 +1,13 @@
|
||||
Site =
|
||||
init: ->
|
||||
swDict = {}
|
||||
for line in Conf['siteSoftware'].split('\n') when line[0] isnt '#'
|
||||
[hostname, software] = line.split(' ')
|
||||
swDict[hostname] = software if software of SW
|
||||
{hostname} = location
|
||||
while hostname and hostname not of swDict
|
||||
hostname = hostname.replace(/^[^.]*\.?/, '')
|
||||
return unless hostname
|
||||
@hostname = hostname
|
||||
@software = swDict[hostname]
|
||||
$.extend @, SW[@software]
|
||||
Loading…
x
Reference in New Issue
Block a user