From 4b40fa65d4dfb3e5fc1b9e74aef85c14debe90bc Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Fri, 8 Jan 2016 18:58:03 -0500 Subject: [PATCH] Cental modals and add SweetAlerts --- public/css/pterodactyl.css | 1 + public/js/admin.min.js | 15 ++++++++++++++- resources/views/layouts/admin.blade.php | 2 ++ resources/views/layouts/master.blade.php | 2 ++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/public/css/pterodactyl.css b/public/css/pterodactyl.css index 9a0cf1e8f..e7347701a 100755 --- a/public/css/pterodactyl.css +++ b/public/css/pterodactyl.css @@ -79,3 +79,4 @@ form .text-muted {margin: 0 0 -5.5px} .tabs_with_panel > li > a {background: transparent;} .label{border-radius: .25em;padding: .2em .6em .3em;} kbd{border-radius: .25em} +.modal-open .modal {padding-left: 0px !important;padding-right: 0px !important;overflow-y: scroll;} diff --git a/public/js/admin.min.js b/public/js/admin.min.js index 2f846e748..13105ba3d 100755 --- a/public/js/admin.min.js +++ b/public/js/admin.min.js @@ -1 +1,14 @@ -$.urlParam=function(name){var results=new RegExp("[\\?&]"+name+"=([^&#]*)").exec(decodeURIComponent(window.location.href));if(results==null){return null}else{return results[1]||0}};function getPageName(url){var index=url.lastIndexOf("/")+1;var filenameWithExtension=url.substr(index);var filename=filenameWithExtension.split(".")[0];return filename} \ No newline at end of file +$(document).ready(function () { + $.urlParam=function(name){var results=new RegExp("[\\?&]"+name+"=([^&#]*)").exec(decodeURIComponent(window.location.href));if(results==null){return null}else{return results[1]||0}};function getPageName(url){var index=url.lastIndexOf("/")+1;var filenameWithExtension=url.substr(index);var filename=filenameWithExtension.split(".")[0];return filename} + function centerModal(element) { + var modal = (element.length > 0) ? element : $('.modal:visible'); + var clone = modal.clone().css('display', 'block').appendTo('body'); + var top = Math.round((clone.height() - clone.find('.modal-content').height()) / 3); + clone.remove(); + modal.find('div.modal-content').css('margin-top', top); + } + $('body').on('show.bs.modal', '.modal', function() { + centerModal($(this)); + }); + $(window).on('resize', centerModal); +}); diff --git a/resources/views/layouts/admin.blade.php b/resources/views/layouts/admin.blade.php index cebb2387a..4af42cbdd 100644 --- a/resources/views/layouts/admin.blade.php +++ b/resources/views/layouts/admin.blade.php @@ -9,8 +9,10 @@ + + @show Pterodactyl - @yield('title') diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index e898b740b..0da099b4f 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -9,9 +9,11 @@ + +