diff --git a/bfportal/bfportal/static/js/bfportal.js b/bfportal/bfportal/static/js/bfportal.js index 168c25a..b3d3631 100644 --- a/bfportal/bfportal/static/js/bfportal.js +++ b/bfportal/bfportal/static/js/bfportal.js @@ -1,6 +1,6 @@ // https://portal.battlefield.com/experience/package/era?playgroundId=d23be170-33aa-11ed-98f8-9d6912d338ca -$(document).ready(function() { +$(document).ready(function () { "use strict"; $("body").on('click touch', function (event) { animateNavBarPane(true); @@ -18,7 +18,7 @@ $(document).ready(function() { otherInp = $('#id_code'); } const req = $(`#${inp.prop('id')}Reason`), - otherReq = $(`#${otherInp.prop('id')}Reason`); + otherReq = $(`#${otherInp.prop('id')}Reason`); if (req.siblings().length <= 2) { required_asterisk.insertBefore(req); @@ -40,7 +40,7 @@ $(document).ready(function() { } - async function GetPlaygroundInfo(url=null, experienceCode=null ){ + async function GetPlaygroundInfo(url = null, experienceCode = null) { let api_url; if (url) { api_url = `https://api.gametools.network/bf2042/playground/?playgroundid=${url.search.split('=').at(-1)}&blockydata=false&lang=en-us&return_ownername=false`; @@ -54,24 +54,26 @@ $(document).ready(function() { } function fillForm(GTApiResponse) { - GTApiResponse.playgroundName = String; - GTApiResponse.playgroundDescription = String; - if (!GTApiResponse.hasOwnProperty('errors')) { - GTApiResponse.tag.forEach(elm => {addTagToDeck(elm['metadata']['translations'][0]['localizedText'])}); + GTApiResponse.playgroundName = String; + GTApiResponse.playgroundDescription = String; + if (!GTApiResponse.hasOwnProperty('errors')) { + GTApiResponse.tag.forEach(elm => { + addTagToDeck(elm['metadata']['translations'][0]['localizedText']) + }); - GTApiResponse = GTApiResponse.validatedPlayground; - document.getElementById("id_title").value = toTitleCase(GTApiResponse.playgroundName); - document.getElementById("id_description").value = GTApiResponse.playgroundDescription; - document.getElementById("id_no_players").value = GTApiResponse.mapRotation.maps[0].gameSize; - { - document.getElementById("id_no_bots").value = GTApiResponse.mapRotation.maps[0].gameSize; + GTApiResponse = GTApiResponse.validatedPlayground; + document.getElementById("id_title").value = toTitleCase(GTApiResponse.playgroundName); + document.getElementById("id_description").value = GTApiResponse.playgroundDescription; + document.getElementById("id_no_players").value = GTApiResponse.mapRotation.maps[0].gameSize; + { + document.getElementById("id_no_bots").value = GTApiResponse.mapRotation.maps[0].gameSize; - } } + } } - $('#autoFillBtn').on('click touch', function (){ + $('#autoFillBtn').on('click touch', function () { let expUrl = $("#id_exp_url"); let experienceCode = $("#id_code"); @@ -102,13 +104,13 @@ $(document).ready(function() { }); - function animateNavBarPane(hide=null) { + function animateNavBarPane(hide = null) { if (hide) { navBarPane.animate({'right': `-${navBarPane.width()}px`}, 100, function () { navBarPane.addClass("hidden"); }); } else { - if (navBarPane.css('right') === '0px'){ + if (navBarPane.css('right') === '0px') { navBarPane.animate({'right': `-${navBarPane.width()}px`}, 100, function () { navBarPane.addClass("hidden"); }); @@ -121,6 +123,7 @@ $(document).ready(function() { $('#menuIcon').on('click touch', function (e) { e.stopPropagation(); + showPopUpBackGround(); $('#nav-bar-pane').height($('#main').height() - 2); animateNavBarPane(); }); @@ -131,6 +134,7 @@ $(document).ready(function() { }); addDropDownPair("profileButton", "accountNavBarDropdown") + }); function getCookie(name) { diff --git a/bfportal/bfportal/templates/base.html b/bfportal/bfportal/templates/base.html index 3fe35d5..0293343 100644 --- a/bfportal/bfportal/templates/base.html +++ b/bfportal/bfportal/templates/base.html @@ -289,12 +289,20 @@ function showPopUp(id) { const popup = $(document.getElementById(id)) if (popup) { - $(`#popUpBackground`).fadeIn(100); + showPopUpBackGround(); popup.fadeIn(); popup.css('display', 'flex'); } } + function showPopUpBackGround() { + $(`#popUpBackground`).fadeIn(100); + } + + $('#disclaimer-mobile').on('click touch', function() { + showPopUp('disclaimerPopUp'); + }); + {% block extra_js %} {# Override this in templates to add extra javascript #} diff --git a/bfportal/bfportal/templates/navbar.html b/bfportal/bfportal/templates/navbar.html index 2f3d08b..95faa12 100644 --- a/bfportal/bfportal/templates/navbar.html +++ b/bfportal/bfportal/templates/navbar.html @@ -1,138 +1,360 @@ {% load static wagtailcore_tags socialaccount %} {% with is_super_user=request.user.is_superuser %} -{% if is_super_user %} -

LOGGED IN AS SUPERUSER :- {{ request.user|upper }}

-{% endif %} - {% endwith %}