Skip to content

Commit

Permalink
feat(core): Add Legal disclaimers. (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
MagneticNeedle authored Jul 23, 2023
2 parents ca6fca7 + 64984b6 commit 5caad84
Show file tree
Hide file tree
Showing 3 changed files with 371 additions and 137 deletions.
38 changes: 21 additions & 17 deletions bfportal/bfportal/static/js/bfportal.js
Original file line number Diff line number Diff line change
@@ -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);
Expand All @@ -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);
Expand All @@ -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`;
Expand All @@ -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");

Expand Down Expand Up @@ -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");
});
Expand All @@ -121,6 +123,7 @@ $(document).ready(function() {

$('#menuIcon').on('click touch', function (e) {
e.stopPropagation();
showPopUpBackGround();
$('#nav-bar-pane').height($('#main').height() - 2);
animateNavBarPane();
});
Expand All @@ -131,6 +134,7 @@ $(document).ready(function() {
});

addDropDownPair("profileButton", "accountNavBarDropdown")

});

function getCookie(name) {
Expand Down
10 changes: 9 additions & 1 deletion bfportal/bfportal/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

</script>
{% block extra_js %}
{# Override this in templates to add extra javascript #}
Expand Down
Loading

0 comments on commit 5caad84

Please sign in to comment.