SMF spoilers don't work in Chrome

  • 8 Replies
  • 18440 Views
*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
SMF spoilers don't work in Chrome
« on: March 15, 2015, 19:05:06 »
I've run into an issue on a couple forums powered by SMF where spoilers sometimes only open to a width of one line when viewed with Google's Chrome. Not sure if the webmasters here can fix it, but it occurs often enough that I've had to switch to Firefox. I have the latest version of Chrome, Version 41.0.2272.89 m, on Win 8.1.

Image edited for size.

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: SMF spoilers don't work in Chrome
« Reply #1 on: March 15, 2015, 19:41:21 »
This is a bug in chrome that I cannot (and don't want to) fix. Make a bug complaint at the chrome forums or wherever you can do that, and they'll fix ithe issue. Basically it doesn't change the size of the DIV, so for me to fix it, I'd have to make a spoiler as big as it is going to be. Don't like doing that.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline SiamJai

  • 706
  • 31
    • View Profile
    • A gaming blog like no other.
Re: SMF spoilers don't work in Chrome
« Reply #2 on: March 19, 2015, 02:40:07 »
Could it be the theme you're using? I have the exact same version (+OS), and I've yet to encounter this issue viewing the forum with Chrome and the Xmas theme.

*

Offline LPChip

  • You can only truly help other people by allowing them to fail.
  • 3510
  • 138
  • Excel at the thing you're the best at!
    • View Profile
    • LPChip Interactive
Re: SMF spoilers don't work in Chrome
« Reply #3 on: March 19, 2015, 10:19:02 »
It shouldn't. The spoilercode is the same everywhere. At least it should. Could be in the CSS I guess. I haven't compared those.

Thats the only thing that is different, but I'm fairly sure I copy/pasted the CSS and only changed formatting. Not size related tags.
on the left, above my avatar.

MODPlug Central Forum
"If I tried to kill you, I'd end up with a big fat hole through my laptop." - Chironex

*

Offline egomassive

  • 1852
  • 250
    • View Profile
    • egomassive games
Re: SMF spoilers don't work in Chrome
« Reply #4 on: March 21, 2015, 04:10:15 »
SiamJai is right. I ran through all the themes and it only happens with WaDF and FiNCK, which are very similar in design. It may still be Chrome's fault, but I'll give the style-sheets a look and see if I can determine the incompatibility.

On a side note: It's not Christmas time SaimJai!

Edit: I think this is the culprit...
Code: [Select]
.post {overflow: auto;}
Reading through that style-sheet was an archaeological expedition. There's a hack for the Mac version of Internet Explorer 5.
« Last Edit: March 21, 2015, 04:53:05 by egomassive »

*

Offline SiamJai

  • 706
  • 31
    • View Profile
    • A gaming blog like no other.
Re: SMF spoilers don't work in Chrome
« Reply #5 on: March 21, 2015, 05:59:30 »
You are right that removing this would fix the issue, but this code is present in all themes' CSS, so it's probably not the culprit. I'd be hesitant to remove it from all, since that could introduce issues elsewhere on the site. (EDIT: However, I've commented this part out of the code in the WADF and FINCK themes' CSS. If there is any undesired side-effect, we need to find another solution.)


On a side note: It's not Christmas time SaimJai!
Heh... living near the equator, I find the sight of snow and winter refreshing! :)
« Last Edit: March 21, 2015, 07:25:32 by SiamJai »

Re: SMF spoilers don't work in Chrome
« Reply #6 on: March 24, 2015, 17:51:36 »

*

Offline BloxMaster

  • 363
  • 26
  • Master of the Bloxes!
    • View Profile
Re: SMF spoilers don't work in Chrome
« Reply #7 on: March 25, 2015, 05:11:05 »
I did a bit of testing - surprisingly, changing the UserAgent on Firefox to mimic Chrome seems to replicate the bug. From there I did a lot of digging- and indeed, while a lot of spoilers in almost any topic I could find didn't seem messed up at all, the posts containing the spoilers mentioned in this topic did have the glitch (they look more like what StraightFlame has posted; so maybe the initial glitch Egomassive posted has been 'fixed' (or rather, just changed). That said, again, I'm not actually running chrome, so I don't know how accurate this really is (but it's odd that it replicates some oddities either way). It could be that the bug(s) I report aren't entirely genuine to the real Chrome; but there's obviously still something to this problem.

I did a full comparison on both pages (the Firefox version and the "Faked" Chrome version (which is using the 'latest' version, as reported)). There was only a single difference between them; a javascript call at the bottom of the page which is merely called "smf_codefix()" -- it doesn't really explain what it's supposed to fix, but it does seem to alter post height on a per-post basis, which possibly explains why the spoilers are drastically overflowing into everything else, yet the post size doesn't match like it should, making it unreadable. It might also explain why I'm not seeing it happen on many other spoilers personally, if it's conditional (maybe those posts just got really unlucky). The real point here is that it only appeared when acting like Chrome - there's nothing of the sort in the Firefox version the page, and it's the only difference at all. Considering the nature of that code, it seems like someone was trying to fix a quirk a long time ago and it never really manifested as a problem. It's probably called based on what browser 'needs' the fix; explaining how I can trick it into loading by using a different UserAgent that 'needs it' (Chrome, in this case, apparently). (So as a side note; that's actually a possible temp fix if you can do that on Chrome; change it to 'appear' as Firefox). I'm guessing this code wasn't just added recently, and since Firefox (maybe others?) are absent of the code entirely the other javascript scripts or the php files themselves must dynamically put that there), it should be relatively harmless to remove it from loading for a quick check. Finding where it gets inserted might be tricky; I doubt it's really part of the php or html code by default, though, since it would appear on Firefox too-- it's easier to add things in realtime to a page than remove stuff hardcoded to a file already. So my guess it that it's part of a script somewhere that only gets added based on reported browser -- if it stops adding that code, I wonder if it would fix the browsers that it tries to mess with.

Anyway, just an idea!

EDIT; this is the relevant code:
Code: [Select]
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
window.addEventListener("load", smf_codeFix, false);

function smf_codeFix()
{
var codeFix = document.getElementsByTagName ? document.getElementsByTagName("div") : document.all.tags("div");

for (var i = 0; i < codeFix.length; i++)
{
if ((codeFix[i].className == "code" || codeFix[i].className == "post" || codeFix[i].className == "signature") && codeFix[i].offsetHeight < 20)
codeFix[i].style.height = (codeFix[i].offsetHeight + 20) + "px";
}
}
// ]]></script>
« Last Edit: March 25, 2015, 05:20:22 by BloxMaster »


*

Offline SiamJai

  • 706
  • 31
    • View Profile
    • A gaming blog like no other.
Re: SMF spoilers don't work in Chrome
« Reply #8 on: April 04, 2015, 08:01:23 »
Thanks for the feedback! Unfortunately I can't devote much time to this right now, as my workload for the month just doubled. The changes made earlier are all undone now, reset back to the original condition. Sorry Ego, I'm afraid you'll have to contend with the faulty spoilers on Chrome a little longer!