Home Reference Source

Function

Static Public Summary
public

Add some css styles to the top most position in head tag.

public

addToWindow(keyValue: string, element: Object): Promise<Object, MyError>

Attach object to window without overwriting anything else.

public

Get window width's info in bootstrap 4's grid system standards.

public

getJquery(): Promise<Object, MyError>

Get jQuery from window.

public

Get scroll bar's width.

public

Check if the current page has scroll bar.

public

init(innerElement: string)

Add scroll to top anchor on the right bottom of the whole page.

public

init()

Fix bootstrap modal's shifting issue. Run bse.fixModalShifting.init();

public

init()

Automatically toggle bootstrap collapse's chevron based on show or hide collapse. Add bse-toggleCollapChevron attribute to chevron link and run bse.toggleCollapseChevron.init();

public

init(config: Object)

Convert a ul li menu to a select options element and display it on small device Add bse-resList attribute to ul and run bse.resList.init();

public

init(displayMessage: string)

Add a message when the table in .table-responsive is scrollable.

public

is(str: *): boolean

Check which grid level is window in.

public

prependClass(sel: Object, strClass: string)

Add class names to the left most position to avoid overwriting original class's style

public

update(displayMessage: *)

public

update()

public

update()

public

update()

public

update()

Static Public

public addStyles(css: string) source

Add some css styles to the top most position in head tag.

Params:

NameTypeAttributeDescription
css string

Css styles that you want to add.

Example:

bse.utilities.addStyles('.test{color: red}');

public addToWindow(keyValue: string, element: Object): Promise<Object, MyError> source

Attach object to window without overwriting anything else.

Params:

NameTypeAttributeDescription
keyValue string

Keyword that you want use to get the object from window.

element Object

Dom element that you want to add to window.

Return:

Promise<Object, MyError>

Promise object.

Example:

bse.utilities.addToWindow('bse', bse);

public checkSize(): string source

Get window width's info in bootstrap 4's grid system standards.

Return:

string

bsGrid of current window

Example:

const bsGrid = bse.utilities.checkBreakPoint.checkSize();

public getJquery(): Promise<Object, MyError> source

Get jQuery from window. Must use this way to get jQuery if we want to attach something to bootstrap's event.

Return:

Promise<Object, MyError>

Promise with jQuery from window.

Example:

bse.utilities.getJquery().then(($)=>{console.log($)});

public getScrollBarWidth(): number source

Get scroll bar's width.

Return:

number

Page's scroll bar width even if there is no scroll bar. Return 0 if scroll bar is transparent(Eg: Safari on iPhone/iPad).

Example:

const scrollBarWidth = bse.utilities.getScrollBarWidth();

public hasScrollBar(): boolean source

Check if the current page has scroll bar.

Return:

boolean

True if current page has scroll bar. False if doesn't have scroll bar or scroll bar is transparent(Eg: Safari on iPhone/iPad).

Example:

const hasScrollBar = bse.utilities.hasScrollBar();

public init(innerElement: string) source

Add scroll to top anchor on the right bottom of the whole page.

Params:

NameTypeAttributeDescription
innerElement string

Dom element string that you want to add to that anchor.

Example:

bse.scrollToTop.init(`<span class="fa-stack fa-lg">
   <i class="fa fa-circle fa-stack-2x"></i>
   <i class="fa fa-chevron-up fa-stack-1x fa-inverse"></i>
 </span>`);

public init() source

Fix bootstrap modal's shifting issue. Run bse.fixModalShifting.init();

Example:

bse.fixModalShifting.init();

public init() source

Automatically toggle bootstrap collapse's chevron based on show or hide collapse. Add bse-toggleCollapChevron attribute to chevron link and run bse.toggleCollapseChevron.init();

Example:

<a data-toggle="collapse" href="#test">
  <i class="fas fa-chevron-down" bse-toggleCollapChevron></i>
</a>
bse.toggleCollapseChevron.init();

public init(config: Object) source

Convert a ul li menu to a select options element and display it on small device Add bse-resList attribute to ul and run bse.resList.init();

Params:

NameTypeAttributeDescription
config Object

Config object

config.breakPoint string

BreakPoint

config.className string

calss name that you want to add to select

Example:

<ul bse-resList>
  <li><a class="h7" href="PASSENGER">PASSENGER</a></li>
  <li><a class="h7" href="TRUCK">TRUCK</a></li>
  <li><a class="h7" href="EARTHMOVER">EARTHMOVER</a></li>
  <li><a class="h7" href="AGRICULTURE">AGRICULTURE</a></li>
  <li><a class="h7" href="AVIATION">AVIATION</a></li>
  <li><a class="h7" href="2R">2R</a></li>
</ul>
bse.resList.init();

public init(displayMessage: string) source

Add a message when the table in .table-responsive is scrollable. Add bse-resTableMess attribute to div.table-responsive and run bse.addScrollMessToResTable.init();

Params:

NameTypeAttributeDescription
displayMessage string

Message that you want to display, default value is: Scroll table horizontally to see more.

Example:

<div class="table-responsive" bse-resTableMess>
  <table class="table">
    <thead>
    </thead>
    <tbody>
    </tbody>
  </table>
</div>
bse.addScrollMessToResTable.init();

public is(str: *): boolean source

Check which grid level is window in.

Params:

NameTypeAttributeDescription
str *

Return:

boolean

True when window is in the scope. False when window is not in the scope.

Example:

const is = bse.utilities.checkBreakPoint.is('md');

public prependClass(sel: Object, strClass: string) source

Add class names to the left most position to avoid overwriting original class's style

Params:

NameTypeAttributeDescription
sel Object

Dom element that you want to add class to.

strClass string

Class name that you want add.

Example:

bse.utilities.prependClass(domElement, 'test-class');

public update(displayMessage: *) source

Params:

NameTypeAttributeDescription
displayMessage *

public update() source

public update() source

public update() source

public update() source