feat: #8734, move slideout to package.json

v1.18.x
Barış Soner Uşaklı 4 years ago
parent 9c157de05d
commit 2c1897b373

@ -116,6 +116,7 @@
"serve-favicon": "^2.5.0", "serve-favicon": "^2.5.0",
"sharp": "0.26.1", "sharp": "0.26.1",
"sitemap": "^6.1.0", "sitemap": "^6.1.0",
"slideout": "1.0.1",
"socket.io": "2.3.0", "socket.io": "2.3.0",
"socket.io-adapter-cluster": "^1.0.1", "socket.io-adapter-cluster": "^1.0.1",
"socket.io-adapter-postgres": "^1.2.1", "socket.io-adapter-postgres": "^1.2.1",

@ -1,7 +1,5 @@
{ {
"globals": { "globals": {
"Sortable": true, "Sortable": true
"Slideout": true,
"NProgress": true
} }
} }

@ -151,58 +151,60 @@
} }
function configureSlidemenu() { function configureSlidemenu() {
var env = utils.findBootstrapEnvironment(); require(['slideout'], function (Slideout) {
var env = utils.findBootstrapEnvironment();
var slideout = new Slideout({
panel: document.getElementById('panel'),
menu: document.getElementById('menu'),
padding: 256,
tolerance: 70,
});
var slideout = new Slideout({ if (env === 'md' || env === 'lg') {
panel: document.getElementById('panel'), slideout.disableTouch();
menu: document.getElementById('menu'), }
padding: 256,
tolerance: 70,
});
if (env === 'md' || env === 'lg') { $('#mobile-menu').on('click', function () {
slideout.disableTouch(); slideout.toggle();
} });
$('#mobile-menu').on('click', function () { $('#menu a').on('click', function () {
slideout.toggle(); slideout.close();
}); });
$('#menu a').on('click', function () { $(window).on('resize', function () {
slideout.close(); slideout.close();
});
$(window).on('resize', function () { env = utils.findBootstrapEnvironment();
slideout.close();
env = utils.findBootstrapEnvironment(); if (env === 'md' || env === 'lg') {
slideout.disableTouch();
$('#header').css({
position: 'relative',
});
} else {
slideout.enableTouch();
$('#header').css({
position: 'fixed',
});
}
});
if (env === 'md' || env === 'lg') { function onOpeningMenu() {
slideout.disableTouch();
$('#header').css({ $('#header').css({
position: 'relative', top: ($('#panel').position().top * -1) + 'px',
}); position: 'absolute',
} else {
slideout.enableTouch();
$('#header').css({
position: 'fixed',
}); });
} }
});
function onOpeningMenu() {
$('#header').css({
top: ($('#panel').position().top * -1) + 'px',
position: 'absolute',
});
}
slideout.on('open', onOpeningMenu); slideout.on('open', onOpeningMenu);
slideout.on('close', function () { slideout.on('close', function () {
$('#header').css({ $('#header').css({
top: '0px', top: '0px',
position: 'fixed', position: 'fixed',
});
}); });
}); });
} }

File diff suppressed because one or more lines are too long

@ -92,7 +92,6 @@ JS.scripts = {
'public/vendor/semver/semver.browser.js', 'public/vendor/semver/semver.browser.js',
'public/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js', 'public/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js',
'public/vendor/jquery/deserialize/jquery.deserialize.min.js', 'public/vendor/jquery/deserialize/jquery.deserialize.min.js',
'public/vendor/slideout/slideout.min.js',
], ],
// modules listed below are built (/src/modules) so they can be defined anonymously // modules listed below are built (/src/modules) so they can be defined anonymously
@ -106,6 +105,7 @@ JS.scripts = {
'clipboard.js': 'node_modules/clipboard/dist/clipboard.min.js', 'clipboard.js': 'node_modules/clipboard/dist/clipboard.min.js',
'nprogress.js': 'node_modules/nprogress/nprogress.js', 'nprogress.js': 'node_modules/nprogress/nprogress.js',
'tinycon.js': 'node_modules/tinycon/tinycon.js', 'tinycon.js': 'node_modules/tinycon/tinycon.js',
'slideout.js': 'node_modules/slideout/dist/slideout.min.js',
}, },
}; };

Loading…
Cancel
Save