1"use strict"; 2 3/* The comments "global" and "exported" are JSHint directives used when we save the file */ 4 5// ---------- 6// expose our entire library of public methods in one go 7// ---------- 8rockstar.gui.add_screen("gui_helper_utils", function gui_helper_utils() { 9 10 // ---------- 11 // show alert popup without share icon 12 // ---------- 13 async function async_show_alert_popup_without_share_icon(alert_text, popup_title_text) { 14 15 let popup_title = "Notification"; 16 17 if (popup_title_text && popup_title_text !== "") { 18 19 popup_title = popup_title_text; 20 21 } 22 23 // create a new popup and 24 const alert_popup = rockstar.gui.popup.create(popup_title); 25 26 // create a alert cotainer 27 const alert_container = document.createElement("div"); 28 alert_container.classList.add("rs_normal_text"); 29 alert_container.style.margin = "auto"; 30 alert_container.style.textAlign = "center"; 31 alert_container.innerText = alert_text; 32 33 alert_popup.set_popup_content(alert_container); 34 alert_popup.set_extra_class_list(["rs_alert"]); 35 36 alert_popup.set_show_share_icon_if_available(false); 37 38 // rename cancel to ok 39 alert_popup.set_cancel_button_name("Ok"); 40 41 // show alert popup 42 await alert_popup.draw(); 43 44 } 45 46 // ---------- 47 // confirmation popup without share icon 48 // ---------- 49 function show_confirmation_popup_without_share_icon(message, title, margin_type) { 50 51 const confirmation_popup = rockstar.gui.popup.create(title || "Confirmation"); 52 53 // remove icon 54 confirmation_popup.set_show_share_icon_if_available(false); 55 56 // create confirmation text container 57 const confirm_text_container = document.createElement("div"); 58 confirm_text_container.className = "rs_normal_text"; 59 confirm_text_container.style = `text-align: center; ${margin_type || "margin-top: 20px;"}`; 60 61 // add confirmation message 62 confirm_text_container.innerText = message; 63 64 // add text container to popup 65 confirmation_popup.add_field("confirm_container", { 66 "type": "rs_container", 67 "value": confirm_text_container, 68 "hover_over": "" 69 }); 70 71 return confirmation_popup; 72 73 } 74 75 // ---------- 76 // return our public API 77 // ---------- 78 return { 79 "show_alert_popup_without_share_icon": async_show_alert_popup_without_share_icon, 80 "show_confirmation_popup_without_share_icon": show_confirmation_popup_without_share_icon 81 }; 82 83}());
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.