Skip to content

Commit

Permalink
Merge pull request #277 from Miss-placed/devBranch
Browse files Browse the repository at this point in the history
Misc Icons, New Intel For Forsaken, Intel fixes & V2 Work In Progress
  • Loading branch information
sol3uk authored Oct 21, 2021
2 parents 4eeafbc + 38015fe commit 9736e0e
Show file tree
Hide file tree
Showing 44 changed files with 7,577 additions and 5,089 deletions.
1,748 changes: 1,748 additions & 0 deletions assets/img/icons/Untitled-1.ai

Large diffs are not rendered by default.

Binary file added assets/img/icons/misc/ammoCrate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icons/misc/arsenal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icons/misc/craftingTable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icons/misc/papMachine.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icons/misc/trialComputer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icons/misc/wallbuy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/icons/misc/zipline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added assets/img/intelScreenshot/placeholder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/intelScreenshot/placeholder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions assets/js/darkmode.js

This file was deleted.

4 changes: 2 additions & 2 deletions assets/js/filtering.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function filterIntel(searchTerm, factionsArr, seasonsArr, intelTypeArr, mapArr)
});

results = results.filter((intel) => {
return mapArr.includes(intel.map) || intel.map == mapStrings.allOutbreakMaps && mapArr.some((e) => { return allOutbreakMapsArr.includes(e) });
return mapArr.includes(intel.map) || intel.map == mapDetails.allOutbreakMaps.id && mapArr.some((e) => { return allOutbreakMapsArr.includes(e) });
});

return results;
Expand Down Expand Up @@ -45,7 +45,7 @@ function TriggerSearch() {
let mapFilters = $('#mapFilterCollapse').find("input[type=checkbox]:checked");
let mapArr = [];
$.each(mapFilters, function() {
mapArr.push(mapStrings[$(this).val()]);
mapArr.push(mapDetails[$(this).val()].id);
});

let filteredIntel = filterIntel($('#searchTerm').val().toLowerCase(), factionsArr, seasonsArr, intelTypeArr, mapArr);
Expand Down
63 changes: 33 additions & 30 deletions assets/js/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,59 +45,62 @@ var generalIcon = L.icon({
iconAnchor: [15, 30],
popupAnchor: [0, -30]
});
var riftIcon = L.icon({
iconUrl: 'assets/img/icons/Rift.png',
var riftIcon = iconInit('rift', 'outbreak', bounds = {
iconSize: [22, 48],
iconAnchor: [11, 24],
popupAnchor: [0, -30]
});
var monkeyIcon = L.icon({
iconUrl: 'assets/img/icons/monkeyIcon.png',
iconSize: [30, 30],
iconAnchor: [15, 15],
popupAnchor: [0, -30]
});
})
var radioIcon = L.icon({
iconUrl: 'assets/img/icons/radioIcon.png',
iconSize: [39, 48],
iconAnchor: [19.5, 24],
popupAnchor: [0, -30]
});
var dementedIcon = L.icon({
iconUrl: 'assets/img/icons/dementedIcon.png',
iconUrl: 'assets/img/icons/outbreak/dementedIcon.png',
iconSize: [48, 48],
iconAnchor: [24, 24],
popupAnchor: [0, -30]
});
var fishingIcon = L.icon({
iconUrl: 'assets/img/icons/fishIcon.png',
var fishingIcon = iconInit('fishIcon', 'outbreak', {
iconSize: [30, 30],
iconAnchor: [15, 15],
popupAnchor: [0, -30]
})

var monkeyIcon = L.icon({
iconUrl: 'assets/img/icons/outbreak/monkeyIcon.png',
iconSize: [30, 30],
iconAnchor: [15, 15],
popupAnchor: [0, -30]
});
var redRiftIcon = L.icon({
iconUrl: 'assets/img/icons/redRiftIcon.png',
var redRiftIcon = iconInit('redRift', 'outbreak', bounds = {
iconSize: [22, 48],
iconAnchor: [11, 24],
popupAnchor: [0, -30]
});
var wunderFizzIcon = L.icon({
iconUrl: 'assets/img/icons/perk/wunderFizz.png',
iconSize: [30, 30],
iconAnchor: [15, 15],
popupAnchor: [0, -15]
});
var mysteryBoxIcon = L.icon({
iconUrl: 'assets/img/icons/misc/mysteryBox.png',
iconSize: [30, 30],
iconAnchor: [15, 15],
popupAnchor: [0, -15]
});
function iconInit(id, type) {
return L.icon({
iconUrl: `assets/img/icons/${type}/${id}.png`,
})

var wunderFizzIcon = iconInit('wunderFizz', 'perk')
var mysteryBoxIcon = iconInit('mysteryBox', 'misc')
var arsenalIcon = iconInit('arsenal', 'misc')
var wallbuyIcon = iconInit('wallBuy', 'misc')
var ammoCrateIcon = iconInit('ammoCrate', 'misc')
var craftingTableIcon = iconInit('craftingTable', 'misc')
var ziplineIcon = iconInit('zipline', 'misc')
var trialComputerIcon = iconInit('trialComputer', 'misc')
var papMachineIcon = iconInit('papMachine', 'misc')

//idk how to do an override where you specify only a few bound properties
function iconInit(id, type,
bounds = {
iconSize: [30, 30],
iconAnchor: [15, 15],
popupAnchor: [0, -15]
}) {
return L.icon({
iconUrl: `assets/img/icons/${type}/${id}.png`,
iconSize: bounds.iconSize,
iconAnchor: bounds.iconAnchor,
popupAnchor: bounds.popupAnchor
});
}
39 changes: 26 additions & 13 deletions assets/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ L.control.attribution()
//loops through all types of intel and makes a marker
AddMapMarkersFromCache(intelCache);

mapInstance.on('popupopen', function() {
$('.mark-collected').click(function(e) {
mapInstance.on('popupopen', function () {
$('.mark-collected').click(function (e) {
let itemId = $(e.target).closest(".buttonContainer").data("item");
if (app.disableMarkers.includes(itemId.toString())) {
app.disableMarkers = $.grep(app.disableMarkers, function(value) {
app.disableMarkers = $.grep(app.disableMarkers, function (value) {
return value != itemId.toString();
});
app.visibleMarkers[itemId].setOpacity(1);
Expand All @@ -23,19 +23,19 @@ mapInstance.on('popupopen', function() {
addCollectedIntel(itemId);
}
});
$('.share').click(function(e) {
$('.share').click(function (e) {
let itemId = $(e.target).closest(".buttonContainer").data("item");
copyToClipboard(`${window.location.origin}${window.location.pathname}?id=${itemId}`, "Link Copied To Clipboard");
});
$('.bugRep').click(function(e) {
$('.bugRep').click(function (e) {
let itemId = $(e.target).closest(".buttonContainer").data("item");
let type = $(e.target).closest(".buttonContainer").data("type");

redirectToGithub({ itemType: type, issueType: "Fix", itemId: itemId })
});
});

mapInstance.on("click", function(e) {
mapInstance.on("click", function (e) {
let location = "[" + e.latlng.lat + ", " + e.latlng.lng + "]";
if (debug) {
copyToClipboard(location, "Location Copied to Clipboard")
Expand All @@ -45,27 +45,39 @@ mapInstance.on("click", function(e) {
})

function onLoad() {
// needs to be replaced with the new menu highlighter
//Set initial theme
setThemeFromPrefs();
initSystemThemeButton();

// needs to be replaced with the new menu highlighter
document.getElementById(app.currentMap).classList.add("current-map")
GenerateFullIntelList(intelCache);
let urlId = (getUrlVars()["id"] === "" ? undefined : getUrlVars()["id"])
if (urlId != undefined) {
goToIntelById(urlId)
}
CheckIfSharingURL();

//Intel Search Listeners
$('#intelFilter').find("input[type=checkbox]").change(function() {
$('#intelFilter').find("input[type=checkbox]").change(function () {
intelFiltered = TriggerSearch();
});

$('#searchTerm').keyup(function() {
$('#searchTerm').keyup(function () {
intelFiltered = TriggerSearch();
});
//Hide aside if toggled off
if (!userPrefs.asideShow) toggleAside(false);
}



function onLoadV2() {
//Set initial theme
setThemeFromPrefs();
initSystemThemeButton();

setDebugButton();

CheckIfSharingURL();
}

if (navigator.userAgent.toLowerCase().match(/mobile/i)) {
let sidebar = document.getElementById("aside");
let worldmap = document.getElementById("worldMap");
Expand All @@ -74,3 +86,4 @@ if (navigator.userAgent.toLowerCase().match(/mobile/i)) {
app.isMobile = true
toggleAside(false);
}

69 changes: 61 additions & 8 deletions assets/js/listgeneration.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
/////////////////////V2/////////////////////////

function GenerateList(filters) {
const intelListEle = document.querySelector("#filtered-intel");
intelListEle.replaceChildren(); // Empty First

intelCache.forEach(intel => {
const buttonTemplate = htmlToElement(`<button class="btn to-intel" target="intel-detail" id="${intel.id}">${intel.name}</button>`);
intelListEle.appendChild(buttonTemplate);
});
InitialiseButtons();
}

function InitialiseButtons() {
document.querySelectorAll(".to-intel").forEach(element => {
element.addEventListener('click', (event) => IntelButtonClick(event));
});
}

function IntelButtonClick(event) {
let target = event.target;
let intelID = target.getAttribute('id');
openSubModal("intel-detail")

//use target to get intel instead of predefined obj

let intel = getIntelById(intelID);
GenerateDetailModal(intel);
closeSubModal("intel-stats");
closeSubModal("intel-type");
}

/////////////////////V1/////////////////////////
function GenerateFullIntelList(pointsOfInterest) {
let intelList = document.getElementById("intelList")
intelList.innerHTML = "";
Expand Down Expand Up @@ -59,7 +92,7 @@ function GenerateIntelListItem(item) {

//Only Generate locate and share buttons if intel has location
if (item.loc[0] != 0 && item.loc[1] != 0) {
let location = createElement("button", ["btn", "btn-info", "remove-button"], "Locate Intel");
let location = createElement("button", ["btn", "btn-info", "inverted", "remove-button"], "Locate Intel");
location.onclick = goToIntel(item);
btnContainer.appendChild(location);
btnContainer.appendChild(genShareButton(item.id));
Expand All @@ -73,42 +106,62 @@ function GenerateIntelListItem(item) {
}

function goToIntel(item) {
return function() {
return function () {
// REMOVE THIS IF WHEN WE MOVE TO V2
if (typeof closeModal !== "undefined") {
closeModal();
}

switchAndFly(item.loc, item.map)
if (app.isMobile)
toggleAside()
}
}

function copyClipboardForButton(intelId) {
return function() {
return function () {
copyToClipboard(`${window.location.origin}${window.location.pathname}?id=${intelId}`, "Link Copied To Clipboard")
}
}

function redirectToGithubForButton(itemId) {
return function() {
return function () {
//This is only for intel in the side panel. Misc markers are only on the map
redirectToGithub({ itemType: markerTypes.intel.id, issueType: "Fix", itemId: itemId })
}
}

function genShareButton(intelId) {
let shareBtn = createElement("button", ["btn", "btn-info", "action-buttons", "share", "fas", "fa-external-link-alt"], "")
let shareBtn = createElement("button", ["btn", "btn-info", "inverted", "action-buttons", "share", "fas", "fa-link"], "")
shareBtn.title = "Copy Sharing Link";
shareBtn.onclick = copyClipboardForButton(intelId);
return shareBtn;
}

function genBugButton(itemId) {
let bugBtn = createElement("button", ["btn", "btn-info", "action-buttons", "bugRep", "fas", "fa-bug"], "")
let bugBtn = createElement("button", ["btn", "btn-info", "inverted", "action-buttons", "bugRep", "fas", "fa-bug"], "")
bugBtn.title = "Submit Bug Report";
bugBtn.onclick = redirectToGithubForButton(itemId);
return bugBtn;
}


function openDescModal(intel) {
return function () {
console.log("lol try again")
GenerateDetailModal(intel)
openModal(modalSet.intelDescription)
}
}
function genMoreButton(intel) {
let moreBtn = createElement("button", ["btn", "btn-info", "inverted", "action-buttons", "moreInfo", "fas", "fa-ellipsis-h"], "")
moreBtn.title = "More Info";
moreBtn.onclick = openDescModal(intel)
return moreBtn;
}

function copyToClipboard(text, notif) {
const listener = function(ev) {
const listener = function (ev) {
ev.preventDefault();
ev.clipboardData.setData('text/plain', text);
};
Expand Down Expand Up @@ -140,7 +193,7 @@ function createElement(type, className, inside = undefined, id, map) {
tempElement.setAttribute("data-id", id);
}
if (map) tempElement.setAttribute("data-map", map);
tempElement.onclick = function() {
tempElement.onclick = function () {
if (this.nextSibling != undefined) this.nextSibling.classList.toggle("visible")
}
tempElement.innerHTML = inside
Expand Down
Loading

0 comments on commit 9736e0e

Please sign in to comment.