remove string interpolation from most HTML files
This commit is contained in:
parent
ab74ca72a9
commit
b263cd73ba
@ -1,7 +1,7 @@
|
||||
module.exports = (grunt) ->
|
||||
|
||||
importHTML = (filename) ->
|
||||
"\"\"\"#{grunt.file.read("src/General/html/#{filename}.html").replace(/^\s+|\s+$</gm, '').replace(/\n/g, '')}\"\"\""
|
||||
"'''#{grunt.file.read("src/General/html/#{filename}.html").replace(/^\s+|\s+$</gm, '').replace(/\n/g, '')}'''"
|
||||
|
||||
# Project configuration.
|
||||
grunt.initConfig
|
||||
|
||||
@ -74,11 +74,14 @@ Index =
|
||||
@searchInput = $ '#index-search', @navLinks
|
||||
@currentPage = @getCurrentPage()
|
||||
|
||||
returnlink = $ '#returnlink a', @navLinks
|
||||
returnlink.href = "/#{g.BOARD}/"
|
||||
|
||||
$.on d, 'scroll', Index.scroll
|
||||
$.on @pagelist, 'click', @cb.pageNav
|
||||
$.on @searchInput, 'input', @onSearchInput
|
||||
$.on $('#index-search-clear', @navLinks), 'click', @clearSearch
|
||||
$.on $('#returnlink a', @navLinks), 'click', Navigate.navigate
|
||||
$.on returnlink, 'click', Navigate.navigate
|
||||
$.on $('#cataloglink a', @navLinks), 'click', -> window.location = "//boards.4chan.org/#{g.BOARD}/catalog"
|
||||
|
||||
@update() if g.VIEW is 'index'
|
||||
|
||||
@ -267,9 +267,11 @@ Settings =
|
||||
$.add div, ta
|
||||
return
|
||||
div.innerHTML = <%= importHTML('Settings/Filter-guide') %>
|
||||
$('.warning', div).hidden = Conf['Filter']
|
||||
|
||||
sauce: (section) ->
|
||||
section.innerHTML = <%= importHTML('Settings/Sauce') %>
|
||||
$('.warning', section).hidden = Conf['Sauce']
|
||||
ta = $ 'textarea', section
|
||||
$.get 'sauces', Conf['sauces'], (item) ->
|
||||
ta.value = item['sauces']
|
||||
@ -277,6 +279,8 @@ Settings =
|
||||
|
||||
advanced: (section) ->
|
||||
section.innerHTML = <%= importHTML('Settings/Advanced') %>
|
||||
warning.hidden = Conf[warning.dataset.feature] for warning in $$ '.warning', section
|
||||
|
||||
items = {}
|
||||
inputs = {}
|
||||
for name in ['boardnav', 'time', 'backlink', 'fileInfo', 'favicon', 'sageEmoji', 'emojiPos', 'usercss']
|
||||
@ -305,9 +309,14 @@ Settings =
|
||||
Settings[key].call input
|
||||
return
|
||||
|
||||
$.on $('input[name=Interval]', section), 'change', ThreadUpdater.cb.interval
|
||||
$.on $('input[name="Custom CSS"]', section), 'change', Settings.togglecss
|
||||
$.on $.id('apply-css'), 'click', Settings.usercss
|
||||
interval = $ 'input[name="Interval"]', section
|
||||
customCSS = $ 'input[name="Custom CSS"]', section
|
||||
interval.value = Conf['Interval']
|
||||
customCSS.checked = Conf['Custom CSS']
|
||||
inputs['usercss'].disabled = !Conf['Custom CSS']
|
||||
$.on interval, 'change', ThreadUpdater.cb.interval
|
||||
$.on customCSS, 'change', Settings.togglecss
|
||||
$.on $.id('apply-css'), 'click', Settings.usercss
|
||||
|
||||
archBoards = {}
|
||||
for {name, boards, files, software, withCredentials} in Redirect.archives
|
||||
@ -434,6 +443,7 @@ Settings =
|
||||
|
||||
keybinds: (section) ->
|
||||
section.innerHTML = <%= importHTML('Settings/Keybinds') %>
|
||||
$('.warning', section).hidden = Conf['Keybinds']
|
||||
|
||||
tbody = $ 'tbody', section
|
||||
items = {}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<span class=brackets-wrap id=returnlink><a href=/#{g.BOARD}/>Return</a></span>
|
||||
<span class=brackets-wrap id=returnlink><a href=javascript:;>Return</a></span>
|
||||
<span class=brackets-wrap id=cataloglink><a href=javascript:;>Catalog</a></span>
|
||||
<span class=brackets-wrap id=bottomlink><a href="#bottom">Bottom</a></span>
|
||||
<span class=brackets-wrap id="index-last-refresh"><time title="Last index refresh">...</time></span>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<fieldset>
|
||||
<legend>Archiver</legend>
|
||||
<div class="warning" #{if Conf['404 Redirect'] then 'hidden' else ''}><code>404 Redirect</code> is disabled.</div>
|
||||
<div class="warning" data-feature='404 Redirect'><code>404 Redirect</code> is disabled.</div>
|
||||
<select id='archive-board-select'></select>
|
||||
<table id='archive-table'>
|
||||
<thead>
|
||||
@ -38,7 +38,7 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Time Formatting <span class=warning #{if Conf['Time Formatting'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<legend>Time Formatting <span class=warning data-feature='Time Formatting'>is disabled.</span></legend>
|
||||
<div><input name=time class=field spellcheck=false>: <span class=time-preview></span></div>
|
||||
<div>Supported <a href=//en.wikipedia.org/wiki/Date_%28Unix%29#Formatting>format specifiers</a>:</div>
|
||||
<div>Day: <code>%a</code>, <code>%A</code>, <code>%d</code>, <code>%e</code></div>
|
||||
@ -50,12 +50,12 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Quote Backlinks formatting <span class=warning #{if Conf['Quote Backlinks'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<legend>Quote Backlinks formatting <span class=warning data-feature='Quote Backlinks'>is disabled.</span></legend>
|
||||
<div><input name=backlink class=field spellcheck=false>: <span class=backlink-preview></span></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>File Info Formatting <span class=warning #{if Conf['File Info Formatting'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<legend>File Info Formatting <span class=warning data-feature='File Info Formatting'>is disabled.</span></legend>
|
||||
<div><input name=fileInfo class=field spellcheck=false>: <span class='fileText file-info-preview'></span></div>
|
||||
<div>Link: <code>%l</code> (truncated), <code>%L</code> (untruncated), <code>%T</code> (Unix timestamp)</div>
|
||||
<div>Original file name: <code>%n</code> (truncated), <code>%N</code> (untruncated), <code>%t</code> (Unix timestamp)</div>
|
||||
@ -82,7 +82,7 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Unread Favicon <span class=warning #{if Conf['Unread Favicon'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<legend>Unread Favicon <span class=warning data-feature='Unread Favicon'>is disabled.</span></legend>
|
||||
<select name=favicon>
|
||||
<option value=ferongr>ferongr</option>
|
||||
<option value=xat->xat-</option>
|
||||
@ -95,7 +95,7 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Emoji <span class=warning #{if Conf['Emoji'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<legend>Emoji <span class=warning data-feature='Emoji'>is disabled.</span></legend>
|
||||
<div>
|
||||
Sage Icon: <select name=sageEmoji>
|
||||
<option value="4chan SS">4chan SS</option>
|
||||
@ -112,16 +112,16 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Thread Updater <span class=warning #{if Conf['Thread Updater'] then 'hidden' else ''}>is disabled.</span></legend>
|
||||
<legend>Thread Updater <span class=warning data-feature='Thread Updater'>is disabled.</span></legend>
|
||||
<div>
|
||||
Interval: <input type=number name=Interval class=field min=1 value=#{Conf['Interval']}>
|
||||
Interval: <input type=number name=Interval class=field min=1>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>
|
||||
<label><input type=checkbox name='Custom CSS' #{if Conf['Custom CSS'] then 'checked' else ''}> Custom CSS</label>
|
||||
<label><input type=checkbox name='Custom CSS'> Custom CSS</label>
|
||||
</legend>
|
||||
<button id=apply-css>Apply CSS</button>
|
||||
<textarea name=usercss class=field spellcheck=false #{if Conf['Custom CSS'] then '' else 'disabled'}></textarea>
|
||||
</fieldset>
|
||||
<textarea name=usercss class=field spellcheck=false></textarea>
|
||||
</fieldset>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class=warning #{if Conf['Filter'] then 'hidden' else ''}><code>Filter</code> is disabled.</div>
|
||||
<div class=warning><code>Filter</code> is disabled.</div>
|
||||
<p>
|
||||
Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions">regular expressions</a>, one per line.<br>
|
||||
Lines starting with a <code>#</code> will be ignored.<br>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<div class=warning #{if Conf['Keybinds'] then 'hidden' else ''}><code>Keybinds</code> are disabled.</div>
|
||||
<div class=warning><code>Keybinds</code> are disabled.</div>
|
||||
<div>Allowed keys: <kbd>a-z</kbd>, <kbd>0-9</kbd>, <kbd>Ctrl</kbd>, <kbd>Shift</kbd>, <kbd>Alt</kbd>, <kbd>Meta</kbd>, <kbd>Enter</kbd>, <kbd>Esc</kbd>, <kbd>Up</kbd>, <kbd>Down</kbd>, <kbd>Right</kbd>, <kbd>Left</kbd>.</div>
|
||||
<div>Press <kbd>Backspace</kbd> to disable a keybind.</div>
|
||||
<table><tbody>
|
||||
<tr><th>Actions</th><th>Keybinds</th></tr>
|
||||
</tbody></table>
|
||||
</tbody></table>
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
<div class=warning #{if Conf['Sauce'] then 'hidden' else ''}><code>Sauce</code> is disabled.</div>
|
||||
<div class=warning><code>Sauce</code> is disabled.</div>
|
||||
<div>Lines starting with a <code>#</code> will be ignored.</div>
|
||||
<div>You can specify a display text by appending <code>;text:[text]</code> to the URL.</div>
|
||||
<ul>These parameters will be replaced by their corresponding values:
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
<a class=reset>Reset Settings</a> | 
|
||||
<input type=file hidden>
|
||||
<a href='<%= meta.page %>' target=_blank><%= meta.name %></a> | 
|
||||
<a href='<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' target=_blank>#{g.VERSION}</a> | 
|
||||
<a href='<%= meta.repo %>blob/<%= meta.mainBranch %>/CHANGELOG.md' target=_blank><%= version %></a> | 
|
||||
<a href='<%= meta.repo %>issues' target=_blank>Issues</a> | 
|
||||
<a href=javascript:; class='close fa fa-times' title=Close></a>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user