@uf-onbrand/onbrand-utility-functions-tv2
Advanced tools
Comparing version 0.0.1 to 1.0.1
@@ -1,2 +0,2 @@ | ||
!function(o,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("onbrandUtilityFunctions",[],t):"object"==typeof exports?exports.onbrandUtilityFunctions=t():o.onbrandUtilityFunctions=t()}(window,function(){return function(o){var t={};function e(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return o[n].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=o,e.c=t,e.d=function(o,t,n){e.o(o,t)||Object.defineProperty(o,t,{configurable:!1,enumerable:!0,get:n})},e.r=function(o){Object.defineProperty(o,"__esModule",{value:!0})},e.n=function(o){var t=o&&o.__esModule?function(){return o.default}:function(){return o};return e.d(t,"a",t),t},e.o=function(o,t){return Object.prototype.hasOwnProperty.call(o,t)},e.p="",e(e.s=1)}([function(o,t,e){"use strict";o.exports=function o(t){!function(o,t){if(!(o instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.options=Object.assign({},{forPage:"hub-page",forPages:!1,imageUrl:"#"},t),console.log("This is a work in progress, currently it cannot be used.")}},function(o,t,e){"use strict";function n(o){var t=$("#injected-header"),e=$(".uf-top-nav-container");return o||("fixed"===t.css("position")||"sticky"===t.css("position")?t.outerHeight(!0):0===t.height()?$("#injected-header>*").outerHeight(!0):0)+("fixed"===e.css("position")||"sticky"===e.css("position")?e.outerHeight(!0):0)}t.Banner=e(0),t.blockCtaFix=function(){var o=document.getElementById("uf-gated-cta-wrapper");if(o){var t=document.getElementById("uf-item-container"),e=o.offsetHeight/2,n=$(t).offset().top,i=n+t.offsetHeight,r=$(window).scrollTop()+$(window).height()/2;!function(o,t){for(var e in t)o.style[e]=t[e]}(o,r-e<n?{position:"absolute",margin:"0",transform:"translate(-50%, -50%)"}:r+e>i?{position:"absolute",margin:"0",top:i-$(o).height()-e+"px",transform:"translate(-50%, -50%)"}:{position:"fixed",transform:"translate(-50%, -50%)",top:""})}},t.fadeOutItem=function(){var o=document.getElementById("injected-footer").offsetHeight,t=document.body.scrollHeight-window.innerHeight-(o+window.innerHeight),e=document.querySelector(".uf-next-link");window.scrollY>t?$(e).fadeOut("fast"):$(e).fadeIn("fast")},t.devMode=function(o){console.log(" "),console.log(" "),console.warn("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="),console.warn(" Hey Onbrander, Just letting you know that we're in dev mode!"),console.warn(" You have access to the following functions:",t),console.warn(" More info available here: http://cihost.uberflip.com/docs/"),console.warn("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="),console.log(" "),console.log(" ");var e=function(o){o.preventDefault(),window.addEventListener("uberflip.load",function(){o.target.href})},n=function(o){var t=new RegExp("^((http[s]?|ftp):/)?/?([^:/s]+)?("+o+")","gi");$("a").not(".onBrand--LocalDevLink").each(function(){var o=$(this).attr("href");if(t.test(o)||o&&"/"===o.charAt(0)){var n=o.replace(t,"");"/"!==n[0]?n="/"+n+"?onbrand":n+="?onbrand",$(this).attr("href",n),$(this).attr("target",""),$(this).on("click",e),$(this).addClass("onBrand--LocalDevLink")}})};production||("localhost"===window.self.location.hostname&&(window.location.protocol,window.location.hostname,window.location.port&&window.location.port),n(o.shortHubUrl),window.addEventListener("uberflip.load",function(){n(o.shortHubUrl)}),window.addEventListener("uberflip.itemsloaded",function(){n(o.shortHubUrl)}),$(window).on("search",function(){setTimeout(function(){n(o.shortHubUrl)},500)}))},t.recoEnginePositioning=function(o){var t=function(o){try{var t=$(".reco-panel"),e=$(o).offset().top+$(o).height()-$(window).scrollTop(),n=e>0?e:0;t.css("top",n)}catch(t){console.warn("recoEnginePositioning() has failed - the error thrown was:"),console.error(t),console.warn("The target used was:"+o)}}.bind($(".reco-panel"),o);Hubs.Events.on("scroll",t),Hubs.Events.on("load",t),Hubs.Events.on("pageChange",t),Hubs.Events.on("resize",t)},t.sideCtaFix=function(o){var t=n(o);if($(window).width()>1351&&$(".uf-article").length){var e=$(window).scrollTop(),i=$(".uf-cta-beside aside");if(i.length>0){var r=i.height(),s=$(".uf-main-content").eq(0).offset().top,a=$(".uf-main-content").eq(0).offset().top+$(".uf-main-content").height();i.css("top",s-e),e+t>s&&i.css("top",t),e+t+r>a&&i.css("top",a-r-e)}}},t.addThisFix=function(o){var t=n(o);if($(window).width()>980){var e=$(window).scrollTop(),i=$(".addthis_toolbox");if(i.length>0){var r=i.height(),s=$(".level-three").eq(0).offset().top,a=$(".level-three").eq(0).offset().top+$(".level-three").height();i.css("top",s-e),e+t>s&&i.css("top",t),e+t+r>a&&i.css("top",a-r-e)}}},t.removeTouchForLaptops=function(){/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)||$("html").removeClass("touch")}}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("onbrandUtilityFunctions",[],e):"object"==typeof exports?exports.onbrandUtilityFunctions=e():t.onbrandUtilityFunctions=e()}(window,function(){return function(t){var e={};function o(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=t,o.c=e,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=1)}([function(t,e,o){"use strict";t.exports=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options=Object.assign({},{forPage:"hub-page",forPages:!1,imageUrl:"#"},e),console.log("This is a work in progress, currently it cannot be used.")}},function(t,e,o){"use strict";function n(t){var e=$("#injected-header"),o=$(".uf-top-nav-container");return t||("fixed"===e.css("position")||"sticky"===e.css("position")?e.outerHeight(!0):0===e.height()?$("#injected-header>*").outerHeight(!0):0)+("fixed"===o.css("position")||"sticky"===o.css("position")?o.outerHeight(!0):0)}e.Banner=o(0),e.blockCtaFix=function(){var t=document.getElementById("uf-gated-cta-wrapper");if(t){var e=document.getElementById("uf-item-container"),o=t.offsetHeight/2,n=e.offsetTop,i=n+e.offsetHeight,r=(window.pageYOffset+window.innerHeight)/2;!function(t,e){for(var o in e)t.style[o]=e[o]}(t,r-o<n?{position:"absolute",margin:"0",transform:"translate(-50%, -50%)"}:r+o>i?{position:"absolute",margin:"0",top:i-t.offsetHeight-o+"px",transform:"translate(-50%, -50%)"}:{position:"fixed",transform:"translate(-50%, -50%)",top:""})}},e.fadeOutItem=function(){var t=document.getElementById("injected-footer").offsetHeight,e=document.body.scrollHeight-window.innerHeight-(t+window.innerHeight),o=document.querySelector(".uf-next-link");window.scrollY>e?$(o).fadeOut("fast"):$(o).fadeIn("fast")},e.devMode=function(t){console.log(" "),console.log(" "),console.warn("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="),console.warn(" Hey Onbrander, Just letting you know that we're in dev mode!"),console.warn(" You have access to the following functions:",e),console.warn(" More info available here: http://cihost.uberflip.com/docs/"),console.warn("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="),console.log(" "),console.log(" ");var o=function(t){t.preventDefault(),window.addEventListener("uberflip.load",function(){t.target.href})},n=function(t){var e=new RegExp("^((http[s]?|ftp):/)?/?([^:/s]+)?("+t+")","gi");$("a").not(".onBrand--LocalDevLink").each(function(){var t=$(this).attr("href");if(e.test(t)||t&&"/"===t.charAt(0)){var n=t.replace(e,"");"/"!==n[0]?n="/"+n+"?onbrand":n+="?onbrand",$(this).attr("href",n),$(this).attr("target",""),$(this).on("click",o),$(this).addClass("onBrand--LocalDevLink")}})};production||("localhost"===window.self.location.hostname&&(window.location.protocol,window.location.hostname,window.location.port&&window.location.port),n(t.shortHubUrl),window.addEventListener("uberflip.load",function(){n(t.shortHubUrl)}),window.addEventListener("uberflip.itemsloaded",function(){n(t.shortHubUrl)}),$(window).on("search",function(){setTimeout(function(){n(t.shortHubUrl)},500)}))},e.recoEnginePositioning=function(t){var e=function(t){try{var e=$(".reco-panel"),o=$(t).offset().top+$(t).height()-$(window).scrollTop(),n=o>0?o:0;e.css("top",n)}catch(e){console.warn("recoEnginePositioning() has failed - the error thrown was:"),console.error(e),console.warn("The target used was:"+t)}}.bind($(".reco-panel"),t);Hubs.Events.on("scroll",e),Hubs.Events.on("load",e),Hubs.Events.on("pageChange",e),Hubs.Events.on("resize",e)},e.sideCtaFix=function(t){var e=n(t);if($(window).width()>1351&&$(".uf-article").length){var o=$(window).scrollTop(),i=$(".uf-cta-beside aside");if(i.length>0){var r=i.height(),s=$(".uf-main-content").eq(0).offset().top,a=$(".uf-main-content").eq(0).offset().top+$(".uf-main-content").height();i.css("top",s-o),o+e>s&&i.css("top",e),o+e+r>a&&i.css("top",a-r-o)}}},e.addThisFix=function(t){var e=n(t);if($(window).width()>980){var o=$(window).scrollTop(),i=$(".addthis_toolbox");if(i.length>0){var r=i.height(),s=$(".level-three").eq(0).offset().top,a=$(".level-three").eq(0).offset().top+$(".level-three").height();i.css("top",s-o),o+e>s&&i.css("top",e),o+e+r>a&&i.css("top",a-r-o)}}},e.removeTouchForLaptops=function(){/Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent)||$("html").removeClass("touch")},e.checkStreamID=function(t){return document.body.dataset.streamId===t},e.streamTraverse=function(t){var e=!1;return t.forEach(function(t){document.body.dataset.streamId===t&&(e=!0)}),e},e.checkPageType=function(){return document.body.classList[0]},e.streamCustomization=function(t,e){t.forEach(function(t){document.body.dataset.streamId===t&&e()})},e.createElem=function(t,e,o){var n=document.createElement(t);return void 0!==e&&Object.keys(e).forEach(function(t){n.setAttribute(t,e[t])}),void 0!==o&&(n.innerHTML=o),n}}])}); | ||
//# sourceMappingURL=onbrandUtilityFunctions.bundle.js.map |
{ | ||
"name": "@uf-onbrand/onbrand-utility-functions-tv2", | ||
"version": "0.0.1", | ||
"version": "1.0.1", | ||
"description": "A collection of useful reusable functions for working with uberflip TV2 hubs, to be included on an as-needed basis.", | ||
@@ -5,0 +5,0 @@ "main": "build/onbrandUtilityFunctions.bundle.js", |
@@ -1,11 +0,15 @@ | ||
# The Onbrand Utility Function Library | ||
# The Onbrand Utility Function Library for Themes V2 | ||
## 1. What is this, and what is it for? | ||
This package is a collection of usefull reusable functions for building [Uberflip](https://www.uberflip.com/) hubs. It allows for quick, stable, bug free implementation of various features, and works in combination with the [Onbrand framework](https://www.npmjs.com/package/onbrand-project-generator) to provide high-quality custom builds for clients. | ||
The supporting documentation for the functions contained in this library can be found here: http://cihost.uberflip.com/docs/ | ||
This package is a collection of useful reusable functions for building [Uberflip](https://www.uberflip.com/) hubs. It allows for quick, stable, bug free implementation of various features, and works in combination with the [onBrand framework](https://www.npmjs.com/package/onbrand-project-generator) to provide high-quality custom builds for clients. | ||
The TV1 utility functions can be [found here](https://www.npmjs.com/package/onbrandutilityfunctions). They have been translated to work with Themes V2 and into vanilla JS. | ||
The supporting documentation for the functions contained in this library can be found here: https://uberflip.atlassian.net/wiki/spaces/USW/pages/816185376/OnBrand+Utility+Functions+TV2 | ||
## 2. How do I use it? | ||
This library depends on jQuery. At the time of writing this, jQuery is included in all Uberflip Hubs, and so this module should be usable without importing jQuery separately. | ||
This library depends on jQuery. At the time of writing this, jQuery is included in all Uberflip Hubs, and so this module should be usable without importing jQuery separately. | ||
Typically, this library would be automatically included when generating a new onbrand project. The library is to be installed via npm `npm install onbrandutilityfunctions`, then refferenced in your scripts via import. Here is a simple example: | ||
@@ -16,19 +20,2 @@ | ||
These functions should be run through babel.js to ensure maximum compatibility. | ||
## 3. Some Examples: | ||
I want to execute code on every tile that has the tag `blog` | ||
Hubs.Events.on('load', function(){ | ||
onbrandutilityfunctions.doIfTag('blog', function(){ | ||
$(this).find('a.view').text('I changed the label!'); | ||
}) | ||
}) | ||
I want to fade out the next item flyout before it overlaps the footer I have added to the page: | ||
Hubs.Events.on('scroll', function(){ | ||
onbrandutilityfunctions.fadeOutItem(); | ||
}) | ||
These functions should be run through babel.js to ensure maximum compatibility. |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
560863
573
2
21
1