Skip to content

Commit

Permalink
Merge pull request #47 from jimathy/main
Browse files Browse the repository at this point in the history
Upgrade linked icon support
  • Loading branch information
GhzGarage authored Nov 15, 2023
2 parents 82e9bcd + ff98053 commit 83deaa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions client/main.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local QBCore = exports['qb-core']:GetCoreObject()

RegisterNetEvent('QBCore:Client:UpdateObject', function() QBCore = exports['qb-core']:GetCoreObject() end)

local headerShown = false
local sendData = nil
Expand All @@ -20,12 +20,10 @@ local function openMenu(data, sort, skipFirst)
if sort then data = sortData(data, skipFirst) end
for _,v in pairs(data) do
if v["icon"] then
local img = "qb-inventory/html/"
if QBCore.Shared.Items[tostring(v["icon"])] then
if not string.find(QBCore.Shared.Items[tostring(v["icon"])].image, "images/") then
img = img.."images/"
if not string.find(QBCore.Shared.Items[tostring(v["icon"])].image, "//") and not string.find(v["icon"], "//") then
v["icon"] = "nui://qb-inventory/html/images/"..QBCore.Shared.Items[tostring(v["icon"])].image
end
v["icon"] = img..QBCore.Shared.Items[tostring(v["icon"])].image
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion html/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const openMenu = (data = null) => {
const getButtonRender = (header, message = null, id, isMenuHeader, isDisabled, icon) => {
return `
<div class="${isMenuHeader ? "title" : "button"} ${isDisabled ? "disabled" : ""}" id="${id}">
<div class="icon"> <img src=nui://${icon} width=30px onerror="this.onerror=null; this.remove();"> <i class="${icon}" onerror="this.onerror=null; this.remove();"></i> </div>
<div class="icon"> <img src=${icon} width=30px onerror="this.onerror=null; this.remove();"> <i class="${icon}" onerror="this.onerror=null; this.remove();"></i> </div>
<div class="column">
<div class="header"> ${header}</div>
${message ? `<div class="text">${message}</div>` : ""}
Expand Down

0 comments on commit 83deaa0

Please sign in to comment.