Fix some things.
This commit is contained in:
parent
1a4871a01e
commit
f1d1aca203
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -805,21 +805,23 @@ Settings =
|
||||
setting = Conf[type]
|
||||
i = setting.length
|
||||
|
||||
test = type is g.MASCOTSTRING
|
||||
|
||||
while i--
|
||||
name = setting[i]
|
||||
continue unless Mascots[name].category is @name
|
||||
setting.remove name
|
||||
continue unless test
|
||||
setting.splice i, 1
|
||||
continue unless type is g.MASCOTSTRING
|
||||
$.rmClass $.id(name), 'enabled'
|
||||
if Conf['mascot'] is name
|
||||
cb = MascotTools.toggle
|
||||
$.set type, setting
|
||||
|
||||
else
|
||||
Conf["Hidden Categories"].remove @name
|
||||
$.remove Conf["Hidden Categories"], @name
|
||||
|
||||
$.set "Hidden Categories", Conf["Hidden Categories"]
|
||||
|
||||
cb() if cb
|
||||
|
||||
edit: (e) ->
|
||||
e.stopPropagation()
|
||||
MascotTools.dialog @parentElement.parentElement.id
|
||||
@ -832,7 +834,7 @@ Settings =
|
||||
if Conf['mascot'] is name
|
||||
MascotTools.toggle()
|
||||
for type in ["Enabled Mascots", "Enabled Mascots sfw", "Enabled Mascots nsfw"]
|
||||
Conf[type].remove name
|
||||
$.remove Conf[type], name
|
||||
$.set type, Conf[type]
|
||||
Conf["Deleted Mascots"].push name
|
||||
$.set "Deleted Mascots", Conf["Deleted Mascots"]
|
||||
@ -861,20 +863,22 @@ Settings =
|
||||
|
||||
restore: ->
|
||||
if confirm "Are you sure you want to restore \"#{@id}\"?"
|
||||
Conf["Deleted Mascots"].remove @id
|
||||
$.remove Conf["Deleted Mascots"], @id
|
||||
$.set "Deleted Mascots", Conf["Deleted Mascots"]
|
||||
$.rm @
|
||||
|
||||
select: ->
|
||||
if Conf[g.MASCOTSTRING].remove @id
|
||||
string = g.MASCOTSTRING
|
||||
if $.remove Conf[string], @id
|
||||
if Conf['mascot'] is @id
|
||||
MascotTools.toggle()
|
||||
else
|
||||
Conf['mascot'] = @id
|
||||
Conf[g.MASCOTSTRING].push @id
|
||||
Conf[string].push @id
|
||||
MascotTools.change Mascots[@id]
|
||||
$.toggleClass @, 'enabled'
|
||||
$.set g.MASCOTSTRING, Conf[g.MASCOTSTRING]
|
||||
$.set string, Conf[string]
|
||||
$.set string, Conf[string]
|
||||
|
||||
theme:
|
||||
select: ->
|
||||
|
||||
@ -9,27 +9,27 @@ body,
|
||||
button,
|
||||
input,
|
||||
textarea {
|
||||
font-size: #{parseInt _conf["Font Size"], 10}px;
|
||||
font-size: #{parseInt Conf["Font Size"], 10}px;
|
||||
}
|
||||
#boardTitle,
|
||||
.boardTitle a {
|
||||
font-size: #{parseInt(_conf["Font Size"], 10) + 10}px;
|
||||
font-size: #{parseInt(Conf["Font Size"], 10) + 10}px;
|
||||
}
|
||||
.boardSubtitle,
|
||||
.boardSubtitle a {
|
||||
font-size: #{parseInt(_conf["Font Size"], 10) - 1}px;
|
||||
font-size: #{parseInt(Conf["Font Size"], 10) - 1}px;
|
||||
}
|
||||
body,
|
||||
button,
|
||||
input,
|
||||
textarea {
|
||||
font-family: #{_conf["Font"]};
|
||||
font-family: #{Conf["Font"]};
|
||||
}
|
||||
body {
|
||||
padding: 0 #{parseInt(_conf["Right Thread Padding"], 10) + editSpace["right"]}px 0 #{parseInt(_conf["Left Thread Padding"], 10) + editSpace["left"]}px;
|
||||
padding: 0 #{parseInt(Conf["Right Thread Padding"], 10) + editSpace["right"]}px 0 #{parseInt(Conf["Left Thread Padding"], 10) + editSpace["left"]}px;
|
||||
}
|
||||
.board > .thread {
|
||||
margin: #{parseInt _conf["Top Thread Padding"], 10}px 0 #{parseInt _conf["Bottom Thread Padding"], 10}px 0;
|
||||
margin: #{parseInt Conf["Top Thread Padding"], 10}px 0 #{parseInt Conf["Bottom Thread Padding"], 10}px 0;
|
||||
}
|
||||
.post,
|
||||
.summary {
|
||||
@ -39,23 +39,23 @@ body {
|
||||
margin-bottom: -#{Conf["Post Spacing"]}px;
|
||||
}
|
||||
.thread > .replyContainer > .reply.post {
|
||||
border-width: #{if _conf['Post Spacing'] is "0" then "1px 1px 0 1px" else '1px'};
|
||||
border-width: #{if Conf['Post Spacing'] is "0" then "1px 1px 0 1px" else '1px'};
|
||||
}
|
||||
#post-preview,
|
||||
.postMessage {
|
||||
margin: #{_conf['Vertical Post Padding']}px #{_conf['Horizontal Post Padding']}px;
|
||||
margin: #{Conf['Vertical Post Padding']}px #{Conf['Horizontal Post Padding']}px;
|
||||
}
|
||||
:root:not(fourchan-ss-navigation):not(.pagination-on-side) .pagelist,
|
||||
:root:not(fourchan-ss-navigation) #header-bar {
|
||||
margin-left: #{parseInt(_conf["Left Thread Padding"], 10) + editSpace["right"]}px;
|
||||
margin-right: #{parseInt(_conf["Right Thread Padding"], 10) + editSpace["left"]}px;
|
||||
margin-left: #{parseInt(Conf["Left Thread Padding"], 10) + editSpace["right"]}px;
|
||||
margin-right: #{parseInt(Conf["Right Thread Padding"], 10) + editSpace["left"]}px;
|
||||
}
|
||||
/* Emoji */
|
||||
a.useremail:last-of-type::before {
|
||||
margin-right: #{parseInt _conf['Emoji Spacing']}px;
|
||||
margin-right: #{parseInt Conf['Emoji Spacing']}px;
|
||||
}
|
||||
a.useremail:last-of-type::after {
|
||||
margin-left: #{parseInt _conf['Emoji Spacing']}px;
|
||||
margin-left: #{parseInt Conf['Emoji Spacing']}px;
|
||||
}
|
||||
#mascot {
|
||||
opacity: #{Conf['Mascot Opacity']};
|
||||
|
||||
@ -1,16 +1,13 @@
|
||||
String::capitalize = ->
|
||||
@charAt(0).toUpperCase() + @slice(1);
|
||||
|
||||
String::contains = (string) ->
|
||||
@indexOf(string) > -1
|
||||
|
||||
Array::contains = (object) ->
|
||||
@indexOf(object) > -1
|
||||
Array::contains = (value) ->
|
||||
@indexOf(value) > -1
|
||||
|
||||
Array::indexOf = (object) ->
|
||||
Array::indexOf = (value) ->
|
||||
i = @length
|
||||
while i--
|
||||
return i if @[i] is object
|
||||
return i if @[i] is value
|
||||
return i
|
||||
|
||||
# loosely follows the jquery api:
|
||||
@ -411,5 +408,13 @@ $.set = do ->
|
||||
return
|
||||
<% } %>
|
||||
|
||||
$.remove = (array, value) ->
|
||||
i = array.indexOf value
|
||||
if i > -1
|
||||
array.splice i, 1
|
||||
true
|
||||
else
|
||||
false
|
||||
|
||||
$$ = (selector, root=d.body) ->
|
||||
[root.querySelectorAll(selector)...]
|
||||
|
||||
@ -3,7 +3,6 @@ Emoji =
|
||||
Emoji.icons['PlanNine'] = Emoji.icons['Plan9']
|
||||
|
||||
css: ->
|
||||
_conf = Conf
|
||||
css = []
|
||||
|
||||
for key, category of Emoji.icons
|
||||
|
||||
@ -217,7 +217,7 @@ JSColor =
|
||||
elements = ['box', 'boxB', 'pad', 'padB', 'padM', 'sld', 'sldB', 'sldM', 'btn']
|
||||
p = {}
|
||||
for item in elements
|
||||
p[item] = $.el 'div', {className: "jsc#{item.capitalize()}"}
|
||||
p[item] = $.el 'div', {className: "jsc#{item.charAt(0).toUpperCase() + item.slice 1}"}
|
||||
|
||||
p.btnS = $.el 'span', {className: 'jscBtnS'}
|
||||
p.btnT = $.tn 'Close'
|
||||
|
||||
@ -50,10 +50,10 @@ MascotTools =
|
||||
enabled = Conf[string]
|
||||
return unless len = enabled.length
|
||||
|
||||
name = enabled[Math.floor(Math.random() * len)]
|
||||
name = enabled[i = Math.floor(Math.random() * len)]
|
||||
|
||||
unless mascot = Mascots[name]
|
||||
enabled.remove name
|
||||
enabled.splice i, 1
|
||||
el.src = "" if el
|
||||
$.set string, Conf[string] = enabled
|
||||
return MascotTools.toggle()
|
||||
@ -256,9 +256,7 @@ MascotTools =
|
||||
mascot.category = MascotTools.categories[0]
|
||||
|
||||
if Mascots[name]
|
||||
|
||||
if Conf["Deleted Mascots"].contains name
|
||||
Conf["Deleted Mascots"].remove name
|
||||
if $.remove Conf["Deleted Mascots"], name
|
||||
$.set "Deleted Mascots", Conf["Deleted Mascots"]
|
||||
|
||||
else
|
||||
@ -311,7 +309,7 @@ MascotTools =
|
||||
name = imported["Mascot"]
|
||||
delete imported["Mascot"]
|
||||
|
||||
if Mascots[name] and not Conf["Deleted Mascots"].remove name
|
||||
if Mascots[name] and not $.remove Conf["Deleted Mascots"], name
|
||||
unless confirm "A mascot with this name already exists. Would you like to over-write?"
|
||||
return
|
||||
|
||||
|
||||
@ -149,14 +149,12 @@ Style =
|
||||
layout: """<%= grunt.file.read('src/General/css/layout.css').replace(/\s+/g, ' ').trim() %>"""
|
||||
|
||||
dynamic: ->
|
||||
_conf = Conf
|
||||
|
||||
sidebarLocation = if _conf["Sidebar Location"] is "left"
|
||||
sidebarLocation = if Conf["Sidebar Location"] is "left"
|
||||
["left", "right"]
|
||||
else
|
||||
["right", "left" ]
|
||||
|
||||
if _conf['editMode'] is "theme"
|
||||
if Conf['editMode'] is "theme"
|
||||
editSpace = {}
|
||||
editSpace[sidebarLocation[1]] = 300
|
||||
editSpace[sidebarLocation[0]] = 0
|
||||
@ -185,15 +183,14 @@ Style =
|
||||
|
||||
iconPositions: ->
|
||||
css = """<%= grunt.file.read('src/General/css/icons.base.css').replace(/\s+/g, ' ').trim() %>"""
|
||||
_conf = Conf
|
||||
i = 0
|
||||
align = _conf['Sidebar Location']
|
||||
align = Conf['Sidebar Location']
|
||||
sidebar = {
|
||||
minimal: 20
|
||||
hide: 2
|
||||
normal: 252
|
||||
large: 303
|
||||
}[_conf['Sidebar']]
|
||||
}[Conf['Sidebar']]
|
||||
|
||||
notCatalog = g.VIEW isnt 'catalog'
|
||||
notEither = notCatalog and g.BOARD isnt 'f'
|
||||
@ -214,30 +211,30 @@ Style =
|
||||
|
||||
position
|
||||
|
||||
if _conf["Icon Orientation"] is "horizontal"
|
||||
if Conf["Icon Orientation"] is "horizontal"
|
||||
|
||||
position = aligner(
|
||||
2
|
||||
[
|
||||
true
|
||||
_conf['Slideout Navigation'] isnt 'hide'
|
||||
_conf['Announcements'] is 'slideout' and (psa = $ '#globalMessage', d.body) and !psa.hidden
|
||||
_conf['Thread Watcher'] and _conf['Slideout Watcher']
|
||||
Conf['Slideout Navigation'] isnt 'hide'
|
||||
Conf['Announcements'] is 'slideout' and (psa = $ '#globalMessage', d.body) and !psa.hidden
|
||||
Conf['Thread Watcher'] and Conf['Slideout Watcher']
|
||||
$ '#navtopright .exlinksOptionsLink', d.body
|
||||
notEither and _conf['Image Expansion']
|
||||
notEither and Conf['Image Expansion']
|
||||
notEither
|
||||
g.VIEW is 'thread'
|
||||
notEither and _conf['Fappe Tyme']
|
||||
navlinks = ((g.VIEW isnt 'thread' and _conf['Index Navigation']) or (g.VIEW is 'thread' and _conf['Reply Navigation'])) and notCatalog
|
||||
notEither and Conf['Fappe Tyme']
|
||||
navlinks = ((g.VIEW isnt 'thread' and Conf['Index Navigation']) or (g.VIEW is 'thread' and Conf['Reply Navigation'])) and notCatalog
|
||||
navlinks
|
||||
]
|
||||
)
|
||||
|
||||
iconOffset =
|
||||
position[position.length - 1] - (if _conf['4chan SS Navigation']
|
||||
position[position.length - 1] - (if Conf['4chan SS Navigation']
|
||||
0
|
||||
else
|
||||
sidebar + parseInt(_conf["Right Thread Padding"], 10))
|
||||
sidebar + parseInt(Conf["Right Thread Padding"], 10))
|
||||
|
||||
if iconOffset < 0 then iconOffset = 0
|
||||
|
||||
@ -248,32 +245,32 @@ Style =
|
||||
position = aligner(
|
||||
2
|
||||
[
|
||||
notEither and _conf['Image Expansion']
|
||||
notEither and Conf['Image Expansion']
|
||||
true
|
||||
_conf['Slideout Navigation'] isnt 'hide'
|
||||
_conf['Announcements'] is 'slideout' and (psa = $ '#globalMessage', d.body) and !psa.hidden
|
||||
_conf['Thread Watcher'] and _conf['Slideout Watcher']
|
||||
Conf['Slideout Navigation'] isnt 'hide'
|
||||
Conf['Announcements'] is 'slideout' and (psa = $ '#globalMessage', d.body) and !psa.hidden
|
||||
Conf['Thread Watcher'] and Conf['Slideout Watcher']
|
||||
$ '#navtopright .exlinksOptionsLink', d.body
|
||||
notEither
|
||||
g.VIEW is 'thread'
|
||||
notEither and _conf['Fappe Tyme']
|
||||
navlinks = ((g.VIEW isnt 'thread' and _conf['Index Navigation']) or (g.VIEW is 'thread' and _conf['Reply Navigation'])) and notCatalog
|
||||
notEither and Conf['Fappe Tyme']
|
||||
navlinks = ((g.VIEW isnt 'thread' and Conf['Index Navigation']) or (g.VIEW is 'thread' and Conf['Reply Navigation'])) and notCatalog
|
||||
navlinks
|
||||
]
|
||||
)
|
||||
|
||||
iconOffset = (
|
||||
20 + (
|
||||
if g.VIEW is 'thread' and _conf['Updater Position'] is 'top'
|
||||
if g.VIEW is 'thread' and Conf['Updater Position'] is 'top'
|
||||
100
|
||||
else
|
||||
0
|
||||
)
|
||||
) - (
|
||||
if _conf['4chan SS Navigation']
|
||||
if Conf['4chan SS Navigation']
|
||||
0
|
||||
else
|
||||
sidebar + parseInt _conf[align.capitalize() + " Thread Padding"], 10
|
||||
sidebar + parseInt Conf[align.charAt(0).toUpperCase() + align.slice(1) + " Thread Padding"], 10
|
||||
)
|
||||
|
||||
if iconOffset < 0 then iconOffset = 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user