diff --git a/Penty/App.py b/Penty/App.py new file mode 100644 index 00000000..89b44199 --- /dev/null +++ b/Penty/App.py @@ -0,0 +1,218 @@ + +#!/usr/bin/env python + +#imports +import eel +import wolframalpha +import wikipedia +import pyshorteners.shorteners.tinyurl +import speedtest +import time +import socket +import os +import platform +import webbrowser +import smtplib +import ctypes +import linecache +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText +from win10toast import ToastNotifier +from getmac import getmac +import pyjokes + + +# Useful when packaging Penty into an exe, since --noconsole in pyinstaller returns an error for some reason. +def hideConsole(): + whnd = ctypes.windll.kernel32.GetConsoleWindow() + if whnd != 0: + ctypes.windll.user32.ShowWindow(whnd, 0) +hideConsole() + +eel.init('web') # Initialize the 'web' folder where frontend and js is stored. + +# Wolfram Alpha module +@eel.expose +def wlfrm(userinputglobal): + client = wolframalpha.Client('34U93P-WGR36VG7WE') # Add your wolfram Alpha App ID Key here + res = client.query(userinputglobal) + answer = (next(res.results).text) + return answer + +# Wikipedia Module +@eel.expose +def wikiped(userinputglobal): + answer = wikipedia.summary(userinputglobal, sentences=1) + return answer + +# Mailer (Passcode and Username is stored at web/mail_creds.text) +@eel.expose +def email(RECV_ID, CONTENT): + mainErrorMsg = "Something went wrong.." + try: + if CONTENT != '': + MAIL_ID = linecache.getline(r"web/mreds.txt", 1) + PASS = linecache.getline(r"web/mreds.txt", 2) + server = smtplib.SMTP("smtp.gmail.com", 587) + server.starttls() + server.login(MAIL_ID, PASS) + server.sendmail( MAIL_ID, RECV_ID, CONTENT) + return f"Sending mail to {RECV_ID}" + else: + return 'Cancelled mail successfully.' + linecache.clearcache() + except (smtplib.SMTPAuthenticationError): + return f"{mainErrorMsg} \n Please enter your credentials at mail settings." + except (smtplib.SMTPRecipientsRefused): + return f"{mainErrorMsg} \n Please enter a valid recipient address." + except (smtplib.SMTPConnectError): + return f"{mainErrorMsg} \n Please establish a network connection." + except: + return f"{mainErrorMsg}" + +# Returns some platform specs +@eel.expose +def platforminfo(): + return f"System: {platform.system()} \n Processor: {platform.processor()} \n Architecture: {platform.architecture()} \n Version: {platform.version()} \n Release: {platform.release()}" + +# Quick Browser Module +@eel.expose +def browser(link): + link_one = f'https://{link}' + link_suffixes = ['.com', '.org', '.in', '.be'] + for suffix in link_suffixes: + if suffix in link and ' ' not in link: + return webbrowser.open(link_one, new=0, autoraise=True) + link = link.replace(' ', '+') + link_two = f"https://www.google.com/search?-b-d&q={link}" + return webbrowser.open(link_two, new=0, autoraise=True) + +# A small 'about Pent' Screen +@eel.expose +def about(): + return "Pent is a Desktop Assistant aimed at helping your workflow. It is fast and reliable. Moreover, it does not use any private user data. It uses the Chrome browser (if available), or the windows pre-installed Edge browser. Developed by github.com/JeswinSunsi, with an Idea by repl.com/@SavioXavier." + +# Displays the Lan IP +@eel.expose +def ipaddress(): + hostname = socket.gethostname() + addip = socket.gethostbyname(hostname) + return f"IP Address : {addip}" + +# Displays the MAC Address +@eel.expose +def macaddress(): + addmac = getmac.get_mac_address() + return f"MAC Address : {addmac}" + +# A joke to lighten the mood +def sayJoke(): + return pyjokes.get_joke() + +# Toast Reminder +@eel.expose +def reminder(): + remind = ToastNotifier() + if "set reminder" in userinputglobal: + remind_text = userinputglobal.replace('set reminder', "") + elif "reminder" in userinputglobal: + remind_text = userinputglobal.replace('reminder', "") + elif "remind" in userinputglobal: + remind_text = userinputglobal.replace("remind", "") + timefactor = 0 + for infactor in remind_text.split(): + if infactor.isdigit(): + timefactor = int(infactor) + #print (timefactor) [For Devt Only] + if timefactor == 0: + eel.sleep(2) + return "Please set a duration." + remind_text = remind_text.replace(infactor, "") + remind_text = remind_text.replace("after", "") + eel.sleep(timefactor) + retvalue = remind.show_toast("Reminder", remind_text, icon_path='fav.ico', duration = 20) + return remind_text + return retvalue + +# Quick Restart +@eel.expose +def restrt(): + restart = os.system("shutdown /r /t 1") + return restart + +# Checks the download speed +@eel.expose +def downloadcheck(): + maintest = speedtest.Speedtest() + download = maintest.download() + download = int(download) / 1048576 + download = round(download, 3) + full_answer = f"Download speed: {download}Mbps" + return full_answer + +# Quick Complex Math Evaluator +@eel.expose +def complexMath(question): + actualQuestion = question.replace(' ', '+') + actualQuestion = actualQuestion.replace('eval', '') + link = f'https://www.wolframalpha.com/input/?i={actualQuestion}' + return webbrowser.open(link, new=0, autoraise=True) + +# Checks the upload speed +@eel.expose +def uploadcheck(): + maintest = speedtest.Speedtest() + upload = maintest.upload() + upload = int(upload) / 1048576 + upload = round(upload, 3) + full_answer = f"Upload speed: {upload}Mbps" + return full_answer + +# Function to change email username and passcode +@eel.expose +def emailSettings(email, passcode): + with open('web/mreds.txt', 'r') as emailAndPass: + data = emailAndPass.readlines() + if email != '' and passcode != '': + data[0] = f'{email} \n' + data[1] = passcode + + with open('web/mreds.txt', 'w') as emailAndPass: + emailAndPass.writelines(data) + +# The logic that connects it with the user io. +@eel.expose +def mainBackend(userinput): + global userinputglobal + userinputglobal = userinput.lower() + #functions + try: + if "download speed" in userinputglobal[0:14] or "download" in userinputglobal[0:8]: + return downloadcheck() + elif "joke" in userinputglobal[0:4] or "say joke" in userinputglobal[0:8] or "say a joke" in userinputglobal[0:10]: + return sayJoke() + elif 'eval' in userinputglobal[0:4] or 'evaluate' in userinputglobal[0:8]: + return complexMath(userinputglobal) + elif "about" in userinputglobal[0:6] or "abt" in userinputglobal[0:4]: + return about() + elif "upload speed" in userinputglobal[0:13] or "upload" in userinputglobal[0:6]: + return uploadcheck() + elif "restart" in userinputglobal[0:7] or "restrt" in userinputglobal[0:6]: + return restrt() + elif "remind" in userinputglobal[0:6] or "set reminder" in userinputglobal[0:12] or "reminder" in userinputglobal[0:8]: + return reminder() + elif "ip" in userinputglobal[0:2] or "ip address" in userinputglobal[0:10]: + return ipaddress() + elif "mac" in userinputglobal[0:3] or "mac address" in userinputglobal[0:11]: + return macaddress() + elif 'system' in userinputglobal: + return platforminfo() + else: + try: + return wlfrm(userinputglobal) + except: + return wikiped(userinputglobal) + except: + return "Something went wrong.." + +eel.start('main.html', size = (471, 220)) diff --git a/Penty/web/Media/BgBrowser.png b/Penty/web/Media/BgBrowser.png new file mode 100644 index 00000000..3108d735 Binary files /dev/null and b/Penty/web/Media/BgBrowser.png differ diff --git a/Penty/web/Media/BgEmail.png b/Penty/web/Media/BgEmail.png new file mode 100644 index 00000000..85e968ba Binary files /dev/null and b/Penty/web/Media/BgEmail.png differ diff --git a/Penty/web/Media/BgImageOrg.jpg b/Penty/web/Media/BgImageOrg.jpg new file mode 100644 index 00000000..0ea1f0dc Binary files /dev/null and b/Penty/web/Media/BgImageOrg.jpg differ diff --git a/Penty/web/Media/BgMailSettings.png b/Penty/web/Media/BgMailSettings.png new file mode 100644 index 00000000..2fcfbc9e Binary files /dev/null and b/Penty/web/Media/BgMailSettings.png differ diff --git a/Penty/web/Media/BgSettings.png b/Penty/web/Media/BgSettings.png new file mode 100644 index 00000000..d54367d2 Binary files /dev/null and b/Penty/web/Media/BgSettings.png differ diff --git a/Penty/web/Media/Bgimage.png b/Penty/web/Media/Bgimage.png new file mode 100644 index 00000000..978d16f1 Binary files /dev/null and b/Penty/web/Media/Bgimage.png differ diff --git a/Penty/web/Media/Icnavirus.svg b/Penty/web/Media/Icnavirus.svg new file mode 100644 index 00000000..ad3f5528 --- /dev/null +++ b/Penty/web/Media/Icnavirus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnback.png b/Penty/web/Media/Icnback.png new file mode 100644 index 00000000..b2f3497f Binary files /dev/null and b/Penty/web/Media/Icnback.png differ diff --git a/Penty/web/Media/Icnback.svg b/Penty/web/Media/Icnback.svg new file mode 100644 index 00000000..8c5e594d --- /dev/null +++ b/Penty/web/Media/Icnback.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnenter.svg b/Penty/web/Media/Icnenter.svg new file mode 100644 index 00000000..a6cd8630 --- /dev/null +++ b/Penty/web/Media/Icnenter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icngames.svg b/Penty/web/Media/Icngames.svg new file mode 100644 index 00000000..346b001c --- /dev/null +++ b/Penty/web/Media/Icngames.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Penty/web/Media/Icnmail.svg b/Penty/web/Media/Icnmail.svg new file mode 100644 index 00000000..8c76ed37 --- /dev/null +++ b/Penty/web/Media/Icnmail.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnmore.svg b/Penty/web/Media/Icnmore.svg new file mode 100644 index 00000000..cfeb5898 --- /dev/null +++ b/Penty/web/Media/Icnmore.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnsearch.svg b/Penty/web/Media/Icnsearch.svg new file mode 100644 index 00000000..6aa8471e --- /dev/null +++ b/Penty/web/Media/Icnsearch.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnsend.svg b/Penty/web/Media/Icnsend.svg new file mode 100644 index 00000000..6f3a06d0 --- /dev/null +++ b/Penty/web/Media/Icnsend.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnsettings.svg b/Penty/web/Media/Icnsettings.svg new file mode 100644 index 00000000..d676b178 --- /dev/null +++ b/Penty/web/Media/Icnsettings.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Penty/web/Media/Icnweb.svg b/Penty/web/Media/Icnweb.svg new file mode 100644 index 00000000..4025e220 --- /dev/null +++ b/Penty/web/Media/Icnweb.svg @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Penty/web/browser.html b/Penty/web/browser.html new file mode 100644 index 00000000..b8b913ab --- /dev/null +++ b/Penty/web/browser.html @@ -0,0 +1,73 @@ + + + + + + + + + PENTY + + + + + + + + + + + + diff --git a/Penty/web/emailer.html b/Penty/web/emailer.html new file mode 100644 index 00000000..41aa80df --- /dev/null +++ b/Penty/web/emailer.html @@ -0,0 +1,78 @@ + + + + + + + + PENTY + + + + + + + + + + + + diff --git a/Penty/web/main.css b/Penty/web/main.css new file mode 100644 index 00000000..141c6060 --- /dev/null +++ b/Penty/web/main.css @@ -0,0 +1,69 @@ +body +{ + background-image: url('Media/BgImage.png'); + background-repeat: no-repeat; + overflow: hidden; + background-size: cover; +} + +input[type=text] +{ + border: none; + background: transparent; + width: 50%; + color: black; + font-size: 16px; + margin-left: 3px; + font-family: 'B612', sans-serif; + margin-top: -1px; + margin-left: 8px; +} + +input[type=text]:focus +{ + outline: none; +} + +input[type=image] +{ + outline: none; + border: none; + height: 40px; + width: 40px; + position:relative; + margin-top: -11px; + margin-left: 36px; +} + +input[type=image]:active +{ + transform: translateX(2px); +} + +.inputTag +{ + margin-left: 10px; + float: left; +} + +#web +{ + margin-top: 39px; + margin-left: -294px; + width: 35px; + height: 36px; +} + +#about +{ + bottom: -54px; + left: -241px; +} + +#settings +{ + bottom: -58px; + right: 77px; + width: 43px; + height: 52px; +} diff --git a/Penty/web/main.html b/Penty/web/main.html new file mode 100644 index 00000000..59314ea6 --- /dev/null +++ b/Penty/web/main.html @@ -0,0 +1,26 @@ + + + + + + + + PENTY + + + + + + + + + +

+ + + + + + + + diff --git a/Penty/web/main.js b/Penty/web/main.js new file mode 100644 index 00000000..d844f35e --- /dev/null +++ b/Penty/web/main.js @@ -0,0 +1,31 @@ +async function answer() { + var quest = document.getElementById("data").value + swagAlert({ + title: "Penty", + text: "Searching.."}); + var val = await eel.mainBackend(quest)(); + swagAlert({ + title: "Penty", + text: val}); +} + +async function systemInfo() { + var val = await eel.platforminfo()(); + swagAlert({ + title: "Penty", + text: val}); +} + +window.addEventListener("resize", function(){ +window.resizeTo(471, 220); +}); + +window.onload=function(){ + var input = document.getElementById("data"); + input.addEventListener("keyup", function(event) { + if (event.keyCode === 13) { + event.preventDefault(); + document.getElementById("enterButton").click(); + } + }); +} diff --git a/Penty/web/mreds.txt b/Penty/web/mreds.txt new file mode 100644 index 00000000..71849a88 --- /dev/null +++ b/Penty/web/mreds.txt @@ -0,0 +1,2 @@ +wels +wels \ No newline at end of file diff --git a/Penty/web/settings.html b/Penty/web/settings.html new file mode 100644 index 00000000..6cf9c4e3 --- /dev/null +++ b/Penty/web/settings.html @@ -0,0 +1,110 @@ + + + + + + + + PENTY + + + + + + + + + + + + + + + diff --git a/Penty/web/swag-alert.css b/Penty/web/swag-alert.css new file mode 100644 index 00000000..18988d6b --- /dev/null +++ b/Penty/web/swag-alert.css @@ -0,0 +1,596 @@ +@import url(//fonts.googleapis.com/css?family=Open+Sans:400,600,700,300); +.sweet-overlay { + background-color: rgba(0, 0, 0, 0.4); + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + display: none; + z-index: 1000; } + +.sweet-alert { + background-color: white; + font-family: 'Open Sans', sans-serif; + width: 425px; + height: 150px; + padding: 5px; + border-radius: 5px; + text-align: center; + position: fixed; + top: 50%; + margin-top: -200px; + overflow: auto; + display: none; + z-index: 2000; } + + .sweet-alert h2 { + color: #575757; + font-size: 20px; + text-align: center; + font-weight: 550; + text-transform: none; + position: relative; + padding: 0; + line-height: 5px; + display: block; } + .sweet-alert p { + color: black; + font-size: 16px; + text-align: center; + font-weight: 450px; + position: relative; + margin: 0; + padding: 0; + line-height: normal; } + .sweet-alert button { + background-color: #AEDEF4; + color: white; + border: none; + box-shadow: none; + font-size: 17px; + font-weight: 500; + border-radius: 5px; + padding: 10px 32px; + margin: 26px 5px 0 5px; + cursor: pointer; } + .sweet-alert button:focus { + outline: none; + box-shadow: 0 0 2px rgb(102, 204, 255), inset 0 0 0 1px rgba(0, 0, 0, 0.05); } + .sweet-alert button:hover { + background-color: #0099CC; } + .sweet-alert button:active { + background-color: #003399; } + .sweet-alert button.cancel { + background-color: #D0D0D0; } + .sweet-alert button.cancel:hover { + background-color: #c8c8c8; } + .sweet-alert button.cancel:active { + background-color: #b6b6b6; } + .sweet-alert button.cancel:focus { + box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important; } + .sweet-alert button::-moz-focus-inner { + border: 0; } + .sweet-alert[data-has-cancel-button=false] button { + box-shadow: none !important; } + .sweet-alert .icon { + width: 80px; + height: 80px; + border: 4px solid gray; + border-radius: 50%; + margin: 20px auto; + padding: 0; + position: relative; + box-sizing: content-box; } + .sweet-alert .icon.error { + border-color: #F27474; } + .sweet-alert .icon.error .x-mark { + position: relative; + display: block; } + .sweet-alert .icon.error .line { + position: absolute; + height: 5px; + width: 47px; + background-color: #F27474; + display: block; + top: 37px; + border-radius: 2px; } + .sweet-alert .icon.error .line.left { + -webkit-transform: rotate(45deg); + transform: rotate(45deg); + left: 17px; } + .sweet-alert .icon.error .line.right { + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + right: 16px; } + .sweet-alert .icon.warning { + border-color: #F8BB86; } + .sweet-alert .icon.warning .body { + position: absolute; + width: 5px; + height: 47px; + left: 50%; + top: 10px; + border-radius: 2px; + margin-left: -2px; + background-color: #F8BB86; } + .sweet-alert .icon.warning .dot { + position: absolute; + width: 7px; + height: 7px; + border-radius: 50%; + margin-left: -3px; + left: 50%; + bottom: 10px; + background-color: #F8BB86; } + .sweet-alert .icon.info { + border-color: #C9DAE1; } + .sweet-alert .icon.info::before { + content: ""; + position: absolute; + width: 5px; + height: 29px; + left: 50%; + bottom: 17px; + border-radius: 2px; + margin-left: -2px; + background-color: #C9DAE1; } + .sweet-alert .icon.info::after { + content: ""; + position: absolute; + width: 7px; + height: 7px; + border-radius: 50%; + margin-left: -3px; + top: 19px; + background-color: #C9DAE1; } + .sweet-alert .icon.success { + border-color: #A5DC86; } + .sweet-alert .icon.success::before, .sweet-alert .icon.success::after { + content: ''; + border-radius: 50%; + position: absolute; + width: 60px; + height: 120px; + background: white; + -webkit-transform: rotate(45deg); + transform: rotate(45deg); } + .sweet-alert .icon.success::before { + border-radius: 120px 0 0 120px; + top: -7px; + left: -33px; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + -webkit-transform-origin: 60px 60px; + transform-origin: 60px 60px; } + .sweet-alert .icon.success::after { + border-radius: 0 120px 120px 0; + top: -11px; + left: 30px; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); + -webkit-transform-origin: 0px 60px; + transform-origin: 0px 60px; } + .sweet-alert .icon.success .placeholder { + width: 80px; + height: 80px; + border: 4px solid rgba(165, 220, 134, 0.2); + border-radius: 50%; + box-sizing: content-box; + position: absolute; + left: -4px; + top: -4px; + z-index: 2; } + .sweet-alert .icon.success .fix { + width: 5px; + height: 90px; + background-color: white; + position: absolute; + left: 28px; + top: 8px; + z-index: 1; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); } + .sweet-alert .icon.success .line { + height: 5px; + background-color: #A5DC86; + display: block; + border-radius: 2px; + position: absolute; + z-index: 2; } + .sweet-alert .icon.success .line.tip { + width: 25px; + left: 14px; + top: 46px; + -webkit-transform: rotate(45deg); + transform: rotate(45deg); } + .sweet-alert .icon.success .line.long { + width: 47px; + right: 8px; + top: 38px; + -webkit-transform: rotate(-45deg); + transform: rotate(-45deg); } + .sweet-alert .icon.custom { + background-size: contain; + border-radius: 0; + border: none; + background-position: center center; + background-repeat: no-repeat; } + +/* + * Animations + */ +@-webkit-keyframes showSweetAlert { + 0% { + transform: scale(0.7); + -webkit-transform: scale(0.7); } + 45% { + transform: scale(1.05); + -webkit-transform: scale(1.05); } + 80% { + transform: scale(0.95); + -webkit-tranform: scale(0.95); } + 100% { + transform: scale(1); + -webkit-transform: scale(1); } } +@-moz-keyframes showSweetAlert { + 0% { + transform: scale(0.7); + -webkit-transform: scale(0.7); } + 45% { + transform: scale(1.05); + -webkit-transform: scale(1.05); } + 80% { + transform: scale(0.95); + -webkit-tranform: scale(0.95); } + 100% { + transform: scale(1); + -webkit-transform: scale(1); } } +@keyframes showSweetAlert { + 0% { + transform: scale(0.7); + -webkit-transform: scale(0.7); } + 45% { + transform: scale(1.05); + -webkit-transform: scale(1.05); } + 80% { + transform: scale(0.95); + -webkit-tranform: scale(0.95); } + 100% { + transform: scale(1); + -webkit-transform: scale(1); } } +@-webkit-keyframes hideSweetAlert { + 0% { + transform: scale(1); + -webkit-transform: scale(1); } + 100% { + transform: scale(0.5); + -webkit-transform: scale(0.5); } } +@-moz-keyframes hideSweetAlert { + 0% { + transform: scale(1); + -webkit-transform: scale(1); } + 100% { + transform: scale(0.5); + -webkit-transform: scale(0.5); } } +@keyframes hideSweetAlert { + 0% { + transform: scale(1); + -webkit-transform: scale(1); } + 100% { + transform: scale(0.5); + -webkit-transform: scale(0.5); } } +.showSweetAlert { + -webkit-animation: showSweetAlert 0.3s; + -moz-animation: showSweetAlert 0.3s; + animation: showSweetAlert 0.3s; } + +.hideSweetAlert { + -webkit-animation: hideSweetAlert 0.2s; + -moz-animation: hideSweetAlert 0.2s; + animation: hideSweetAlert 0.2s; } + +@-webkit-keyframes animateSuccessTip { + 0% { + width: 0; + left: 1px; + top: 19px; } + 54% { + width: 0; + left: 1px; + top: 19px; } + 70% { + width: 50px; + left: -8px; + top: 37px; } + 84% { + width: 17px; + left: 21px; + top: 48px; } + 100% { + width: 25px; + left: 14px; + top: 45px; } } +@-moz-keyframes animateSuccessTip { + 0% { + width: 0; + left: 1px; + top: 19px; } + 54% { + width: 0; + left: 1px; + top: 19px; } + 70% { + width: 50px; + left: -8px; + top: 37px; } + 84% { + width: 17px; + left: 21px; + top: 48px; } + 100% { + width: 25px; + left: 14px; + top: 45px; } } +@keyframes animateSuccessTip { + 0% { + width: 0; + left: 1px; + top: 19px; } + 54% { + width: 0; + left: 1px; + top: 19px; } + 70% { + width: 50px; + left: -8px; + top: 37px; } + 84% { + width: 17px; + left: 21px; + top: 48px; } + 100% { + width: 25px; + left: 14px; + top: 45px; } } +@-webkit-keyframes animateSuccessLong { + 0% { + width: 0; + right: 46px; + top: 54px; } + 65% { + width: 0; + right: 46px; + top: 54px; } + 84% { + width: 55px; + right: 0px; + top: 35px; } + 100% { + width: 47px; + right: 8px; + top: 38px; } } +@-moz-keyframes animateSuccessLong { + 0% { + width: 0; + right: 46px; + top: 54px; } + 65% { + width: 0; + right: 46px; + top: 54px; } + 84% { + width: 55px; + right: 0px; + top: 35px; } + 100% { + width: 47px; + right: 8px; + top: 38px; } } +@keyframes animateSuccessLong { + 0% { + width: 0; + right: 46px; + top: 54px; } + 65% { + width: 0; + right: 46px; + top: 54px; } + 84% { + width: 55px; + right: 0px; + top: 35px; } + 100% { + width: 47px; + right: 8px; + top: 38px; } } +@-webkit-keyframes rotatePlaceholder { + 0% { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); } + 5% { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); } + 12% { + transform: rotate(-405deg); + -webkit-transform: rotate(-405deg); } + 100% { + transform: rotate(-405deg); + -webkit-transform: rotate(-405deg); } } +@-moz-keyframes rotatePlaceholder { + 0% { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); } + 5% { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); } + 12% { + transform: rotate(-405deg); + -webkit-transform: rotate(-405deg); } + 100% { + transform: rotate(-405deg); + -webkit-transform: rotate(-405deg); } } +@keyframes rotatePlaceholder { + 0% { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); } + 5% { + transform: rotate(-45deg); + -webkit-transform: rotate(-45deg); } + 12% { + transform: rotate(-405deg); + -webkit-transform: rotate(-405deg); } + 100% { + transform: rotate(-405deg); + -webkit-transform: rotate(-405deg); } } +.animateSuccessTip { + -webkit-animation: animateSuccessTip 0.75s; + -moz-animation: animateSuccessTip 0.75s; + animation: animateSuccessTip 0.75s; } + +.animateSuccessLong { + -webkit-animation: animateSuccessLong 0.75s; + -moz-animation: animateSuccessLong 0.75s; + animation: animateSuccessLong 0.75s; } + +.icon.success.animate::after { + -webkit-animation: rotatePlaceholder 4.25s ease-in; + -moz-animation: rotatePlaceholder 4.25s ease-in; + animation: rotatePlaceholder 4.25s ease-in; } + +@-webkit-keyframes animateErrorIcon { + 0% { + transform: rotateX(100deg); + -webkit-transform: rotateX(100deg); + opacity: 0; } + 100% { + transform: rotateX(0deg); + -webkit-transform: rotateX(0deg); + opacity: 1; } } +@-moz-keyframes animateErrorIcon { + 0% { + transform: rotateX(100deg); + -webkit-transform: rotateX(100deg); + opacity: 0; } + 100% { + transform: rotateX(0deg); + -webkit-transform: rotateX(0deg); + opacity: 1; } } +@keyframes animateErrorIcon { + 0% { + transform: rotateX(100deg); + -webkit-transform: rotateX(100deg); + opacity: 0; } + 100% { + transform: rotateX(0deg); + -webkit-transform: rotateX(0deg); + opacity: 1; } } +.animateErrorIcon { + -webkit-animation: animateErrorIcon 0.5s; + -moz-animation: animateErrorIcon 0.5s; + animation: animateErrorIcon 0.5s; } + +@-webkit-keyframes animateXMark { + 0% { + transform: scale(0.4); + -webkit-transform: scale(0.4); + margin-top: 26px; + opacity: 0; } + 50% { + transform: scale(0.4); + -webkit-transform: scale(0.4); + margin-top: 26px; + opacity: 0; } + 80% { + transform: scale(1.15); + -webkit-transform: scale(1.15); + margin-top: -6px; } + 100% { + transform: scale(1); + -webkit-transform: scale(1); + margin-top: 0; + opacity: 1; } } +@-moz-keyframes animateXMark { + 0% { + transform: scale(0.4); + -webkit-transform: scale(0.4); + margin-top: 26px; + opacity: 0; } + 50% { + transform: scale(0.4); + -webkit-transform: scale(0.4); + margin-top: 26px; + opacity: 0; } + 80% { + transform: scale(1.15); + -webkit-transform: scale(1.15); + margin-top: -6px; } + 100% { + transform: scale(1); + -webkit-transform: scale(1); + margin-top: 0; + opacity: 1; } } +@keyframes animateXMark { + 0% { + transform: scale(0.4); + -webkit-transform: scale(0.4); + margin-top: 26px; + opacity: 0; } + 50% { + transform: scale(0.4); + -webkit-transform: scale(0.4); + margin-top: 26px; + opacity: 0; } + 80% { + transform: scale(1.15); + -webkit-transform: scale(1.15); + margin-top: -6px; } + 100% { + transform: scale(1); + -webkit-transform: scale(1); + margin-top: 0; + opacity: 1; } } +.animateXMark { + -webkit-animation: animateXMark 0.5s; + -moz-animation: animateXMark 0.5s; + animation: animateXMark 0.5s; } + +@-webkit-keyframes pulseWarning { + 0% { + border-color: #F8D486; } + 100% { + border-color: #F8BB86; } } +@-moz-keyframes pulseWarning { + 0% { + border-color: #F8D486; } + 100% { + border-color: #F8BB86; } } +@keyframes pulseWarning { + 0% { + border-color: #F8D486; } + 100% { + border-color: #F8BB86; } } +.pulseWarning { + -webkit-animation: pulseWarning 0.75s infinite alternate; + -moz-animation: pulseWarning 0.75s infinite alternate; + animation: pulseWarning 0.75s infinite alternate; } + +@-webkit-keyframes pulseWarningIns { + 0% { + background-color: #F8D486; } + 100% { + background-color: #F8BB86; } } +@-moz-keyframes pulseWarningIns { + 0% { + background-color: #F8D486; } + 100% { + background-color: #F8BB86; } } +@keyframes pulseWarningIns { + 0% { + background-color: #F8D486; } + 100% { + background-color: #F8BB86; } } +.pulseWarningIns { + -webkit-animation: pulseWarningIns 0.75s infinite alternate; + -moz-animation: pulseWarningIns 0.75s infinite alternate; + animation: pulseWarningIns 0.75s infinite alternate; } diff --git a/Penty/web/swag-alert.min.js b/Penty/web/swag-alert.min.js new file mode 100644 index 00000000..b6287338 --- /dev/null +++ b/Penty/web/swag-alert.min.js @@ -0,0 +1 @@ +!function(e,t){function n(t){var n=y(),o=n.querySelector("h2"),r=n.querySelector("p"),a=n.querySelector("button.cancel"),c=n.querySelector("button.confirm");if(o.innerHTML=w(t.title).split("\n").join("
"),r.innerHTML=w(t.text||"").split("\n").join("
"),t.text&&S(r),C(n.querySelectorAll(".icon")),t.type){for(var l=!1,s=0;sr;r++)o=parseInt(e.substr(2*r,2),16),o=Math.round(Math.min(Math.max(0,o+o*t),255)).toString(16),n+=("00"+o).substr(o.length);return n}function r(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function a(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16):null}function i(e,t){var n=a(t);e.style.boxShadow="0 0 2px rgba("+n+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"}function c(){var e=y();T(p(),10),S(e),v(e,"showSweetAlert"),b(e,"hideSweetAlert"),I=t.activeElement;var n=e.querySelector("button.confirm");n.focus(),setTimeout(function(){v(e,"visible")},500);var o=e.getAttribute("data-timer");"null"!==o&&""!==o&&(e.timeout=setTimeout(function(){l()},o))}function l(){var n=y();E(p(),5),E(n,5),b(n,"showSweetAlert"),v(n,"hideSweetAlert"),b(n,"visible");var o=n.querySelector(".icon.success");b(o,"animate"),b(o.querySelector(".tip"),"animateSuccessTip"),b(o.querySelector(".long"),"animateSuccessLong");var r=n.querySelector(".icon.error");b(r,"animateErrorIcon"),b(r.querySelector(".x-mark"),"animateXMark");var a=n.querySelector(".icon.warning");b(a,"pulseWarning"),b(a.querySelector(".body"),"pulseWarningIns"),b(a.querySelector(".dot"),"pulseWarningIns"),e.onkeydown=M,t.onclick=A,I&&I.focus(),z=void 0,clearTimeout(n.timeout)}function s(){var e=y();e.style.marginTop=B(y())}var u=".sweet-alert",f=".sweet-overlay",d=["error","warning","info","success"],m={title:"",text:"",type:null,allowOutsideClick:!1,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#AEDEF4",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null},y=function(){return t.querySelector(u)},p=function(){return t.querySelector(f)},g=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},v=function(e,t){g(e,t)||(e.className+=" "+t)},b=function(e,t){var n=" "+e.className.replace(/[\t\r\n]/g," ")+" ";if(g(e,t)){for(;n.indexOf(" "+t+" ")>=0;)n=n.replace(" "+t+" "," ");e.className=n.replace(/^\s+|\s+$/g,"")}},w=function(e){var n=t.createElement("div");return n.appendChild(t.createTextNode(e)),n.innerHTML},h=function(e){e.style.opacity="",e.style.display="block"},S=function(e){if(e&&!e.length)return h(e);for(var t=0;t0?setTimeout(o,t):e.style.display="none"};o()},q=function(n){if(MouseEvent){var o=new MouseEvent("click",{view:e,bubbles:!1,cancelable:!0});n.dispatchEvent(o)}else if(t.createEvent){var r=t.createEvent("MouseEvents");r.initEvent("click",!1,!1),n.dispatchEvent(r)}else t.createEventObject?n.fireEvent("onclick"):"function"==typeof n.onclick&&n.onclick()},O=function(t){"function"==typeof t.stopPropagation?(t.stopPropagation(),t.preventDefault()):e.event&&e.event.hasOwnProperty("cancelBubble")&&(e.event.cancelBubble=!0)},I,A,M,z;e.sweetAlertInitialize=function(){var e='

Title

Text

',n=t.createElement("div");n.innerHTML=e,t.body.appendChild(n)},e.swagAlert=e.swal=function(){function a(t){var n=t||e.event,o=n.keyCode||n.which;if(-1!==[9,13,32,27].indexOf(o)){for(var r=n.target||n.srcElement,a=-1,c=0;c