The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Code, Why won't this code work?
calico
post Jan 23 2017, 05:31 PM
Post #1





Group: Members
Posts: 5
Joined: 23-January 17
Member No.: 26,279



Hello,

When I use the following HTML code it works just fine:

<script type="text/javascript">
boatload_puzzles_format = 'Landscape';</script>
<p>Loading <a href="https://www.boatloadpuzzles.com/playcrossword">
crossword puzzle</a>. One moment please.</p>
<script type="text/javascript"
src="//www.boatloadpuzzles.com/Crossword.js"></script>

But when I place this code within my Word Press site I get errors. Does anyone know what is going on here with the code?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Jan 23 2017, 07:58 PM
Post #2


This is My Life
*******

Group: Members
Posts: 1,354
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



The first thing I would try is moving this line:
CODE
<script type="text/javascript" src="//www.boatloadpuzzles.com/Crossword.js"></script>
into the <head>...</head> section of the page.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
calico
post Jan 24 2017, 08:58 AM
Post #3





Group: Members
Posts: 5
Joined: 23-January 17
Member No.: 26,279



Thank you very much. But that doesn't appear to work.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Jan 24 2017, 11:42 AM
Post #4


This is My Life
*******

Group: Members
Posts: 1,354
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Well, ok, let's try one more thing. Change this line:
CODE
<script type="text/javascript"
src="//www.boatloadpuzzles.com/Crossword.js"></script>
Add 'http:' or 'https:' to the beginning of the 'src' attribute.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 24 2017, 01:54 PM
Post #5


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,505
Joined: 9-August 06
Member No.: 6



Don't think that will help either. It works with both http and https (tried locally), so as long as the document is online // should work.

Maybe the script clashes with another script.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Jan 24 2017, 01:58 PM
Post #6


This is My Life
*******

Group: Members
Posts: 1,354
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



To be honest, I didn't think it would make a difference either. Maybe a script conflict is the problem.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 24 2017, 03:10 PM
Post #7


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,505
Joined: 9-August 06
Member No.: 6



Who wants to dig into WordPress's JavaScripts? laugh.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jan 24 2017, 03:11 PM
Post #8


.
********

Group: WDG Moderators
Posts: 7,497
Joined: 10-August 06
Member No.: 7



QUOTE(calico @ Jan 23 2017, 11:31 PM) *

when I place this code within my Word Press site I get errors.

Could you post the errors here?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
calico
post Jan 24 2017, 05:04 PM
Post #9





Group: Members
Posts: 5
Joined: 23-January 17
Member No.: 26,279



Perhaps errors was a bad choice of words. When I place the code on my Word Press site, I see the output for a brief second and then it just disappears and the screen is blank.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 24 2017, 05:10 PM
Post #10


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,505
Joined: 9-August 06
Member No.: 6



I don't know if we can help, but to have a chance I think we need to see the page.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
calico
post Jan 24 2017, 05:23 PM
Post #11





Group: Members
Posts: 5
Joined: 23-January 17
Member No.: 26,279



http://www.intobserver.com/crossword/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 24 2017, 06:31 PM
Post #12


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,505
Joined: 9-August 06
Member No.: 6



The only JS error I get is this.
CODE
Warning: http://www.intobserver.com/wp-content/themes/advanced-newspaper/inc/js/jquery.cycle2.min.js?ver=4.7.1 is being assigned a //# sourceMappingURL, but already has one

Commenting that script out doesn't make a difference.

Using FF's Inspector I see that the crossword script writes an IFRAME - and loads a blank document in it.
CODE
<iframe style="width:575px; height:442px;" name="u148529991523092_" id="u148529991523092_" frameborder="0">
<html><head></head><body></body></html>
</iframe>


First I thought there might be some licensing involved and they catch you when the page is on the web. But your WP page doesn't run locally for me, so that's not it. But still, first the crossword flashes as you said, then the blank page is loaded. That feels like it's "them" doing it. wacko.gif

User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 24 2017, 06:36 PM
Post #13


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,505
Joined: 9-August 06
Member No.: 6



I found it. That doesn't mean I can fix it, but I found what it is. I thought I'd try removing all other JS. I got lucky with the first one I tried, the large style block. Commented it out and the crossword is back.

What is it for? Seems to be related to the menu, but your menu only has normal links, from the look of it at least.

CODE
        <!--     <script type='text/javascript'>
            (function($) {
                $(document).ready(function() {
                    $(".children").parent("li").addClass("has-child-menu");
                    $(".sub-menu").parent("li").addClass("has-child-menu");
                    $(".drop").parent("li").addClass("has-child-menu");
                    
                    $('.fadeimage').hover(
                        function() {$(this).stop().animate({ opacity: 0.5 }, 800);},
                        function() {$(this).stop().animate({ opacity: 1.0 }, 800);}
                    );
                    
                    $('.mastheadnav li ul,.mainnav li ul,.subnav li ul,.mastheadnav li ul,.mainnav li ul').hide().removeClass('fallback');
                    $('.mastheadnav > li,.mainnav > li,.subnav > li,.mainnav > li').hover(
                        function () {
                            $('ul', this).stop().slideDown(250);
                        },
                        function () {
                            $('ul', this).stop().slideUp(250);
                        }
                    );

                    $('[data-toggle="tooltip"]').tooltip({
                        'placement': 'top'
                    });    

                    $('.sidebar-wrapper, .post-wrapper')
                    .theiaStickySidebar({
                        additionalMarginTop: 30,
                        additionalMarginBottom: 30
                    });
                
                    /* InnerPage Slider */
                    var innerslider = $(".carousel-gallery");
                    innerslider.owlCarousel({
                      autoPlay: 999999,
                      pagination:true,
                      singleItem : true,
                      autoHeight : true,
                      mouseDrag: false,
                      touchDrag: false                      
                    });    
                    $(".carousel-gallery-next").click(function(){
                        innerslider.trigger('owl.next');
                    });
                    $(".carousel-gallery-prev").click(function(){
                        innerslider.trigger('owl.prev');
                    });
                    
                    /* InnerPage Slider */
                    var owl4 = $(".carousel-four");
                    owl4.owlCarousel({
                      autoPlay: 999999,
                      pagination:true,
                      singleItem : true,
                      autoHeight : true,
                      mouseDrag: false,
                      touchDrag: false                      
                    });    
                    $(".carousel-four-next").click(function(){
                        owl4.trigger('owl.next');
                    });
                    $(".carousel-four-prev").click(function(){
                        owl4.trigger('owl.prev');
                    });                        
                    
                    // Responsive Menu (TinyNav)
                    $(".responsive_menu").tinyNav({
                        active: 'current_page_item', // Set the "active" class for default menu
                        label: ''
                    });
                    $(".tinynav").selectbox();            
                    
                    $('a[href="#top"]').click(function(){
                        $('html, body').animate({scrollTop:0}, 'slow');
                        return false;
                    });
                    $('.modal').on('shown.bs.modal', function() {
                      $(this).find('[autofocus]').focus();
                    });                    
                });
            })(jQuery);
            </script> -->
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
calico
post Jan 24 2017, 08:31 PM
Post #14





Group: Members
Posts: 5
Joined: 23-January 17
Member No.: 26,279



I genuinely appreciate everyone's input. I feel a little stupid, but apparently the problem was that for security reasons Word Press does not allow single page java script. I'm sure you can build a work-around into the site, but I just downloaded a plugin to allow for the use of javascript.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jan 24 2017, 08:43 PM
Post #15


Don't like donuts. Don't do MySpace.
********

Group: WDG Moderators
Posts: 17,505
Joined: 9-August 06
Member No.: 6



Fact remains it didn't run locally either - until I removed that block. Peculiar.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 24th March 2017 - 07:06 AM