Some rethinking of how to handle theme and mascots sections.
This commit is contained in:
parent
df47d68235
commit
31c3af58aa
2
LICENSE
2
LICENSE
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* appchan x - Version 2.0.1 - 2013-05-08
|
||||
* appchan x - Version 2.0.1 - 2013-05-09
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* https://github.com/zixaphir/appchan-x/blob/master/LICENSE
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -544,6 +544,8 @@ Settings =
|
||||
keys.sort()
|
||||
|
||||
cb = Settings.cb.theme
|
||||
mouseover = -> @style.color = "#{@dataset.hover}"
|
||||
mouseout = -> @style.color = "#{@dataset.color}"
|
||||
|
||||
if mode is "default"
|
||||
|
||||
@ -555,68 +557,26 @@ Settings =
|
||||
div = $.el 'div',
|
||||
className: "theme #{if name is Conf['theme'] then 'selectedtheme' else ''}"
|
||||
id: name
|
||||
innerHTML: "
|
||||
<div style='cursor: pointer; position: relative; margin-bottom: 2px; width: 100% !important; box-shadow: none !important; background:#{theme['Reply Background']}!important;border:1px solid #{theme['Reply Border']}!important;color:#{theme['Text']}!important'>
|
||||
<div>
|
||||
<div style='cursor: pointer; width: 9px; height: 9px; margin: 2px 3px; display: inline-block; vertical-align: bottom; background: #{theme['Checkbox Background']}; border: 1px solid #{theme['Checkbox Border']};'></div>
|
||||
<span style='color:#{theme['Subjects']}!important; font-weight: 600 !important'>
|
||||
#{name}
|
||||
</span>
|
||||
<span style='color:#{theme['Names']}!important; font-weight: 600 !important'>
|
||||
#{theme['Author']}
|
||||
</span>
|
||||
<span style='color:#{theme['Sage']}!important'>
|
||||
(SAGE)
|
||||
</span>
|
||||
<span style='color:#{theme['Tripcodes']}!important'>
|
||||
#{theme['Author Tripcode']}
|
||||
</span>
|
||||
<time style='color:#{theme['Timestamps']}'>
|
||||
20XX.01.01 12:00
|
||||
</time>
|
||||
<a onmouseout='this.setAttribute("style","color:#{theme['Post Numbers']}!important")' onmouseover='this.setAttribute("style","color:#{theme['Hovered Links']}!important;")' style='color:#{theme['Post Numbers']}!important;' href='javascript:;'>
|
||||
No.27583594
|
||||
</a>
|
||||
<a onmouseout='this.setAttribute("style","color:#{theme['Backlinks']}!important;")' onmouseover='this.setAttribute("style","color:#{theme['Hovered Links']}!important;")' style='color:#{theme['Backlinks']}!important;' href='javascript:;' name='#{name}' class=edit>
|
||||
>>edit
|
||||
</a>
|
||||
<a onmouseout='this.setAttribute("style","color:#{theme['Backlinks']}!important;")' onmouseover='this.setAttribute("style","color:#{theme['Hovered Links']}!important;")' style='color:#{theme['Backlinks']}!important;' href='javascript:;' name='#{name}' class=export>
|
||||
>>export
|
||||
</a>
|
||||
<a onmouseout='this.setAttribute("style","color:#{theme['Backlinks']}!important;")' onmouseover='this.setAttribute("style","color:#{theme['Hovered Links']}!important;")' style='color:#{theme['Backlinks']}!important;' href='javascript:;' name='#{name}' class=delete>
|
||||
>>delete
|
||||
</a>
|
||||
</div>
|
||||
<blockquote style='margin: 0; padding: 12px 40px 12px 38px'>
|
||||
<a style='color:#{theme['Quotelinks']}!important; text-shadow: none;'>
|
||||
>>27582902
|
||||
</a>
|
||||
<br>
|
||||
Post content is right here.
|
||||
</blockquote>
|
||||
<h1 style='color: #{theme['Text']}'>
|
||||
Selected
|
||||
</h1>
|
||||
</div>"
|
||||
innerHTML: """<%= grunt.file.read('src/General/html/Settings/Theme.html').replace(/>\s+</g, '><').trim() %>"""
|
||||
|
||||
div.style.backgroundColor = theme['Background Color']
|
||||
|
||||
for a in $$ 'a[data-color]', div
|
||||
a.style.color = "#{a.dataset.color}"
|
||||
$.on a, 'mouseover', mouseover
|
||||
$.on a, 'mouseout', mouseout
|
||||
|
||||
$.on $('a.edit', div), 'click', cb.edit
|
||||
$.on $('a.export', div), 'click', cb.export
|
||||
$.on $('a.delete', div), 'click', cb.delete
|
||||
$.on div, 'click', cb.select
|
||||
|
||||
$.on div, 'click', cb.select
|
||||
|
||||
$.add suboptions, div
|
||||
|
||||
div = $.el 'div',
|
||||
id: 'addthemes'
|
||||
innerHTML: "
|
||||
<a id=newtheme href='javascript:;'>New Theme</a> /
|
||||
<a id=import href='javascript:;'>Import Theme</a><input id=importbutton type=file hidden> /
|
||||
<a id=SSimport href='javascript:;'>Import from 4chan SS</a><input id=SSimportbutton type=file hidden> /
|
||||
<a id=OCimport href='javascript:;'>Import from Oneechan</a><input id=OCimportbutton type=file hidden> /
|
||||
<a id=tUndelete href='javascript:;'>Undelete Theme</a>
|
||||
"
|
||||
innerHTML: """<%= grunt.file.read('src/General/html/Settings/Batch-Theme.html').replace(/>\s+</g, '><').trim() %>"""
|
||||
|
||||
$.on $("#newtheme", div), 'click', ->
|
||||
ThemeTools.init "untitled"
|
||||
@ -657,24 +617,7 @@ Settings =
|
||||
div = $.el 'div',
|
||||
id: name
|
||||
className: theme
|
||||
innerHTML: "
|
||||
<div style='cursor: pointer; position: relative; margin-bottom: 2px; width: 100% !important; box-shadow: none !important; background:#{theme['Reply Background']}!important;border:1px solid #{theme['Reply Border']}!important;color:#{theme['Text']}!important'>
|
||||
<div style='padding: 3px 0px 0px 8px;'>
|
||||
<span style='color:#{theme['Subjects']}!important; font-weight: 600 !important'>#{name}</span>
|
||||
<span style='color:#{theme['Names']}!important; font-weight: 600 !important'>#{theme['Author']}</span>
|
||||
<span style='color:#{theme['Sage']}!important'>(SAGE)</span>
|
||||
<span style='color:#{theme['Tripcodes']}!important'>#{theme['Author Tripcode']}</span>
|
||||
<time style='color:#{theme['Timestamps']}'>20XX.01.01 12:00</time>
|
||||
<a onmouseout='this.setAttribute("style","color:#{theme['Post Numbers']}!important")' onmouseover='this.setAttribute("style","color:#{theme['Hovered Links']}!important")' style='color:#{theme['Post Numbers']}!important;' href='javascript:;'>No.27583594</a>
|
||||
</div>
|
||||
<blockquote style='margin: 0; padding: 12px 40px 12px 38px'>
|
||||
<a style='color:#{theme['Quotelinks']}!important; text-shadow: none;'>
|
||||
>>27582902
|
||||
</a>
|
||||
<br>
|
||||
I forgive you for using VLC to open me. ;__;
|
||||
</blockquote>
|
||||
</div>"
|
||||
innerHTML: """<%= grunt.file.read('src/General/html/Settings/Deleted-Theme.html').replace(/>\s+</g, '><').trim() %>"""
|
||||
|
||||
$.on div, 'click', cb.restore
|
||||
|
||||
@ -735,6 +678,18 @@ Settings =
|
||||
keys.sort()
|
||||
|
||||
if mode is 'default'
|
||||
mascotoptions = $.el 'div',
|
||||
id: 'mascot-options'
|
||||
innerHTML: """<a class=edit name='#{name}' href='javascript:;'>Edit</a><a class=delete name='#{name}' href='javascript:;'>Delete</a><a class=export name='#{name}' href='javascript:;'>Export</a>"""
|
||||
|
||||
$.on $('.edit', mascotoptions), 'click', cb.edit
|
||||
$.on $('.delete', mascotoptions), 'click', cb.delete
|
||||
$.on $('.export', mascotoptions), 'click', cb.export
|
||||
|
||||
addoptions = ->
|
||||
return if mascotoptions.parentElement is @
|
||||
$.add @, mascotoptions
|
||||
|
||||
# Create a keyed Unordered List Element and hide option for each mascot category.
|
||||
nodes = {}
|
||||
for name in MascotTools.categories
|
||||
@ -762,11 +717,8 @@ Settings =
|
||||
id: name
|
||||
innerHTML: "<%= grunt.file.read('src/General/html/Settings/Mascot.html') %>"
|
||||
|
||||
$.on $('.edit', mascotEl), 'click', cb.edit
|
||||
$.on $('.delete', mascotEl), 'click', cb.delete
|
||||
$.on $('.export', mascotEl), 'click', cb.export
|
||||
|
||||
$.on mascotEl, 'click', cb.select
|
||||
$.on mascotEl, 'mouseover', addoptions
|
||||
|
||||
if MascotTools.categories.contains mascot.category
|
||||
nodes[mascot.category].push mascotEl
|
||||
@ -882,25 +834,27 @@ Settings =
|
||||
|
||||
edit: (e) ->
|
||||
e.stopPropagation()
|
||||
MascotTools.dialog @name
|
||||
MascotTools.dialog @parentElement.parentElement.id
|
||||
Settings.close()
|
||||
|
||||
delete: (e) ->
|
||||
e.stopPropagation()
|
||||
if confirm "Are you sure you want to delete \"#{@name}\"?"
|
||||
if Conf['mascot'] is @name
|
||||
name = @parentElement.parentElement.id
|
||||
if confirm "Are you sure you want to delete \"#{name}\"?"
|
||||
if Conf['mascot'] is name
|
||||
MascotTools.init()
|
||||
for type in ["Enabled Mascots", "Enabled Mascots sfw", "Enabled Mascots nsfw"]
|
||||
Conf[type].remove @name
|
||||
Conf[type].remove name
|
||||
$.set type, Conf[type]
|
||||
Conf["Deleted Mascots"].push @name
|
||||
Conf["Deleted Mascots"].push name
|
||||
$.set "Deleted Mascots", Conf["Deleted Mascots"]
|
||||
$.rm $.id @name
|
||||
$.rm $.id name
|
||||
|
||||
export: (e) ->
|
||||
e.stopPropagation()
|
||||
exportMascot = Mascots[@name]
|
||||
exportMascot['Mascot'] = @name
|
||||
name = @parentElement.parentElement.id
|
||||
exportMascot = Mascots[name]
|
||||
exportMascot['Mascot'] = name
|
||||
exportedMascot = "data:application/json," + encodeURIComponent(JSON.stringify(exportMascot))
|
||||
|
||||
if window.open exportedMascot, "_blank"
|
||||
|
||||
@ -1614,10 +1614,14 @@ article li {
|
||||
bottom: 1.7em;
|
||||
left: 0;
|
||||
}
|
||||
#themecontent {
|
||||
top: 1.8em;
|
||||
}
|
||||
.mAlign {
|
||||
height: 250px;
|
||||
vertical-align: middle;
|
||||
vertical-align: bottom;
|
||||
display: table-cell;
|
||||
line-height: 0;
|
||||
}
|
||||
#save,
|
||||
.stylesettings {
|
||||
@ -1701,24 +1705,25 @@ article li {
|
||||
max-width: 200px;
|
||||
}
|
||||
.mascotname,
|
||||
.mascotoptions {
|
||||
#mascot-options {
|
||||
#{Style.sizing}: border-box;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.mascot .mascotoptions {
|
||||
opacity: 0;
|
||||
#mascot-options {
|
||||
opacity: 0;
|
||||
#{agent}transition: opacity .3s linear;
|
||||
}
|
||||
.mascot:hover .mascotoptions {
|
||||
.mascot:hover #mascot-options {
|
||||
opacity: 1;
|
||||
}
|
||||
.mascotoptions {
|
||||
#mascot-options {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
.mascotoptions a {
|
||||
#mascot-options a {
|
||||
display: inline-block;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
box-shadow: 0 0 5px #{theme["Reply Border"]};
|
||||
}
|
||||
.mascotname,
|
||||
.mascotoptions {
|
||||
#mascot-options {
|
||||
background: #{theme["Dialog Background"]};
|
||||
border: 1px solid #{theme["Buttons Border"]};
|
||||
}
|
||||
|
||||
12
src/General/html/Settings/Batch-Theme.html
Normal file
12
src/General/html/Settings/Batch-Theme.html
Normal file
@ -0,0 +1,12 @@
|
||||
<a id=newtheme href='javascript:;'>New Theme</a>
|
||||
/
|
||||
<a id=import href='javascript:;'>Import Theme</a>
|
||||
<input id=importbutton type=file hidden>
|
||||
/
|
||||
<a id=SSimport href='javascript:;'>Import from 4chan SS</a>
|
||||
<input id=SSimportbutton type=file hidden>
|
||||
/
|
||||
<a id=OCimport href='javascript:;'>Import from Oneechan</a>
|
||||
<input id=OCimportbutton type=file hidden>
|
||||
/
|
||||
<a id=tUndelete href='javascript:;'>Undelete Theme</a>
|
||||
29
src/General/html/Settings/Deleted-Theme.html
Normal file
29
src/General/html/Settings/Deleted-Theme.html
Normal file
@ -0,0 +1,29 @@
|
||||
<div style='cursor: pointer; position: relative; margin-bottom: 2px; width: 100% ; box-shadow: none ; background:#{theme['Reply Background']};border:1px solid #{theme['Reply Border']};color:#{theme['Text']}'>
|
||||
<div style='padding: 3px 0px 0px 8px;'>
|
||||
<span style='color:#{theme['Subjects']}; font-weight: 600 '>
|
||||
#{name}
|
||||
</span>
|
||||
<span style='color:#{theme['Names']}; font-weight: 600 '>
|
||||
#{theme['Author']}
|
||||
</span>
|
||||
<span style='color:#{theme['Sage']}'>
|
||||
(SAGE)
|
||||
</span>
|
||||
<span style='color:#{theme['Tripcodes']}'>
|
||||
#{theme['Author Tripcode']}
|
||||
</span>
|
||||
<time style='color:#{theme['Timestamps']}'>
|
||||
20XX.01.01 12:00
|
||||
</time>
|
||||
<a data-color='#{theme['Post Numbers']}' data-hover='#{theme['Hovered Links']}'>
|
||||
No.27583594
|
||||
</a>
|
||||
</div>
|
||||
<blockquote style='margin: 0; padding: 12px 40px 12px 38px'>
|
||||
<a data-color='#{theme['Quotelinks']}' data-hover='#{theme['Hovered Links']}' style='text-shadow: none;'>
|
||||
>>27582902
|
||||
</a>
|
||||
<br>
|
||||
I forgive you for using VLC to open me. ;__;
|
||||
</blockquote>
|
||||
</div>
|
||||
@ -1,3 +1,2 @@
|
||||
<div class='mascotname'>#{name.replace /_/g, " "}</div>
|
||||
<div class='mascotcontainer'><div class='mAlign #{mascot.category}'><img class=mascotimg src='#{if Array.isArray(mascot.image) then (if Style.lightTheme then mascot.image[1] else mascot.image[0]) else mascot.image}'></div></div>
|
||||
<div class='mascotoptions'><a class=edit name='#{name}' href='javascript:;'>Edit</a><a class=delete name='#{name}' href='javascript:;'>Delete</a><a class=export name='#{name}' href='javascript:;'>Export</a></div>
|
||||
<div class='mascotcontainer'><div class='mAlign #{mascot.category}'><img class=mascotimg src='#{if Array.isArray(mascot.image) then (if Style.lightTheme then mascot.image[1] else mascot.image[0]) else mascot.image}'></div></div>
|
||||
42
src/General/html/Settings/Theme.html
Normal file
42
src/General/html/Settings/Theme.html
Normal file
@ -0,0 +1,42 @@
|
||||
<div style='cursor: pointer; position: relative; margin-bottom: 2px; width: 100% ; box-shadow: none ; background:#{theme['Reply Background']};border:1px solid #{theme['Reply Border']};color:#{theme['Text']}'>
|
||||
<div>
|
||||
<div style='cursor: pointer; width: 9px; height: 9px; margin: 2px 3px; display: inline-block; vertical-align: bottom; background: #{theme['Checkbox Background']}; border: 1px solid #{theme['Checkbox Border']};'></div>
|
||||
<span style='color:#{theme['Subjects']}; font-weight: 600 '>
|
||||
#{name}
|
||||
</span>
|
||||
<span style='color:#{theme['Names']}; font-weight: 600 '>
|
||||
#{theme['Author']}
|
||||
</span>
|
||||
<span style='color:#{theme['Sage']}'>
|
||||
(SAGE)
|
||||
</span>
|
||||
<span style='color:#{theme['Tripcodes']}'>
|
||||
#{theme['Author Tripcode']}
|
||||
</span>
|
||||
<time style='color:#{theme['Timestamps']}'>
|
||||
20XX.01.01 12:00
|
||||
</time>
|
||||
<a data-color='#{theme['Post Numbers']}' data-hover='#{theme['Hovered Links']}'>
|
||||
No.27583594
|
||||
</a>
|
||||
<a data-color='#{theme['Backlinks']}' data-hover='#{theme['Hovered Links']}' name='#{name}' class=edit>
|
||||
>>edit
|
||||
</a>
|
||||
<a data-color='#{theme['Backlinks']}' data-hover='#{theme['Hovered Links']}' name='#{name}' class=export>
|
||||
>>export
|
||||
</a>
|
||||
<a data-color='#{theme['Backlinks']}' data-hover='#{theme['Hovered Links']}' name='#{name}' class=delete>
|
||||
>>delete
|
||||
</a>
|
||||
</div>
|
||||
<blockquote style='margin: 0; padding: 12px 40px 12px 38px'>
|
||||
<a data-color='#{theme['Quotelinks']}' data-hover='#{theme['Hovered Links']}' style='text-shadow: none;'>
|
||||
>>27582902
|
||||
</a>
|
||||
<br>
|
||||
Post content is right here.
|
||||
</blockquote>
|
||||
<h1 style='color: #{theme['Text']}'>
|
||||
Selected
|
||||
</h1>
|
||||
</div>
|
||||
@ -224,7 +224,7 @@ MascotTools =
|
||||
|
||||
$.on input, 'blur', ->
|
||||
@value = @value.replace /[^a-z-_0-9]/ig, "_"
|
||||
unless /^[a-z]/i.test @value
|
||||
if (@value isnt "") and !/^[a-z]/i.test @value
|
||||
return alert "Mascot names must start with a letter."
|
||||
editMascot[@name] = @value
|
||||
MascotTools.addMascot editMascot
|
||||
@ -249,7 +249,7 @@ MascotTools =
|
||||
optionHTML = "<div class=optionlabel>#{item[0]}</div><div class=option><select name='#{name}' value='#{value}'><br>"
|
||||
for option in item[3]
|
||||
optionHTML = optionHTML + "<option value=\"#{option}\">#{option}</option>"
|
||||
optionHTML = optionHTML + "</select>"
|
||||
optionHTML = optionHTML + "</select></div>"
|
||||
div = $.el 'div',
|
||||
className: "mascotvar"
|
||||
innerHTML: optionHTML
|
||||
|
||||
@ -96,7 +96,7 @@ ThemeTools =
|
||||
<input class='field name' name='Author' placeholder='Author' value='#{editTheme['Author']}'>
|
||||
<input class='field postertrip' name='Author Tripcode' placeholder='Author Tripcode' value='#{editTheme['Author Tripcode']}'>"
|
||||
|
||||
#Setup inputs that are not generated from the layout variable.
|
||||
# Setup inputs that are not generated from the layout variable.
|
||||
for input in $$("input", header)
|
||||
$.on input, 'blur', ->
|
||||
editTheme[@name] = @value
|
||||
@ -155,7 +155,7 @@ ThemeTools =
|
||||
toggle2 = false
|
||||
len = @value.length
|
||||
|
||||
unless len > 1000
|
||||
if len < 1000
|
||||
i = 0
|
||||
while i < len
|
||||
switch @value[i++]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user