binary-style
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -1,2 +0,2 @@ | ||
!function(t,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define([],n);else{var e=n();for(var a in e)("object"==typeof exports?exports:t)[a]=e[a]}}(this,function(){return function(t){function n(a){if(e[a])return e[a].exports;var i=e[a]={i:a,l:!1,exports:{}};return t[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}var e={};return n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:a})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},n.p="",n(n.s=0)}([function(t,n,e){"use strict";function a(t){t.animate({opacity:0},100,function(){t.css("visibility","hidden").css("display","none")})}function i(t){t.css("visibility","visible").css("display","block").animate({opacity:1},100)}function s(){$(".nav-menu").on("click",function(t){t.stopPropagation(),a($(".top-nav-menu li ul")),a($("#language_select, #select_language"));var n=$("#all-accounts, #all-accounts-top");1==+n.css("opacity")?a(n):i(n)})}function o(){$(".top-nav-menu > li").on("click",function(t){t.stopPropagation(),a($("#all-accounts, #all-accounts-top")),a($("#language_select, #select_language"));var n=$(this).find(" > ul"),e=$(".top-nav-menu li ul");1==+n.css("opacity")&&$(t.target).find("span").hasClass("nav-caret")?a(e):0==+n.css("opacity")&&$(t.target).find("span").hasClass("nav-caret")&&e.animate({opacity:0},100,function(){e.css("visibility","hidden"),i(n)})})}function l(){$(document).on("click",function(){a($("#all-accounts, #all-accounts-top")),a($(".top-nav-menu li ul")),a($("#language_select, #select_language"))})}function c(){$(".languages").on("click",function(t){t.stopPropagation(),a($(".top-nav-menu li ul")),a($("#all-accounts, #all-accounts-top"));var n=$("#language_select, #select_language");1==+n.css("opacity")?a(n):i(n)})}function r(t){function n(t){for(var n=0;n<e.length;n++)e[n](t)}var e=[];t.filter(":not(.follow-default)").delegate(".tm-a,.tm-a-2","click",function(t){t.preventDefault();var e=$(t.target);if(e.parents("li:first").attr("id")){var a=e.parents(".tm-ul"),i=a.find(".tm-a,.tm-a-2").removeClass("a-active").end().find(".menu-wrap-a .tm-a").unwrap().unwrap().end().end().addClass("a-active").parents(".tm-li").addClass("active").removeClass("hover").find(".tm-li-2").addClass("active").end().find(".tm-a").wrap('<span class="menu-wrap-a"><span class="menu-wrap-b"></span></span>').end().siblings().removeClass("active").find(".tm-li-2").removeClass("active").end().end().end(),s=a.find("span.tm-a");s.replaceWith('<a href="#" class="'+s.attr("class")+'">'+s.html()+"</a>");var o=i.parents("li"),l=o.find(".tm-ul-2 .a-active"),c=o.attr("id");l.length||(l=o.find(".tm-a-2:first").addClass("a-active"),l.length?(i=l,c=l.parents("li").attr("id")):c=o.attr("id")),n({id:c,target:i,content:$("#"+c+"-content").removeClass("invisible").siblings(":not(.sticky)").addClass("invisible").end(),menu:o.parents("ul.tm-ul"),event:t})}return!1})}function u(){$(".tm-ul > li").hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}),r($(".content-tab-container").find(".tm-ul"))}Object.defineProperty(n,"__esModule",{value:!0}),n.hide_menu=a,n.show_menu=i,n.navMenuListener=s,n.topNavMenuListener=o,n.documentListener=l,n.langListener=c,n.initMenuContent=r,n.tabListener=u,$(document).ready(function(){s(),o(),l(),c(),u()})}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var a in n)("object"==typeof exports?exports:e)[a]=n[a]}}(this,function(){return function(e){function t(a){if(n[a])return n[a].exports;var i=n[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,a){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:a})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";function a(e){e.animate({opacity:0},100,function(){e.css("visibility","hidden").css("display","none")})}function i(e){e.css("visibility","visible").css("display","block").animate({opacity:1},100)}function s(){$(".nav-menu").on("click",function(e){e.stopPropagation(),a($(".top-nav-menu li ul")),a($("#language_select, #select_language"));var t=$("#all-accounts, #all-accounts-top");1==+t.css("opacity")?a(t):i(t)})}function l(){$(".top-nav-menu > li").on("click",function(e){e.stopPropagation(),a($("#all-accounts, #all-accounts-top")),a($("#language_select, #select_language"));var t=$(this).find(" > ul"),n=$(".top-nav-menu li ul");1==+t.css("opacity")&&$(e.target).find("span").hasClass("nav-caret")?a(n):0==+t.css("opacity")&&$(e.target).find("span").hasClass("nav-caret")&&n.animate({opacity:0},100,function(){n.css("visibility","hidden"),i(t)})})}function c(){$(document).on("click",function(){a($("#all-accounts, #all-accounts-top")),a($(".top-nav-menu li ul")),a($("#language_select, #select_language"))})}function o(){$(".languages").on("click",function(e){e.stopPropagation(),a($(".top-nav-menu li ul")),a($("#all-accounts, #all-accounts-top"));var t=$("#language_select, #select_language");1==+t.css("opacity")?a(t):i(t)})}function r(e){function t(e){for(var t=0;t<n.length;t++)n[t](e)}var n=[];e.filter(":not(.follow-default)").delegate(".tm-a,.tm-a-2","click",function(e){e.preventDefault();var n=$(e.target);if(n.parents("li:first").attr("id")){var a=n.parents(".tm-ul"),i=a.find(".tm-a,.tm-a-2").removeClass("a-active").end().find(".menu-wrap-a .tm-a").unwrap().unwrap().end().end().addClass("a-active").parents(".tm-li").addClass("active").removeClass("hover").find(".tm-li-2").addClass("active").end().find(".tm-a").wrap('<span class="menu-wrap-a"><span class="menu-wrap-b"></span></span>').end().siblings().removeClass("active").find(".tm-li-2").removeClass("active").end().end().end(),s=a.find("span.tm-a");s.replaceWith('<a href="#" class="'+s.attr("class")+'">'+s.html()+"</a>");var l=i.parents("li"),c=l.find(".tm-ul-2 .a-active"),o=l.attr("id");c.length||(c=l.find(".tm-a-2:first").addClass("a-active"),c.length?(i=c,o=c.parents("li").attr("id")):o=l.attr("id")),t({id:o,target:i,content:$("#"+o+"-content").removeClass("invisible").siblings(":not(.sticky)").addClass("invisible").end(),menu:l.parents("ul.tm-ul"),event:e})}return!1})}function u(){$(".tm-ul > li").hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}),r($(".content-tab-container").find(".tm-ul"))}function d(){function e(e){var t=0;return e.children().each(function(){t+=$(this).outerHeight(!0)}),t}function t(t){var n=t.parent(),a=t.siblings("ul");if(n.is(".active")){var i=e(a);a.animate({height:i+"px"},300),a.find(".active").length||a.find("li:first-child > a").addClass("selected")}else a.animate({height:"0px"},300);n.siblings().find("ul").animate({height:"0px"},300)}function n(e){var t=e.nextElementSibling;return(t?$(t).find($(t).find(".selected")[0]?".selected":"a:first")[0]:e).getAttribute("href")}function a(e){var t=$(".sidebar-collapsible-content");if(t){var a=n(e);t.find("> div").addClass("invisible").end().find(a+"-content").removeClass("invisible")}}var i=".sidebar-collapsible";!function(){$(i).find(".active").length&&$(i).find(".active").removeClass("active"),$(i).find("a").off("click").on("click",function(e){e.preventDefault();var n=$(this),i=n.parent("li"),s=i.siblings("li");i.hasClass("has-submenu")?n.toggleClass("selected").parent("li").toggleClass("active"):n.addClass("selected").parent("li").addClass("active"),s.removeClass("active").find("> a").removeClass("selected"),t(n),a(e.target)})}()}Object.defineProperty(t,"__esModule",{value:!0}),t.hide_menu=a,t.show_menu=i,t.navMenuListener=s,t.topNavMenuListener=l,t.documentListener=c,t.langListener=o,t.initMenuContent=r,t.tabListener=u,t.sidebarCollapsible=d,$(document).ready(function(){s(),l(),c(),o(),u(),d()})}])}); | ||
//# sourceMappingURL=binary.js.map |
{ | ||
"name": "binary-style", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Style system and guide for Binary.com", | ||
@@ -5,0 +5,0 @@ "main": "binary.js", |
@@ -160,2 +160,68 @@ /* | ||
export function sidebarCollapsible() { | ||
const sidebar = '.sidebar-collapsible'; | ||
function getChildrenHeight($el) { | ||
let totalHeight = 0; | ||
$el.children().each(function() { | ||
totalHeight += $(this).outerHeight(true); | ||
}); | ||
return totalHeight; | ||
} | ||
function toggleSubmenu($el) { | ||
const $parent = $el.parent(); | ||
const $submenu = $el.siblings('ul'); | ||
if ($parent.is('.active')) { | ||
const totalHeight = getChildrenHeight($submenu); | ||
$submenu.animate({ height: `${totalHeight}px` }, 300); | ||
if (!$submenu.find('.active').length) { | ||
$submenu.find('li:first-child > a').addClass('selected'); // set first child active | ||
} | ||
} else { | ||
$submenu.animate({ height: '0px' }, 300); | ||
} | ||
$parent.siblings().find('ul').animate({ height: '0px' }, 300); | ||
} | ||
function getTargetHref(current_target) { | ||
const submenu = current_target.nextElementSibling; | ||
const target = submenu ? $(submenu).find($(submenu).find('.selected')[0] ? '.selected' : 'a:first')[0] : current_target; | ||
return target.getAttribute('href'); | ||
} | ||
function showSelectedContent(current_target) { | ||
const $content = $('.sidebar-collapsible-content'); | ||
if (!$content) return; | ||
const target = getTargetHref(current_target); | ||
$content | ||
.find('> div') | ||
.addClass('invisible') | ||
.end() | ||
.find(`${target}-content`) | ||
.removeClass('invisible'); | ||
} | ||
function initSidebar() { | ||
if ($(sidebar).find('.active').length) { | ||
$(sidebar).find('.active').removeClass('active'); | ||
} | ||
$(sidebar).find('a').off('click').on('click', function(e) { | ||
e.preventDefault(); | ||
const $this = $(this); | ||
const $parent = $this.parent('li'); | ||
const $siblings = $parent.siblings('li'); | ||
if ($parent.hasClass('has-submenu')) { | ||
$this.toggleClass('selected').parent('li').toggleClass('active'); | ||
} else { | ||
$this.addClass('selected').parent('li').addClass('active'); | ||
} | ||
$siblings.removeClass('active').find('> a').removeClass('selected'); | ||
toggleSubmenu($this); | ||
showSelectedContent(e.target); | ||
}); | ||
} | ||
initSidebar(); | ||
} | ||
$(document).ready(() => { | ||
@@ -167,3 +233,4 @@ navMenuListener(); | ||
tabListener(); | ||
sidebarCollapsible(); | ||
}); | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
4
1781657
75
7442