Club PA 2.0 has arrived! If you'd like to access some extra PA content and help support the forums, check it out at patreon.com/ClubPA
The image size limit has been raised to 1mb! Anything larger than that should be linked to. This is a HARD limit, please do not abuse it.
Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

Help with javascript

Mace1370Mace1370 Registered User regular
edited January 2008 in Help / Advice Forum
Hey guys. My blog was working perfectly for months and then suddenly it stopped working.

http://mtgdrafts.blogspot.com

The problem is that when you click the "Pick" links in the blog posts nothing happens. Before, when it was working properly, the pick would appear.

Using the error console I found that "reveal_layer" is not being defined. Looking at the source code, it appears that the javascript is being condensed into a single line... for some reason. Here is what the code is:
<script type='text/javascript' language='JavaScript'>
<!--
function reveal_layer (object) {
  if (document.getElementById) {
    document.getElementById(object).style.display = 'inline';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].display = 'inline';
  }
  else if (document.all) {
    document.all[object].style.display = 'inline';
  }
}
function hide_layer (object) {
  if (document.getElementById) {
    document.getElementById(object).style.display = 'none';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].display = 'none';
  }
  else if (document.all) {
    document.all[object].style.display = 'none';
  }
}
-->
</script>

This is what I see when I view the page source:
<script language='JavaScript' type='text/javascript'>
<!-- function reveal_layer (object) { if (document.getElementById) { document.getElementById(object).style.display = 'inline'; } else if (document.layers && document.layers[object]) { document.layers[object].display = 'inline'; } else if (document.all) { document.all[object].style.display = 'inline'; } } function hide_layer (object) { if (document.getElementById) { document.getElementById(object).style.display = 'none'; } else if (document.layers && document.layers[object]) { document.layers[object].display = 'none'; } else if (document.all) { document.all[object].style.display = 'none'; } } -->
</script>

Now, what troubles me is the ending of the code. Normally I would put //--> instead of the --> that is there. However, blogger is being retarded and gives me an error whenever I try to do that.

Finally, when I copy and paste the code into blogger and save the template and then review the template code it looks like blogger is editing my code to this:
<script language='JavaScript' src='http://www.wizards.com/global/basic.js' type='text/javascript'/>
<script language='JavaScript' type='text/javascript'>
<!--
function reveal_layer (object) {
  if (document.getElementById) {
    document.getElementById(object).style.display = 'inline';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].display = 'inline';
  }
  else if (document.all) {
    document.all[object].style.display = 'inline';
  }
}
function hide_layer (object) {
  if (document.getElementById) {
    document.getElementById(object).style.display = 'none';
  }
  else if (document.layers && document.layers[object]) {
    document.layers[object].display = 'none';
  }
  else if (document.all) {
    document.all[object].style.display = 'none';
  }
}
-->
</script>

I'm totally lost. What is going on here?

Mace1370 on

Posts

  • JHunzJHunz Registered User regular
    edited January 2008
    It looks like it's working just fine to me...
    Did you fix it already?

    JHunz on
    bunny.gif Gamertag: JHunz. R.I.P. Mygamercard.net bunny.gif
  • DaenrisDaenris Registered User regular
    edited January 2008
    Yeah, I can confirm also that this is working for me, so either you fixed it or it's possibly an issue with your browser for some reason.

    Daenris on
  • SzechuanosaurusSzechuanosaurus Registered User, ClubPA regular
    edited January 2008
    Yeah, works for me in Firefox 2.0.0.11 in OSX.

    If the JS is being condensed in certain browsers, it might be a better idea to create an external Javascript file and just have the page source it, rather than putting it all in the actual HTML page. Could be some sort of add blocker or something messing up the script on the page.

    Having it external is better practice anyway.

    Szechuanosaurus on
Sign In or Register to comment.