Make list of banners configurable.
This commit is contained in:
parent
6a9508371e
commit
5814dadcf7
@ -183,3 +183,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<textarea hidden name="jsWhitelist" class="field" spellcheck="false"></textarea>
|
<textarea hidden name="jsWhitelist" class="field" spellcheck="false"></textarea>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset>
|
||||||
|
<legend>Known Banners</legend>
|
||||||
|
<div>List of known banners, used for click-to-change feature.</div>
|
||||||
|
<textarea hidden name="knownBanners" class="field" spellcheck="false"></textarea>
|
||||||
|
</fieldset>
|
||||||
|
|||||||
@ -1,6 +1,4 @@
|
|||||||
Banner =
|
Banner =
|
||||||
banners: `<%= JSON.stringify(readJSON('banners.json')) %>`
|
|
||||||
|
|
||||||
init: ->
|
init: ->
|
||||||
if Conf['Custom Board Titles']
|
if Conf['Custom Board Titles']
|
||||||
@db = new DataBoard 'customTitles', null, true
|
@db = new DataBoard 'customTitles', null, true
|
||||||
@ -44,7 +42,7 @@ Banner =
|
|||||||
cb:
|
cb:
|
||||||
toggle: ->
|
toggle: ->
|
||||||
unless Banner.choices?.length
|
unless Banner.choices?.length
|
||||||
Banner.choices = Banner.banners.slice()
|
Banner.choices = Conf['knownBanners'].split(',').slice()
|
||||||
i = Math.floor(Banner.choices.length * Math.random())
|
i = Math.floor(Banner.choices.length * Math.random())
|
||||||
banner = Banner.choices.splice i, 1
|
banner = Banner.choices.splice i, 1
|
||||||
$('img', @parentNode).src = "//s.4cdn.org/image/title/#{banner}"
|
$('img', @parentNode).src = "//s.4cdn.org/image/title/#{banner}"
|
||||||
|
|||||||
@ -1181,3 +1181,5 @@ Config =
|
|||||||
fourchanImageHost: 'i.4cdn.org'
|
fourchanImageHost: 'i.4cdn.org'
|
||||||
|
|
||||||
hiddenPSAList: [{}]
|
hiddenPSAList: [{}]
|
||||||
|
|
||||||
|
knownBanners: '<%= readJSON('banners.json').join(',') %>'
|
||||||
|
|||||||
@ -659,7 +659,8 @@ div[data-checked="false"] > .suboption-list {
|
|||||||
height: 150px;
|
height: 150px;
|
||||||
}
|
}
|
||||||
.section-advanced textarea[name="archiveLists"],
|
.section-advanced textarea[name="archiveLists"],
|
||||||
.section-advanced textarea[name="externalCatalogURLs"] {
|
.section-advanced textarea[name="externalCatalogURLs"],
|
||||||
|
.section-advanced textarea[name="knownBanners"] {
|
||||||
height: 75px;
|
height: 75px;
|
||||||
}
|
}
|
||||||
.section-advanced .archive-cell {
|
.section-advanced .archive-cell {
|
||||||
|
|||||||
@ -15,5 +15,5 @@ for ext in ['jpg', 'png', 'gif']:
|
|||||||
print(banner, status)
|
print(banner, status)
|
||||||
if status == 200:
|
if status == 200:
|
||||||
banners.append(banner)
|
banners.append(banner)
|
||||||
with open('src/Miscellaneous/Banner/banners.json', 'w') as f:
|
with open('src/config/banners.json', 'w') as f:
|
||||||
f.write(json.dumps(banners))
|
f.write(json.dumps(banners))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user