-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Jordan2139/master
feat: bundle pNotify
- Loading branch information
Showing
10 changed files
with
4,066 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
description "Simple Notification Script using https://notifyjs.com/" | ||
|
||
ui_page "html/index.html" | ||
|
||
client_script "cl_notify.lua" | ||
|
||
export "SetQueueMax" | ||
export "SendNotification" | ||
|
||
files { | ||
"html/index.html", | ||
"html/pNotify.js", | ||
"html/noty.js", | ||
"html/noty.css", | ||
"html/themes.css", | ||
"html/sound-example.wav" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
--[[ | ||
Complete List of Options: | ||
type | ||
layout | ||
theme | ||
text | ||
timeout | ||
progressBar | ||
closeWith | ||
animation = { | ||
open | ||
close | ||
} | ||
sounds = { | ||
volume | ||
conditions | ||
sources | ||
} | ||
docTitle = { | ||
conditions | ||
} | ||
modal | ||
id | ||
force | ||
queue | ||
killer | ||
container | ||
buttons | ||
More details below or visit the creators website http://ned.im/noty/options.html | ||
Layouts: | ||
top | ||
topLeft | ||
topCenter | ||
topRight | ||
center | ||
centerLeft | ||
centerRight | ||
bottom | ||
bottomLeft | ||
bottomCenter | ||
bottomRight | ||
Types: | ||
alert | ||
success | ||
error | ||
warning | ||
info | ||
Themes: -- You can create more themes inside html/themes.css, use the gta theme as a template. | ||
gta | ||
mint | ||
relax | ||
metroui | ||
Animations: | ||
open: | ||
noty_effects_open | ||
gta_effects_open | ||
gta_effects_open_left | ||
gta_effects_fade_in | ||
close: | ||
noty_effects_close | ||
gta_effects_close | ||
gta_effects_close_left | ||
gta_effects_fade_out | ||
closeWith: -- array, You will probably never use this. | ||
click | ||
button | ||
sounds: | ||
volume: 0.0 - 1.0 | ||
conditions: -- array | ||
docVisible | ||
docHidden | ||
sources: -- array of sound files | ||
modal: | ||
true | ||
false | ||
force: | ||
true | ||
false | ||
queue: -- default is global, you can make it what ever you want though. | ||
global | ||
killer: -- will close all visible notifications and show only this one | ||
true | ||
false | ||
visit the creators website http://ned.im/noty/options.html for more information | ||
--]] | ||
|
||
function SetQueueMax(queue, max) | ||
local tmp = { | ||
queue = tostring(queue), | ||
max = tonumber(max) | ||
} | ||
|
||
SendNUIMessage({maxNotifications = tmp}) | ||
end | ||
|
||
function SendNotification(options) | ||
options.animation = options.animation or {} | ||
options.sounds = options.sounds or {} | ||
options.docTitle = options.docTitle or {} | ||
|
||
local options = { | ||
type = options.type or "success", | ||
layout = options.layout or "topRight", | ||
theme = options.theme or "gta", | ||
text = options.text or "Empty Notification", | ||
timeout = options.timeout or 5000, | ||
progressBar = options.progressBar ~= false and true or false, | ||
closeWith = options.closeWith or {}, | ||
animation = { | ||
open = options.animation.open or "gta_effects_open", | ||
close = options.animation.close or "gta_effects_close" | ||
}, | ||
sounds = { | ||
volume = options.sounds.volume or 1, | ||
conditions = options.sounds.conditions or {}, | ||
sources = options.sounds.sources or {} | ||
}, | ||
docTitle = { | ||
conditions = options.docTitle.conditions or {} | ||
}, | ||
modal = options.modal or false, | ||
id = options.id or false, | ||
force = options.force or false, | ||
queue = options.queue or "global", | ||
killer = options.killer or false, | ||
container = options.container or false, | ||
buttons = options.button or false | ||
} | ||
|
||
SendNUIMessage({options = options}) | ||
end | ||
|
||
RegisterNetEvent("pNotify:SendNotification") | ||
AddEventHandler("pNotify:SendNotification", function(options) | ||
SendNotification(options) | ||
end) | ||
|
||
RegisterNetEvent("pNotify:SetQueueMax") | ||
AddEventHandler("pNotify:SetQueueMax", function(queue, max) | ||
SetQueueMax(queue, max) | ||
end) | ||
|
||
--[[RegisterNetEvent("chatMessage") | ||
AddEventHandler("chatMessage", function(author, color, text) | ||
TriggerEvent("pNotify:SendNotification", {text = "<span style='font-weight: 900'>" .. text .. "</span>", | ||
layout = "centerLeft", | ||
timeout = 2000, | ||
progressBar = false, | ||
type = "error", | ||
animation = { | ||
open = "gta_effects_fade_in", | ||
close = "gta_effects_fade_out" | ||
}}) | ||
end)]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>pNotify</title> | ||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script> | ||
<script src="pNotify.js" type="text/javascript"></script> | ||
<link href="noty.css" rel="stylesheet"></script> | ||
<link href="themes.css" rel="stylesheet"></script> | ||
<script src="noty.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
</body> | ||
</html> |
Oops, something went wrong.