Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: global refactor: make api more consistent & reliable
using external API also for internal processes to add possibility to override some of them BREAKING CHANGE: .updateStyles method got renamed into .update, also - first argument type now is supposed to be a partial of configuration object BREAKING CHANGE: createNewChild is no longer exposed - it's part of an private, internal API BREAKING CHANGE: there is no longer any css file to be included - whole styling is being generated by JS
- Loading branch information
Jakub Freisler
committed
Feb 6, 2020
1 parent
53c7d17
commit 7522a9f
Showing
28 changed files
with
910 additions
and
861 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
var e,t=window.FRSHideScrollbar||{},i=t.config=t.config||{};function l(){var e=n("div",document.body);e.style.position="absolute",e.style["z-index"]="-1",e.style.width="100px",e.style.overflow="scroll";var t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t!==i.scrollWidth&&(i.scrollWidth=t,s()),t}function n(e,t){return t.appendChild(document.createElement(e))}function s(t,l){if(void 0===t&&(t=i.styleElement),void 0===l&&(l=e),l){var n=l.styleElement,s=n.innerText.lastIndexOf("."+l.className+"{margin-right:-");n.innerText=n.innerText.substring(0,s)}0!==i.scrollWidth&&(e=Object.assign({},i),t.innerText+="."+i.className+"{margin-right:-"+(i.scrollWidth+.5)+"px;height:calc(100% + "+i.scrollWidth+"px)}")}t.refreshScrollWidth=l,t.createNewChild=n,t.updateStyles=s,i.className=i.className||"frs-hide-scroll",i.wrapperClassName=i.wrapperClassName||"frs-hide-scroll-wrapper",i.styleElement=i.styleElement||document.getElementsByTagName("style")[0]||n("style",document.head),i.autoInit=void 0===i.autoInit||i.autoInit,i.autoInit&&(document.readyState&&"loading"!==document.readyState?l():window.addEventListener("load",l,{passive:!0}),window.addEventListener("resize",l,{passive:!0}));export{t as FRSHideScrollbar}; | ||
var e=window.FRSHideScrollbar&&window.FRSHideScrollbar.FRSHideScrollbar,t=Object.assign({className:"frs-hide-scroll",wrapperClassName:"frs-hide-scroll-wrapper",autoInit:!0},e&&e.config||{}),l={refreshScrollWidth:function(){var e=r("div",document.body);e.style.position="absolute",e.style["z-index"]="-1",e.style.width="100px",e.style.overflow="scroll";var n=e.offsetWidth-e.clientWidth;document.body.removeChild(e),n!==t.scrollWidth&&(t.scrollWidth=n,l.update())},update:function(e,l){if(void 0===e&&(e=t),void 0===l&&(l=o),l){var n=l.styleElement,r=n.textContent.lastIndexOf("."+l.wrapperClassName+"{overflow:hidden;height:100%}");n.textContent=n.textContent.substring(0,r)}Object.assign(t,e);var i="height:",s=t.scrollWidth;i+=0===s?"100%":"calc(100% + "+s+"px);margin-right:-"+(s+.5)+"px",o=Object.assign({},t),t.styleElement.textContent+="."+t.wrapperClassName+"{overflow:hidden;height:100%}."+t.className+"{overflow:scroll;"+i+"}"},config:t};t.styleElement=t.styleElement||r("style",document.head);var n,o=Object.assign({},t);function r(e,t){return t.appendChild(document.createElement(e))}t.autoInit&&(n=function(){return l.refreshScrollWidth()},document.readyState&&"loading"!==document.readyState?n():window.addEventListener("load",n,{passive:!0}),window.addEventListener("resize",n,{passive:!0}));export{l as FRSHideScrollbar}; | ||
//# sourceMappingURL=FRS-hide-scrollbar.mjs.map |
Oops, something went wrong.