HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux aritmodecarnaval.es 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: www-data (33)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /home/www/fotospedroj/galleria/plugins/history/galleria.history.js
/**
 * @preserve Galleria History Plugin 2011-08-01
 * http://galleria.aino.se
 *
 * Copyright 2011, Aino
 * Licensed under the MIT license.
 *
 */

/*global jQuery, Galleria, window */

Galleria.requires(1.25, 'The History Plugin requires Galleria version 1.2.5 or later.');

(function( $, window ) {

    Galleria.History = (function() {

        var onloads = [],

            init = false,

            loc = window.location,

            doc = window.document,

            ie = Galleria.IE,

            support = 'onhashchange' in window && ( doc.mode === undefined || doc.mode > 7 ),

            iframe,

            get = function( winloc ) {
                if( iframe && !support && Galleria.IE ) {
                    winloc = winloc || iframe.location;
                }  else {
                    winloc = loc;
                }
                return parseInt( winloc.hash.substr(2), 10 );
            },

            saved = get( loc ),

            callbacks = [],

            onchange = function() {
                $.each( callbacks, function( i, fn ) {
                    fn.call( window, get() );
                });
            },

            ready = function() {
                $.each( onloads, function(i, fn) {
                    fn();
                });

                init = true;
            },

            setHash = function( val ) {
                return '/' + val;
            };

        // always remove support if IE < 8
        if ( support && ie < 8 ) {
            support = false;
        }

        if ( !support ) {

            $(function() {

                var interval = window.setInterval(function() {

                    var hash = get();

                    if ( !isNaN( hash ) && hash != saved ) {
                        saved = hash;
                        loc.hash = setHash( hash );
                        onchange();
                    }

                }, 50);

                if ( ie ) {

                    $('<iframe tabindex="-1" title="empty">').hide().attr( 'src', 'about:blank' ).one('load', function() {

                        iframe = this.contentWindow;

                        ready();

                    }).insertAfter(doc.body);

                } else {
                    ready();
                }
            });
        } else {
            ready();
        }

        return {

            change: function( fn ) {

                callbacks.push( fn );

                if( support ) {
                    window.onhashchange = onchange;
                }
            },

            set: function( val ) {

                if ( isNaN( val ) ) {
                    return;
                }

                if ( !support && ie ) {

                    this.ready(function() {

                        var idoc = iframe.document;
                        idoc.open();
                        idoc.close();

                        iframe.location.hash = setHash( val );

                    });
                }

                loc.hash = setHash( val );
            },

            ready: function(fn) {
                if (!init) {
                    onloads.push(fn);
                } else {
                    fn();
                }
            }
        };
    }());

}( jQuery, this ));