Changeset 23437 for trunk/themes/default
- Timestamp:
- Jun 22, 2013, 6:44:48 AM (11 years ago)
- Location:
- trunk/themes/default
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/themes/default/js/switchbox.js
r23320 r23437 1 function switchBox(link, box) { 2 jQuery(link).click(function() { 3 var elt = jQuery(box); 4 elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5)) 5 .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true)) 6 .toggle(); 7 }); 8 jQuery(box).on("mouseleave click", function() { 9 jQuery(this).hide(); 10 }); 11 } 1 (function () { 2 var sbFunc = function(link, box) { 3 jQuery(link).click(function() { 4 var elt = jQuery(box); 5 elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5)) 6 .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true)) 7 .toggle(); 8 return false; 9 }); 10 jQuery(box).on("mouseleave click", function() { 11 jQuery(this).hide(); 12 }); 13 }; 14 15 if (window.SwitchBox) { 16 for (var i=0; i<SwitchBox.length; i+=2) 17 sbFunc(SwitchBox[i], SwitchBox[i+1]); 18 } 19 20 SwitchBox = { 21 push: sbFunc 22 } 23 })(); -
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'} 2 2 {$MENUBAR} 3 3 … … 27 27 {/foreach} 28 28 </div> 29 {footer_script require='core.switchbox'}switchBox("#sortOrderLink", "#sortOrderBox");{/footer_script}29 {footer_script}(SwitchBox=window.SwitchBox||[]).push("#sortOrderLink", "#sortOrderBox");{/footer_script} 30 30 {/strip}</li> 31 31 {/if} … … 44 44 {/foreach} 45 45 </div> 46 {footer_script require='core.switchbox'}switchBox("#derivativeSwitchLink", "#derivativeSwitchBox");{/footer_script}46 {footer_script}(SwitchBox=window.SwitchBox||[]).push("#derivativeSwitchLink", "#derivativeSwitchBox");{/footer_script} 47 47 {/strip}</li> 48 48 {/if} … … 102 102 {if isset($chronology_views)} 103 103 <div class="calendarViews">{'View'|@translate}: 104 <a id="calendarViewSwitchLink" href=" javascript:toggleCalendarViewsBox()">104 <a id="calendarViewSwitchLink" href="#"> 105 105 {foreach from=$chronology_views item=view}{if $view.SELECTED}{$view.CONTENT}{/if}{/foreach} 106 </a> 106 </a> 107 107 <div id="calendarViewSwitchBox" class="switchBox"> 108 108 {foreach from=$chronology_views item=view name=loop}{if !$smarty.foreach.loop.first}<br>{/if} … … 110 110 {/foreach} 111 111 </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} 124 113 </div> 125 114 {/if} -
trunk/themes/default/template/picture.tpl
r23384 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'} 2 2 {if isset($MENUBAR)}{$MENUBAR}{/if} 3 3 <div id="content"{if isset($MENUBAR)} class="contentWithMenu"{/if}> … … 21 21 <div class="actionButtons"> 22 22 {if isset($current.unique_derivatives) && count($current.unique_derivatives)>1} 23 {footer_script require='jquery ,core.switchbox'}{literal}23 {footer_script require='jquery'}{literal} 24 24 function changeImgSrc(url,typeSave,typeMap) 25 25 { … … 35 35 document.cookie = 'picture_deriv='+typeSave+';path={/literal}{$COOKIE_PATH}{literal}'; 36 36 } 37 switchBox("#derivativeSwitchLink", "#derivativeSwitchBox");37 (SwitchBox=window.SwitchBox||[]).push("#derivativeSwitchLink", "#derivativeSwitchBox"); 38 38 {/literal}{/footer_script} 39 39 {strip}<a id="derivativeSwitchLink" title="{'Photo sizes'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
Note: See TracChangeset
for help on using the changeset viewer.