diff options
author | mistic100 <mistic@piwigo.org> | 2013-06-18 10:29:55 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2013-06-18 10:29:55 +0000 |
commit | 078e4d1bbdc920ff6c7a3ba8777fae2b23d38909 (patch) | |
tree | b16cf52fa2642b8118985173b9723e5d4655907f /themes/default/template/index.tpl | |
parent | 9602a3a2034ac6a83a90a9fb925065a931a2ff19 (diff) |
feature:2928 Factorize JS code for switchBox
switchBox("selector for link", "selector for box");
git-svn-id: http://piwigo.org/svn/trunk@23320 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'themes/default/template/index.tpl')
-rw-r--r-- | themes/default/template/index.tpl | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/themes/default/template/index.tpl b/themes/default/template/index.tpl index 71e8d8ba4..89ac0f2b4 100644 --- a/themes/default/template/index.tpl +++ b/themes/default/template/index.tpl @@ -1,5 +1,7 @@ +{combine_script id='core.switchbox' load='footer' require='jquery' path='themes/default/js/switchbox.js'} {$MENUBAR} + {if isset($errors) or isset($infos)} <div class="content messages{if isset($MENUBAR)} contentWithMenu{/if}"> {include file='infos_errors.tpl'} @@ -24,17 +26,7 @@ {/if} {/foreach} </div> - {footer_script require='jquery'}{literal} -jQuery("#sortOrderLink").click(function() { - var elt = jQuery("#sortOrderBox"); - elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5)) - .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true)) - .toggle(); -}); -jQuery("#sortOrderBox").on("mouseleave", function() { - jQuery(this).hide(); -}); - {/literal}{/footer_script} + {footer_script require='core.switchbox'}switchBox("#sortOrderLink", "#sortOrderBox");{/footer_script} {/strip}</li> {/if} {if !empty($image_derivatives)} @@ -51,17 +43,7 @@ jQuery("#sortOrderBox").on("mouseleave", function() { {/if} {/foreach} </div> - {footer_script require='jquery'}{literal} -jQuery("#derivativeSwitchLink").click(function() { - var elt = jQuery("#derivativeSwitchBox"); - elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5)) - .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true)) - .toggle(); -}); -jQuery("#derivativeSwitchBox").on("mouseleave", function() { - jQuery(this).hide(); -}); - {/literal}{/footer_script} + {footer_script require='core.switchbox'}switchBox("#derivativeSwitchLink", "#derivativeSwitchBox");{/footer_script} {/strip}</li> {/if} |