From f9aa03b2733b28fdc8a44a88d55c37803a1cd9f4 Mon Sep 17 00:00:00 2001 From: p0lygun Date: Sat, 22 Jul 2023 02:49:18 +0530 Subject: [PATCH 1/4] =?UTF-8?q?feat(core):=20add=20Electronic=20Arts?= =?UTF-8?q?=E2=80=99=20Fansite=20Agreement?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bfportal/bfportal/static/js/bfportal.js | 42 ++-- bfportal/bfportal/templates/navbar.html | 266 +++++++++++++----------- 2 files changed, 172 insertions(+), 136 deletions(-) diff --git a/bfportal/bfportal/static/js/bfportal.js b/bfportal/bfportal/static/js/bfportal.js index 168c25a..d2c7645 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"); }); @@ -131,6 +133,12 @@ $(document).ready(function() { }); addDropDownPair("profileButton", "accountNavBarDropdown") + + $('#disclaimer').on( + 'touch click', function () { + console.log('Show legal garbage') + } + ) }); function getCookie(name) { diff --git a/bfportal/bfportal/templates/navbar.html b/bfportal/bfportal/templates/navbar.html index 2f3d08b..d622a5a 100644 --- a/bfportal/bfportal/templates/navbar.html +++ b/bfportal/bfportal/templates/navbar.html @@ -1,138 +1,166 @@ {% 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 %} From 83d2949ac5c2b0fd0e98db42d7caa73679f00dd8 Mon Sep 17 00:00:00 2001 From: p0lygun Date: Sun, 23 Jul 2023 23:43:09 +0530 Subject: [PATCH 2/4] feat(core): add why i love lawyers --- bfportal/bfportal/templates/navbar.html | 197 +++++++++++++++++++++++- 1 file changed, 194 insertions(+), 3 deletions(-) diff --git a/bfportal/bfportal/templates/navbar.html b/bfportal/bfportal/templates/navbar.html index d622a5a..1c73eee 100644 --- a/bfportal/bfportal/templates/navbar.html +++ b/bfportal/bfportal/templates/navbar.html @@ -157,9 +157,200 @@ Disclaimer

This site was created under Electronic Arts’ Fansite Agreement using materials from Battlefield 2042. -Trademarks are the property of their respective owners. Game materials copyright Electronic Arts -Inc. and/or its licensors. Electronic Arts Inc. and its licensors have not otherwise endorsed and are -not responsible for the operation of or content on this site + Trademarks are the property of their respective owners. Game materials copyright Electronic Arts + Inc. and/or its licensors. Electronic Arts Inc. and its licensors have not otherwise endorsed and are + not responsible for the operation of or content on this site +

From 8e55b91cb84bdd5bfaaa5eb4241f79e5f5044ce3 Mon Sep 17 00:00:00 2001 From: p0lygun Date: Mon, 24 Jul 2023 00:11:41 +0530 Subject: [PATCH 3/4] feat(core): add disclaimer for mobile --- bfportal/bfportal/static/js/bfportal.js | 1 + bfportal/bfportal/templates/base.html | 10 +++++++++- bfportal/bfportal/templates/navbar.html | 17 ++++++++++------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/bfportal/bfportal/static/js/bfportal.js b/bfportal/bfportal/static/js/bfportal.js index d2c7645..db965ff 100644 --- a/bfportal/bfportal/static/js/bfportal.js +++ b/bfportal/bfportal/static/js/bfportal.js @@ -123,6 +123,7 @@ $(document).ready(function () { $('#menuIcon').on('click touch', function (e) { e.stopPropagation(); + showPopUpBackGround(); $('#nav-bar-pane').height($('#main').height() - 2); animateNavBarPane(); }); 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 1c73eee..95faa12 100644 --- a/bfportal/bfportal/templates/navbar.html +++ b/bfportal/bfportal/templates/navbar.html @@ -100,7 +100,7 @@
- {% endwith %} From 64984b66cf02ff08a52a3774d35d751dceda48a7 Mon Sep 17 00:00:00 2001 From: p0lygun Date: Mon, 24 Jul 2023 00:13:16 +0530 Subject: [PATCH 4/4] fix(core): remove function --- bfportal/bfportal/static/js/bfportal.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/bfportal/bfportal/static/js/bfportal.js b/bfportal/bfportal/static/js/bfportal.js index db965ff..b3d3631 100644 --- a/bfportal/bfportal/static/js/bfportal.js +++ b/bfportal/bfportal/static/js/bfportal.js @@ -135,11 +135,6 @@ $(document).ready(function () { addDropDownPair("profileButton", "accountNavBarDropdown") - $('#disclaimer').on( - 'touch click', function () { - console.log('Show legal garbage') - } - ) }); function getCookie(name) {