New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

onbrandutilityfunctions

Package Overview
Dependencies
Maintainers
3
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

onbrandutilityfunctions - npm Package Compare versions

Comparing version

to
1.0.5

2

package.json
{
"name": "onbrandutilityfunctions",
"version": "1.0.4",
"version": "1.0.5",
"description": "A collection of useful reusable functions for working with uberflip hubs, to be included on an as-needed basis.",

@@ -5,0 +5,0 @@ "main": "scripts.js",

@@ -473,7 +473,25 @@ /**

/**
* Adds helpful body classes based on content type to make styling easier.
*/
exports.helpfulClasses = function() {
//An array to keep track of what content types are used (ensures we are dynamic, no hardcoded types)
const typeArray = [];
//the function to run on page change/load
/**
* Removes all known type classes from the body, then adds whichever
* is relevent to that page. Checks to see if that class is known, and if
* not, adds it to the array.
*/
function detectAndAddClass() {
typeArray.forEach(type => $('body').removeClass(type));
const $class = $('#page-type-identifier').attr('data-item-type');
if ($class) {
$('body').addClass($class);
if (typeArray.indexOf($class) < 0) {
typeArray.push($class);
}
}

@@ -486,4 +504,5 @@

//Event listeners
Hubs.Events.on('load', detectAndAddClass);
Hubs.Events.on('pageChange', detectAndAddClass);
};