[RELEASE] Simple Tablet (for CADs and other iframes)

Click the background that is outside the iPad, then press ESC.

1 Like

I changed the url for my community’s cad but it’s just the tablet’s border nothing else.

2 Likes

image

“Allow all iframes” - if its a bubble cad

3 Likes

Is it possible to add this to esx_police or make this compatible with the police menu somehow?

1 Like

Does this work with the bubble cad?

1 Like

Is there anyway to add a close button, I tried adding <button onclick="self.close()">Close</button> but no luck

1 Like

I will try this tonight thank you.

1 Like

It will work a Bubble CAD, just make sure you enable “Allow all iframes” in the Settings page when in Edit Mode

2 Likes

I meant to say Rocket Cad. Lmao.

You can add a html element which triggers the JS function to disable the NUI on click

Something like this?

document.addEventListener('click', () => {
  window.close("https://cad.mastaterp.com");
}, { once: true });

document.addEventListener('click', () => {
  $.post('http://mdt0.5/NUIFocusOff', JSON.stringify({}));
}, { once: true });

Something like this would work, I believe. It’s a cool idea, a button to close it like a home button on the bottom of the CAD. Might update this sometime.

I added

<button type="button" onclick="<buttondocument.addEventListener('click', () => { $.post('http://mdt0.5/NUIFocusOff', JSON.stringify({})); }, { once: true });">Close</button> But for some reason it doesnt work. If anyone sees any issue with the element, let me know please.

Here you go :smiley:

  <button onclick="CloseCAD()"type="button">Close CAD</button>
 <script> 
 function CloseCAD() {
$.post('http://mdt0.5/NUIFocusOff', JSON.stringify({}));
 }
  </script>

Whacky indentation for some reason.

Thank you for the idea for closing the CAD on button press, this was really designed for iframes so I never thought of something like this.

Thanks my man, great release! Keep up the good work

1 Like

@Matthew5

I just added it to index.html file, and it doesnt work after inputing that code into the file. The button in game is showing but not working.

1 Like

Just for other people reading: that code was not intended as a copy paste permanent measure, its just to get the idea of how you do it across

Your file looks like this?

how do i setup a cad?

Editted

We used the other tablet for a while but hated how it would not save session and would take us back off patrol anytime we closed it. I was looking for other things and discovered this. Had it in game for all of an hour now and have been getting a TON of positive feedback from our LEO and Fire/EMS (haven’t announced it for CIVs yet as we wanted to test it first). I do have one question though. I know we have some resources that we want to do 2 functions so we make a copy of the resource and change the name and commands. I was wondering if that is feasible on here as well. We have a page on our site for our penal code for LEO to access when they need to jail someone so they can find the times.

I looked over the code a little and wondered if it would be possible to change the resource name to something like “penal”, change the command in the code, and also change where it references the mdt0.5 link for closing it in all the files that reference that closing link, would this work to run as a separate resource or will it just completely break?

1 Like