Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Resourcename issue #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tab/client.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
--[[------------------------------------------------------------------------
Resource Rename Fix
------------------------------------------------------------------------]]--
Citizen.CreateThread( function()
Citizen.Wait( 1000 )
local resourceName = GetCurrentResourceName()
SendNUIMessage( { resourcename = resourceName } )
end )
--[[------------------------------------------------------------------------
End Resource Fix
------------------------------------------------------------------------]]--

-- Define the variable used to open/close the tab
local tabEnabled = false
local tabLoaded = true --false
Expand Down
40 changes: 9 additions & 31 deletions tab/nui/ui.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" type="text/javascript"></script>
<style>
* { box-sizing: border-box; }

body {
font-family: sans-serif;
overflow: hidden;
Expand All @@ -24,7 +23,6 @@
height: 100vh;

}

#iframe {
width: 100%;
flex: 1;
Expand All @@ -34,31 +32,24 @@
margin: 0;
padding: 0;
}

#iframe.empty {
display: none;
}

#iframe:not(.empty) ~ .tab-content {
display:none;
}


.placeholder {
flex: 1;
}

#iframe:not(.empty) + .placeholder {
display:none;
}


#tab-container {
display: flex;
flex: 1;
top: 20px;
}

.tab {
background: url('loadscreen.jpg');
background-size: 100% 100%;
Expand All @@ -67,7 +58,6 @@
display: flex;
flex-direction: column;
}

.tab-wrap {
position: relative;
background: black;
Expand All @@ -82,7 +72,6 @@
display: flex;
flex-direction: column;
}

.tab-wrap .dot {
position: absolute;
width: 30px;
Expand All @@ -93,18 +82,15 @@
transition: all 0.5s ease;
align-self: center;
}

.tab-wrap .dot:hover {
background: whitesmoke;
}

.tab-wrap .tab {
padding: 0;
overflow:hidden;
}

/*--Dock--*/

footer {
text-align: center;
background: linear-gradient(to top, rgba(0,0,0, 0.25) 0%, rgba(43, 80, 133, 0.5) 100%);
Expand All @@ -114,7 +100,6 @@
box-sizing: border-box;
perspective: 1000px;
}

footer ul {
display: inline-block;
box-sizing: border-box;
Expand All @@ -124,7 +109,6 @@
position: relative;
width: 100%;
}

footer ul:before {
background: linear-gradient(to top, rgba(0,0,0, 0.25) 0%, #a2abb7 100%);
content: '';
Expand All @@ -137,7 +121,6 @@
height: 100%;
box-shadow: 1px 1px 10px 10px #333;
}

footer li {
display: inline-block;
vertical-align: top;
Expand All @@ -146,7 +129,6 @@
transform-origin: bottom center;
transition: transform 2s;
}

footer li:before {
background: rgba(0, 0, 0, 0.65);
border-radius: 12px;
Expand All @@ -170,18 +152,14 @@
box-sizing: border-box;
box-shadow: 1px 2px 6px #f0f8ffb8;
}


footer li:hover:before {
opacity: 1;
top: -38px;
visibility: visible;
}

.jump {
-webkit-animation: JUMP 600ms 2 cubic-bezier(0.4, 0.01, 0.6, 0.99);
}

footer img, footer .myicon {
width: 64px;
height: 64px;
Expand All @@ -197,11 +175,9 @@
transition: all 0.2s;
/* width: 4em; */
}

footer img:hover, footer i:hover {
transform: scale(1.2);
}

@-webkit-keyframes JUMP {
0% {
bottom: 0;
Expand All @@ -214,7 +190,6 @@
bottom: 0;
}
}

.myicon {
color: ivory;
background: #333;
Expand All @@ -224,7 +199,6 @@
box-sizing: border-box;
box-shadow: 1px 4px 10px #254a7d;
}

.nav-myframe {
text-decoration: none;
}
Expand Down Expand Up @@ -304,6 +278,7 @@
</div>
</div>
<script>
var resourcename = ""
// When the document is ready
$(document).ready(function () {
var iframe = $("#iframe")[0];
Expand All @@ -324,7 +299,10 @@
// Listens for NUI messages from Lua
window.addEventListener('message', function (event) {
var item = event.data;
if (item.showtab) {
if ( item.resourcename ) {
resourceName = item.resourcename;
}
else if (item.showtab) {
SHOW_HIDE(true)
} // lua requested show
else if (item.hidetab) {
Expand All @@ -336,7 +314,7 @@
document.addEventListener('keyup', function (data) {
if (data.which == 27) {
SHOW_HIDE(); // hide ui
$.post("http://tab/tablet-bus", JSON.stringify({
$.post('http://'+resourceName+'/tablet-bus', JSON.stringify({
hide: true
})) // tell lua to unfocus
}
Expand All @@ -346,7 +324,7 @@
$('.tab-wrap .dot').click(function () {
if (iframe.src == 'about:blank') {
SHOW_HIDE(); // hide ui
$.post("http://tab/tablet-bus", JSON.stringify({
$.post('http://'+resourceName+'/tablet-bus', JSON.stringify({
hide: true
})) // tell lua to unfocus
} else {
Expand All @@ -371,11 +349,11 @@
});

// Tell lua the nui loaded
$.post("http://tab/tablet-bus", JSON.stringify({
$.post('http://'+resourceName+'/tablet-bus', JSON.stringify({
load: true
}))
});
</script>
</body>

</html>
</html>