Announcement

  •  » Engine
  •  » [Piwigo 2.2] jQuery upgrade to 1.4.4

#1 2010-12-15 14:12:33

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13182

[Piwigo 2.2] jQuery upgrade to 1.4.4

In [Bugtracker, ticket 2061, fixed] Upgrade jQuery from version 1.4.1 to 1.4.4

rvelices wrote:

This update will break templates as the packed version is not released anymore [...]

I suppose you're writting this because in Piwigo template files, we have:

{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"}

and with jQuery 1.4.4, we will need:

{known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.min.js"}

This is not a problem for core template files, but it might be a problem for plugins.

If it is a matter of 10 minutes coding, could we add a check in the known_script function to transform packed into min automatically?


Latest blog post (November 9th 2018) Why Flickr could not remain free for ever

Offline

 

#2 2010-12-15 14:35:35

rvelices
Piwigo Team
2005-12-29
1960

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

Yes we could do that small change, however also note that known_script is deprecated because it has been replaced with combine_script ... I will leave it there probably with a warning
the combine script does not take src as parameter but path which is supposed to be relative to PHPWG_ROOT_PATH - this path is needed to read the files and combine themif necessary or just put an url (eg if you combine only one javascript file, it will be served from the original location)

Offline

 

#3 2010-12-27 10:13:59

rub
Piwigo Team
Lille
2005-08-26
5019

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

No upgrade of UI? 1.7.3 or 1.8.7?

Offline

 

#4 2010-12-27 11:47:02

rvelices
Piwigo Team
2005-12-29
1960

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

rub wrote:

No upgrade of UI? 1.7.3 or 1.8.7?

Its a mess - they changed file naming conventions and the file structure (for example our ui.core is now ui.core ui.mouse ui.widget ui.position) ...

Offline

 

#5 2011-02-10 11:21:32

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13182

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

We have discussed with P@t about jQuery UI.

jQuery UI needs an update, we can't stay with an obsolete version forever.

* either we use a minified version of jQuery UI in a single file
* or we use jQuery UI in several files, but they are not minified

I'm in favor of a single file, which will be easier to update in the future. The single file weights 200KB (minified). I don't think it is useful to remove some modules (to make the whole thing simple to update).

rvelices, do you think a 200KB javascript file in the administration will decrease speed performances?


Latest blog post (November 9th 2018) Why Flickr could not remain free for ever

Offline

 

#6 2011-02-10 13:32:18

rvelices
Piwigo Team
2005-12-29
1960

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

plg wrote:

* or we use jQuery UI in several files, but they are not minified

I think minified versions are also available in the downnload for single files (development-bundle/ui/minified) and combine_script is able to minify js anyway. The only drawback of this is that we have to add several combine_script and correctly set the 'require' parameter (it is not too difficult as dependencies are easily visible from the ui download page, but it is an extra step to pay attention to)

plg wrote:

I'm in favor of a single file, which will be easier to update in the future. The single file weights 200KB (minified). I don't think it is useful to remove some modules (to make the whole thing simple to update).

rvelices, do you think a 200KB javascript file in the administration will decrease speed performances?

Let's go for this on single file. However I think we should combine both jquery and jquery.ui at the top of the page and all other scripts at the bottom. In this case we will avoid the following case: admin page A needs ui + A.js, B needs ui + B.js and we will end up with two js each one greater than 200K.
Not sure about performance, we will see. I read somewhere that mobile devices such as IPhone never cache objects larger than X kB ...

Offline

 

#7 2011-02-10 14:25:28

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

rvelices wrote:

I think minified versions are also available in the downnload for single files (development-bundle/ui/minified)

Not any more...

rvelices wrote:

and combine_script is able to minify js anyway. The only drawback of this is that we have to add several combine_script and correctly set the 'require' parameter (it is not too difficult as dependencies are easily visible from the ui download page, but it is an extra step to pay attention to)

If combine_script is able to minify, we can do that way...

rvelices wrote:

Let's go for this on single file. However I think we should combine both jquery and jquery.ui at the top of the page and all other scripts at the bottom. In this case we will avoid the following case: admin page A needs ui + A.js, B needs ui + B.js and we will end up with two js each one greater than 200K.

I prefer this way ;-)

rvelices wrote:

Not sure about performance, we will see. I read somewhere that mobile devices such as IPhone never cache objects larger than X kB ...

iPhone never cache objects larger than 15k! So however, jquery, jquery ui core, etc... will never be cached.


P@t

Offline

 

#8 2011-02-10 16:56:41

rvelices
Piwigo Team
2005-12-29
1960

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

P@t wrote:

rvelices wrote:

I think minified versions are also available in the downnload for single files (development-bundle/ui/minified)

Not any more...

? Just downloaded it. They are there.

Offline

 

#9 2011-02-10 20:27:29

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

rvelices wrote:

? Just downloaded it. They are there.

Sorry, I didn't see them...
So, do we keep minified files, or do we use full single file?


P@t

Offline

 

#10 2011-02-11 09:26:59

rvelices
Piwigo Team
2005-12-29
1960

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

P@t wrote:

So, do we keep minified files, or do we use full single file?

4 files core = 13.6 KB
accordion = 9 KB
14 files effects = 27 KB
datepicker = 35 KB
...
total - 202KB

I would say
- merge the 4 core files into a single one (to avoid 4 combine_script every time)
- use multiple files

So by default we will load only core + accordion ~= 23 KB and some pages will load more ...

Offline

 

#11 2011-02-11 17:13:03

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

jQuery and jQuery UI have been upgraded
[Subversion] r9172

I merged the 4 core files into themes/default/js/jquery.ui.min.js
Is the file name good? I didn't want to name it jquery.ui.core.min.js because file already exist in ui directory. It may be confused.


P@t

Offline

 

#12 2011-02-11 20:56:01

LucMorizur
Member
Vienne (Isère) - France
2009-04-30
168

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

Not a small job !


Our gallery : Le Site à Nous (a silly name in french, but here I don't care ;-) ! )
An event, a new gallery ? Plugin Event Cats
My test gallery : Tests Piwigo de Luc
Thanksalot for this beautiful project.

Offline

 

#13 2011-02-17 05:00:35

jortex696
Member
2010-05-13
62

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

Hi, I would help improve the performance of javascript and / or general Piwigo ...
I have a server with 2.2 rc2 Piwigo .. and handling around 1 million images.

On occasion the synchronization on the issue of viewing the category becomes very slow. and difficult to upgrading. If I can help as a guinea pig, do not hesitate to tell me.

----------------------------------------------------------------

Versión de Piwigo

        * Piwigo 2.2.0RC2
        * Última versión
        * Abonar *********************** a la newsletter Piwigo

Entorno

        * Systema operativo: Linux
        * PHP: 5.3.3-7 (Mostrar las informaciones) [2011-02-16 23:06:17]
        * mysql: 5.1.49-3 [2011-02-16 23:06:17]

Base de datos

        * 1069784 Fotos (el primer foto añadida Sábado 22 Enero 2011)
        * 30258 àlbumes dont30258 físicos et 0 virtuales (1069784 asociaciones)
        * 0 etiqueta (0 asociación)
        * 2 usuarios
        * 0 grupo
        * 0 Comentario


edit
delete e-mail

Last edited by ddtddt (2011-02-17 06:54:30)

Offline

 

#14 2011-03-06 12:46:05

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

rvelices wrote:

I would say
- merge the 4 core files into a single one (to avoid 4 combine_script every time)
- use multiple files

jQuery UI 1.8.10 as been released... it's really boring to merge 4 core files each time... maybe template class can load all ccore files for us. I did the following changes, and it work perfectly:

$known_paths = array(
      'core.scripts' => 'themes/default/js/scripts.js',
      'jquery' => 'themes/default/js/jquery.min.js',
      'jquery.ui' => 'themes/default/js/ui/minified/jquery.ui.core.min.js',
      'jquery.ui.widget' => 'themes/default/js/ui/minified/jquery.ui.widget.min.js',
      'jquery.ui.mouse' => 'themes/default/js/ui/minified/jquery.ui.mouse.min.js',
      'jquery.ui.position' => 'themes/default/js/ui/minified/jquery.ui.position.min.js'

    );

function add($id, $load_mode, $require, $path, $version=0)
  {
    if ($this->did_head && $load_mode==0 )
    {
      trigger_error("Attempt to add a new script $id but the head has been written", E_USER_WARNING);
    }
    if (! isset( $this->registered_scripts[$id] ) )
    {
      $script = new Script($load_mode, $id, $path, $version, $require);
      self::fill_well_known($id, $script);
      $this->registered_scripts[$id] = $script;
      if ($id == 'jquery.ui')
      {
        $this->add('jquery.ui.widget', $load_mode, array('jquery'), null);
        $this->add('jquery.ui.mouse', $load_mode, array('jquery', 'jquery.ui', 'jquery.ui.widget'), null);
        $this->add('jquery.ui.position', $load_mode, array('jquery'), null);
      }

    }
...

private static function fill_well_known($id, $script)
  {
    if ( empty($script->path) && isset(self::$known_paths[$id]))
    {
      $script->path = self::$known_paths[$id];
    }
    if ( strncmp($id, 'jquery.', 7)==0 )
    {
        if ( !in_array('jquery', $script->precedents ) )
        $script->precedents[] = 'jquery';

      $required_ids = array('jquery.ui', 'jquery.ui.widget', 'jquery.ui.mouse', 'jquery.ui.position');
      if ( strncmp($id, 'jquery.ui.', 10)==0 and !in_array($id, $required_ids) )
      {
        foreach ($required_ids as $required_id)
        {
          if ( !in_array($required_id, $script->precedents ) )
            $script->precedents[] = $required_id;
        }
      }

    }
  }

Can I commit that?


P@t

Offline

 

#15 2011-03-06 13:36:46

rvelices
Piwigo Team
2005-12-29
1960

Re: [Piwigo 2.2] jQuery upgrade to 1.4.4

yes

Offline

 
  •  » Engine
  •  » [Piwigo 2.2] jQuery upgrade to 1.4.4

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2019 · Contact