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