Make mascots work.

This commit is contained in:
Zixaphir 2013-03-20 20:35:52 -07:00
parent f725de47cd
commit 55cf28ad8d
3 changed files with 42 additions and 11 deletions

View File

@ -3322,6 +3322,9 @@
'presto': '-o-' 'presto': '-o-'
}[$.engine]; }[$.engine];
this.sizing = "" + ($.engine === 'gecko' ? this.agent : '') + "box-sizing"; this.sizing = "" + ($.engine === 'gecko' ? this.agent : '') + "box-sizing";
$.asap((function() {
return d.body;
}), MascotTools.init);
$.ready(function() { $.ready(function() {
if (!$.id('navtopright')) { if (!$.id('navtopright')) {
return; return;
@ -3683,7 +3686,7 @@
Banner = { Banner = {
init: function() { init: function() {
return $.asap((function() { return $.asap((function() {
return doc; return d.body;
}), function() { }), function() {
return $.asap((function() { return $.asap((function() {
return $('.abovePostForm'); return $('.abovePostForm');
@ -3741,7 +3744,7 @@
GlobalMessage = { GlobalMessage = {
init: function() { init: function() {
return $.asap((function() { return $.asap((function() {
return doc; return d.body;
}), function() { }), function() {
return $.asap((function() { return $.asap((function() {
return $.id('delform'); return $.id('delform');
@ -4247,7 +4250,7 @@
Conf[g.MASCOTSTRING].remove(Conf["mascot"]); Conf[g.MASCOTSTRING].remove(Conf["mascot"]);
return this.init(); return this.init();
} }
this.addMascot(mascot); MascotTools.addMascot(mascot);
} }
if (Conf["Sidebar Location"] === 'left') { if (Conf["Sidebar Location"] === 'left') {
if (Conf["Mascot Location"] === "sidebar") { if (Conf["Mascot Location"] === "sidebar") {
@ -11923,6 +11926,18 @@
if (g.VIEW === 'thread') { if (g.VIEW === 'thread') {
g.THREAD = +pathname[3]; g.THREAD = +pathname[3];
} }
if (['b', 'd', 'e', 'gif', 'h', 'hc', 'hm', 'hr', 'pol', 'r', 'r9k', 'rs', 's', 'soc', 't', 'u', 'y'].contains(g.BOARD)) {
g.TYPE = 'nsfw';
}
if (Conf["NSFW/SFW Mascots"]) {
g.MASCOTSTRING = "Enabled Mascots " + g.TYPE;
} else {
g.MASCOTSTRING = "Enabled Mascots";
}
Conf["Enabled Mascots"] = $.get("Enabled Mascots", []);
Conf["Enabled Mascots sfw"] = $.get("Enabled Mascots sfw", []);
Conf["Enabled Mascots nsfw"] = $.get("Enabled Mascots nsfw", []);
Conf["Deleted Mascots"] = $.get("Deleted Mascots", []);
switch (location.hostname) { switch (location.hostname) {
case 'sys.4chan.org': case 'sys.4chan.org':
Report.init(); Report.init();

View File

@ -8,6 +8,8 @@ Style =
@sizing = "#{if $.engine is 'gecko' then @agent else ''}box-sizing" @sizing = "#{if $.engine is 'gecko' then @agent else ''}box-sizing"
$.asap (-> d.body), MascotTools.init
$.ready -> $.ready ->
return unless $.id 'navtopright' return unless $.id 'navtopright'
Style.padding.nav = $ "#boardNavDesktop", d.body Style.padding.nav = $ "#boardNavDesktop", d.body
@ -457,7 +459,7 @@ vertical-align: top;
Banner = Banner =
init: -> init: ->
$.asap (-> doc), -> $.asap (-> d.body), ->
$.asap (-> $ '.abovePostForm'), Banner.ready $.asap (-> $ '.abovePostForm'), Banner.ready
ready: -> ready: ->
@ -504,7 +506,7 @@ Banner =
GlobalMessage = GlobalMessage =
init: -> init: ->
$.asap (-> doc), -> $.asap (-> d.body), ->
$.asap (-> $.id 'delform'), GlobalMessage.ready $.asap (-> $.id 'delform'), GlobalMessage.ready
ready: -> ready: ->
@ -1004,7 +1006,7 @@ MascotTools =
Conf[g.MASCOTSTRING].remove Conf["mascot"] Conf[g.MASCOTSTRING].remove Conf["mascot"]
return @init() return @init()
@addMascot mascot MascotTools.addMascot mascot
if Conf["Sidebar Location"] is 'left' if Conf["Sidebar Location"] is 'left'
if Conf["Mascot Location"] is "sidebar" if Conf["Mascot Location"] is "sidebar"

View File

@ -315,6 +315,20 @@ Main =
if g.VIEW is 'thread' if g.VIEW is 'thread'
g.THREAD = +pathname[3] g.THREAD = +pathname[3]
# Check if the current board we're on is SFW or not, so we can handle options that need to know that.
if ['b', 'd', 'e', 'gif', 'h', 'hc', 'hm', 'hr', 'pol', 'r', 'r9k', 'rs', 's', 'soc', 't', 'u', 'y'].contains g.BOARD
g.TYPE = 'nsfw'
if Conf["NSFW/SFW Mascots"]
g.MASCOTSTRING = "Enabled Mascots #{g.TYPE}"
else
g.MASCOTSTRING = "Enabled Mascots"
Conf["Enabled Mascots"] = $.get "Enabled Mascots", []
Conf["Enabled Mascots sfw"] = $.get "Enabled Mascots sfw", []
Conf["Enabled Mascots nsfw"] = $.get "Enabled Mascots nsfw", []
Conf["Deleted Mascots"] = $.get "Deleted Mascots", []
switch location.hostname switch location.hostname
when 'sys.4chan.org' when 'sys.4chan.org'
Report.init() Report.init()