[Fixed] Stuck in night mode

Zomby

  • Newbie
  • Posts: 10
  • Trades: 4
[Fixed] Stuck in night mode
« on July 29th, 2017, 03:20 AM »Last edited on August 2nd, 2017, 02:07 PM by Lestrade 尚
For some reason, the site was in night mode for me today (after being away for a week).

I can click on the "Night & Day" at the top of the page to get it back to the right mode, but as soon as I change page it's back to night mode and I have to change it every single time. It's getting annonying real fast.

[Lestrades.com] Nao 尚

  • I'm Share-Locked
  • Administrator
  • Posts: 1,396
  • Trades: 222
Re: Stuck in night mode
« Reply #1, on July 29th, 2017, 08:39 AM »
If you never changed the mode before, then Lt now defaults to night for you. It's my own way to invite people to experience it.
However it is designed to remember your choice... so if you're not getting day mode after forcing it, there's a problem. Especially since it works for me... anyone else?

Akylen

  • Full Member
  • Posts: 218
  • Trades: 61

[Lestrades.com] Nao 尚

  • I'm Share-Locked
  • Administrator
  • Posts: 1,396
  • Trades: 222
Re: Stuck in night mode
« Reply #3, on July 29th, 2017, 03:29 PM »
With all browsers?

Reminder: guests can NOT change to Day mode. It's only for logged in users. I haven't implemented a cookie-based saving procedure for now. Plus, if it can encourage (?) people to log in... All for the best.

Akylen

  • Full Member
  • Posts: 218
  • Trades: 61

[Lestrades.com] Nao 尚

  • I'm Share-Locked
  • Administrator
  • Posts: 1,396
  • Trades: 222
Re: Stuck in night mode
« Reply #5, on July 29th, 2017, 05:48 PM »
I really don't get it... (1) my code seems to be flawless when it comes to this. (2) I tried with Firefox, Chrome, both logged in and logged off. I always got the same consistent results...

Maybe I should stop it with the whole "realtime style change on button click"... I mean, it's unlikely anyone will click that button while writing a message isn't it..? So I might as well force it to reload the page. That way, maybe it'll fix your issue. I don't know. It would also fix one of my issues, where Night mode isn't actually a Wedge sub-skin, but a hack I integrated everywhere into my code, making it hard to allow Wedge users to build a similar type of skin. (I know, not your concern, but...)

/u/humpaaa

  • Full Member
  • ▶ ¦ Yep
  • Posts: 190
  • Trades: 10
Re: Stuck in night mode
« Reply #6, on July 29th, 2017, 08:06 PM »
Defaults to day mode for me. If i switch to night mode, and change pages, it's back to day mode.

Zomby

  • Newbie
  • Posts: 10
  • Trades: 4

[Lestrades.com] Nao 尚

  • I'm Share-Locked
  • Administrator
  • Posts: 1,396
  • Trades: 222
Re: Stuck in night mode
« Reply #8, on July 31st, 2017, 01:09 AM »
Even weirder...
Well, I took a look at the database. We all have different settings! The night mode variable is a custom variable called 'dk' stored in a serialized array in the table.
- Me: I have an integer set to 1
- Zombie: no variable at all (should default to night mode until he selects a different mode...)
- Akylen: has a string set to 1 (night mode explicitly enabled)
- humpaa: has a string set to 0 (night mode explicitly disabled)
I could see there being something about the string vs integer thing, but I don't see why...

Oh, maybe it's a problem that happens *before* saving..? Can you guys open your console and check for JavaScript errors when clicking on the Day/Night button?

Zomby

  • Newbie
  • Posts: 10
  • Trades: 4
Re: Stuck in night mode
« Reply #9, on July 31st, 2017, 01:11 AM »
This is what I get from the console when I click on the Day/Night button

Code: [Select]
Uncaught ReferenceError: xtc is not defined
    at night (script-m-189538.js.gz:8)
    at HTMLAnchorElement.eves.1 ((index):21)
    at HTMLAnchorElement.dispatch (jquery.min.js:3)
    at HTMLAnchorElement.q.handle (jquery.min.js:3)

/u/humpaaa

  • Full Member
  • ▶ ¦ Yep
  • Posts: 190
  • Trades: 10
Re: Stuck in night mode
« Reply #10, on July 31st, 2017, 05:28 AM »
Code: [Select]
(index):21 Uncaught ReferenceError: xtc is not defined
    at night (script-m-189538.js.gz:8)
    at HTMLAnchorElement.eves.1 ((index):21)
    at HTMLAnchorElement.dispatch (jquery.min.js:3)
    at HTMLAnchorElement.q.handle (jquery.min.js:3)

Akylen

  • Full Member
  • Posts: 218
  • Trades: 61
Re: Stuck in night mode
« Reply #11, on July 31st, 2017, 05:19 PM »
Code: [Select]
Uncaught ReferenceError: xtc is not defined
    at night (script-m-189538.js.gz:8)
    at HTMLAnchorElement.eves.1 ((index):15)
    at HTMLAnchorElement.dispatch (jquery.min.js:3)
    at HTMLAnchorElement.q.handle (jquery.min.js:3)
night @ script-m-189538.js.gz:8
eves.1 @ (index):15
dispatch @ jquery.min.js:3q.handle @ jquery.min.js:3

[Lestrades.com] Nao 尚

  • I'm Share-Locked
  • Administrator
  • Posts: 1,396
  • Trades: 222
Re: Stuck in night mode
« Reply #12, on July 31st, 2017, 06:26 PM »
Well... That explains why ;)
xtc (extended controls, just my silly way of naming fun names..) is just a random variable I added to help with internal testing. The code was testing to see if it was me asking for a mode change, in which case it'd redraw the scrollbars for me. Anyway... Fixed :^^;:

Note for die-hard users: install the 'JavaScript Errors Notifier' extension for Chrome. If you get a JS error, you'll get a big red icon at the bottom of the page. That way you can immediately tell me something's wrong. Ideally, that icon should never show up... I'd usually see the problems myself, but in this particular case I was testing for a variable that did exist on my side-- except I forgot on your side it's undefined, and thus '!!xtc' will silently fail, I should have done <'xtc' in window>, which takes more bytes but is safer.

Zomby

  • Newbie
  • Posts: 10
  • Trades: 4

[Lestrades.com] Nao 尚

  • I'm Share-Locked
  • Administrator
  • Posts: 1,396
  • Trades: 222
Re: Stuck in night mode
« Reply #14, on July 31st, 2017, 09:38 PM »
A good opportunity for you guys to vote for your preferred skin :)
(Although I'm unlikely to change my mind based on that; I just feel night mode is appropriate these days. I'M BATMAN!)
Oh, I just tweaked the day mode to re-implement the background it used to have, only now with the extra transparency... I'm trying to keep it clean and not too obvious. I'll probably keep updating it... It's not like I'm the kind of guy who ever gets satisfied with his own work.