22// noinspection JSUnusedGlobalSymbols
33let link ;
44let navbarShown = false ;
5+
56if ( ! Element . prototype . matches ) {
67 Element . prototype . matches =
78 Element . prototype . msMatchesSelector ||
@@ -20,6 +21,14 @@ if (!Element.prototype.closest) {
2021 } ;
2122}
2223window . blazorStrap = {
24+ BlurAll : function ( ) {
25+ var tmp = document . createElement ( "input" ) ;
26+ tmp . position = "absolute" ;
27+ tmp . top = - 500 ;
28+ document . body . appendChild ( tmp ) ;
29+ tmp . focus ( ) ;
30+ document . body . removeChild ( tmp ) ;
31+ } ,
2332 AddAttribute : async function ( element , name , value ) {
2433 if ( element === null || element === undefined ) return ;
2534 return new Promise ( function ( resolve ) {
@@ -48,19 +57,18 @@ window.blazorStrap = {
4857 } ,
4958 AddEventInternal : function ( objRef , element , id , name , type , ignoreChildren = false , filter = "" ) {
5059 let expandedWidth = 0 ;
51- if ( type === "resize" && element == document )
52- {
60+ if ( type === "resize" && element == document ) {
5361 let navbar = document . querySelector ( "[class*=navbar-expand]" ) ;
5462 // Gets the expanded size
55- if ( navbar !== null ) {
63+ if ( navbar !== null ) {
5664
57- if ( navbar . classList . contains ( "navbar-expand" ) || navbar . classList . contains ( "navbar-expand-ex" ) ) expandedWidth = 576 ;
58- else if ( navbar . classList . contains ( "navbar-expand-md" ) ) expandedWidth = 768 ;
59- else if ( navbar . classList . contains ( "navbar-expand-lg" ) ) expandedWidth = 992 ;
60- else if ( navbar . classList . contains ( "navbar-expand-xl" ) ) expandedWidth = 1200 ;
61- else if ( navbar . classList . contains ( "navbar-expand-xxl" ) ) expandedWidth = 1400 ;
65+ if ( navbar . classList . contains ( "navbar-expand" ) || navbar . classList . contains ( "navbar-expand-ex" ) ) expandedWidth = 576 ;
66+ else if ( navbar . classList . contains ( "navbar-expand-md" ) ) expandedWidth = 768 ;
67+ else if ( navbar . classList . contains ( "navbar-expand-lg" ) ) expandedWidth = 992 ;
68+ else if ( navbar . classList . contains ( "navbar-expand-xl" ) ) expandedWidth = 1200 ;
69+ else if ( navbar . classList . contains ( "navbar-expand-xxl" ) ) expandedWidth = 1400 ;
6270 }
63- if ( expandedWidth > window . innerWidth )
71+ if ( expandedWidth > window . innerWidth )
6472 navbarShown = true ;
6573 }
6674 if ( blazorStrap . EventHandlers [ id ] === undefined ) {
@@ -72,18 +80,17 @@ window.blazorStrap = {
7280 }
7381
7482 blazorStrap . EventHandlers [ id ] [ name ] [ type ] = {
75- resizeFunc : function ( ) { }
83+ resizeFunc : function ( ) { }
7684 }
7785 blazorStrap . EventHandlers [ id ] [ name ] [ type ] = {
7886 Callback : function ( event ) {
7987 let resizeFunc ;
8088 if ( type === "resize" && element === document ) {
8189 clearTimeout ( resizeFunc ) ;
8290 resizeFunc = setTimeout ( function ( ) {
83- if ( window . innerWidth < expandedWidth )
91+ if ( window . innerWidth < expandedWidth )
8492 navbarShown = false ;
85- if ( window . innerWidth > expandedWidth && navbarShown === false )
86- {
93+ if ( window . innerWidth > expandedWidth && navbarShown === false ) {
8794 navbarShown = true ;
8895 // noinspection JSUnresolvedVariable,JSUnresolvedFunction
8996 try {
@@ -95,8 +102,7 @@ window.blazorStrap = {
95102 } , 100 ) ;
96103 return ;
97104 }
98- if ( type === "resize" )
99- {
105+ if ( type === "resize" ) {
100106 clearTimeout ( blazorStrap . EventHandlers [ id ] [ name ] [ type ] [ resizeFunc ] ) ;
101107 blazorStrap . EventHandlers [ id ] [ name ] [ type ] [ resizeFunc ] = setTimeout ( function ( ) {
102108 objRef . invokeMethodAsync ( "InteropEventCallback" , id , name , type , element . classList , blazorStrap . GetEvents ( event ) ) ;
@@ -261,7 +267,7 @@ window.blazorStrap = {
261267
262268 if ( await blazorStrap . TransitionDidNotStart ( element , 50 ) ) {
263269 cleanup ( ) ;
264- element . removeEventListener ( "transitionend" , cleanup , { once : true } ) ;
270+ element . removeEventListener ( "transitionend" , cleanup , { once : true } ) ;
265271 objRef . invokeMethodAsync ( "InteropEventCallback" , id , name , "transitionend" , null , null ) ;
266272 }
267273 } , 10 ) ;
0 commit comments