1 | "use strict";
|
2 |
|
3 | import $ from 'jquery';
|
4 |
|
5 |
|
6 |
|
7 | |
8 |
|
9 |
|
10 | function rtl() {
|
11 | return $('html').attr('dir') === 'rtl';
|
12 | }
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | function GetYoDigits(length, namespace){
|
23 | length = length || 6;
|
24 | return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? `-${namespace}` : '');
|
25 | }
|
26 |
|
27 | function transitionend($elem){
|
28 | var transitions = {
|
29 | 'transition': 'transitionend',
|
30 | 'WebkitTransition': 'webkitTransitionEnd',
|
31 | 'MozTransition': 'transitionend',
|
32 | 'OTransition': 'otransitionend'
|
33 | };
|
34 | var elem = document.createElement('div'),
|
35 | end;
|
36 |
|
37 | for (var t in transitions){
|
38 | if (typeof elem.style[t] !== 'undefined'){
|
39 | end = transitions[t];
|
40 | }
|
41 | }
|
42 | if(end){
|
43 | return end;
|
44 | }else{
|
45 | end = setTimeout(function(){
|
46 | $elem.triggerHandler('transitionend', [$elem]);
|
47 | }, 1);
|
48 | return 'transitionend';
|
49 | }
|
50 | }
|
51 |
|
52 | export {rtl, GetYoDigits, transitionend};
|