• Hi there,

    I’ve found an strange intermitent bug that happens just sometimes, other times it’s ok.

    Give a look a this image: http://i.imgur.com/AYHSLcY.png

    As you can see, it’s like if the width were double of the width of the screen. But this happens just some times.

    I’ve tried to track down the problem, and this is what I’ve found so far:

    When the thumbnail renders correctly, the javascript variable “wppaTopMoc” value is “1”. When the thumbnail renders incorrectly, that variable’s value is “0”.

    Having that variable set to “0” means that nobody is calling to function _wppaDoAutocol( mocc ), so nobody is setting the width of the thumbnail.

    I haven’t been able to find more on the issue, but I would like to help you if I can. I think the problem could be the order of load of the .js files, because it happens more frequently in some devices (Apple ones) than others.

    Is there any possibility to load normal .js files and not .min.js ones?

    https://wordpress.org/plugins/wp-photo-album-plus/

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter ktecho

    (@ktecho)

    You set the variable to 0 in the header of the page (wppa.js):

    var wppaTopMoc = 0;

    But then it’s expected that the script at the end of the page sets it to 1 in uploads/wppa/temp/wppa.xx.yy.zz.aa.js:

    wppaTopMoc = 1;

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    wppaTopMocc is initialized in wppa.js. This file MUST therefor and for other inits be placed before any other wppa js files.

    wppaTopMocc is incremented at every wppa occurrance ( shortcode, widget, etc., see wppa_container($action) when $action = ‘open’ in wppa_functions.php

    Now, wppaDoAutocol() knows what the maximum occurrance is it should act upon.

    If you have a plugin active that moves js file to the bottom ( so to say to speed up page loading ) TRASH it. You may set defer js loading in Table IV-A13 if you believe in the fairytale that putting js file in the footer speeds up page loading, but this switch will load the wppa+ js files in the footer in the right order, i.e. first wppa.js and then the temp file with the page dependant js, i.c. the wppaTopMocc = 1, = 2 , = 3 etc.

    If you think it should work correctly and it does not, i need a live link to see what happens.

    BTW, If you are interested, pls visit my new wppa+ docs and demos site that is still under construction, but intented to be comprehensive and mobile friendly. To see the most interesting things, you need to register, and registering must be moderated, so it may take a while.

    Thread Starter ktecho

    (@ktecho)

    Hi Jacob. Thanks for your reply.

    URL of the album is this one: https://www.aalquilar.es/album-de-fotos-de-baiona/

    I have “wppa-utils.min.js” before “wppa.min.js”, if that matters.

    I don’t have a plugin that reorders the .js files, so I don’t think something is messing up the things.

    I already have the IV-A13 setting enabled. Going to disable it and test again. I’ll come back with the results.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Sorry i forgot to answer this:

    Is there any possibility to load normal .js files and not .min.js ones?

    Yes, delete the xxx.min.js files.
    See also: wppa-non-admin.php function wppa_add_javascripts()

    Thread Starter ktecho

    (@ktecho)

    Hi Jacob,

    I’ll continue to do testing about this, but it seems the problem gets solved by unchecking the IV-A13 setting. Maybe it changes the order of some .js or something.

    So maybe it’s a good idea to put off this option so users don’t check it. I remember checking it while thinking “I think putting .js at the end is better, so click” 🙂

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    IV-A13 should work. If i do not supply that, they are going to install disastrous plugins as i indicaed above. If you encounter this on mobile only, especially when rotating, i rather think it is a timing issue. Sometimes i have the same when my phone is overloaded with Chrome having 20 or more tabs open. I will, however, get into the timing issue and put some delay in the response on orientationchange. Having IV-A13 ticked is not a good idea anyway.

    The fact that utils.js is the first is ok, wppa.js uses its wppaConsoleLog() function at the end of loading, to report that it loaded.

    Thread Starter ktecho

    (@ktecho)

    No, I don’t see it while rotating. It has nothing to do with rotating.

    I have iOS and Android apps (that are merely webviews to my website) and the problem appears a lot more in that apps than if I open the same page in the browser. That’s why I think it could be a timming / order issue, because there are some differences. Take this for an example: Chrome uses http/2, but the webview that I’m using (based in Chrome) uses just http/1.1.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I know that not all browsers have the sam idea about when to trigger the document.ready event.
    I made a patch such that the wppaDoAutocol() action is not only done at the time of the document.ready trigger, but also one second later.

    So, pls try the current development version

    Thread Starter ktecho

    (@ktecho)

    Just if you set the IV-A13 option or always?

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Always.

    I changed in wppa.js:

    // Init at dom ready
    jQuery( document ).ready(function() {
    	var anyAutocol = false;
    
    	// Check for occurrences that are responsive
    	for ( mocc = 1; mocc <= wppaTopMoc; mocc++ ) {
    		if ( wppaAutoColumnWidth[mocc] ) {
    			wppaColWidth[mocc] = 0;
    			_wppaDoAutocol( mocc );
    			anyAutocol = true;
    		}
    	}
    
    	// Misc. init
    	_wppaTextDelay = wppaAnimationSpeed;
    	if ( wppaFadeInAfterFadeOut ) _wppaTextDelay *= 2;
    
    	// Install resize handler
    	if ( anyAutocol ) {
    		jQuery( window ).resize(function() {
    			for ( mocc = 1; mocc <= wppaTopMoc; mocc++ ) {
    				if ( wppaAutoColumnWidth[mocc] ) {
    					wppaColWidth[mocc] = 0;
    					_wppaDoAutocol( mocc );
    				}
    			}
    		});
    	}
    });

    to:

    // Init at dom ready
    jQuery( document ).ready(function() {
    	wppaDoInit( false );
    
    	// For browsers that signal domready too early for autocol, redo autocol
    	setTimeout( function() { wppaDoInit( true ); }, 1000 );
    });
    
    function wppaDoInit( autoOnly ) {
    	var anyAutocol = false;
    
    	// Check for occurrences that are responsive
    	for ( mocc = 1; mocc <= wppaTopMoc; mocc++ ) {
    		if ( wppaAutoColumnWidth[mocc] ) {
    			wppaColWidth[mocc] = 0;
    			_wppaDoAutocol( mocc );
    			anyAutocol = true;
    		}
    	}
    
    	if ( ! autoOnly ) {
    
    		// Misc. init
    		_wppaTextDelay = wppaAnimationSpeed;
    		if ( wppaFadeInAfterFadeOut ) _wppaTextDelay *= 2;
    
    		// Install resize handler
    		if ( anyAutocol ) {
    			jQuery( window ).resize(function() {
    				for ( mocc = 1; mocc <= wppaTopMoc; mocc++ ) {
    					if ( wppaAutoColumnWidth[mocc] ) {
    						wppaColWidth[mocc] = 0;
    						_wppaDoAutocol( mocc );
    					}
    				}
    			});
    		}
    	}
    }

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Width intermitent problem with thumbnails’ is closed to new replies.