From 669992fc255b77f838119e2e562576c9f2d6a292 Mon Sep 17 00:00:00 2001 From: Owen Leonard <oleonard@myacpl.org> Date: Thu, 6 Dec 2018 17:15:49 +0000 Subject: [PATCH] Bug 21751: fixFloat toolbar not displaying properly in Chrome This patch replaces the fixFloat jQuery plugin with a new one: HC-sticky (https://github.com/somewebmedia/hc-sticky). This plugin provides the same functionality without the page-reflow problems fixFloat suffers from. To test, apply the patch and regenerate the staff client CSS. Test the behavior of the floating toolbar on these pages: - Acquisitions -> Vendor -> Vendor details - Acquisitions -> Vendor -> View basket - On both these pages, test toolbar behavior before and after expanding the "Orders search" options at the top of the page. - Administration -> System preferences - Authorities -> Create or edit an authority - Catalog -> Advanced search - Search results - Catalog -> Item search - Cataloging -> Add or edit a record - Open the plugin window for the 008 field - Tools -> Label creator -> New label batch -> Add items -> Search -> Results - Patrons -> New patron - Test before and after expanding the patron search options at the top of the page - Test editing a patron too - Tools -> Automatic item modifications by age -> Edit - Tools -> Notices & slips -> Edit - Lists -> View list Check that the About page has been updated with information about the plugin. --- gulpfile.js | 2 +- koha-tmpl/intranet-tmpl/lib/hc-sticky.js | 11 ++++++ .../intranet-tmpl/prog/css/src/staff-global.scss | 23 ++++++----- koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 3 ++ .../intranet-tmpl/prog/en/modules/acqui/basket.tt | 13 +++++- .../prog/en/modules/acqui/supplier.tt | 11 +++++- .../prog/en/modules/admin/preferences.tt | 14 ++++--- .../prog/en/modules/authorities/authorities.tt | 9 ++++- .../prog/en/modules/catalogue/advsearch.tt | 9 ++++- .../prog/en/modules/catalogue/itemsearch.tt | 10 +++-- .../prog/en/modules/catalogue/results.tt | 11 ++++-- .../prog/en/modules/cataloguing/addbiblio.tt | 9 ++++- .../cataloguing/value_builder/marc21_field_008.tt | 9 ++++- .../intranet-tmpl/prog/en/modules/labels/result.tt | 9 ++++- .../prog/en/modules/members/memberentrygen.tt | 46 +++++++++------------- .../tools/automatic_item_modification_by_age.tt | 9 ++++- .../intranet-tmpl/prog/en/modules/tools/letter.tt | 2 +- .../prog/en/modules/virtualshelves/shelves.tt | 9 ++++- koha-tmpl/intranet-tmpl/prog/js/letter.js | 8 +++- koha-tmpl/intranet-tmpl/prog/js/members-menu.js | 3 ++ koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 5 ++- 21 files changed, 151 insertions(+), 74 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/lib/hc-sticky.js diff --git a/gulpfile.js b/gulpfile.js index 1eb0d6b..1214585 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -52,7 +52,7 @@ gulp.task('build', function() { return gulp.src( css_base + "/src/**/*.scss" ) .pipe(sass( sassOptions ).on('error', sass.logError)) .pipe(autoprefixer()) - .pipe(cssnano()) + .pipe(cssnano({ zindex: false })) .pipe(gulp.dest( css_base )); }); diff --git a/koha-tmpl/intranet-tmpl/lib/hc-sticky.js b/koha-tmpl/intranet-tmpl/lib/hc-sticky.js new file mode 100644 index 0000000..748bfe6 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/lib/hc-sticky.js @@ -0,0 +1,11 @@ +/*! + * HC-Sticky + * ========= + * Version: 2.2.3 + * Author: Some Web Media + * Author URL: http://somewebmedia.com + * Plugin URL: https://github.com/somewebmedia/hc-sticky + * Description: Cross-browser plugin that makes any element on your page visible while you scroll + * License: MIT + */ +!function(t,e){"use strict";if("object"==typeof module&&"object"==typeof module.exports){if(!t.document)throw new Error("HC-Sticky requires a browser to run.");module.exports=e(t)}else"function"==typeof define&&define.amd?define("hcSticky",[],e(t)):e(t)}("undefined"!=typeof window?window:this,function(U){"use strict";var Y={top:0,bottom:0,bottomEnd:0,innerTop:0,innerSticker:null,stickyClass:"sticky",stickTo:null,followScroll:!0,responsive:null,mobileFirst:!1,onStart:null,onStop:null,onBeforeResize:null,onResize:null,resizeDebounce:100,disable:!1,queries:null,queryFlow:"down"},$=function(t,e,o){console.log("%c! HC Sticky:%c "+t+"%c "+o+" is now deprecated and will be removed. Use%c "+e+"%c instead.","color: red","color: darkviolet","color: black","color: darkviolet","color: black")},Q=U.document,X=function(n,f){var o=this;if("string"==typeof n&&(n=Q.querySelector(n)),!n)return!1;f.queries&&$("queries","responsive","option"),f.queryFlow&&$("queryFlow","mobileFirst","option");var p={},d=X.Helpers,s=n.parentNode;"static"===d.getStyle(s,"position")&&(s.style.position="relative");var u=function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d.isEmptyObject(t)&&!d.isEmptyObject(p)||(p=Object.assign({},Y,p,t))},t=function(){return p.disable},e=function(){var t,e=p.responsive||p.queries;if(e){var o=U.innerWidth;if(t=f,(p=Object.assign({},Y,t||{})).mobileFirst)for(var i in e)i<=o&&!d.isEmptyObject(e[i])&&u(e[i]);else{var n=[];for(var s in e){var r={};r[s]=e[s],n.push(r)}for(var l=n.length-1;0<=l;l--){var a=n[l],c=Object.keys(a)[0];o<=c&&!d.isEmptyObject(a[c])&&u(a[c])}}}},r={css:{},position:null,stick:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};d.hasClass(n,p.stickyClass)||(!1===l.isAttached&&l.attach(),r.position="fixed",n.style.position="fixed",n.style.left=l.offsetLeft+"px",n.style.width=l.width,void 0===t.bottom?n.style.bottom="auto":n.style.bottom=t.bottom+"px",void 0===t.top?n.style.top="auto":n.style.top=t.top+"px",n.classList?n.classList.add(p.stickyClass):n.className+=" "+p.stickyClass,p.onStart&&p.onStart.call(n,Object.assign({},p)))},release:function(){var t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{};if(t.stop=t.stop||!1,!0===t.stop||"fixed"===r.position||null===r.position||!(void 0===t.top&&void 0===t.bottom||void 0!==t.top&&(parseInt(d.getStyle(n,"top"))||0)===t.top||void 0!==t.bottom&&(parseInt(d.getStyle(n,"bottom"))||0)===t.bottom)){!0===t.stop?!0===l.isAttached&&l.detach():!1===l.isAttached&&l.attach();var e=t.position||r.css.position;r.position=e,n.style.position=e,n.style.left=!0===t.stop?r.css.left:l.positionLeft+"px",n.style.width="absolute"!==e?r.css.width:l.width,void 0===t.bottom?n.style.bottom=!0===t.stop?"":"auto":n.style.bottom=t.bottom+"px",void 0===t.top?n.style.top=!0===t.stop?"":"auto":n.style.top=t.top+"px",n.classList?n.classList.remove(p.stickyClass):n.className=n.className.replace(new RegExp("(^|\\b)"+p.stickyClass.split(" ").join("|")+"(\\b|$)","gi")," "),p.onStop&&p.onStop.call(n,Object.assign({},p))}}},l={el:Q.createElement("div"),offsetLeft:null,positionLeft:null,width:null,isAttached:!1,init:function(){for(var t in l.el.className="sticky-spacer",r.css)l.el.style[t]=r.css[t];l.el.style["z-index"]="-1";var e=d.getStyle(n);l.offsetLeft=d.offset(n).left-(parseInt(e.marginLeft)||0),l.positionLeft=d.position(n).left,l.width=d.getStyle(n,"width")},attach:function(){s.insertBefore(l.el,n),l.isAttached=!0},detach:function(){l.el=s.removeChild(l.el),l.isAttached=!1}},a=void 0,c=void 0,g=void 0,m=void 0,h=void 0,v=void 0,y=void 0,b=void 0,S=void 0,w=void 0,k=void 0,E=void 0,x=void 0,L=void 0,T=void 0,j=void 0,O=void 0,C=void 0,i=function(){var t,e,o,i;r.css=(t=n,e=d.getCascadedStyle(t),o=d.getStyle(t),i={height:t.offsetHeight+"px",left:e.left,right:e.right,top:e.top,bottom:e.bottom,position:o.position,display:o.display,verticalAlign:o.verticalAlign,boxSizing:o.boxSizing,marginLeft:e.marginLeft,marginRight:e.marginRight,marginTop:e.marginTop,marginBottom:e.marginBottom,paddingLeft:e.paddingLeft,paddingRight:e.paddingRight},e.float&&(i.float=e.float||"none"),e.cssFloat&&(i.cssFloat=e.cssFloat||"none"),o.MozBoxSizing&&(i.MozBoxSizing=o.MozBoxSizing),i.width="auto"!==e.width?e.width:"border-box"===i.boxSizing||"border-box"===i.MozBoxSizing?t.offsetWidth+"px":o.width,i),l.init(),a=!(!p.stickTo||!("document"===p.stickTo||p.stickTo.nodeType&&9===p.stickTo.nodeType||"object"==typeof p.stickTo&&p.stickTo instanceof("undefined"!=typeof HTMLDocument?HTMLDocument:Document))),c=p.stickTo?a?Q:"string"==typeof p.stickTo?Q.querySelector(p.stickTo):p.stickTo:s,T=(C=function(){var t=n.offsetHeight+(parseInt(r.css.marginTop)||0)+(parseInt(r.css.marginBottom)||0),e=(T||0)-t;return-1<=e&&e<=1?T:t})(),m=(O=function(){return a?Math.max(Q.documentElement.clientHeight,Q.body.scrollHeight,Q.documentElement.scrollHeight,Q.body.offsetHeight,Q.documentElement.offsetHeight):c.offsetHeight})(),h=a?0:d.offset(c).top,v=p.stickTo?a?0:d.offset(s).top:h,y=U.innerHeight,j=n.offsetTop-(parseInt(r.css.marginTop)||0),g=p.innerSticker?"string"==typeof p.innerSticker?Q.querySelector(p.innerSticker):p.innerSticker:null,b=isNaN(p.top)&&-1<p.top.indexOf("%")?parseFloat(p.top)/100*y:p.top,S=isNaN(p.bottom)&&-1<p.bottom.indexOf("%")?parseFloat(p.bottom)/100*y:p.bottom,w=g?g.offsetTop:p.innerTop?p.innerTop:0,k=isNaN(p.bottomEnd)&&-1<p.bottomEnd.indexOf("%")?parseFloat(p.bottomEnd)/100*y:p.bottomEnd,E=h-b+w+j},z=U.pageYOffset||Q.documentElement.scrollTop,N=0,H=void 0,R=function(){T=C(),m=O(),x=h+m-b-k,L=y<T;var t=U.pageYOffset||Q.documentElement.scrollTop,e=d.offset(n).top,o=e-t,i=void 0;H=t<z?"up":"down",N=t-z,E<(z=t)?x+b+(L?S:0)-(p.followScroll&&L?0:b)<=t+T-w-(y-(E-w)<T-w&&p.followScroll&&0<(i=T-y-w)?i:0)?r.release({position:"absolute",bottom:v+s.offsetHeight-x-b}):L&&p.followScroll?"down"===H?o+T+S<=y+.9?r.stick({bottom:S}):"fixed"===r.position&&r.release({position:"absolute",top:e-b-E-N+w}):Math.ceil(o+w)<0&&"fixed"===r.position?r.release({position:"absolute",top:e-b-E+w-N}):t+b-w<=e&&r.stick({top:b-w}):r.stick({top:b-w}):r.release({stop:!0})},A=!1,B=!1,I=function(){A&&(d.event.unbind(U,"scroll",R),A=!1)},q=function(){null!==n.offsetParent&&"none"!==d.getStyle(n,"display")?(i(),m<=T?I():(R(),A||(d.event.bind(U,"scroll",R),A=!0))):I()},F=function(){n.style.position="",n.style.left="",n.style.top="",n.style.bottom="",n.style.width="",n.classList?n.classList.remove(p.stickyClass):n.className=n.className.replace(new RegExp("(^|\\b)"+p.stickyClass.split(" ").join("|")+"(\\b|$)","gi")," "),r.css={},!(r.position=null)===l.isAttached&&l.detach()},M=function(){F(),e(),t()?I():q()},D=function(){p.onBeforeResize&&p.onBeforeResize.call(n,Object.assign({},p)),M(),p.onResize&&p.onResize.call(n,Object.assign({},p))},P=p.resizeDebounce?d.debounce(D,p.resizeDebounce):D,W=function(){B&&(d.event.unbind(U,"resize",P),B=!1),I()},V=function(){B||(d.event.bind(U,"resize",P),B=!0),e(),t()?I():q()};this.options=function(t){return t?p[t]:Object.assign({},p)},this.refresh=M,this.update=function(t){u(t),f=Object.assign({},f,t||{}),M()},this.attach=V,this.detach=W,this.destroy=function(){W(),F()},this.triggerMethod=function(t,e){"function"==typeof o[t]&&o[t](e)},this.reinit=function(){$("reinit","refresh","method"),M()},u(f),V(),d.event.bind(U,"load",M)};if(void 0!==U.jQuery){var i=U.jQuery,n="hcSticky";i.fn.extend({hcSticky:function(e,o){return this.length?"options"===e?i.data(this.get(0),n).options():this.each(function(){var t=i.data(this,n);t?t.triggerMethod(e,o):(t=new X(this,e),i.data(this,n,t))}):this}})}return U.hcSticky=U.hcSticky||X,X}),function(c){"use strict";var t=c.hcSticky,f=c.document;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(t),i=1;i<arguments.length;i++){var n=arguments[i];if(null!=n)for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(o[s]=n[s])}return o},writable:!0,configurable:!0}),Array.prototype.forEach||(Array.prototype.forEach=function(t){var e,o;if(null==this)throw new TypeError("this is null or not defined");var i=Object(this),n=i.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(1<arguments.length&&(e=arguments[1]),o=0;o<n;){var s;o in i&&(s=i[o],t.call(e,s,o,i)),o++}});var e=function(){var t=f.documentElement,e=function(){};function i(t){var e=c.event;return e.target=e.target||e.srcElement||t,e}t.addEventListener?e=function(t,e,o){t.addEventListener(e,o,!1)}:t.attachEvent&&(e=function(e,t,o){e[t+o]=o.handleEvent?function(){var t=i(e);o.handleEvent.call(o,t)}:function(){var t=i(e);o.call(e,t)},e.attachEvent("on"+t,e[t+o])});var o=function(){};return t.removeEventListener?o=function(t,e,o){t.removeEventListener(e,o,!1)}:t.detachEvent&&(o=function(e,o,i){e.detachEvent("on"+o,e[o+i]);try{delete e[o+i]}catch(t){e[o+i]=void 0}}),{bind:e,unbind:o}}(),r=function(t,e){return c.getComputedStyle?e?f.defaultView.getComputedStyle(t,null).getPropertyValue(e):f.defaultView.getComputedStyle(t,null):t.currentStyle?e?t.currentStyle[e.replace(/-\w/g,function(t){return t.toUpperCase().replace("-","")})]:t.currentStyle:void 0},l=function(t){var e=t.getBoundingClientRect(),o=c.pageYOffset||f.documentElement.scrollTop,i=c.pageXOffset||f.documentElement.scrollLeft;return{top:e.top+o,left:e.left+i}};t.Helpers={isEmptyObject:function(t){for(var e in t)return!1;return!0},debounce:function(i,n,s){var r=void 0;return function(){var t=this,e=arguments,o=s&&!r;clearTimeout(r),r=setTimeout(function(){r=null,s||i.apply(t,e)},n),o&&i.apply(t,e)}},hasClass:function(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},offset:l,position:function(t){var e=t.offsetParent,o=l(e),i=l(t),n=r(e),s=r(t);return o.top+=parseInt(n.borderTopWidth)||0,o.left+=parseInt(n.borderLeftWidth)||0,{top:i.top-o.top-(parseInt(s.marginTop)||0),left:i.left-o.left-(parseInt(s.marginLeft)||0)}},getStyle:r,getCascadedStyle:function(t){var e=t.cloneNode(!0);e.style.display="none",Array.prototype.slice.call(e.querySelectorAll('input[type="radio"]')).forEach(function(t){t.removeAttribute("name")}),t.parentNode.insertBefore(e,t.nextSibling);var o=void 0;e.currentStyle?o=e.currentStyle:c.getComputedStyle&&(o=f.defaultView.getComputedStyle(e,null));var i={};for(var n in o)!isNaN(n)||"string"!=typeof o[n]&&"number"!=typeof o[n]||(i[n]=o[n]);if(Object.keys(i).length<3)for(var s in i={},o)isNaN(s)||(i[o[s].replace(/-\w/g,function(t){return t.toUpperCase().replace("-","")})]=o.getPropertyValue(o[s]));if(i.margin||"auto"!==i.marginLeft?i.margin||i.marginLeft!==i.marginRight||i.marginLeft!==i.marginTop||i.marginLeft!==i.marginBottom||(i.margin=i.marginLeft):i.margin="auto",!i.margin&&"0px"===i.marginLeft&&"0px"===i.marginRight){var r=t.offsetLeft-t.parentNode.offsetLeft,l=r-(parseInt(i.left)||0)-(parseInt(i.right)||0),a=t.parentNode.offsetWidth-t.offsetWidth-r-(parseInt(i.right)||0)+(parseInt(i.left)||0)-l;0!==a&&1!==a||(i.margin="auto")}return e.parentNode.removeChild(e),e=null,i},event:e}}(window); \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index dc72a32..787a903 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -1627,6 +1627,16 @@ dd { border-radius: 5px 5px 0 0; margin: 0; padding: 5px; + + .dropdown-menu { + border-top-width: 1px; + font-size: 13px; + } + + &.floating { + border-radius: 0; + margin-top: 0; + } } #disabled { @@ -3242,18 +3252,6 @@ button, padding: 3px 5px; } -#toolbar { - .dropdown-menu { - border-top-width: 1px; - font-size: 13px; - } - - &.floating { - border-radius: 0; - margin-top: 0; - } -} - .dropdown-menu { border-color: rgba(0, 0, 0, .2); border-top: 0; @@ -3594,6 +3592,7 @@ progress { .floating { box-shadow: 0 3px 2px 0 rgba(0, 0, 0, .5); + z-index: 100; } .inline { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index bffb1ea..be7e7e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -1055,6 +1055,9 @@ <h2>Noto fonts</h2> <p><a href="https://github.com/googlei18n/noto-fonts">Noto</a> by Google is a family of fonts licensed under the <a href="http://scripts.sil.org/OFL">SIL Open Font License (OFL) v1.1</a>.</p> + + <h2>HC Sticky</h2> + <p><a href="http://somewebmedia.com/hc-sticky/">HC Sticky</a> by Some Web Media is a JavaScript library that makes any element on your page visible while you scroll, licensed under the <a href="https://github.com/somewebmedia/hc-sticky/blob/master/LICENSE">MIT license</a>.</p> </div> <div id="translations"> diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index f098dfe..ea49b81 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -761,7 +761,7 @@ [% Asset.js("js/acquisitions-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] <script> function updateColumnsVisibility(visible) { if ( visible ) { @@ -775,8 +775,17 @@ } } + var Sticky; + $(document).ready(function() { - if ( $('#toolbar').length ) {$('#toolbar').fixFloat();} + if ( $('#toolbar').length ) { + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "#yui-main", + stickyClass: "floating" + }); + } + [% UNLESS ( closedate ) %] $('#addtoBasket').on('show', function () { $(this).find(".modal-body").html($(".acqui_basket_add")[0].outerHTML); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt index c6db192..6d04108 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt @@ -363,7 +363,7 @@ </div> <!-- /.row --> [% MACRO jsinclude BLOCK %] [% Asset.js("js/acquisitions-menu.js") | $raw %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% INCLUDE 'datatables.inc' %] <script> function confirm_deletion() { @@ -397,6 +397,8 @@ ev.preventDefault(); } + var Sticky; + $(document).ready(function() { var contractst = $("#contractst").dataTable($.extend(true, {}, dataTablesDefaults, { "aoColumnDefs": [ @@ -434,7 +436,12 @@ $('body').on('click', '.contact_claimissues', null, function () { $(this).next('.contact_claimissues_hidden').val($(this).is(':checked') ? '1' : '0'); }); - $('#toolbar').fixFloat(); + + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "main", + stickyClass: "floating" + }); }); </script> [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt index 6cc0570..4d24de3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences.tt @@ -159,14 +159,18 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("lib/jquery/plugins/multiple-select/jquery.multiple.select.js") | $raw %] <script> - [% UNLESS ( searchfield ) %]$(document).ready(function(){ - $('#toolbar').fixFloat(); - });[% END %] - + var Sticky; $(document).ready(function(){ + [% UNLESS ( searchfield ) %] + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "main", + stickyClass: "floating" + }); + [% END %] $("select[multiple='multiple']").multipleSelect( { placeholder: _("Please select ..."), selectAllText: _("Select all"), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 033c9c9..b0856b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -3,7 +3,7 @@ [% INCLUDE 'doc-head-open.inc' %] <title>Koha › Authorities › [% IF ( authid ) %]Modify authority #[% authid | html %] ([% authtypetext | html %])[% ELSE %]Adding authority ([% authtypetext | html %])[% END %]</title> [% INCLUDE 'doc-head-close.inc' %] -[% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] +[% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %] <script type="text/javascript"> @@ -11,9 +11,14 @@ $(window).load(function(){ $("#loading").hide(); }); + var Sticky; $(document).ready(function() { $('#authoritytabs').tabs(); - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: ".main", + stickyClass: "floating" + }); $("#addauth").click(function(){ if(Check()){ $("#f").submit(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt index e6a143f..d013823 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt @@ -279,7 +279,7 @@ </div> [% MACRO jsinclude BLOCK %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] <script type="text/JavaScript"> /** * Function add_field(); @@ -292,10 +292,15 @@ dad.appendChild(line.cloneNode(true)); line.removeChild(ButtonPlus); } + var Sticky; $(document).ready(function() { $("input[name=q]:eq(0)").focus(); $('#advsearches').tabs(); - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: ".main", + stickyClass: "floating" + }); $("#branchloop").on("change",function(){ if( this.value != ""){ document.getElementById("categoryloop").disabled=true; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index a7abe0f..1b9535d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -218,7 +218,7 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] <script type="text/javascript"> var authorised_values = [% authorised_values_json | html %]; @@ -410,9 +410,13 @@ ] }); } - + var Sticky; $(document).ready(function () { - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "#item-search-block", + stickyClass: "floating" + }); // Add the "New field" link. var form_field = $('div.form-field-select-text').last() var NEW_FIELD = _("New field"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 3f14e6e..7e7bc1a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -631,7 +631,7 @@ [% MACRO jsinclude BLOCK %] [% INCLUDE 'browser-strings.inc' %] [% Asset.js("js/browser.js") | $raw %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] <script type="text/javascript"> var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); @@ -657,10 +657,13 @@ verify_images(); }); [% END %] - + var Sticky; $(document).ready(function() { - - $("#searchheader").fixFloat(); + Sticky = $("#searchheader"); + Sticky.hcSticky({ + stickTo: "#yui-main", + stickyClass: "floating" + }); $("#cartsubmit").click(function(e){ e.preventDefault(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 4d6a214..41326ab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -4,7 +4,7 @@ [% INCLUDE 'doc-head-open.inc' %] <title>Koha › Cataloging › [% IF ( biblionumber ) %]Editing [% title | html %] (Record number [% biblionumber | html %])[% ELSE %]Add MARC record[% END %]</title> [% INCLUDE 'doc-head-close.inc' %] -[% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] +[% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("js/cataloging.js") | $raw %] [% INCLUDE 'browser-strings.inc' %] [% Asset.js("js/browser.js") | $raw %] @@ -16,6 +16,7 @@ $(window).load(function(){ $("#loading").hide(); }); + var Sticky; $(document).ready(function() { [% IF bib_doesnt_exist %] @@ -31,7 +32,11 @@ $('#addbibliotabs').selectTabByID("#[% tab | html %]"); [% END %] - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: ".main", + stickyClass: "floating" + }); /* check cookie to hide/show marcdocs*/ if($.cookie("marcdocs_[% borrowernumber | html %]") == 'hide'){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt index bd9a95b..de50ebe 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/marc21_field_008.tt @@ -42,11 +42,16 @@ </form> [% MACRO jsinclude BLOCK %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("js/xmlControlfield.js") | $raw %] <script> + var Sticky; $(document).ready(function(){ - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "#f_pop", + stickyClass: "floating" + }); $(".close_window").on("click", function(e){ e.preventDefault(); window.close(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt index 40412b9..25138a0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/labels/result.tt @@ -103,10 +103,15 @@ </div> [% MACRO jsinclude BLOCK %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] <script> + var Sticky; $(document).ready(function(){ - $("#toolbar").fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "form", + stickyClass: "floating" + }); $("#CheckAll").click(function(e){ e.preventDefault(); $("input[type='checkbox']").prop("checked",true); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt index 143af0a..9b7a566 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -1087,7 +1087,7 @@ <!-- handle changing prefs if creating new patron and changing the patron category --> - <script type="text/javascript">//<![CDATA[ + <script> $(document).ready(function(){ var message_prefs_dirty = false; $('#memberentry_messaging_prefs > *').change(function() { @@ -1126,7 +1126,6 @@ ); }); }); - //]]> </script> [% END %] <input type="hidden" name="setting_messaging_prefs" value="1" /> @@ -1174,27 +1173,29 @@ </div> [% MACRO jsinclude BLOCK %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% INCLUDE 'calendar.inc' %] [% INCLUDE 'str/members-menu.inc' %] [% Asset.js("js/members-menu.js") | $raw %] - <script type="text/javascript"> + <script> + function update_cardnumber_warning(size){ + var max_len = [% maxlength_cardnumber | html %]; + if ( size >= max_len ) { + $("#cn_max").show(); + } else { + $("#cn_max").hide(); + } + } + var Sticky; $(document).ready(function() { $("#saverecord").css({ 'margin-left': 0 }); - var original_offset = $("#toolbar").position().top; - var additional_height = $("#filters").height(); - $('#toolbar').fixFloat({ 'originalOffset': original_offset }); - $("#filteraction_on").on("click", function(){ - $(window).off('scroll'); - $("#toolbar").css({ top: original_offset + additional_height }); - $('#toolbar').fixFloat({ 'originalOffset': original_offset + additional_height }); - }); - $("#filteraction_off").on("click", function(){ - $(window).off('scroll'); - $("#toolbar").css({ top: original_offset }); - $('#toolbar').fixFloat({ 'originalOffset': original_offset }); - }) + + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "#yui-main", + stickyClass: "floating" + }); [% IF categorycode %] update_category_code( "[% categorycode | html %]" ); @@ -1204,18 +1205,7 @@ update_category_code( category_code ); } [% END %] - }); - function update_cardnumber_warning(size){ - var max_len = [% maxlength_cardnumber | html %]; - if ( size >= max_len ) { - $("#cn_max").show(); - } else { - $("#cn_max").hide(); - } - } - - $(document).ready(function() { $("#cn_max").hide(); var content; $("#cardnumber").on("keydown", function(e){ diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt index fbf23a6..7116202 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/automatic_item_modification_by_age.tt @@ -229,13 +229,18 @@ [% MACRO jsinclude BLOCK %] [% Asset.js("js/tools-menu.js") | $raw %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("js/automatic_item_modification_by_age.js") | $raw %] [% IF op == 'edit_form' %] <script> + var Sticky; $(document).ready(function() { [% IF ( op == 'edit_form' ) %] - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: "main", + stickyClass: "floating" + }); [% END %] [% IF rules.size > 0 %] $("#norules").hide(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index c72b4ed..3c85ebd 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -462,7 +462,7 @@ [% Asset.js("js/tools-menu.js") | $raw %] [% INCLUDE 'datatables.inc' %] [% INCLUDE 'columns_settings.inc' %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% Asset.js("lib/jquery/plugins/jquery.insertatcaret.js") | $raw %] <script> var no_op_set = '[% no_op_set | html %]'; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 84bfc52..ec49bac 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -439,7 +439,7 @@ [% IF op == 'view' %] [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %] - [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %] + [% Asset.js("lib/hc-sticky.js") | $raw %] [% END %] <script> var MSG_NO_ITEM_SELECTED = _("Nothing is selected."); @@ -532,8 +532,13 @@ [% END %] [% IF shelf AND op == 'view' %] + var Sticky; $(document).ready(function(){ - [% IF ( itemsloop ) %]$('#searchheader').fixFloat();[% END %] + Sticky = $("#searchheader"); + Sticky.hcSticky({ + stickTo: "#listform", + stickyClass: "floating" + }); $("span.clearall").html("<a id=\"CheckNone\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-remove\"></i>"+_(" Clear all")+"<\/a>"); $("span.checkall").html("<a id=\"CheckAll\" href=\"/cgi-bin/koha/shelves.pl\"><i class=\"fa fa-check\"></i>"+_(" Select all")+"<\/a>"); $("#CheckAll").click(function(){ diff --git a/koha-tmpl/intranet-tmpl/prog/js/letter.js b/koha-tmpl/intranet-tmpl/prog/js/letter.js index 968b0d1..c471788 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/letter.js +++ b/koha-tmpl/intranet-tmpl/prog/js/letter.js @@ -30,9 +30,15 @@ function checkCodes( new_lettercode, new_branchcode ){ }); } +var Sticky; + $(document).ready(function() { if( add_form || copy_form ){ - $('#toolbar').fixFloat(); + Sticky = $("#toolbar"); + Sticky.hcSticky({ + stickTo: ".main", + stickyClass: "floating" + }); } var ntable = KohaTable("lettert", { diff --git a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js index ecc22b1..287a8b9 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/members-menu.js +++ b/koha-tmpl/intranet-tmpl/prog/js/members-menu.js @@ -5,6 +5,9 @@ $(document).ready(function(){ e.preventDefault(); $('#filters').toggle(); $('.filteraction').toggle(); + if (typeof Sticky !== "undefined" && typeof hcSticky === "function") { + Sticky.hcSticky('update'); + } }); if( advsearch ){ $("#filteraction_on").toggle(); diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 1de48aa..b60af5e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -1,4 +1,4 @@ -// staff-global.js +/* global shortcut delCookie delBasket Sticky */ if ( KOHA === undefined ) var KOHA = {}; function _(s) { return s; } // dummy function for gettext @@ -71,6 +71,9 @@ $.fn.selectTabByID = function (tabID) { $(".toggle_element").on("click",function(e){ e.preventDefault(); $( $(this).data("element") ).toggle(); + if (typeof Sticky !== "undefined" && typeof hcSticky === "function") { + Sticky.hcSticky('update'); + } }); var navmenulist = $("#navmenulist"); -- 2.1.4