Skip to content

Commit 2229306

Browse files
committed
Remove legacy code from sidebar
1 parent 6258196 commit 2229306

File tree

1 file changed

+8
-118
lines changed

1 file changed

+8
-118
lines changed

src/definitions/modules/sidebar.js

Lines changed: 8 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ $.fn.sidebar = function(parameters) {
8383

8484
transitionEvent = module.get.transitionEvent();
8585

86-
// cache on initialize
87-
if( ( settings.useLegacy == 'auto' && module.is.legacy() ) || settings.useLegacy === true) {
88-
settings.transition = 'overlay';
89-
settings.useLegacy = true;
90-
}
91-
9286
if(module.is.ios()) {
9387
module.set.ios();
9488
}
@@ -368,11 +362,6 @@ $.fn.sidebar = function(parameters) {
368362
},
369363

370364
show: function(callback) {
371-
var
372-
animateMethod = (settings.useLegacy === true)
373-
? module.legacyPushPage
374-
: module.pushPage
375-
;
376365
callback = $.isFunction(callback)
377366
? callback
378367
: function(){}
@@ -400,7 +389,7 @@ $.fn.sidebar = function(parameters) {
400389
settings.transition = 'overlay';
401390
}
402391
}
403-
animateMethod(function() {
392+
module.pushPage(function() {
404393
callback.call(element);
405394
settings.onShow.call(element);
406395
});
@@ -413,19 +402,14 @@ $.fn.sidebar = function(parameters) {
413402
},
414403

415404
hide: function(callback) {
416-
var
417-
animateMethod = (settings.useLegacy === true)
418-
? module.legacyPullPage
419-
: module.pullPage
420-
;
421405
callback = $.isFunction(callback)
422406
? callback
423407
: function(){}
424408
;
425409
if(module.is.visible() || module.is.animating()) {
426410
module.debug('Hiding sidebar', callback);
427411
module.refreshSidebars();
428-
animateMethod(function() {
412+
module.pullPage(function() {
429413
callback.call(element);
430414
settings.onHidden.call(element);
431415
});
@@ -474,11 +458,9 @@ $.fn.sidebar = function(parameters) {
474458
pushPage: function(callback) {
475459
var
476460
transition = module.get.transition(),
477-
$transition = (transition == 'safe')
478-
? $context
479-
: (transition === 'overlay' || module.othersActive())
480-
? $module
481-
: $pusher,
461+
$transition = (transition === 'overlay' || module.othersActive())
462+
? $module
463+
: $pusher,
482464
animate,
483465
dim,
484466
transitionEnd
@@ -520,11 +502,9 @@ $.fn.sidebar = function(parameters) {
520502
pullPage: function(callback) {
521503
var
522504
transition = module.get.transition(),
523-
$transition = (transition == 'safe')
524-
? $context
525-
: (transition == 'overlay' || module.othersActive())
526-
? $module
527-
: $pusher,
505+
$transition = (transition == 'overlay' || module.othersActive())
506+
? $module
507+
: $pusher,
528508
animate,
529509
transitionEnd
530510
;
@@ -562,62 +542,6 @@ $.fn.sidebar = function(parameters) {
562542
requestAnimationFrame(animate);
563543
},
564544

565-
legacyPushPage: function(callback) {
566-
var
567-
distance = $module.width(),
568-
direction = module.get.direction(),
569-
properties = {}
570-
;
571-
distance = distance || $module.width();
572-
callback = $.isFunction(callback)
573-
? callback
574-
: function(){}
575-
;
576-
properties[direction] = distance;
577-
module.debug('Using javascript to push context', properties);
578-
module.set.visible();
579-
module.set.transition();
580-
module.set.animating();
581-
if(settings.dimPage) {
582-
$pusher.addClass(className.dimmed);
583-
}
584-
$context
585-
.css('position', 'relative')
586-
.animate(properties, settings.duration, settings.easing, function() {
587-
module.remove.animating();
588-
module.bind.clickaway();
589-
callback.call(element);
590-
})
591-
;
592-
},
593-
legacyPullPage: function(callback) {
594-
var
595-
distance = 0,
596-
direction = module.get.direction(),
597-
properties = {}
598-
;
599-
distance = distance || $module.width();
600-
callback = $.isFunction(callback)
601-
? callback
602-
: function(){}
603-
;
604-
properties[direction] = '0px';
605-
module.debug('Using javascript to pull context', properties);
606-
module.unbind.clickaway();
607-
module.set.animating();
608-
module.remove.visible();
609-
if(settings.dimPage && !module.othersActive()) {
610-
$pusher.removeClass(className.dimmed);
611-
}
612-
$context
613-
.css('position', 'relative')
614-
.animate(properties, settings.duration, settings.easing, function() {
615-
module.remove.animating();
616-
callback.call(element);
617-
})
618-
;
619-
},
620-
621545
scrollToTop: function() {
622546
module.verbose('Scrolling to top of page to avoid animation issues');
623547
currentScroll = $(window).scrollTop();
@@ -782,30 +706,6 @@ $.fn.sidebar = function(parameters) {
782706
return (isIE11 || isIE);
783707
},
784708

785-
legacy: function() {
786-
var
787-
element = document.createElement('div'),
788-
transforms = {
789-
'webkitTransform' :'-webkit-transform',
790-
'OTransform' :'-o-transform',
791-
'msTransform' :'-ms-transform',
792-
'MozTransform' :'-moz-transform',
793-
'transform' :'transform'
794-
},
795-
has3D
796-
;
797-
798-
// Add it to the body to get the computed style.
799-
document.body.insertBefore(element, null);
800-
for (var transform in transforms) {
801-
if (element.style[transform] !== undefined) {
802-
element.style[transform] = "translate3d(1px,1px,1px)";
803-
has3D = window.getComputedStyle(element).getPropertyValue(transforms[transform]);
804-
}
805-
}
806-
document.body.removeChild(element);
807-
return !(has3D !== undefined && has3D.length > 0 && has3D !== 'none');
808-
},
809709
ios: function() {
810710
var
811711
userAgent = navigator.userAgent,
@@ -1073,9 +973,7 @@ $.fn.sidebar.settings = {
1073973
returnScroll : false,
1074974
delaySetup : false,
1075975

1076-
useLegacy : false,
1077976
duration : 500,
1078-
easing : 'easeInOutQuint',
1079977

1080978
onChange : function(){},
1081979
onShow : function(){},
@@ -1121,13 +1019,5 @@ $.fn.sidebar.settings = {
11211019

11221020
};
11231021

1124-
// Adds easing
1125-
$.extend( $.easing, {
1126-
easeInOutQuint: function (x, t, b, c, d) {
1127-
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
1128-
return c/2*((t-=2)*t*t*t*t + 2) + b;
1129-
}
1130-
});
1131-
11321022

11331023
})( jQuery, window , document );

0 commit comments

Comments
 (0)