Rebuild only needed files when an imported file changes.
29
Makefile
@ -44,8 +44,6 @@ parts := \
|
||||
)) \
|
||||
main
|
||||
|
||||
lang = $(if $(filter globals css,$1),js,coffee)
|
||||
|
||||
# remove extension when sorting so X.coffee comes before X.Y.coffee
|
||||
sources_part = \
|
||||
$(subst !c,.coffee,$(subst !j,.js,$(sort $(subst .coffee,!c,$(subst .js,!j, \
|
||||
@ -55,21 +53,30 @@ sources := $(foreach p,$(parts),$(call sources_part,$(p)))
|
||||
|
||||
part_of = $(patsubst src/%/,%,$(dir $1))
|
||||
|
||||
imports = \
|
||||
$(filter-out %.coffee %.js,$(wildcard src/$1/*.* src/$1/*/*.* src/$1/*/*/*.*)) \
|
||||
.tests_enabled \
|
||||
$(imports_$1)
|
||||
uses_tests_enabled := \
|
||||
src/classes/Post.coffee \
|
||||
src/General/Build.Test.coffee \
|
||||
src/Linkification/Linkify.coffee \
|
||||
src/Miscellaneous/Keybinds.coffee \
|
||||
src/Monitoring/Unread.coffee \
|
||||
src/main/Main.coffee
|
||||
|
||||
imports_globals := \
|
||||
imports_src/globals/globals.js := \
|
||||
version.json
|
||||
imports_config := \
|
||||
imports_src/config/Config.coffee := \
|
||||
src/Archive/archives.json
|
||||
imports_css := \
|
||||
imports_src/css/CSS.js := \
|
||||
tools/style.js \
|
||||
node_modules/font-awesome/package.json
|
||||
imports_Monitoring := \
|
||||
imports_src/Monitoring/Favicon.coffee := \
|
||||
src/meta/icon128.png
|
||||
|
||||
imports = \
|
||||
$(filter-out %.coffee %.js,$(wildcard $(dir $1)*.*)) \
|
||||
$(wildcard $(basename $1)/*.*) \
|
||||
$(if $(filter $(uses_tests_enabled),$1),.tests_enabled) \
|
||||
$(imports_$1)
|
||||
|
||||
dests_platform = $(addprefix tmp/,$(subst /,-,$(subst src/,,$(subst platform,platform_$2,$(subst .coffee,.js,$1)))))
|
||||
|
||||
dests_of = $(sort $(call dests_platform,$1,crx) $(call dests_platform,$1,userscript))
|
||||
@ -131,7 +138,7 @@ tmp/declaration.js : .events/declare
|
||||
$(if $(wildcard $@),,node tools/declare.js && echo -> $^)
|
||||
|
||||
define force_compile
|
||||
$$(call dests_of,$1) : $1 $$(call imports,$$(call part_of,$1)) $$(template_deps) $$(coffee_deps) tools/chain.js
|
||||
$$(call dests_of,$1) : $1 $$(call imports,$1) $$(template_deps) $$(coffee_deps) tools/chain.js
|
||||
$(RM) $$(call QUOTE,$$@)
|
||||
endef
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ Redirect =
|
||||
|
||||
archives:
|
||||
`<%=
|
||||
JSON.stringify(readJSON('src/Archive/archives.json'), null, 2)
|
||||
JSON.stringify(readJSON('archives.json'), null, 2)
|
||||
.replace(/\n {2,}(?!{)/g, ' ')
|
||||
.replace(/\n/g, '\n ')
|
||||
.replace(/`/g, '\\`')
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<% if (readJSON('.tests_enabled')) { %>
|
||||
<% if (readJSON('/.tests_enabled')) { %>
|
||||
Build.Test =
|
||||
init: ->
|
||||
return if !Conf['Menu'] or g.VIEW not in ['index', 'thread']
|
||||
|
||||
@ -115,7 +115,7 @@ Build =
|
||||
else
|
||||
"/#{boardID}/thread/#{threadID}#q#{postID}"
|
||||
|
||||
postInfo = <%= importHTML('General/Build/PostInfo') %>
|
||||
postInfo = <%= readHTML('PostInfo.html') %>
|
||||
|
||||
### File Info ###
|
||||
|
||||
@ -125,13 +125,13 @@ Build =
|
||||
shortFilename = Build.shortFilename file.name
|
||||
fileThumb = if file.isSpoiler then Build.spoilerThumb(boardID) else file.thumbURL.replace(protocol, '')
|
||||
|
||||
fileBlock = <%= importHTML('General/Build/File') %>
|
||||
fileBlock = <%= readHTML('File.html') %>
|
||||
|
||||
### Whole Post ###
|
||||
|
||||
postClass = if o.isReply then 'reply' else 'op'
|
||||
|
||||
wholePost = <%= importHTML('General/Build/Post') %>
|
||||
wholePost = <%= readHTML('Post.html') %>
|
||||
|
||||
container = $.el 'div',
|
||||
className: "postContainer #{postClass}Container"
|
||||
@ -221,7 +221,7 @@ Build =
|
||||
root = $.el 'div',
|
||||
className: 'catalog-thread'
|
||||
|
||||
$.extend root, <%= importHTML('General/Build/CatalogThread') %>
|
||||
$.extend root, <%= readHTML('CatalogThread.html') %>
|
||||
|
||||
root.dataset.fullID = thread.fullID
|
||||
$.addClass root, thread.OP.highlights... if thread.OP.highlights
|
||||
|
||||
@ -63,7 +63,7 @@ Index =
|
||||
|
||||
# Navigation links at top of index
|
||||
@navLinks = $.el 'div', className: 'navLinks json-index'
|
||||
$.extend @navLinks, <%= importHTML('General/Index/NavLinks') %>
|
||||
$.extend @navLinks, <%= readHTML('NavLinks.html') %>
|
||||
$('.cataloglink a', @navLinks).href = CatalogLinks.catalog()
|
||||
$('.archlistlink', @navLinks).hidden = true if g.BOARD.ID in ['b', 'trash']
|
||||
$.on $('#index-last-refresh a', @navLinks), 'click', @cb.refreshFront
|
||||
@ -96,7 +96,7 @@ Index =
|
||||
|
||||
# Page list
|
||||
@pagelist = $.el 'div', className: 'pagelist json-index'
|
||||
$.extend @pagelist, <%= importHTML('General/Index/PageList') %>
|
||||
$.extend @pagelist, <%= readHTML('PageList.html') %>
|
||||
$('.cataloglink a', @pagelist).href = CatalogLinks.catalog()
|
||||
$.on @pagelist, 'click', @cb.pageNav
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ Settings =
|
||||
Settings.dialog = dialog = $.el 'div',
|
||||
id: 'fourchanx-settings'
|
||||
className: 'dialog'
|
||||
$.extend dialog, <%= importHTML('General/Settings/Settings') %>
|
||||
$.extend dialog, <%= readHTML('Settings.html') %>
|
||||
|
||||
Settings.overlay = overlay = $.el 'div',
|
||||
id: 'overlay'
|
||||
@ -377,7 +377,7 @@ Settings =
|
||||
window.location.reload()
|
||||
|
||||
filter: (section) ->
|
||||
$.extend section, <%= importHTML('General/Settings/Filter-select') %>
|
||||
$.extend section, <%= readHTML('Filter-select.html') %>
|
||||
select = $ 'select', section
|
||||
$.on select, 'change', Settings.selectFilter
|
||||
Settings.selectFilter.call select
|
||||
@ -395,11 +395,11 @@ Settings =
|
||||
$.on ta, 'change', $.cb.value
|
||||
$.add div, ta
|
||||
return
|
||||
$.extend div, <%= importHTML('General/Settings/Filter-guide') %>
|
||||
$.extend div, <%= readHTML('Filter-guide.html') %>
|
||||
$('.warning', div).hidden = Conf['Filter']
|
||||
|
||||
sauce: (section) ->
|
||||
$.extend section, <%= importHTML('General/Settings/Sauce') %>
|
||||
$.extend section, <%= readHTML('Sauce.html') %>
|
||||
$('.warning', section).hidden = Conf['Sauce']
|
||||
ta = $ 'textarea', section
|
||||
$.get 'sauces', Conf['sauces'], (item) ->
|
||||
@ -407,7 +407,7 @@ Settings =
|
||||
$.on ta, 'change', $.cb.value
|
||||
|
||||
advanced: (section) ->
|
||||
$.extend section, <%= importHTML('General/Settings/Advanced') %>
|
||||
$.extend section, <%= readHTML('Advanced.html') %>
|
||||
warning.hidden = Conf[warning.dataset.feature] for warning in $$ '.warning', section
|
||||
|
||||
items = {}
|
||||
@ -584,7 +584,7 @@ Settings =
|
||||
CustomCSS.update()
|
||||
|
||||
keybinds: (section) ->
|
||||
$.extend section, <%= importHTML('General/Settings/Keybinds') %>
|
||||
$.extend section, <%= readHTML('Keybinds.html') %>
|
||||
$('.warning', section).hidden = Conf['Keybinds']
|
||||
|
||||
tbody = $ 'tbody', section
|
||||
|
||||
@ -44,7 +44,7 @@ Gallery =
|
||||
|
||||
nodes.el = dialog = $.el 'div',
|
||||
id: 'a-gallery'
|
||||
$.extend dialog, <%= importHTML('Images/Gallery') %>
|
||||
$.extend dialog, <%= readHTML('Gallery.html') %>
|
||||
|
||||
nodes[key] = $ value, dialog for key, value of {
|
||||
buttons: '.gal-buttons'
|
||||
|
||||
@ -19,7 +19,7 @@ Sauce =
|
||||
cb: @node
|
||||
|
||||
sandbox: (url) ->
|
||||
E.url <%= importHTML('Images/Sandbox') %>
|
||||
E.url <%= readHTML('Sandbox.html') %>
|
||||
|
||||
rmOrigin: (e) ->
|
||||
return if e.shiftKey or e.altKey or e.ctrlKey or e.metaKey or e.button isnt 0
|
||||
|
||||
@ -6,7 +6,7 @@ Embedding =
|
||||
|
||||
if Conf['Floating Embeds']
|
||||
@dialog = UI.dialog 'embedding', 'top: 50px; right: 0px;',
|
||||
<%= importHTML('Linkification/Embed') %>
|
||||
<%= readHTML('Embed.html') %>
|
||||
@media = $ '#media-embed', @dialog
|
||||
$.one d, '4chanXInitFinished', @ready
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ Linkify =
|
||||
|
||||
if Linkify.regString.test word
|
||||
links.push Linkify.makeRange node, endNode, index, length
|
||||
<%= assert('.tests_enabled', 'word is links[links.length-1].toString()') %>
|
||||
<% if (readJSON('/.tests_enabled')) { %><%= assert('word is links[links.length-1].toString()') %><% } %>
|
||||
|
||||
break unless test.lastIndex and node is endNode
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Banner =
|
||||
banners: `<%= JSON.stringify(readJSON('src/Miscellaneous/banners.json')) %>`
|
||||
banners: `<%= JSON.stringify(readJSON('banners.json')) %>`
|
||||
|
||||
init: ->
|
||||
if Conf['Custom Board Titles']
|
||||
|
||||
@ -192,7 +192,7 @@ Keybinds =
|
||||
when Conf['Next Post Quoting You']
|
||||
return unless threadRoot and QuoteYou.db
|
||||
QuoteYou.cb.seek 'following'
|
||||
<% if (readJSON('.tests_enabled')) { %>
|
||||
<% if (readJSON('/.tests_enabled')) { %>
|
||||
when 't'
|
||||
return unless threadRoot
|
||||
Build.Test.testAll()
|
||||
|
||||
@ -12,52 +12,52 @@ Favicon =
|
||||
switch: ->
|
||||
items = {
|
||||
ferongr: [
|
||||
'<%= readBase64("src/Monitoring/Favicon/ferongr/unreadDead.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/ferongr/unreadDeadY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/ferongr/unreadSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/ferongr/unreadSFWY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/ferongr/unreadNSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/ferongr/unreadNSFWY.png") %>'
|
||||
'<%= readBase64('ferongr.unreadDead.png') %>'
|
||||
'<%= readBase64('ferongr.unreadDeadY.png') %>'
|
||||
'<%= readBase64('ferongr.unreadSFW.png') %>'
|
||||
'<%= readBase64('ferongr.unreadSFWY.png') %>'
|
||||
'<%= readBase64('ferongr.unreadNSFW.png') %>'
|
||||
'<%= readBase64('ferongr.unreadNSFWY.png') %>'
|
||||
]
|
||||
'xat-': [
|
||||
'<%= readBase64("src/Monitoring/Favicon/xat-/unreadDead.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/xat-/unreadDeadY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/xat-/unreadSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/xat-/unreadSFWY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/xat-/unreadNSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/xat-/unreadNSFWY.png") %>'
|
||||
'<%= readBase64('xat-.unreadDead.png') %>'
|
||||
'<%= readBase64('xat-.unreadDeadY.png') %>'
|
||||
'<%= readBase64('xat-.unreadSFW.png') %>'
|
||||
'<%= readBase64('xat-.unreadSFWY.png') %>'
|
||||
'<%= readBase64('xat-.unreadNSFW.png') %>'
|
||||
'<%= readBase64('xat-.unreadNSFWY.png') %>'
|
||||
]
|
||||
Mayhem: [
|
||||
'<%= readBase64("src/Monitoring/Favicon/Mayhem/unreadDead.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Mayhem/unreadDeadY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Mayhem/unreadSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Mayhem/unreadSFWY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Mayhem/unreadNSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Mayhem/unreadNSFWY.png") %>'
|
||||
'<%= readBase64('Mayhem.unreadDead.png') %>'
|
||||
'<%= readBase64('Mayhem.unreadDeadY.png') %>'
|
||||
'<%= readBase64('Mayhem.unreadSFW.png') %>'
|
||||
'<%= readBase64('Mayhem.unreadSFWY.png') %>'
|
||||
'<%= readBase64('Mayhem.unreadNSFW.png') %>'
|
||||
'<%= readBase64('Mayhem.unreadNSFWY.png') %>'
|
||||
]
|
||||
'4chanJS': [
|
||||
'<%= readBase64("src/Monitoring/Favicon/4chanJS/unreadDead.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/4chanJS/unreadDeadY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/4chanJS/unreadSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/4chanJS/unreadSFWY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/4chanJS/unreadNSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/4chanJS/unreadNSFWY.png") %>'
|
||||
'<%= readBase64('4chanJS.unreadDead.png') %>'
|
||||
'<%= readBase64('4chanJS.unreadDeadY.png') %>'
|
||||
'<%= readBase64('4chanJS.unreadSFW.png') %>'
|
||||
'<%= readBase64('4chanJS.unreadSFWY.png') %>'
|
||||
'<%= readBase64('4chanJS.unreadNSFW.png') %>'
|
||||
'<%= readBase64('4chanJS.unreadNSFWY.png') %>'
|
||||
]
|
||||
Original: [
|
||||
'<%= readBase64("src/Monitoring/Favicon/Original/unreadDead.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Original/unreadDeadY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Original/unreadSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Original/unreadSFWY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Original/unreadNSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Original/unreadNSFWY.png") %>'
|
||||
'<%= readBase64('Original.unreadDead.png') %>'
|
||||
'<%= readBase64('Original.unreadDeadY.png') %>'
|
||||
'<%= readBase64('Original.unreadSFW.png') %>'
|
||||
'<%= readBase64('Original.unreadSFWY.png') %>'
|
||||
'<%= readBase64('Original.unreadNSFW.png') %>'
|
||||
'<%= readBase64('Original.unreadNSFWY.png') %>'
|
||||
]
|
||||
'Metro': [
|
||||
'<%= readBase64("src/Monitoring/Favicon/Metro/unreadDead.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Metro/unreadDeadY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Metro/unreadSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Metro/unreadSFWY.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Metro/unreadNSFW.png") %>'
|
||||
'<%= readBase64("src/Monitoring/Favicon/Metro/unreadNSFWY.png") %>'
|
||||
'<%= readBase64('Metro.unreadDead.png') %>'
|
||||
'<%= readBase64('Metro.unreadDeadY.png') %>'
|
||||
'<%= readBase64('Metro.unreadSFW.png') %>'
|
||||
'<%= readBase64('Metro.unreadSFWY.png') %>'
|
||||
'<%= readBase64('Metro.unreadNSFW.png') %>'
|
||||
'<%= readBase64('Metro.unreadNSFWY.png') %>'
|
||||
]
|
||||
}[Conf['favicon']]
|
||||
|
||||
@ -78,7 +78,7 @@ Favicon =
|
||||
@unread = @unreadNSFW
|
||||
@unreadY = @unreadNSFWY
|
||||
|
||||
dead: 'data:image/gif;base64,<%= readBase64("src/Monitoring/Favicon/dead.gif") %>'
|
||||
logo: 'data:image/png;base64,<%= readBase64("src/meta/icon128.png") %>'
|
||||
dead: 'data:image/gif;base64,<%= readBase64('dead.gif') %>'
|
||||
logo: 'data:image/png;base64,<%= readBase64('/src/meta/icon128.png') %>'
|
||||
|
||||
return Favicon
|
||||
|
||||
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 168 B After Width: | Height: | Size: 168 B |
|
Before Width: | Height: | Size: 167 B After Width: | Height: | Size: 167 B |
|
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 162 B |
|
Before Width: | Height: | Size: 161 B After Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 335 B After Width: | Height: | Size: 335 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 376 B |
|
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
|
Before Width: | Height: | Size: 377 B After Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 189 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 170 B After Width: | Height: | Size: 170 B |
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 254 B After Width: | Height: | Size: 254 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 201 B |
|
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
|
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
|
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
@ -87,7 +87,7 @@ ThreadUpdater =
|
||||
http://freesound.org/people/pierrecartoons1979/sounds/90112/
|
||||
cc-by-nc-3.0
|
||||
###
|
||||
beep: 'data:audio/wav;base64,<%= readBase64("src/Monitoring/beep.wav") %>'
|
||||
beep: 'data:audio/wav;base64,<%= readBase64('beep.wav') %>'
|
||||
|
||||
playBeep: ->
|
||||
{audio} = ThreadUpdater
|
||||
|
||||
@ -10,7 +10,7 @@ ThreadWatcher =
|
||||
className: 'disabled fa fa-eye'
|
||||
|
||||
@db = new DataBoard 'watchedThreads', @refresh, true
|
||||
@dialog = UI.dialog 'thread-watcher', 'top: 50px; left: 0px;', <%= importHTML('Monitoring/ThreadWatcher') %>
|
||||
@dialog = UI.dialog 'thread-watcher', 'top: 50px; left: 0px;', <%= readHTML('ThreadWatcher.html') %>
|
||||
|
||||
@status = $ '#watcher-status', @dialog
|
||||
@list = @dialog.lastElementChild
|
||||
|
||||
@ -28,7 +28,7 @@ Unread =
|
||||
name: 'Unread'
|
||||
cb: @addPost
|
||||
|
||||
<% if (readJSON('.tests_enabled')) { %>
|
||||
<% if (readJSON('/.tests_enabled')) { %>
|
||||
testLink = $.el 'a',
|
||||
textContent: 'Test Post Order'
|
||||
$.on testLink, 'click', ->
|
||||
|
||||
@ -433,7 +433,7 @@ QR =
|
||||
dialog: ->
|
||||
QR.nodes = nodes =
|
||||
el: dialog = UI.dialog 'qr', 'top: 50px; right: 0px;',
|
||||
<%= importHTML('Posting/QuickReply') %>
|
||||
<%= readHTML('QuickReply.html') %>
|
||||
|
||||
setNode = (name, query) ->
|
||||
nodes[name] = $ query, dialog
|
||||
|
||||
@ -2,7 +2,7 @@ class Post
|
||||
toString: -> @ID
|
||||
|
||||
constructor: (root, @thread, @board) ->
|
||||
<% if (readJSON('.tests_enabled')) { %>
|
||||
<% if (readJSON('/.tests_enabled')) { %>
|
||||
root2 = root.cloneNode true
|
||||
for el in $$ '.mobile', root2
|
||||
$.rm el
|
||||
|
||||
@ -728,10 +728,10 @@ Config =
|
||||
# "View Same" in archives:
|
||||
#https://archive.4plebs.org/_/search/image/%sMD5/;text:View same on 4plebs
|
||||
#https://archive.4plebs.org/%board/search/image/%sMD5/;text:View same on 4plebs /%board/;boards:<%=
|
||||
readJSON('src/Archive/archives.json').filter(function(x) {return x.uid === 3})[0].files.join(',')
|
||||
readJSON('/src/Archive/archives.json').filter(function(x) {return x.uid === 3})[0].files.join(',')
|
||||
%>
|
||||
#https://rbt.asia/%board/image/%sMD5;text:View same on RBT /%board/;boards:<%=
|
||||
readJSON('src/Archive/archives.json').filter(function(x) {return x.uid === 8})[0].files.join(',')
|
||||
readJSON('/src/Archive/archives.json').filter(function(x) {return x.uid === 8})[0].files.join(',')
|
||||
%>
|
||||
"""
|
||||
|
||||
@ -796,7 +796,7 @@ Config =
|
||||
|
||||
favicon: 'ferongr'
|
||||
|
||||
usercss: `<%= multiline(read('src/config/user.css')) %>`
|
||||
usercss: `<%= multiline(read('user.css')) %>`
|
||||
|
||||
hotkeys:
|
||||
# QR & Options
|
||||
|
||||
@ -4,9 +4,9 @@ boards:
|
||||
<%= multiline(require['style']()()) %>,
|
||||
|
||||
report:
|
||||
<%= multiline(read('src/css/report.css')) %>,
|
||||
<%= multiline(read('report.css')) %>,
|
||||
|
||||
www:
|
||||
<%= multiline(read('src/css/www.css')) %>
|
||||
<%= multiline(read('www.css')) %>
|
||||
|
||||
};
|
||||
|
||||
|
Before Width: | Height: | Size: 700 B After Width: | Height: | Size: 700 B |
|
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 226 B After Width: | Height: | Size: 226 B |
|
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
|
Before Width: | Height: | Size: 667 B After Width: | Height: | Size: 667 B |
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 863 B |
|
Before Width: | Height: | Size: 729 B After Width: | Height: | Size: 729 B |
|
Before Width: | Height: | Size: 740 B After Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 839 B |
|
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 491 B |
|
Before Width: | Height: | Size: 248 B After Width: | Height: | Size: 248 B |
|
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 744 B |
|
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 307 B |
|
Before Width: | Height: | Size: 990 B After Width: | Height: | Size: 990 B |
|
Before Width: | Height: | Size: 928 B After Width: | Height: | Size: 928 B |
|
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 347 B |
@ -6,7 +6,7 @@ d = document;
|
||||
doc = d.documentElement;
|
||||
|
||||
g = {
|
||||
VERSION: '<%= readJSON('version.json').version %>',
|
||||
VERSION: '<%= readJSON('/version.json').version %>',
|
||||
NAMESPACE: '<%= meta.name %>.',
|
||||
boards: {}
|
||||
};
|
||||
|
||||
@ -465,7 +465,7 @@ Main =
|
||||
['Banner', Banner]
|
||||
['Flash Features', Flash]
|
||||
['Reply Pruning', ReplyPruning]
|
||||
<% if (readJSON('.tests_enabled')) { %>
|
||||
<% if (readJSON('/.tests_enabled')) { %>
|
||||
['Build Test', Build.Test]
|
||||
<% } %>
|
||||
]
|
||||
|
||||
@ -21,9 +21,9 @@
|
||||
"chrome": true<%=
|
||||
meta.grants.map(x => `,\n "${x}": true`).join('')
|
||||
%><%=
|
||||
read('tmp/declaration.js').match(/^var (.*);/)[1].split(', ').map(x => `,\n "${x}": true`).join('')
|
||||
read('/tmp/declaration.js').match(/^var (.*);/)[1].split(', ').map(x => `,\n "${x}": true`).join('')
|
||||
%><%=
|
||||
read('tmp/globals-globals.js').match(/^var (.*);/)[1].split(', ').map(x => `,\n "${x}": true`).join('')
|
||||
read('/tmp/globals-globals.js').match(/^var (.*);/)[1].split(', ').map(x => `,\n "${x}": true`).join('')
|
||||
%>
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "<%= meta.name %>",
|
||||
"version": "<%= readJSON('version.json').version %>",
|
||||
"version": "<%= readJSON('/version.json').version %>",
|
||||
"manifest_version": 2,
|
||||
"description": "<%= description %>",
|
||||
"icons": {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name <%= meta.name %><%= (channel === '-beta') ? ' beta' : '' %>
|
||||
// @version <%= readJSON('version.json').version %>
|
||||
// @version <%= readJSON('/version.json').version %>
|
||||
// @minGMVer <%= meta.min.greasemonkey %>
|
||||
// @minFFVer <%= meta.min.firefox %>
|
||||
// @namespace <%= name %>
|
||||
@ -42,5 +42,5 @@
|
||||
// @run-at document-start
|
||||
// @updateURL <%= (channel !== '-noupdate') ? `${meta.downloads}${name}${channel}.meta.js` : 'https://noupdate.invalid/' %>
|
||||
// @downloadURL <%= (channel !== '-noupdate') ? `${meta.downloads}${name}${channel}.user.js` : 'https://noupdate.invalid/' %>
|
||||
// @icon data:image/png;base64,<%= readBase64('src/meta/icon48.png') %>
|
||||
// @icon data:image/png;base64,<%= readBase64('/src/meta/icon48.png') %>
|
||||
// ==/UserScript==
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
|
||||
<app appid='<%= meta.appid %>'>
|
||||
<updatecheck codebase='<%= meta.downloads %><%= name %><%= channel %>.crx' version='<%= readJSON('version.json').version %>' />
|
||||
<updatecheck codebase='<%= meta.downloads %><%= name %><%= channel %>.crx' version='<%= readJSON('/version.json').version %>' />
|
||||
</app>
|
||||
</gupdate>
|
||||
|
||||
|
||||
@ -15,5 +15,5 @@ for ext in ['jpg', 'png', 'gif']:
|
||||
print(banner, status)
|
||||
if status == 200:
|
||||
banners.append(banner)
|
||||
with open('src/Miscellaneous/banners.json', 'w') as f:
|
||||
with open('src/Miscellaneous/Banner/banners.json', 'w') as f:
|
||||
f.write(json.dumps(banners))
|
||||
|
||||
@ -6,9 +6,10 @@ for (var name of process.argv.slice(2)) {
|
||||
try {
|
||||
var parts = name.match(/^tmp\/([^_]*)(?:_(.*))?-(.*)\.js$/);
|
||||
var basename = fs.readdirSync(`src/${parts[1]}`).filter(x => (x === `${parts[3]}.coffee` || x === `${parts[3]}.js`))[0];
|
||||
var script = fs.readFileSync(`src/${parts[1]}/${basename}`, 'utf8');
|
||||
var sourceName = `src/${parts[1]}/${basename}`;
|
||||
var script = fs.readFileSync(sourceName, 'utf8');
|
||||
script = script.replace(/\r\n/g, '\n');
|
||||
script = template(script, {type: parts[2]});
|
||||
script = template(script, {type: parts[2]}, sourceName);
|
||||
if (/\.coffee$/.test(basename)) {
|
||||
script = coffee.compile(script);
|
||||
if (/^[$A-Z][$\w]*$/.test(parts[3])) {
|
||||
|
||||
@ -32,9 +32,11 @@ read('node_modules/font-awesome/css/font-awesome.css')
|
||||
).join('') +
|
||||
|
||||
'/* Link Title Favicons */\n' +
|
||||
fs.readdirSync('src/css/linkIcons').map(file =>
|
||||
`.linkify.${file.split('.')[0]} {
|
||||
background: transparent url('data:image/png;base64,${readBase64(`src/css/linkIcons/${file}`)}') center left no-repeat!important;
|
||||
fs.readdirSync('src/css').filter(file =>
|
||||
/^linkify\.[^.]+\.png$/.test(file)
|
||||
).map(file =>
|
||||
`.linkify.${file.split('.')[1]} {
|
||||
background: transparent url('data:image/png;base64,${readBase64(`src/css/${file}`)}') center left no-repeat!important;
|
||||
padding-left: 18px;
|
||||
}
|
||||
`
|
||||
|
||||
@ -1,10 +1,12 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var _template = require('lodash.template');
|
||||
var esprima = require('esprima');
|
||||
|
||||
// disable ES6 delimiters
|
||||
var _templateSettings = {interpolate: /<%=([\s\S]+?)%>/g};
|
||||
|
||||
// Functions used in templates.
|
||||
var tools = {};
|
||||
|
||||
tools.require = {};
|
||||
@ -16,18 +18,18 @@ var read = tools.read = filename => fs.readFileSync(filename, 'utf8').re
|
||||
var readJSON = tools.readJSON = filename => JSON.parse(read(filename));
|
||||
tools.readBase64 = filename => fs.readFileSync(filename).toString('base64');
|
||||
|
||||
// Convert JSON object to Coffeescript expression (via embedded JS).
|
||||
var constExpression = data => '`' + JSON.stringify(data).replace(/`/g, '\\`') + '`';
|
||||
tools.readHTML = function(filename) {
|
||||
var text = read(filename).replace(/^ +/gm, '').replace(/\r?\n/g, '');
|
||||
text = _template(text, _templateSettings)(pkg); // package.json data only; no recursive imports
|
||||
return tools.html(text);
|
||||
};
|
||||
|
||||
tools.multiline = function(text) {
|
||||
return text.replace(/\n+/g, '\n').split(/^/m).map(JSON.stringify).join(' +\n').replace(/`/g, '\\`');
|
||||
};
|
||||
|
||||
tools.importHTML = function(filename) {
|
||||
var text = read(`src/${filename}.html`).replace(/^ +/gm, '').replace(/\r?\n/g, '');
|
||||
text = _template(text, _templateSettings)(pkg); // variables only; no recursive imports
|
||||
return tools.html(text);
|
||||
};
|
||||
// Convert JSON object to Coffeescript expression (via embedded JS).
|
||||
var constExpression = data => '`' + JSON.stringify(data).replace(/`/g, '\\`') + '`';
|
||||
|
||||
function TextStream(text) {
|
||||
this.text = text;
|
||||
@ -173,20 +175,44 @@ tools.html = function(template) {
|
||||
return `(innerHTML: ${output})`;
|
||||
};
|
||||
|
||||
tools.assert = function(flagFile, statement) {
|
||||
if (!readJSON(flagFile)) return '';
|
||||
tools.assert = function(statement) {
|
||||
return `throw new Error 'Assertion failed: ' + ${constExpression(statement)} unless ${statement}`;
|
||||
};
|
||||
|
||||
function resolvePath(filename, templateName) {
|
||||
if (filename[0] === '/') {
|
||||
return path.join(process.cwd(), filename);
|
||||
}
|
||||
var dir = path.dirname(templateName);
|
||||
var subdir = path.basename(templateName).replace(/\.[^.]+$/, '');
|
||||
if (fs.readdirSync(dir).indexOf(subdir) >= 0) {
|
||||
return path.join(dir, subdir, filename);
|
||||
} else {
|
||||
return path.join(dir, filename);
|
||||
}
|
||||
}
|
||||
|
||||
function wrapTool(tool, templateName) {
|
||||
return function(filename) {
|
||||
return tool(resolvePath(filename, templateName));
|
||||
};
|
||||
}
|
||||
|
||||
// Import variables from package.json.
|
||||
var pkg = readJSON('package.json');
|
||||
|
||||
function interpolate(text, data) {
|
||||
function interpolate(text, data, filename) {
|
||||
var context = {}, key;
|
||||
for (key in tools) context[key] = tools[key];
|
||||
for (key in pkg) context[key] = pkg[key];
|
||||
for (key in tools) {
|
||||
context[key] = /^read/.test(key) ? wrapTool(tools[key], filename) : tools[key];
|
||||
}
|
||||
for (key in pkg) {
|
||||
context[key] = pkg[key];
|
||||
}
|
||||
if (data) {
|
||||
for (key in data) context[key] = data[key];
|
||||
for (key in data) {
|
||||
context[key] = data[key];
|
||||
}
|
||||
}
|
||||
return _template(text, _templateSettings)(context);
|
||||
}
|
||||
@ -203,7 +229,7 @@ if (require.main === module) {
|
||||
}
|
||||
|
||||
var text = read(process.argv[2]);
|
||||
text = interpolate(text, data);
|
||||
text = interpolate(text, data, process.argv[2]);
|
||||
fs.writeFileSync(process.argv[3], text);
|
||||
})();
|
||||
}
|
||||
|
||||