Make HTML templates output Javascript, part 3. #829
This commit is contained in:
parent
375c717dea
commit
fba3d2d18e
@ -283,7 +283,7 @@ Filter =
|
|||||||
$('span', notice.el).textContent = "#{notice.filters.length} MD5s filtered."
|
$('span', notice.el).textContent = "#{notice.filters.length} MD5s filtered."
|
||||||
else
|
else
|
||||||
msg = $.el 'div',
|
msg = $.el 'div',
|
||||||
<%= html('<span>MD5 filtered.</span> [<a href="javascript:;">show</a>] [<a href="javascript:;">undo</a>]') %>
|
`<%= html('<span>MD5 filtered.</span> [<a href="javascript:;">show</a>] [<a href="javascript:;">undo</a>]') %>`
|
||||||
notice = Filter.quickFilterMD5.notice = new Notice 'info', msg, undefined, ->
|
notice = Filter.quickFilterMD5.notice = new Notice 'info', msg, undefined, ->
|
||||||
delete Filter.quickFilterMD5.notice
|
delete Filter.quickFilterMD5.notice
|
||||||
notice.filters = [filter]
|
notice.filters = [filter]
|
||||||
|
|||||||
@ -139,7 +139,7 @@ ThreadHiding =
|
|||||||
a = $.el 'a',
|
a = $.el 'a',
|
||||||
className: "#{type}-thread-button"
|
className: "#{type}-thread-button"
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.extend a, <%= html('<span class="fa fa-?{type === "hide"}{minus}{plus}-square"></span>') %>
|
$.extend a, `<%= html('<span class="fa fa-?{type === "hide"}{minus}{plus}-square"></span>') %>`
|
||||||
a.dataset.fullID = thread.fullID
|
a.dataset.fullID = thread.fullID
|
||||||
$.on a, 'click', ThreadHiding.toggle
|
$.on a, 'click', ThreadHiding.toggle
|
||||||
a
|
a
|
||||||
|
|||||||
@ -11,7 +11,7 @@ Header =
|
|||||||
|
|
||||||
menuButton = $.el 'span',
|
menuButton = $.el 'span',
|
||||||
className: 'menu-button'
|
className: 'menu-button'
|
||||||
$.extend menuButton, <%= html('<i></i>') %>
|
$.extend menuButton, `<%= html('<i></i>') %>`
|
||||||
|
|
||||||
box = UI.checkbox
|
box = UI.checkbox
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ Header =
|
|||||||
setBoardList: ->
|
setBoardList: ->
|
||||||
Header.boardList = boardList = $.el 'span',
|
Header.boardList = boardList = $.el 'span',
|
||||||
id: 'board-list'
|
id: 'board-list'
|
||||||
$.extend boardList, <%= html(
|
$.extend boardList, `<%= html(
|
||||||
'<span id="custom-board-list"></span>' +
|
'<span id="custom-board-list"></span>' +
|
||||||
'<span id="full-board-list" hidden>' +
|
'<span id="full-board-list" hidden>' +
|
||||||
'<span class="hide-board-list-container brackets-wrap">' +
|
'<span class="hide-board-list-container brackets-wrap">' +
|
||||||
@ -151,7 +151,7 @@ Header =
|
|||||||
' ' +
|
' ' +
|
||||||
'<span class="boardList"></span>' +
|
'<span class="boardList"></span>' +
|
||||||
'</span>'
|
'</span>'
|
||||||
) %>
|
) %>`
|
||||||
|
|
||||||
btn = $('.hide-board-list-button', boardList)
|
btn = $('.hide-board-list-button', boardList)
|
||||||
$.on btn, 'click', Header.toggleBoardList
|
$.on btn, 'click', Header.toggleBoardList
|
||||||
@ -547,11 +547,11 @@ Header =
|
|||||||
return
|
return
|
||||||
|
|
||||||
el = $.el 'span',
|
el = $.el 'span',
|
||||||
<%= html(
|
`<%= html(
|
||||||
meta.name + ' needs your permission to show desktop notifications. ' +
|
meta.name + ' needs your permission to show desktop notifications. ' +
|
||||||
'[<a href="' + meta.faq + '#why-is-4chan-x-asking-for-permission-to-show-desktop-notifications" target="_blank">FAQ</a>]<br>' +
|
'[<a href="' + meta.faq + '#why-is-4chan-x-asking-for-permission-to-show-desktop-notifications" target="_blank">FAQ</a>]<br>' +
|
||||||
'<button>Authorize</button> or <button>Disable</button>'
|
'<button>Authorize</button> or <button>Disable</button>'
|
||||||
) %>
|
) %>`
|
||||||
[authorize, disable] = $$ 'button', el
|
[authorize, disable] = $$ 'button', el
|
||||||
$.on authorize, 'click', ->
|
$.on authorize, 'click', ->
|
||||||
Notification.requestPermission (status) ->
|
Notification.requestPermission (status) ->
|
||||||
|
|||||||
@ -85,7 +85,7 @@ Index =
|
|||||||
|
|
||||||
# Navigation links at top of index
|
# Navigation links at top of index
|
||||||
@navLinks = $.el 'div', className: 'navLinks json-index'
|
@navLinks = $.el 'div', className: 'navLinks json-index'
|
||||||
$.extend @navLinks, <%= readHTML('NavLinks.html') %>
|
$.extend @navLinks, `<%= readHTML('NavLinks.html') %>`
|
||||||
$('.cataloglink a', @navLinks).href = CatalogLinks.catalog()
|
$('.cataloglink a', @navLinks).href = CatalogLinks.catalog()
|
||||||
$('.archlistlink', @navLinks).hidden = true unless BoardConfig.isArchived(g.BOARD.ID)
|
$('.archlistlink', @navLinks).hidden = true unless BoardConfig.isArchived(g.BOARD.ID)
|
||||||
$.on $('#index-last-refresh a', @navLinks), 'click', @cb.refreshFront
|
$.on $('#index-last-refresh a', @navLinks), 'click', @cb.refreshFront
|
||||||
@ -134,7 +134,7 @@ Index =
|
|||||||
|
|
||||||
# Page list
|
# Page list
|
||||||
@pagelist = $.el 'div', className: 'pagelist json-index'
|
@pagelist = $.el 'div', className: 'pagelist json-index'
|
||||||
$.extend @pagelist, <%= readHTML('PageList.html') %>
|
$.extend @pagelist, `<%= readHTML('PageList.html') %>`
|
||||||
$('.cataloglink a', @pagelist).href = CatalogLinks.catalog()
|
$('.cataloglink a', @pagelist).href = CatalogLinks.catalog()
|
||||||
$.on @pagelist, 'click', @cb.pageNav
|
$.on @pagelist, 'click', @cb.pageNav
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ Index =
|
|||||||
el: $.el 'a',
|
el: $.el 'a',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
className: 'has-shortcut-text'
|
className: 'has-shortcut-text'
|
||||||
, <%= html('<span></span><span class="shortcut-text">Shift+click</span>') %>
|
, `<%= html('<span></span><span class="shortcut-text">Shift+click</span>') %>`
|
||||||
order: 20
|
order: 20
|
||||||
open: ({thread}) ->
|
open: ({thread}) ->
|
||||||
return false if Conf['Index Mode'] isnt 'catalog'
|
return false if Conf['Index Mode'] isnt 'catalog'
|
||||||
|
|||||||
@ -44,7 +44,7 @@ Settings =
|
|||||||
Settings.dialog = dialog = $.el 'div',
|
Settings.dialog = dialog = $.el 'div',
|
||||||
id: 'overlay'
|
id: 'overlay'
|
||||||
,
|
,
|
||||||
<%= readHTML('Settings.html') %>
|
`<%= readHTML('Settings.html') %>`
|
||||||
|
|
||||||
$.on $('.export', dialog), 'click', Settings.export
|
$.on $('.export', dialog), 'click', Settings.export
|
||||||
$.on $('.import', dialog), 'click', Settings.import
|
$.on $('.import', dialog), 'click', Settings.import
|
||||||
@ -112,16 +112,16 @@ Settings =
|
|||||||
$.onExists doc, '.adg-rects > .desktop', (ad) -> $.onExists ad, 'iframe', ->
|
$.onExists doc, '.adg-rects > .desktop', (ad) -> $.onExists ad, 'iframe', ->
|
||||||
url = Redirect.to 'thread', {boardID: 'qa', threadID: 362590}
|
url = Redirect.to 'thread', {boardID: 'qa', threadID: 362590}
|
||||||
cb $.el 'li',
|
cb $.el 'li',
|
||||||
<%= html(
|
`<%= html(
|
||||||
'To protect yourself from <a href="${url}" target="_blank">malicious ads</a>,' +
|
'To protect yourself from <a href="${url}" target="_blank">malicious ads</a>,' +
|
||||||
' you should <a href="https://github.com/gorhill/uBlock#ublock-origin" target="_blank">block ads</a> on 4chan.'
|
' you should <a href="https://github.com/gorhill/uBlock#ublock-origin" target="_blank">block ads</a> on 4chan.'
|
||||||
) %>
|
) %>`
|
||||||
|
|
||||||
main: (section) ->
|
main: (section) ->
|
||||||
warnings = $.el 'fieldset',
|
warnings = $.el 'fieldset',
|
||||||
hidden: true
|
hidden: true
|
||||||
,
|
,
|
||||||
<%= html('<legend>Warnings</legend><ul></ul>') %>
|
`<%= html('<legend>Warnings</legend><ul></ul>') %>`
|
||||||
addWarning = (item) ->
|
addWarning = (item) ->
|
||||||
$.add $('ul', warnings), item
|
$.add $('ul', warnings), item
|
||||||
warnings.hidden = false
|
warnings.hidden = false
|
||||||
@ -136,7 +136,7 @@ Settings =
|
|||||||
for key, arr of obj when arr instanceof Array
|
for key, arr of obj when arr instanceof Array
|
||||||
description = arr[1]
|
description = arr[1]
|
||||||
div = $.el 'div',
|
div = $.el 'div',
|
||||||
<%= html('<label><input type="checkbox" name="${key}">${key}</label><span class="description">: ${description}</span>') %>
|
`<%= html('<label><input type="checkbox" name="${key}">${key}</label><span class="description">: ${description}</span>') %>`
|
||||||
div.dataset.name = key
|
div.dataset.name = key
|
||||||
input = $ 'input', div
|
input = $ 'input', div
|
||||||
$.on input, 'change', $.cb.checked
|
$.on input, 'change', $.cb.checked
|
||||||
@ -154,11 +154,11 @@ Settings =
|
|||||||
|
|
||||||
for keyFS, obj of Config.main
|
for keyFS, obj of Config.main
|
||||||
fs = $.el 'fieldset',
|
fs = $.el 'fieldset',
|
||||||
<%= html('<legend>${keyFS}</legend>') %>
|
`<%= html('<legend>${keyFS}</legend>') %>`
|
||||||
addCheckboxes fs, obj
|
addCheckboxes fs, obj
|
||||||
if keyFS is 'Posting and Captchas'
|
if keyFS is 'Posting and Captchas'
|
||||||
$.add fs, $.el 'p',
|
$.add fs, $.el 'p',
|
||||||
<%= html('For more info on captcha options and issues, see the <a href="' + meta.captchaFAQ + '" target="_blank">captcha FAQ</a>.') %>
|
`<%= html('For more info on captcha options and issues, see the <a href="' + meta.captchaFAQ + '" target="_blank">captcha FAQ</a>.') %>`
|
||||||
$.add section, fs
|
$.add section, fs
|
||||||
addCheckboxes $('div[data-name="JSON Index"] > .suboption-list', section), Config.Index
|
addCheckboxes $('div[data-name="JSON Index"] > .suboption-list', section), Config.Index
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ Settings =
|
|||||||
return
|
return
|
||||||
|
|
||||||
div = $.el 'div',
|
div = $.el 'div',
|
||||||
<%= html('<button></button><span class="description">: Clear manually-hidden threads and posts on all boards. Reload the page to apply.') %>
|
`<%= html('<button></button><span class="description">: Clear manually-hidden threads and posts on all boards. Reload the page to apply.') %>`
|
||||||
button = $ 'button', div
|
button = $ 'button', div
|
||||||
$.get {hiddenThreads: {}, hiddenPosts: {}}, ({hiddenThreads, hiddenPosts}) ->
|
$.get {hiddenThreads: {}, hiddenPosts: {}}, ({hiddenThreads, hiddenPosts}) ->
|
||||||
hiddenNum = 0
|
hiddenNum = 0
|
||||||
@ -515,7 +515,7 @@ Settings =
|
|||||||
window.location.reload()
|
window.location.reload()
|
||||||
|
|
||||||
filter: (section) ->
|
filter: (section) ->
|
||||||
$.extend section, <%= readHTML('Filter-select.html') %>
|
$.extend section, `<%= readHTML('Filter-select.html') %>`
|
||||||
select = $ 'select', section
|
select = $ 'select', section
|
||||||
$.on select, 'change', Settings.selectFilter
|
$.on select, 'change', Settings.selectFilter
|
||||||
Settings.selectFilter.call select
|
Settings.selectFilter.call select
|
||||||
@ -534,12 +534,12 @@ Settings =
|
|||||||
$.add div, ta
|
$.add div, ta
|
||||||
return
|
return
|
||||||
filterTypes = Object.keys(Config.filter).filter((x) -> x isnt 'general').map (x, i) ->
|
filterTypes = Object.keys(Config.filter).filter((x) -> x isnt 'general').map (x, i) ->
|
||||||
<%= html('?{i}{,}<wbr>${x}') %>
|
`<%= html('?{i}{,}<wbr>${x}') %>`
|
||||||
$.extend div, <%= readHTML('Filter-guide.html') %>
|
$.extend div, `<%= readHTML('Filter-guide.html') %>`
|
||||||
$('.warning', div).hidden = Conf['Filter']
|
$('.warning', div).hidden = Conf['Filter']
|
||||||
|
|
||||||
sauce: (section) ->
|
sauce: (section) ->
|
||||||
$.extend section, <%= readHTML('Sauce.html') %>
|
$.extend section, `<%= readHTML('Sauce.html') %>`
|
||||||
$('.warning', section).hidden = Conf['Sauce']
|
$('.warning', section).hidden = Conf['Sauce']
|
||||||
ta = $ 'textarea', section
|
ta = $ 'textarea', section
|
||||||
$.get 'sauces', Conf['sauces'], (item) ->
|
$.get 'sauces', Conf['sauces'], (item) ->
|
||||||
@ -548,7 +548,7 @@ Settings =
|
|||||||
$.on ta, 'change', $.cb.value
|
$.on ta, 'change', $.cb.value
|
||||||
|
|
||||||
advanced: (section) ->
|
advanced: (section) ->
|
||||||
$.extend section, <%= readHTML('Advanced.html') %>
|
$.extend section, `<%= readHTML('Advanced.html') %>`
|
||||||
warning.hidden = Conf[warning.dataset.feature] for warning in $$ '.warning', section
|
warning.hidden = Conf[warning.dataset.feature] for warning in $$ '.warning', section
|
||||||
|
|
||||||
inputs = {}
|
inputs = {}
|
||||||
@ -702,7 +702,7 @@ Settings =
|
|||||||
textContent: archive[1]
|
textContent: archive[1]
|
||||||
}
|
}
|
||||||
|
|
||||||
$.extend td, <%= html('<select></select>') %>
|
$.extend td, `<%= html('<select></select>') %>`
|
||||||
select = td.firstElementChild
|
select = td.firstElementChild
|
||||||
if not (select.disabled = length is 1)
|
if not (select.disabled = length is 1)
|
||||||
# XXX GM can't into datasets
|
# XXX GM can't into datasets
|
||||||
@ -790,7 +790,7 @@ Settings =
|
|||||||
$.cb.checked.call @
|
$.cb.checked.call @
|
||||||
|
|
||||||
keybinds: (section) ->
|
keybinds: (section) ->
|
||||||
$.extend section, <%= readHTML('Keybinds.html') %>
|
$.extend section, `<%= readHTML('Keybinds.html') %>`
|
||||||
$('.warning', section).hidden = Conf['Keybinds']
|
$('.warning', section).hidden = Conf['Keybinds']
|
||||||
|
|
||||||
tbody = $ 'tbody', section
|
tbody = $ 'tbody', section
|
||||||
@ -798,7 +798,7 @@ Settings =
|
|||||||
inputs = {}
|
inputs = {}
|
||||||
for key, arr of Config.hotkeys
|
for key, arr of Config.hotkeys
|
||||||
tr = $.el 'tr',
|
tr = $.el 'tr',
|
||||||
<%= html('<td>${arr[1]}</td><td><input class="field"></td>') %>
|
`<%= html('<td>${arr[1]}</td><td><input class="field"></td>') %>`
|
||||||
input = $ 'input', tr
|
input = $ 'input', tr
|
||||||
input.name = key
|
input.name = key
|
||||||
input.spellcheck = false
|
input.spellcheck = false
|
||||||
|
|||||||
@ -43,7 +43,7 @@ Gallery =
|
|||||||
|
|
||||||
nodes.el = dialog = $.el 'div',
|
nodes.el = dialog = $.el 'div',
|
||||||
id: 'a-gallery'
|
id: 'a-gallery'
|
||||||
$.extend dialog, <%= readHTML('Gallery.html') %>
|
$.extend dialog, `<%= readHTML('Gallery.html') %>`
|
||||||
|
|
||||||
nodes[key] = $ value, dialog for key, value of {
|
nodes[key] = $ value, dialog for key, value of {
|
||||||
buttons: '.gal-buttons'
|
buttons: '.gal-buttons'
|
||||||
@ -388,7 +388,7 @@ Gallery =
|
|||||||
createSubEntries: ->
|
createSubEntries: ->
|
||||||
subEntries = (Gallery.menu.createSubEntry item for item in ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Stretch to Fit', 'Scroll to Post'])
|
subEntries = (Gallery.menu.createSubEntry item for item in ['Hide Thumbnails', 'Fit Width', 'Fit Height', 'Stretch to Fit', 'Scroll to Post'])
|
||||||
|
|
||||||
delayLabel = $.el 'label', <%= html('Slide Delay: <input type="number" name="Slide Delay" min="0" step="any" class="field">') %>
|
delayLabel = $.el 'label', `<%= html('Slide Delay: <input type="number" name="Slide Delay" min="0" step="any" class="field">') %>`
|
||||||
delayInput = delayLabel.firstElementChild
|
delayInput = delayLabel.firstElementChild
|
||||||
delayInput.value = Gallery.delay
|
delayInput.value = Gallery.delay
|
||||||
$.on delayInput, 'change', Gallery.cb.setDelay
|
$.on delayInput, 'change', Gallery.cb.setDelay
|
||||||
|
|||||||
@ -12,7 +12,7 @@ ImageExpand =
|
|||||||
Header.addShortcut 'expand-all', @EAI, 520
|
Header.addShortcut 'expand-all', @EAI, 520
|
||||||
$.on d, 'scroll visibilitychange', @cb.playVideos
|
$.on d, 'scroll visibilitychange', @cb.playVideos
|
||||||
@videoControls = $.el 'span', className: 'video-controls'
|
@videoControls = $.el 'span', className: 'video-controls'
|
||||||
$.extend @videoControls, <%= html(' <a href="javascript:;" title="You can also contract the video by dragging it to the left.">contract</a>') %>
|
$.extend @videoControls, `<%= html(' <a href="javascript:;" title="You can also contract the video by dragging it to the left.">contract</a>') %>`
|
||||||
|
|
||||||
Callbacks.Post.push
|
Callbacks.Post.push
|
||||||
name: 'Image Expansion'
|
name: 'Image Expansion'
|
||||||
|
|||||||
@ -17,7 +17,7 @@ ImageLoader =
|
|||||||
return unless Conf['Image Prefetching'] and g.VIEW in ['index', 'thread']
|
return unless Conf['Image Prefetching'] and g.VIEW in ['index', 'thread']
|
||||||
|
|
||||||
prefetch = $.el 'label',
|
prefetch = $.el 'label',
|
||||||
<%= html('<input type="checkbox" name="prefetch"> Prefetch Images') %>
|
`<%= html('<input type="checkbox" name="prefetch"> Prefetch Images') %>`
|
||||||
|
|
||||||
@el = prefetch.firstElementChild
|
@el = prefetch.firstElementChild
|
||||||
$.on @el, 'change', @toggle
|
$.on @el, 'change', @toggle
|
||||||
|
|||||||
@ -15,7 +15,7 @@ Metadata =
|
|||||||
className: 'webm-title'
|
className: 'webm-title'
|
||||||
el.dataset.index = i
|
el.dataset.index = i
|
||||||
$.extend el,
|
$.extend el,
|
||||||
<%= html('<a href="javascript:;"></a>') %>
|
`<%= html('<a href="javascript:;"></a>') %>`
|
||||||
$.add file.text, [$.tn(' '), el]
|
$.add file.text, [$.tn(' '), el]
|
||||||
$.one el.lastElementChild, 'mouseover focus', Metadata.load if el.children.length is 1
|
$.one el.lastElementChild, 'mouseover focus', Metadata.load if el.children.length is 1
|
||||||
return
|
return
|
||||||
|
|||||||
@ -29,7 +29,7 @@ Volume =
|
|||||||
volumeEntry = $.el 'label',
|
volumeEntry = $.el 'label',
|
||||||
title: 'Default volume for videos.'
|
title: 'Default volume for videos.'
|
||||||
$.extend volumeEntry,
|
$.extend volumeEntry,
|
||||||
<%= html('<input name="Default Volume" type="range" min="0" max="1" step="0.01" value="${Conf["Default Volume"]}"> Volume') %>
|
`<%= html('<input name="Default Volume" type="range" min="0" max="1" step="0.01" value="${Conf["Default Volume"]}"> Volume') %>`
|
||||||
|
|
||||||
@inputs =
|
@inputs =
|
||||||
unmute: unmuteEntry.firstElementChild
|
unmute: unmuteEntry.firstElementChild
|
||||||
|
|||||||
@ -6,7 +6,7 @@ Embedding =
|
|||||||
|
|
||||||
if Conf['Embedding'] and g.VIEW isnt 'archive'
|
if Conf['Embedding'] and g.VIEW isnt 'archive'
|
||||||
@dialog = UI.dialog 'embedding',
|
@dialog = UI.dialog 'embedding',
|
||||||
<%= readHTML('Embed.html') %>
|
`<%= readHTML('Embed.html') %>`
|
||||||
@media = $ '#media-embed', @dialog
|
@media = $ '#media-embed', @dialog
|
||||||
$.one d, '4chanXInitFinished', @ready
|
$.one d, '4chanXInitFinished', @ready
|
||||||
$.on d, 'IndexRefreshInternal', ->
|
$.on d, 'IndexRefreshInternal', ->
|
||||||
@ -62,7 +62,7 @@ Embedding =
|
|||||||
className: 'embedder'
|
className: 'embedder'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
,
|
,
|
||||||
<%= html('(<span>un</span>embed)') %>
|
`<%= html('(<span>un</span>embed)') %>`
|
||||||
|
|
||||||
embed.dataset[name] = value for name, value of {key, uid, options, href}
|
embed.dataset[name] = value for name, value of {key, uid, options, href}
|
||||||
|
|
||||||
@ -216,7 +216,7 @@ Embedding =
|
|||||||
regExp: /^[^?#]+\.(?:gif|png|jpg|jpeg|bmp)(?::\w+)?(?:[?#]|$)/i
|
regExp: /^[^?#]+\.(?:gif|png|jpg|jpeg|bmp)(?::\w+)?(?:[?#]|$)/i
|
||||||
style: ''
|
style: ''
|
||||||
el: (a) ->
|
el: (a) ->
|
||||||
$.el 'div', <%= html('<a target="_blank" href="${a.dataset.href}"><img src="${a.dataset.href}" style="max-width: 80vw; max-height: 80vh;"></a>') %>
|
$.el 'div', `<%= html('<a target="_blank" href="${a.dataset.href}"><img src="${a.dataset.href}" style="max-width: 80vw; max-height: 80vh;"></a>') %>`
|
||||||
,
|
,
|
||||||
key: 'video'
|
key: 'video'
|
||||||
regExp: /^[^?#]+\.(?:og[gv]|webm|mp4)(?:[?#]|$)/i
|
regExp: /^[^?#]+\.(?:og[gv]|webm|mp4)(?:[?#]|$)/i
|
||||||
|
|||||||
@ -93,7 +93,7 @@ DeleteLink =
|
|||||||
|
|
||||||
link.textContent = DeleteLink.linkText fileOnly
|
link.textContent = DeleteLink.linkText fileOnly
|
||||||
if resDoc.title is '4chan - Banned' # Ban/warn check
|
if resDoc.title is '4chan - Banned' # Ban/warn check
|
||||||
el = $.el 'span', <%= html('You can't delete posts because you are <a href="//www.4chan.org/banned" target="_blank">banned</a>.') %>
|
el = $.el 'span', `<%= html('You can't delete posts because you are <a href="//www.4chan.org/banned" target="_blank">banned</a>.') %>`
|
||||||
new Notice 'warning', el, 20
|
new Notice 'warning', el, 20
|
||||||
else if msg = resDoc.getElementById 'errmsg' # error!
|
else if msg = resDoc.getElementById 'errmsg' # error!
|
||||||
new Notice 'warning', msg.textContent, 20
|
new Notice 'warning', msg.textContent, 20
|
||||||
|
|||||||
@ -6,7 +6,7 @@ Menu =
|
|||||||
className: 'menu-button'
|
className: 'menu-button'
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
|
|
||||||
$.extend @button, <%= html('<i class="fa fa-angle-down"></i>') %>
|
$.extend @button, `<%= html('<i class="fa fa-angle-down"></i>') %>`
|
||||||
|
|
||||||
@menu = new UI.Menu 'post'
|
@menu = new UI.Menu 'post'
|
||||||
Callbacks.Post.push
|
Callbacks.Post.push
|
||||||
|
|||||||
@ -29,9 +29,9 @@ FileInfo =
|
|||||||
output.push if c of FileInfo.formatters
|
output.push if c of FileInfo.formatters
|
||||||
FileInfo.formatters[c].call post
|
FileInfo.formatters[c].call post
|
||||||
else
|
else
|
||||||
<%= html('${s}') %>
|
`<%= html('${s}') %>`
|
||||||
''
|
''
|
||||||
$.extend outputNode, <%= html('@{output}') %>
|
$.extend outputNode, `<%= html('@{output}') %>`
|
||||||
for a in $$ '.download-button', outputNode
|
for a in $$ '.download-button', outputNode
|
||||||
$.on a, 'click', ImageCommon.download
|
$.on a, 'click', ImageCommon.download
|
||||||
for a in $$ '.quick-filter-md5', outputNode
|
for a in $$ '.quick-filter-md5', outputNode
|
||||||
@ -39,25 +39,25 @@ FileInfo =
|
|||||||
return
|
return
|
||||||
|
|
||||||
formatters:
|
formatters:
|
||||||
t: -> <%= html('${this.file.url.match(/[^\/]*$/)[0]}') %>
|
t: -> `<%= html('${this.file.url.match(/[^\/]*$/)[0]}') %>`
|
||||||
T: -> <%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %>
|
T: -> `<%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %>`
|
||||||
l: -> <%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.n.call(this)}</a>') %>
|
l: -> `<%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.n.call(this)}</a>') %>`
|
||||||
L: -> <%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.N.call(this)}</a>') %>
|
L: -> `<%= html('<a href="${this.file.url}" target="_blank">&{FileInfo.formatters.N.call(this)}</a>') %>`
|
||||||
n: ->
|
n: ->
|
||||||
fullname = @file.name
|
fullname = @file.name
|
||||||
shortname = g.SITE.Build.shortFilename @file.name, @isReply
|
shortname = g.SITE.Build.shortFilename @file.name, @isReply
|
||||||
if fullname is shortname
|
if fullname is shortname
|
||||||
<%= html('${fullname}') %>
|
`<%= html('${fullname}') %>`
|
||||||
else
|
else
|
||||||
<%= html('<span class="fnswitch"><span class="fntrunc">${shortname}</span><span class="fnfull">${fullname}</span></span>') %>
|
`<%= html('<span class="fnswitch"><span class="fntrunc">${shortname}</span><span class="fnfull">${fullname}</span></span>') %>`
|
||||||
N: -> <%= html('${this.file.name}') %>
|
N: -> `<%= html('${this.file.name}') %>`
|
||||||
d: -> <%= html('<a href="${this.file.url}" download="${this.file.name}" class="fa fa-download download-button"></a>') %>
|
d: -> `<%= html('<a href="${this.file.url}" download="${this.file.name}" class="fa fa-download download-button"></a>') %>`
|
||||||
f: -> <%= html('<a href="javascript:;" class="fa fa-times quick-filter-md5"></a>') %>
|
f: -> `<%= html('<a href="javascript:;" class="fa fa-times quick-filter-md5"></a>') %>`
|
||||||
p: -> <%= html('?{this.file.isSpoiler}{Spoiler, }') %>
|
p: -> `<%= html('?{this.file.isSpoiler}{Spoiler, }') %>`
|
||||||
s: -> <%= html('${this.file.size}') %>
|
s: -> `<%= html('${this.file.size}') %>`
|
||||||
B: -> <%= html('${Math.round(this.file.sizeInBytes)} Bytes') %>
|
B: -> `<%= html('${Math.round(this.file.sizeInBytes)} Bytes') %>`
|
||||||
K: -> <%= html('${Math.round(this.file.sizeInBytes/1024)} KB') %>
|
K: -> `<%= html('${Math.round(this.file.sizeInBytes/1024)} KB') %>`
|
||||||
M: -> <%= html('${Math.round(this.file.sizeInBytes/1048576*100)/100} MB') %>
|
M: -> `<%= html('${Math.round(this.file.sizeInBytes/1048576*100)/100} MB') %>`
|
||||||
r: -> <%= html('${this.file.dimensions || "PDF"}') %>
|
r: -> `<%= html('${this.file.dimensions || "PDF"}') %>`
|
||||||
g: -> <%= html('?{this.file.tag}{, ${this.file.tag}}{}') %>
|
g: -> `<%= html('?{this.file.tag}{, ${this.file.tag}}{}') %>`
|
||||||
'%': -> <%= html('%') %>
|
'%': -> `<%= html('%') %>`
|
||||||
|
|||||||
@ -16,19 +16,19 @@ ModContact =
|
|||||||
$.add @nodes.post, moveNote
|
$.add @nodes.post, moveNote
|
||||||
|
|
||||||
template: (capcode) ->
|
template: (capcode) ->
|
||||||
<%= html(
|
`<%= html(
|
||||||
'<a href="https://www.4chan.org/feedback" target="_blank">feedback</a>&{ModContact.specific[capcode]()}'
|
'<a href="https://www.4chan.org/feedback" target="_blank">feedback</a>&{ModContact.specific[capcode]()}'
|
||||||
) %>
|
) %>`
|
||||||
|
|
||||||
specific:
|
specific:
|
||||||
Mod: -> <%= html(' <a href="https://www.4chan-x.net/4chan-irc.html" target="_blank">IRC</a>') %>
|
Mod: -> `<%= html(' <a href="https://www.4chan-x.net/4chan-irc.html" target="_blank">IRC</a>') %>`
|
||||||
Manager: -> ModContact.specific.Mod()
|
Manager: -> ModContact.specific.Mod()
|
||||||
Developer: -> <%= html(' <a href="https://github.com/4chan" target="_blank">github</a>') %>
|
Developer: -> `<%= html(' <a href="https://github.com/4chan" target="_blank">github</a>') %>`
|
||||||
Admin: -> <%= html(' <a href="https://twitter.com/hiroyuki_ni" target="_blank">twitter</a>') %>
|
Admin: -> `<%= html(' <a href="https://twitter.com/hiroyuki_ni" target="_blank">twitter</a>') %>`
|
||||||
|
|
||||||
moveNote:
|
moveNote:
|
||||||
qa: <%= html(
|
qa: `<%= html(
|
||||||
'Moving a thread to /qa/ does not imply mods will read it. If you wish to contact mods, use ' +
|
'Moving a thread to /qa/ does not imply mods will read it. If you wish to contact mods, use ' +
|
||||||
'<a href="https://www.4chan.org/feedback" target="_blank">feedback</a><span class="invisible"> (https://www.4chan.org/feedback)</span> or ' +
|
'<a href="https://www.4chan.org/feedback" target="_blank">feedback</a><span class="invisible"> (https://www.4chan.org/feedback)</span> or ' +
|
||||||
'<a href="https://www.4chan-x.net/4chan-irc.html" target="_blank">IRC</a><span class="invisible"> (https://www.4chan-x.net/4chan-irc.html)</span>.'
|
'<a href="https://www.4chan-x.net/4chan-irc.html" target="_blank">IRC</a><span class="invisible"> (https://www.4chan-x.net/4chan-irc.html)</span>.'
|
||||||
) %>
|
) %>`
|
||||||
|
|||||||
@ -56,7 +56,7 @@ PostJumper =
|
|||||||
classNext = 'next'
|
classNext = 'next'
|
||||||
span = $.el 'span',
|
span = $.el 'span',
|
||||||
className: 'postJumper'
|
className: 'postJumper'
|
||||||
$.extend span, <%= html('<a href="javascript:;" class="${classPrev}">${charPrev}</a><a href="javascript:;" class="${classNext}">${charNext}</a>') %>
|
$.extend span, `<%= html('<a href="javascript:;" class="${classPrev}">${charPrev}</a><a href="javascript:;" class="${classNext}">${charNext}</a>') %>`
|
||||||
span
|
span
|
||||||
|
|
||||||
scroll: (fromJumper, toJumper) ->
|
scroll: (fromJumper, toJumper) ->
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Report =
|
|||||||
id: 'archive-report'
|
id: 'archive-report'
|
||||||
hidden: true
|
hidden: true
|
||||||
,
|
,
|
||||||
<%= readHTML('ArchiveReport.html') %>
|
`<%= readHTML('ArchiveReport.html') %>`
|
||||||
enabled = $ '#archive-report-enabled', fieldset
|
enabled = $ '#archive-report-enabled', fieldset
|
||||||
reason = $ '#archive-report-reason', fieldset
|
reason = $ '#archive-report-reason', fieldset
|
||||||
submit = $ '#archive-report-submit', fieldset
|
submit = $ '#archive-report-submit', fieldset
|
||||||
|
|||||||
@ -16,7 +16,7 @@ ReplyPruning =
|
|||||||
el = $.el 'span',
|
el = $.el 'span',
|
||||||
title: 'Maximum number of replies to show.'
|
title: 'Maximum number of replies to show.'
|
||||||
,
|
,
|
||||||
<%= html(' <input type="number" name="Max Replies" min="0" step="1" value="${Conf["Max Replies"]}" class="field">') %>
|
`<%= html(' <input type="number" name="Max Replies" min="0" step="1" value="${Conf["Max Replies"]}" class="field">') %>`
|
||||||
$.prepend el, label
|
$.prepend el, label
|
||||||
|
|
||||||
@inputs =
|
@inputs =
|
||||||
|
|||||||
@ -9,11 +9,11 @@ ThreadStats =
|
|||||||
if Conf['Page Count in Stats']
|
if Conf['Page Count in Stats']
|
||||||
@[if g.SITE.isPrunedByAge?(g.BOARD) then 'showPurgePos' else 'showPage'] = true
|
@[if g.SITE.isPrunedByAge?(g.BOARD) then 'showPurgePos' else 'showPage'] = true
|
||||||
|
|
||||||
statsHTML = <%= html(
|
statsHTML = `<%= html(
|
||||||
'<span id="post-count">?</span> / <span id="file-count">?</span>' +
|
'<span id="post-count">?</span> / <span id="file-count">?</span>' +
|
||||||
'?{Conf["IP Count in Stats"] && g.SITE.hasIPCount}{ / <span id="ip-count">?</span>}' +
|
'?{Conf["IP Count in Stats"] && g.SITE.hasIPCount}{ / <span id="ip-count">?</span>}' +
|
||||||
'?{Conf["Page Count in Stats"]}{ / <span id="page-count">?</span>}'
|
'?{Conf["Page Count in Stats"]}{ / <span id="page-count">?</span>}'
|
||||||
) %>
|
) %>`
|
||||||
statsTitle = 'Posts / Files'
|
statsTitle = 'Posts / Files'
|
||||||
statsTitle += ' / IPs' if Conf['IP Count in Stats'] and g.SITE.hasIPCount
|
statsTitle += ' / IPs' if Conf['IP Count in Stats'] and g.SITE.hasIPCount
|
||||||
statsTitle += (if @showPurgePos then ' / Purge Position' else ' / Page') if Conf['Page Count in Stats']
|
statsTitle += (if @showPurgePos then ' / Purge Position' else ' / Page') if Conf['Page Count in Stats']
|
||||||
@ -27,7 +27,7 @@ ThreadStats =
|
|||||||
|
|
||||||
else
|
else
|
||||||
@dialog = sc = UI.dialog 'thread-stats',
|
@dialog = sc = UI.dialog 'thread-stats',
|
||||||
<%= html('<div class="move" title="${statsTitle}">&{statsHTML}</div>') %>
|
`<%= html('<div class="move" title="${statsTitle}">&{statsHTML}</div>') %>`
|
||||||
$.addClass doc, 'float'
|
$.addClass doc, 'float'
|
||||||
$.ready ->
|
$.ready ->
|
||||||
$.add d.body, sc
|
$.add d.body, sc
|
||||||
|
|||||||
@ -12,11 +12,11 @@ ThreadUpdater =
|
|||||||
if Conf['Updater and Stats in Header']
|
if Conf['Updater and Stats in Header']
|
||||||
@dialog = sc = $.el 'span',
|
@dialog = sc = $.el 'span',
|
||||||
id: 'updater'
|
id: 'updater'
|
||||||
$.extend sc, <%= html('<span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>
|
$.extend sc, `<%= html('<span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>`
|
||||||
Header.addShortcut 'updater', sc, 100
|
Header.addShortcut 'updater', sc, 100
|
||||||
else
|
else
|
||||||
@dialog = sc = UI.dialog 'updater',
|
@dialog = sc = UI.dialog 'updater',
|
||||||
<%= html('<div class="move"></div><span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>
|
`<%= html('<div class="move"></div><span id="update-status" class="empty"></span><span id="update-timer" class="empty" title="Update now"></span>') %>`
|
||||||
$.addClass doc, 'float'
|
$.addClass doc, 'float'
|
||||||
$.ready ->
|
$.ready ->
|
||||||
$.add d.body, sc
|
$.add d.body, sc
|
||||||
@ -31,7 +31,7 @@ ThreadUpdater =
|
|||||||
|
|
||||||
updateLink = $.el 'span',
|
updateLink = $.el 'span',
|
||||||
className: 'brackets-wrap updatelink'
|
className: 'brackets-wrap updatelink'
|
||||||
$.extend updateLink, <%= html('<a href="javascript:;">Update</a>') %>
|
$.extend updateLink, `<%= html('<a href="javascript:;">Update</a>') %>`
|
||||||
Main.ready ->
|
Main.ready ->
|
||||||
($.add navLinksBot, [$.tn(' '), updateLink] if (navLinksBot = $ '.navLinksBot'))
|
($.add navLinksBot, [$.tn(' '), updateLink] if (navLinksBot = $ '.navLinksBot'))
|
||||||
$.on updateLink.firstElementChild, 'click', @update
|
$.on updateLink.firstElementChild, 'click', @update
|
||||||
@ -50,7 +50,7 @@ ThreadUpdater =
|
|||||||
subEntries.push el: el
|
subEntries.push el: el
|
||||||
|
|
||||||
@settings = $.el 'span',
|
@settings = $.el 'span',
|
||||||
<%= html('<a href="javascript:;">Interval</a>') %>
|
`<%= html('<a href="javascript:;">Interval</a>') %>`
|
||||||
|
|
||||||
$.on @settings, 'click', @intervalShortcut
|
$.on @settings, 'click', @intervalShortcut
|
||||||
|
|
||||||
|
|||||||
@ -11,7 +11,7 @@ ThreadWatcher =
|
|||||||
|
|
||||||
@db = new DataBoard 'watchedThreads', @refresh, true
|
@db = new DataBoard 'watchedThreads', @refresh, true
|
||||||
@dbLM = new DataBoard 'watcherLastModified', null, true
|
@dbLM = new DataBoard 'watcherLastModified', null, true
|
||||||
@dialog = UI.dialog 'thread-watcher', <%= readHTML('ThreadWatcher.html') %>
|
@dialog = UI.dialog 'thread-watcher', `<%= readHTML('ThreadWatcher.html') %>`
|
||||||
@status = $ '#watcher-status', @dialog
|
@status = $ '#watcher-status', @dialog
|
||||||
@list = @dialog.lastElementChild
|
@list = @dialog.lastElementChild
|
||||||
@refreshButton = $ '.refresh', @dialog
|
@refreshButton = $ '.refresh', @dialog
|
||||||
@ -50,7 +50,7 @@ ThreadWatcher =
|
|||||||
el: $.el 'a',
|
el: $.el 'a',
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
className: 'has-shortcut-text'
|
className: 'has-shortcut-text'
|
||||||
, <%= html('<span></span><span class="shortcut-text">Alt+click</span>') %>
|
, `<%= html('<span></span><span class="shortcut-text">Alt+click</span>') %>`
|
||||||
order: 6
|
order: 6
|
||||||
open: ({thread}) ->
|
open: ({thread}) ->
|
||||||
return false if Conf['Index Mode'] isnt 'catalog'
|
return false if Conf['Index Mode'] isnt 'catalog'
|
||||||
|
|||||||
@ -12,9 +12,9 @@ Captcha.v2 =
|
|||||||
$.on d, 'CaptchaCount', @count.bind(@)
|
$.on d, 'CaptchaCount', @count.bind(@)
|
||||||
|
|
||||||
root = $.el 'div', className: 'captcha-root'
|
root = $.el 'div', className: 'captcha-root'
|
||||||
$.extend root, <%= html(
|
$.extend root, `<%= html(
|
||||||
'<div class="captcha-counter"><a href="javascript:;"></a></div>'
|
'<div class="captcha-counter"><a href="javascript:;"></a></div>'
|
||||||
) %>
|
) %>`
|
||||||
counter = $ '.captcha-counter > a', root
|
counter = $ '.captcha-counter > a', root
|
||||||
@nodes = {root, counter}
|
@nodes = {root, counter}
|
||||||
@count()
|
@count()
|
||||||
|
|||||||
@ -8,7 +8,7 @@ PassLink =
|
|||||||
|
|
||||||
passLink = $.el 'span',
|
passLink = $.el 'span',
|
||||||
className: 'brackets-wrap pass-link-container'
|
className: 'brackets-wrap pass-link-container'
|
||||||
$.extend passLink, <%= html('<a href="javascript:;">4chan Pass</a>') %>
|
$.extend passLink, `<%= html('<a href="javascript:;">4chan Pass</a>') %>`
|
||||||
$.on passLink.firstElementChild, 'click', ->
|
$.on passLink.firstElementChild, 'click', ->
|
||||||
window.open "//sys.#{location.hostname.split('.')[1]}.org/auth",
|
window.open "//sys.#{location.hostname.split('.')[1]}.org/auth",
|
||||||
Date.now()
|
Date.now()
|
||||||
|
|||||||
@ -72,7 +72,7 @@ QR =
|
|||||||
if (origToggle = $.id 'togglePostFormLink')
|
if (origToggle = $.id 'togglePostFormLink')
|
||||||
link = $.el 'h1',
|
link = $.el 'h1',
|
||||||
className: "qr-link-container"
|
className: "qr-link-container"
|
||||||
$.extend link, <%= html('<a href="javascript:;" class="qr-link">?{g.VIEW === "thread"}{Reply to Thread}{Start a Thread}</a>') %>
|
$.extend link, `<%= html('<a href="javascript:;" class="qr-link">?{g.VIEW === "thread"}{Reply to Thread}{Start a Thread}</a>') %>`
|
||||||
|
|
||||||
QR.link = link.firstElementChild
|
QR.link = link.firstElementChild
|
||||||
$.on link.firstChild, 'click', ->
|
$.on link.firstChild, 'click', ->
|
||||||
@ -85,7 +85,7 @@ QR =
|
|||||||
if g.VIEW is 'thread'
|
if g.VIEW is 'thread'
|
||||||
linkBot = $.el 'div',
|
linkBot = $.el 'div',
|
||||||
className: "brackets-wrap qr-link-container-bottom"
|
className: "brackets-wrap qr-link-container-bottom"
|
||||||
$.extend linkBot, <%= html('<a href="javascript:;" class="qr-link-bottom">Reply to Thread</a>') %>
|
$.extend linkBot, `<%= html('<a href="javascript:;" class="qr-link-bottom">Reply to Thread</a>') %>`
|
||||||
|
|
||||||
$.on linkBot.firstElementChild, 'click', ->
|
$.on linkBot.firstElementChild, 'click', ->
|
||||||
QR.open()
|
QR.open()
|
||||||
@ -243,10 +243,10 @@ QR =
|
|||||||
|
|
||||||
connectionError: ->
|
connectionError: ->
|
||||||
$.el 'span',
|
$.el 'span',
|
||||||
<%= html(
|
`<%= html(
|
||||||
'Connection error while posting. ' +
|
'Connection error while posting. ' +
|
||||||
'[<a href="' + meta.faq + '#connection-errors" target="_blank">More info</a>]'
|
'[<a href="' + meta.faq + '#connection-errors" target="_blank">More info</a>]'
|
||||||
) %>
|
) %>`
|
||||||
|
|
||||||
notifications: []
|
notifications: []
|
||||||
|
|
||||||
@ -363,7 +363,7 @@ QR =
|
|||||||
|
|
||||||
openError: ->
|
openError: ->
|
||||||
div = $.el 'div'
|
div = $.el 'div'
|
||||||
$.extend div, <%= html('Could not open file. [<a href="' + meta.faq + '#error-reading-metadata" target="_blank">More info</a>]') %>
|
$.extend div, `<%= html('Could not open file. [<a href="' + meta.faq + '#error-reading-metadata" target="_blank">More info</a>]') %>`
|
||||||
QR.error div
|
QR.error div
|
||||||
|
|
||||||
setFile: (e) ->
|
setFile: (e) ->
|
||||||
@ -490,7 +490,7 @@ QR =
|
|||||||
dialog: ->
|
dialog: ->
|
||||||
QR.nodes = nodes =
|
QR.nodes = nodes =
|
||||||
el: dialog = UI.dialog 'qr',
|
el: dialog = UI.dialog 'qr',
|
||||||
<%= readHTML('QuickReply.html') %>
|
`<%= readHTML('QuickReply.html') %>`
|
||||||
|
|
||||||
setNode = (name, query) ->
|
setNode = (name, query) ->
|
||||||
nodes[name] = $ query, dialog
|
nodes[name] = $ query, dialog
|
||||||
|
|||||||
@ -4,7 +4,7 @@ QR.post = class
|
|||||||
className: 'qr-preview'
|
className: 'qr-preview'
|
||||||
draggable: true
|
draggable: true
|
||||||
href: 'javascript:;'
|
href: 'javascript:;'
|
||||||
$.extend el, <%= html('<a class="remove fa fa-times-circle" title="Remove"></a><label class="qr-preview-spoiler"><input type="checkbox"> Spoiler</label><span></span>') %>
|
$.extend el, `<%= html('<a class="remove fa fa-times-circle" title="Remove"></a><label class="qr-preview-spoiler"><input type="checkbox"> Spoiler</label><span></span>') %>`
|
||||||
|
|
||||||
@nodes =
|
@nodes =
|
||||||
el: el
|
el: el
|
||||||
@ -177,7 +177,7 @@ QR.post = class
|
|||||||
|
|
||||||
error: (className, message, link) ->
|
error: (className, message, link) ->
|
||||||
div = $.el 'div', {className}
|
div = $.el 'div', {className}
|
||||||
$.extend div, <%= html('${message}?{link}{ [<a href="${link}" target="_blank">More info</a>]}<br>[<a href="javascript:;">delete post</a>] [<a href="javascript:;">delete all</a>]') %>
|
$.extend div, `<%= html('${message}?{link}{ [<a href="${link}" target="_blank">More info</a>]}<br>[<a href="javascript:;">delete post</a>] [<a href="javascript:;">delete all</a>]') %>`
|
||||||
(@errors or= []).push div
|
(@errors or= []).push div
|
||||||
[rm, rmAll] = $$ 'a', div
|
[rm, rmAll] = $$ 'a', div
|
||||||
$.on div, 'click', =>
|
$.on div, 'click', =>
|
||||||
|
|||||||
@ -7,12 +7,12 @@ QuoteThreading =
|
|||||||
return unless Conf['Quote Threading'] and g.VIEW is 'thread'
|
return unless Conf['Quote Threading'] and g.VIEW is 'thread'
|
||||||
|
|
||||||
@controls = $.el 'label',
|
@controls = $.el 'label',
|
||||||
<%= html('<input id="threadingControl" name="Thread Quotes" type="checkbox"> Threading') %>
|
`<%= html('<input id="threadingControl" name="Thread Quotes" type="checkbox"> Threading') %>`
|
||||||
|
|
||||||
@threadNewLink = $.el 'span',
|
@threadNewLink = $.el 'span',
|
||||||
className: 'brackets-wrap threadnewlink'
|
className: 'brackets-wrap threadnewlink'
|
||||||
hidden: true
|
hidden: true
|
||||||
$.extend @threadNewLink, <%= html('<a href="javascript:;">Thread New Posts</a>') %>
|
$.extend @threadNewLink, `<%= html('<a href="javascript:;">Thread New Posts</a>') %>`
|
||||||
|
|
||||||
@input = $('input', @controls)
|
@input = $('input', @controls)
|
||||||
@input.checked = Conf['Thread Quotes']
|
@input.checked = Conf['Thread Quotes']
|
||||||
|
|||||||
@ -59,7 +59,7 @@ QuoteYou =
|
|||||||
label = $.el 'label',
|
label = $.el 'label',
|
||||||
className: 'toggle-you'
|
className: 'toggle-you'
|
||||||
,
|
,
|
||||||
<%= html('<input type="checkbox"> You') %>
|
`<%= html('<input type="checkbox"> You') %>`
|
||||||
input = $ 'input', label
|
input = $ 'input', label
|
||||||
$.on input, 'change', QuoteYou.menu.toggle
|
$.on input, 'change', QuoteYou.menu.toggle
|
||||||
Menu.menu?.addEntry
|
Menu.menu?.addEntry
|
||||||
|
|||||||
@ -149,10 +149,10 @@ class Fetcher
|
|||||||
greentext = text[0] is '>'
|
greentext = text[0] is '>'
|
||||||
text = text.replace /(\[\/?[a-z]+):lit(\])/g, '$1$2'
|
text = text.replace /(\[\/?[a-z]+):lit(\])/g, '$1$2'
|
||||||
text = for text2, j in text.split /(>>(?:>\/[a-z\d]+\/)?\d+)/g
|
text = for text2, j in text.split /(>>(?:>\/[a-z\d]+\/)?\d+)/g
|
||||||
<%= html('?{j % 2}{<span class="deadlink">${text2}</span>}{${text2}}') %>
|
`<%= html('?{j % 2}{<span class="deadlink">${text2}</span>}{${text2}}') %>`
|
||||||
text = <%= html('?{greentext}{<span class="quote">@{text}</span>}{@{text}}') %>
|
text = `<%= html('?{greentext}{<span class="quote">@{text}</span>}{@{text}}') %>`
|
||||||
text
|
text
|
||||||
comment = <%= html('@{comment}') %>
|
comment = `<%= html('@{comment}') %>`
|
||||||
|
|
||||||
@threadID = +data.thread_num
|
@threadID = +data.thread_num
|
||||||
o =
|
o =
|
||||||
@ -219,24 +219,24 @@ class Fetcher
|
|||||||
@insert post
|
@insert post
|
||||||
|
|
||||||
archiveTags:
|
archiveTags:
|
||||||
'\n': <%= html('<br>') %>
|
'\n': `<%= html('<br>') %>`
|
||||||
'[b]': <%= html('<b>') %>
|
'[b]': `<%= html('<b>') %>`
|
||||||
'[/b]': <%= html('</b>') %>
|
'[/b]': `<%= html('</b>') %>`
|
||||||
'[spoiler]': <%= html('<s>') %>
|
'[spoiler]': `<%= html('<s>') %>`
|
||||||
'[/spoiler]': <%= html('</s>') %>
|
'[/spoiler]': `<%= html('</s>') %>`
|
||||||
'[code]': <%= html('<pre class="prettyprint">') %>
|
'[code]': `<%= html('<pre class="prettyprint">') %>`
|
||||||
'[/code]': <%= html('</pre>') %>
|
'[/code]': `<%= html('</pre>') %>`
|
||||||
'[moot]': <%= html('<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">') %>
|
'[moot]': `<%= html('<div style="padding:5px;margin-left:.5em;border-color:#faa;border:2px dashed rgba(255,0,0,.1);border-radius:2px">') %>`
|
||||||
'[/moot]': <%= html('</div>') %>
|
'[/moot]': `<%= html('</div>') %>`
|
||||||
'[banned]': <%= html('<strong style="color: red;">') %>
|
'[banned]': `<%= html('<strong style="color: red;">') %>`
|
||||||
'[/banned]': <%= html('</strong>') %>
|
'[/banned]': `<%= html('</strong>') %>`
|
||||||
'[fortune]': (text) -> <%= html('<span class="fortune" style="color:${text.match(/#\\w+|$/)[0]}"><b>') %>
|
'[fortune]': (text) -> `<%= html('<span class="fortune" style="color:${text.match(/#\\w+|$/)[0]}"><b>') %>`
|
||||||
'[/fortune]': <%= html('</b></span>') %>
|
'[/fortune]': `<%= html('</b></span>') %>`
|
||||||
'[i]': <%= html('<span class="mu-i">') %>
|
'[i]': `<%= html('<span class="mu-i">') %>`
|
||||||
'[/i]': <%= html('</span>') %>
|
'[/i]': `<%= html('</span>') %>`
|
||||||
'[red]': <%= html('<span class="mu-r">') %>
|
'[red]': `<%= html('<span class="mu-r">') %>`
|
||||||
'[/red]': <%= html('</span>') %>
|
'[/red]': `<%= html('</span>') %>`
|
||||||
'[green]': <%= html('<span class="mu-g">') %>
|
'[green]': `<%= html('<span class="mu-g">') %>`
|
||||||
'[/green]': <%= html('</span>') %>
|
'[/green]': `<%= html('</span>') %>`
|
||||||
'[blue]': <%= html('<span class="mu-b">') %>
|
'[blue]': `<%= html('<span class="mu-b">') %>`
|
||||||
'[/blue]': <%= html('</span>') %>
|
'[/blue]': `<%= html('</span>') %>`
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
class Notice
|
class Notice
|
||||||
constructor: (type, content, @timeout, @onclose) ->
|
constructor: (type, content, @timeout, @onclose) ->
|
||||||
@el = $.el 'div',
|
@el = $.el 'div',
|
||||||
<%= html('<a href="javascript:;" class="close fa fa-times" title="Close"></a><div class="message"></div>') %>
|
`<%= html('<a href="javascript:;" class="close fa fa-times" title="Close"></a><div class="message"></div>') %>`
|
||||||
@el.style.opacity = 0
|
@el.style.opacity = 0
|
||||||
@setType type
|
@setType type
|
||||||
$.on @el.firstElementChild, 'click', @close
|
$.on @el.firstElementChild, 'click', @close
|
||||||
|
|||||||
@ -121,7 +121,7 @@ Main =
|
|||||||
$.set changes, ->
|
$.set changes, ->
|
||||||
if items['Show Updated Notifications'] ? true
|
if items['Show Updated Notifications'] ? true
|
||||||
el = $.el 'span',
|
el = $.el 'span',
|
||||||
<%= html(meta.name + ' has been updated to <a href="' + meta.changelog + '" target="_blank">version ${g.VERSION}</a>.') %>
|
`<%= html(meta.name + ' has been updated to <a href="' + meta.changelog + '" target="_blank">version ${g.VERSION}</a>.') %>`
|
||||||
new Notice 'info', el, 15
|
new Notice 'info', el, 15
|
||||||
|
|
||||||
parseURL: (site=g.SITE, url=location) ->
|
parseURL: (site=g.SITE, url=location) ->
|
||||||
@ -316,7 +316,7 @@ Main =
|
|||||||
|
|
||||||
if g.SITE.isIncomplete?()
|
if g.SITE.isIncomplete?()
|
||||||
msg = $.el 'div',
|
msg = $.el 'div',
|
||||||
<%= html('The page didn't load completely.<br>Some features may not work unless you <a href="javascript:;">reload</a>.') %>
|
`<%= html('The page didn't load completely.<br>Some features may not work unless you <a href="javascript:;">reload</a>.') %>`
|
||||||
$.on $('a', msg), 'click', -> location.reload()
|
$.on $('a', msg), 'click', -> location.reload()
|
||||||
new Notice 'warning', msg
|
new Notice 'warning', msg
|
||||||
|
|
||||||
@ -510,7 +510,7 @@ Main =
|
|||||||
$.addClass doc, 'tainted'
|
$.addClass doc, 'tainted'
|
||||||
if Conf['Disable Native Extension'] and !Main.isFirstRun
|
if Conf['Disable Native Extension'] and !Main.isFirstRun
|
||||||
msg = $.el 'div',
|
msg = $.el 'div',
|
||||||
<%= html('Failed to disable the native extension. You may need to <a href="' + meta.faq + '#blocking-native-extension" target="_blank">block it</a>.') %>
|
`<%= html('Failed to disable the native extension. You may need to <a href="' + meta.faq + '#blocking-native-extension" target="_blank">block it</a>.') %>`
|
||||||
new Notice 'error', msg
|
new Notice 'error', msg
|
||||||
|
|
||||||
unless errors instanceof Array
|
unless errors instanceof Array
|
||||||
@ -522,7 +522,7 @@ Main =
|
|||||||
return
|
return
|
||||||
|
|
||||||
div = $.el 'div',
|
div = $.el 'div',
|
||||||
<%= html('${errors.length} errors occurred.&{Main.reportLink(errors)} [<a href="javascript:;">show</a>]') %>
|
`<%= html('${errors.length} errors occurred.&{Main.reportLink(errors)} [<a href="javascript:;">show</a>]') %>`
|
||||||
$.on div.lastElementChild, 'click', ->
|
$.on div.lastElementChild, 'click', ->
|
||||||
[@textContent, logs.hidden] = if @textContent is 'show' then (
|
[@textContent, logs.hidden] = if @textContent is 'show' then (
|
||||||
['hide', false]
|
['hide', false]
|
||||||
@ -540,7 +540,7 @@ Main =
|
|||||||
parseError: (data, reportLink) ->
|
parseError: (data, reportLink) ->
|
||||||
c.error data.message, data.error.stack
|
c.error data.message, data.error.stack
|
||||||
message = $.el 'div',
|
message = $.el 'div',
|
||||||
<%= html('${data.message}?{reportLink}{&{reportLink}}') %>
|
`<%= html('${data.message}?{reportLink}{&{reportLink}}') %>`
|
||||||
error = $.el 'div',
|
error = $.el 'div',
|
||||||
textContent: "#{data.error.name or 'Error'}: #{data.error.message or 'see console for details'}"
|
textContent: "#{data.error.name or 'Error'}: #{data.error.message or 'see console for details'}"
|
||||||
lines = data.error.stack?.match(/\d+(?=:\d+\)?$)/mg)?.join().replace(/^/, ' at ') or ''
|
lines = data.error.stack?.match(/\d+(?=:\d+\)?$)/mg)?.join().replace(/^/, ' at ') or ''
|
||||||
@ -568,7 +568,7 @@ Main =
|
|||||||
addDetails '\n`' + data.html + '`' if data.html
|
addDetails '\n`' + data.html + '`' if data.html
|
||||||
details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths
|
details = details.replace /file:\/{3}.+\//g, '' # Remove local file paths
|
||||||
url = '<%= meta.newIssue %>'.replace('%title', encodeURIComponent title).replace('%details', encodeURIComponent details)
|
url = '<%= meta.newIssue %>'.replace('%title', encodeURIComponent title).replace('%details', encodeURIComponent details)
|
||||||
<%= html('<span class="report-error"> [<a href="${url}" target="_blank">report</a>]</span>') %>
|
`<%= html('<span class="report-error"> [<a href="${url}" target="_blank">report</a>]</span>') %>`
|
||||||
|
|
||||||
isThisPageLegit: ->
|
isThisPageLegit: ->
|
||||||
# not 404 error page or similar.
|
# not 404 error page or similar.
|
||||||
|
|||||||
@ -527,7 +527,7 @@ $.crxWorking = ->
|
|||||||
return true
|
return true
|
||||||
unless $.crxWarningShown
|
unless $.crxWarningShown
|
||||||
msg = $.el 'div',
|
msg = $.el 'div',
|
||||||
<%= html('4chan X seems to have been updated. You will need to <a href="javascript:;">reload</a> the page.') %>
|
`<%= html('4chan X seems to have been updated. You will need to <a href="javascript:;">reload</a> the page.') %>`
|
||||||
$.on $('a', msg), 'click', -> location.reload()
|
$.on $('a', msg), 'click', -> location.reload()
|
||||||
new Notice 'warning', msg
|
new Notice 'warning', msg
|
||||||
$.crxWarningShown = true
|
$.crxWarningShown = true
|
||||||
|
|||||||
@ -144,7 +144,7 @@ Build =
|
|||||||
else
|
else
|
||||||
"#{url}#q#{ID}"
|
"#{url}#q#{ID}"
|
||||||
|
|
||||||
postInfo = <%= readHTML('PostInfo.html') %>
|
postInfo = `<%= readHTML('PostInfo.html') %>`
|
||||||
|
|
||||||
### File Info ###
|
### File Info ###
|
||||||
|
|
||||||
@ -154,13 +154,13 @@ Build =
|
|||||||
shortFilename = Build.shortFilename file.name
|
shortFilename = Build.shortFilename file.name
|
||||||
fileThumb = if file.isSpoiler then Build.spoilerThumb(boardID) else file.thumbURL.replace(protocol, '')
|
fileThumb = if file.isSpoiler then Build.spoilerThumb(boardID) else file.thumbURL.replace(protocol, '')
|
||||||
|
|
||||||
fileBlock = <%= readHTML('File.html') %>
|
fileBlock = `<%= readHTML('File.html') %>`
|
||||||
|
|
||||||
### Whole Post ###
|
### Whole Post ###
|
||||||
|
|
||||||
postClass = if o.isReply then 'reply' else 'op'
|
postClass = if o.isReply then 'reply' else 'op'
|
||||||
|
|
||||||
wholePost = <%= readHTML('Post.html') %>
|
wholePost = `<%= readHTML('Post.html') %>`
|
||||||
|
|
||||||
container = $.el 'div',
|
container = $.el 'div',
|
||||||
className: "postContainer #{postClass}Container"
|
className: "postContainer #{postClass}Container"
|
||||||
@ -237,7 +237,7 @@ Build =
|
|||||||
postCount = data.replies + 1
|
postCount = data.replies + 1
|
||||||
fileCount = data.images + !!data.ext
|
fileCount = data.images + !!data.ext
|
||||||
|
|
||||||
container = $.el 'div', <%= readHTML('CatalogThread.html') %>
|
container = $.el 'div', `<%= readHTML('CatalogThread.html') %>`
|
||||||
$.before thread.OP.nodes.info, [container.childNodes...]
|
$.before thread.OP.nodes.info, [container.childNodes...]
|
||||||
|
|
||||||
for br in $$('br', thread.OP.nodes.comment) when br.previousSibling and br.previousSibling.nodeName is 'BR'
|
for br in $$('br', thread.OP.nodes.comment) when br.previousSibling and br.previousSibling.nodeName is 'BR'
|
||||||
@ -265,6 +265,6 @@ Build =
|
|||||||
|
|
||||||
link = Build.postURL thread.board.ID, thread.ID, data.no
|
link = Build.postURL thread.board.ID, thread.ID, data.no
|
||||||
$.el 'div', {className: 'catalog-reply'},
|
$.el 'div', {className: 'catalog-reply'},
|
||||||
<%= readHTML('CatalogReply.html') %>
|
`<%= readHTML('CatalogReply.html') %>`
|
||||||
|
|
||||||
SW.yotsuba.Build = Build
|
SW.yotsuba.Build = Build
|
||||||
|
|||||||
@ -168,7 +168,7 @@ tools.html = function(template) {
|
|||||||
if (stream.text) {
|
if (stream.text) {
|
||||||
throw new Error(`Unexpected characters in template (${stream.text}): ${template}`);
|
throw new Error(`Unexpected characters in template (${stream.text}): ${template}`);
|
||||||
}
|
}
|
||||||
return `\`{innerHTML: ${output}}\``;
|
return `{innerHTML: ${output}}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
function includesDir(templateName) {
|
function includesDir(templateName) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user