Changeset 4363


Ignore:
Timestamp:
Nov 24, 2009, 11:22:08 PM (14 years ago)
Author:
grum
Message:

[AMM] moving the JS for the "random image" outside the <DL> tag

Location:
extensions/AMenuManager
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/AMenuManager/amm_pip.class.inc.php

    r3690 r4363  
    4949    add_event_handler('blockmanager_apply', array(&$this, 'blockmanager_apply') );
    5050    add_event_handler('loc_end_page_header', array(&$this->css, 'apply_CSS'));
     51    add_event_handler('loc_end_page_tail', array(&$this, 'applyJS'));
    5152  }
    5253
     
    230231  }
    231232
     233
     234  public function applyJS()
     235  {
     236    global $user, $template;
     237
     238    $menu = new BlockManager("menubar");
     239    $menu->load_registered_blocks();
     240    $menu->prepare_display();
     241
     242    if ( ( ($block = $menu->get_block( 'mbAMM_randompict' ) ) != null ) && ($user['nb_total_images'] > 0) )
     243    {
     244      $local_tpl = new Template(AMM_PATH."admin/", "");
     245      $local_tpl->set_filename('body_page', dirname($this->filelocation).'/menu_templates/menubar_randompic.js.tpl');
     246
     247      $data = array(
     248        "delay" => $this->my_config['amm_randompicture_periodicchange'],
     249        "blockHeight" => $this->my_config['amm_randompicture_height'],
     250        "firstPicture" => $this->ajax_amm_get_random_picture()
     251      );
     252
     253      $local_tpl->assign('data', $data);
     254
     255      $template->append('footer_elements', $local_tpl->parse('body_page', true));
     256    }
     257
     258  }
     259
    232260} // AMM_PIP class
    233261
  • extensions/AMenuManager/main.inc.php

    r4274 r4363  
    22/*
    33Plugin Name: Advanced Menu Manager
    4 Version: 2.1.2
     4Version: 2.1.3
    55Description: Gestion avancée du menu / Advanced management of menu
    66Plugin URI: http://piwigo.org
     
    4444|         |            |    - es_ES
    4545|         |            |    - hu_HU (thx to sámli)
    46 |         |            |
    47 |         |            |
     46| 2.1.3   | 2009/11/24 | * move the js for "random image" in the the footer
     47|         |            |   (having the js inside the <dl> tag was not w3c
     48|         |            |   compliant)
    4849|         |            |
    4950
     
    7071define('AMM_PATH' , PHPWG_PLUGINS_PATH . AMM_DIR . '/');
    7172
    72 define('AMM_VERSION' , '2.1.2'); // => ne pas oublier la version dans l'entête !!
     73define('AMM_VERSION' , '2.1.3'); // => ne pas oublier la version dans l'entête !!
    7374
    7475global $prefixeTable, $page;
  • extensions/AMenuManager/menu_templates/menubar_randompic.tpl

    r3690 r4363  
    44<dt>{$block->get_title()}</dt>
    55
    6 {literal}
    7 <script type="text/javascript">
    8 var fixedHeight = {/literal}{$block->data.blockHeight}{literal};
    9 
    10   function init()
    11   {
    12     {/literal}
    13     {if $block->data.blockHeight>0}
    14       $("#irandompicinner").height(fixedHeight);
    15       {literal}$("#iammrpic").load( function () { computePositionTop(); } );{/literal}
    16     {else}
    17       {literal}
    18       $("#iammrpic").load( function () { $("#irandompicinner").animate({height: ($("#iamm_ill0").innerHeight())+"px"}, "normal"); } );
    19       {/literal}
    20     {/if}
    21     {literal}
    22   }
    23 
    24   function computePositionTop()
    25   {
    26     $("#iamm_ill0").css({top:(fixedHeight-$("#iamm_ill0").innerHeight())/2});
    27   }
    28 
    29   function getRandomPicture()
    30   {
    31     $.get("./index.php", {ajaxfct:"randompic"},
    32       function (data)
    33       {
    34         $("#iamm_ill0").fadeTo('slow', 0, function ()
    35         {
    36           $("#iamm_ill0").html(data);
    37 
    38           {/literal}
    39           {if $block->data.blockHeight>0}
    40             {literal}
    41             $("#iammrpic").load( function () {
    42               computePositionTop();
    43               $("#iamm_ill0").fadeTo('slow', 1);
    44             } );
    45             {/literal}
    46           {else}
    47             {literal}
    48             $("#iammrpic").load( function () {
    49               $("#irandompicinner").animate({height: ($("#iamm_ill0").innerHeight())+"px"}, "normal", function ()
    50               {
    51                 $("#iamm_ill0").fadeTo('slow', 1, function ()
    52                 {
    53                   $("#irandompicinner").animate({height: this.clientHeight+"px"}, "normal");
    54                 });
    55               });
    56             } );
    57             {/literal}
    58           {/if}
    59           {literal}
    60 
    61         } );
    62       }
    63     );
    64   }
    65 
    66 
    67 </script>
    68 {/literal}
    696
    707<dd id="irandompicdd" class="randompicdd">
     
    7613</dd>
    7714
    78 <script type="text/javascript">
    79   init();
    80   {if $block->data.delay > 0 }
    81     var vIntervalID = window.setInterval(getRandomPicture, {$block->data.delay});
    82   {/if}
    83 </script>
Note: See TracChangeset for help on using the changeset viewer.