Jump to content
Sign in to follow this  
George Clooney

Drop down menu glitch

Recommended Posts

In Wars, when choosing Nuclear Attack option from the Select Action menu, nothing happens.  Selecting another option immediately loads that page, then browsing back to the Wars menu and selecting Nuclear Attack again results in the appropriate page loading. 

It is a random thing in that it doesn't happen every time, but often enough that it is noticeable.  Using Win 10 and version 68.0.1 of the Firefox browser if that helps troubleshooting.

  • Upvote 1

Share this post


Link to post
Share on other sites

Nuclear Attack should work exactly the same as the other options.

My best guess is that it's some sort of issue on your end. If the other options are working, that suggests that JavaScript is enabled and working properly (which would be troubleshooting step #1.)

Can you try another browser to see if that fixes the problem? If so, it's likely an issue on your end. My best guess as to what the issue would be is some sort of add-on or extension interfering with how the page is loading/operating.

Share this post


Link to post
Share on other sites
1 hour ago, Alex said:

Nuclear Attack should work exactly the same as the other options.

My best guess is that it's some sort of issue on your end. If the other options are working, that suggests that JavaScript is enabled and working properly (which would be troubleshooting step #1.)

Can you try another browser to see if that fixes the problem? If so, it's likely an issue on your end. My best guess as to what the issue would be is some sort of add-on or extension interfering with how the page is loading/operating.

I'll try Chrome and see if the issue pops up again and report back here if so.

  • Like 1

Share this post


Link to post
Share on other sites

This isn't a problem on @George Clooney's side, this is a bug. This is something that happens sporadically with any option besides nuclear, and the reason is quite simple: 

 

<script type="21a01513a89b768abbb4d894-text/javascript">
    $(function(){
      // on change event to select
      $('.actionselector').on('change', function () {
          var url = $(this).val(); // get selected value
          if (url) { // require a URL
              window.location = url; // redirect
          }
          return false;
      });
    });
</script>

 

The above snippet is wrapped in $(), which means it's executed when the DOM is ready. However, analytics and all those other extra goodies just love taking forever sporadically (on any website, not just PnW), so even though the page looks loaded to the user, the DOM ready callbacks haven't fired yet. 

Usually things are placed at DOM ready so that whatever elements are being referenced are sure to be loaded, but ironically it's not even needed at this point, since the above <script> is placed after the actionselector <select> element is declared but before all of those wonderful extraneous goodies. So the solution is simple - take it out of $(), and it works. @Alex

  • Like 5

Share this post


Link to post
Share on other sites
17 hours ago, Roavin said:

This isn't a problem on @George Clooney's side, this is a bug. This is something that happens sporadically with any option besides nuclear, and the reason is quite simple: 

 

<script type="21a01513a89b768abbb4d894-text/javascript">
    $(function(){
      // on change event to select
      $('.actionselector').on('change', function () {
          var url = $(this).val(); // get selected value
          if (url) { // require a URL
              window.location = url; // redirect
          }
          return false;
      });
    });
</script>

 

The above snippet is wrapped in $(), which means it's executed when the DOM is ready. However, analytics and all those other extra goodies just love taking forever sporadically (on any website, not just PnW), so even though the page looks loaded to the user, the DOM ready callbacks haven't fired yet. 

Usually things are placed at DOM ready so that whatever elements are being referenced are sure to be loaded, but ironically it's not even needed at this point, since the above <script> is placed after the actionselector <select> element is declared but before all of those wonderful extraneous goodies. So the solution is simple - take it out of $(), and it works. @Alex

I learned something. When this was originally implemented some 6 years ago, I knew little/nothing about JavaScript, and it was a modification of someone else's snippet. Thanks for the help!

  • Like 4

Share this post


Link to post
Share on other sites

Presumably this will be/ is now fixed then? Also noticed this issue happen with me numerous times over the last few months but I just figured it was indeed a glitch on my end

Share this post


Link to post
Share on other sites

It was happening to me on Airstrikes all war, nearly tripped me up on a declare and air before ground once too.  glad its been fixed.

  • Upvote 3

Share this post


Link to post
Share on other sites

@Alex  - So, I see that while the code has now changed on the live site, the effect is still happening, especially when there's a very slow loading flag on the war page (like for me right now - Bamika's image takes 7 seconds to load, wtf). Given that I proposed the prospective fix and it's still not working right, I felt somewhat obligated to investigate further :P

After dabbling around, I believe I've found the problem, though I'm not 100% certain on how best to fix it. I suspect the issue is Rocket Loader, which is injected by Cloudflare to asynchronously defer various blobs of Javascript for the purpose of making the page load faster. Apparently it works by replacing script type attributes with a prefixed version thereof (for example, prefix "bce348fb34a3edbcc529509b-"), then later going back and loading them on the side. Quite an insane piece of tech, honestly. If that is indeed the case, then why it's broken is clear - that piece of javascript to bind the drop down actions isn't executed immediately with the load, but rather much later whenever Rocket Loader feels like it. 

I can think of three potential ways of fixing it:

  • Add data-cfasync="false" to the script tag, as described here. The problem here is that the snippet requires jQuery, so the script tag for loading jQuery in the head section needs that attribute as well.
  • As above, except instead of also "synchronously" loading jQuery, replace that snippet with a vanilla js based version. Good ol' document.getElementsByClassName() should do the trick.
  • Turn off Rocket Loader entirely in the CloudFlare settings. This may fix other potentially wonky places as well, though it may make the site "feel" slower (or faster, depending on how the browser rather than CloudFlare decides to schedule things like Bamika's insanely slow image.

*phew*.

While I'm here, a question: Would you mind if I rig up a piece of Greasemonkey code to replace that dropdown with individual buttons and/or keybinds?

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, Roavin said:

@Alex  - So, I see that while the code has now changed on the live site, the effect is still happening, especially when there's a very slow loading flag on the war page (like for me right now - Bamika's image takes 7 seconds to load, wtf). Given that I proposed the prospective fix and it's still not working right, I felt somewhat obligated to investigate further :P

After dabbling around, I believe I've found the problem, though I'm not 100% certain on how best to fix it. I suspect the issue is Rocket Loader, which is injected by Cloudflare to asynchronously defer various blobs of Javascript for the purpose of making the page load faster. Apparently it works by replacing script type attributes with a prefixed version thereof (for example, prefix "bce348fb34a3edbcc529509b-"), then later going back and loading them on the side. Quite an insane piece of tech, honestly. If that is indeed the case, then why it's broken is clear - that piece of javascript to bind the drop down actions isn't executed immediately with the load, but rather much later whenever Rocket Loader feels like it. 

I can think of three potential ways of fixing it:

  • Add data-cfasync="false" to the script tag, as described here. The problem here is that the snippet requires jQuery, so the script tag for loading jQuery in the head section needs that attribute as well.
  • As above, except instead of also "synchronously" loading jQuery, replace that snippet with a vanilla js based version. Good ol' document.getElementsByClassName() should do the trick.
  • Turn off Rocket Loader entirely in the CloudFlare settings. This may fix other potentially wonky places as well, though it may make the site "feel" slower (or faster, depending on how the browser rather than CloudFlare decides to schedule things like Bamika's insanely slow image.

*phew*.

While I'm here, a question: Would you mind if I rig up a piece of Greasemonkey code to replace that dropdown with individual buttons and/or keybinds?

Thanks for your insights. I am going to look further and see if I can find a better solution for everyone.

No, I don't have any issue with you writing a greasemonkey script. If you can design a better UI that's great, and I'd be happy to adopt it for everyone in-game. To be honest, the existing functionality was adopted because that's how CN did it.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and the Guidelines of the game and community.