Ignore:
Timestamp:
Jun 22, 2013, 6:44:48 AM (11 years ago)
Author:
rvelices
Message:

feature 2928: fctorize switchBox (now js is loaded async + also apply to the calendar type links on index page)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/themes/default/template/index.tpl

    r23399 r23437  
    1 {combine_script id='core.switchbox' load='footer' require='jquery' path='themes/default/js/switchbox.js'}
     1{combine_script id='core.switchbox' load='async' require='jquery' path='themes/default/js/switchbox.js'}
    22{$MENUBAR}
    33
     
    2727                        {/foreach}
    2828                </div>
    29                 {footer_script require='core.switchbox'}switchBox("#sortOrderLink", "#sortOrderBox");{/footer_script}
     29                {footer_script}(SwitchBox=window.SwitchBox||[]).push("#sortOrderLink", "#sortOrderBox");{/footer_script}
    3030                {/strip}</li>
    3131{/if}
     
    4444                        {/foreach}
    4545                </div>
    46                 {footer_script require='core.switchbox'}switchBox("#derivativeSwitchLink", "#derivativeSwitchBox");{/footer_script}
     46                {footer_script}(SwitchBox=window.SwitchBox||[]).push("#derivativeSwitchLink", "#derivativeSwitchBox");{/footer_script}
    4747                {/strip}</li>
    4848{/if}
     
    102102{if isset($chronology_views)}
    103103<div class="calendarViews">{'View'|@translate}:
    104         <a id="calendarViewSwitchLink" href="javascript:toggleCalendarViewsBox()">
     104        <a id="calendarViewSwitchLink" href="#">
    105105        {foreach from=$chronology_views item=view}{if $view.SELECTED}{$view.CONTENT}{/if}{/foreach}
    106         </a> 
     106        </a>
    107107        <div id="calendarViewSwitchBox" class="switchBox">
    108108                {foreach from=$chronology_views item=view name=loop}{if !$smarty.foreach.loop.first}<br>{/if}
     
    110110                {/foreach}
    111111        </div>
    112         {footer_script require='jquery'}{literal}
    113 function toggleCalendarViewsBox() {
    114         var elt = jQuery("#calendarViewSwitchBox")
    115                 , ePos = jQuery("#calendarViewSwitchLink");
    116         elt.css("left", Math.min( ePos.offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
    117                 .css("top", ePos.offset().top + ePos.outerHeight(true))
    118                 .toggle();
    119 };
    120 jQuery("#calendarViewSwitchBox").on("mouseleave", function() {
    121         jQuery(this).hide();
    122 });
    123         {/literal}{/footer_script}
     112        {footer_script}(SwitchBox=window.SwitchBox||[]).push("#calendarViewSwitchLink", "#calendarViewSwitchBox");{/footer_script}
    124113</div>
    125114{/if}
Note: See TracChangeset for help on using the changeset viewer.