Topalian Python JavaScript Navigator by Christopher Topalian
Topalian Python JavaScript Navigator by Christopher Topalian
Python
JavaScript
Navigator
by
Christopher Andrew Topalian
All Rights Reserved
Copyright 2000-2024
Dedicated
to
God the Father
# Dedicated to God the Father
# All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
# https://github.com/ChristopherTopalian
#
https://github.com/ChristopherAndrewTopalia
n
# Topalian_Python_JavaScript_Navigator.pyw
# Version 001 - (2024-06-13)
import webview
import base64
##
# Our JS is imported below
with open("js/date/getDayOfWeekNameJS.js",
"r") as file:
getDayOfWeekNameJS = file.read()
with
open("js/date/getDayOfWeekNumber7JS.js",
"r") as file:
getDayOfWeekNumber7JS = file.read()
with
open("js/date/getDayOfWeekNumberJS.js",
"r") as file:
getDayOfWeekNumberJS = file.read()
with open("js/date/getMonthNumberJS.js",
"r") as file:
getMonthNumberJS = file.read()
##
def getFileContent(filePath):
try:
with open(filePath, 'r') as file:
return file.read()
except FileNotFoundError:
return "File not found."
except Exception as e:
return str(e)
##
bgTexturePath = "media/textures/bg001.jpg"
bgImage =
readImageAsBase64(bgTexturePath)
##
htmlContent = f"""
<html>
<head>
<title> Topalian Python JavaScript Navigator
</title>
<style>
body
{{
background-color: rgb(0, 0, 0);
font-family: Arial;
color: rgb(255, 255, 255);
}}
#bg
{{
position: fixed;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
object-fit: cover;
z-index: -1;
}}
.textStyle001
{{
width: 300px;
margin: 2px;
border: solid 1px rgb(100, 100, 100);
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
background-color: rgb(0, 0, 0);
font-family: Arial;
font-size: 16px;
font-weight: bold;
color: rgb(150, 150, 150);
overflow: hidden;
cursor: pointer;
}}
.textStyle001:hover
{{
border-color: rgb(0, 255, 255);
}}
#code
{{
width: 99%;
height: 130vh;
margin: 2px;
border: solid 1px rgb(100, 100, 100);
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
background-color: rgb(0, 0, 0);
font-family: Arial;
font-size: 24px;
font-weight: bold;
color: rgb(220, 220, 220);
overflow-y: scroll;
cursor: pointer;
}}
* {{
scrollbar-width: thin;
scrollbar-color: rgb(100, 100, 100) rgb(0, 0,
0);
}}
</style>
<script>
function ge(whichId)
{{
let result =
document.getElementById(whichId);
return result;
}}
function ce(whichType)
{{
let result =
document.createElement(whichType);
return result;
}}
function ba(whichElement)
{{
let result =
document.body.append(whichElement);
return result;
}}
//-//
{ getTime12JS }
{ getTime24JS }
//-//
function makeInterface()
{{
let mainDiv = ce('div');
mainDiv.id = 'mainDiv';
ba(mainDiv);
//-//
//-//
// leftContainer
let leftContainer = ce('div');
leftContainer.id = 'leftContainer';
leftContainer.style.overflowY = 'scroll';
leftContainer.style.height = '200px';
divContainer.append(leftContainer);
//-//
//-//
//-//
//-//
//-//
let yearPY = ce('input');
yearPY.id = 'yearPY';
yearPY.className = 'textStyle001';
yearPY.value = 'Year: ' + '{getYear()}';
yearPY.title = 'getYear()';
yearPY.onclick = function()
{{
ge('code').value =
`{getFileContent('py/date/getYear.py')}`;
}};
leftContainer.append(yearPY);
//-//
//-//
//-//
//-//
leftContainer.append(dayOfWeekNumberPY);
//-//
leftContainer.append(dayOfWeekNumber7PY)
;
//----//
// rightContainer
let rightContainer = ce('div');
rightContainer.id = 'rightContainer';
rightContainer.style.overflowY = 'scroll';
rightContainer.style.height = '200px';
divContainer.append(rightContainer);
//-//
//-//
//-//
//-//
//-//
//-//
rightContainer.append(dayOfMonthNumberJ
S);
//-//
rightContainer.append(dayOfWeekNameJS);
//-//
let dayOfWeekNumberJS = ce('input');
dayOfWeekNumberJS.id =
'dayOfWeekNumberJS';
dayOfWeekNumberJS.className =
'textStyle001';
dayOfWeekNumberJS.value = 'Day of Week
Number: ' + getDayOfWeekNumberJS();
dayOfWeekNumberJS.title =
'getDayOfWeekNumberJS()';
dayOfWeekNumberJS.onclick = function()
{{
ge('code').value =
getDayOfWeekNumberJS;
}};
rightContainer.append(dayOfWeekNumberJS)
;
//-//
//-//
//-//
// centerContainer
let centerContainer = ce('div');
centerContainer.id = 'centerContainer';
centerContainer.style.overflowY = 'scroll';
centerContainer.style.height = '270px';
mainDiv.append(centerContainer);
//-//
//-//
//-//
window.onload = function()
{{
makeInterface();
}};
</script>
</head>
<body>
</body>
</html>
"""
if __name__ == "__main__":
# we can start the window at a small size
# to avoid flashing white on the screen
# and then maximize it manually
widthOfWindow = 1200 #20
heightOfWindow = 670 # 20
import datetime as dt
def getDate():
today = dt.date.today()
return today
# print(getDate())
# input('')
#--------------------#
# 2024-06-10
#--------------------#
#********************#
# getDateTime12.py
import datetime as dt
def getDateTime12():
currentDateTime = dt.datetime.now()
return formattedDateTime
# print(getDateTime12())
# input('')
#--------------------#
# 06-11-24 05:33 PM
#--------------------#
#********************#
# getDayOfMonth.py
import datetime as dt
def getDayOfMonth():
currentDate = dt.datetime.now()
dayNumber = currentDate.day
return dayNumber
# print(getDayOfMonth())
# input('')
#--------------------#
# 17
#--------------------#
# Dedicated to God the Father
# All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
# getDayOfMonth.py
# https://github.com/ChristopherTopalian
#
https://github.com/ChristopherAndrewTopalia
n
#********************#
# getDayOfWeekName.py
import datetime as dt
def getDayOfWeekName():
currentDate = dt.datetime.now()
# 0 is Monday, 6 is Sunday
dayOfWeek = currentDate.weekday()
return dayName
#print(getDayOfWeekName())
#input('')
#--------------------#
# Monday
#--------------------#
#********************#
# getDayOfWeekNumber.py
import datetime as dt
def getDayOfWeekNumber():
now = dt.datetime.now()
# sunday returns as 6
dayOfWeekNumber = now.weekday()
# print(getDayOfWeekNumber())
# input('')
#--------------------#
# If today is Wednesday, it returns:
#4
#--------------------#
import datetime as dt
def getDayOfWeekNumber7():
now = dt.datetime.now()
# monday is 0, sunday is 6
dayOfWeekNumber = now.weekday()
return dayOfWeekNumberAdjusted
# print(getDayOfWeekNumber7())
# input('')
#--------------------#
# If today is Wednesday, it returns:
#3
#--------------------#
#********************#
# getMonthNumber.py
import datetime as dt
def getMonthNumber():
currentDate = dt.datetime.now()
# 1 is Jan, 12 is December
month = currentDate.month
return month
# print(getMonthNumber())
# input('')
#--------------------#
#6
#--------------------#
# Dedicated to God the Father
# All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
# getMonthNumber.py
# https://github.com/ChristopherTopalian
#
https://github.com/ChristopherAndrewTopalia
n
#********************#
# getYear.py
import datetime as dt
def getYear():
today = dt.date.today()
year = today.year
return year
# print(getYear())
# input('')
#--------------------#
# 2024
#--------------------#
# Dedicated to God the Father
# All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
# getYear.py
# https://github.com/ChristopherTopalian
#
https://github.com/ChristopherAndrewTopalia
n
#********************#
# getTime12.py
import datetime as dt
def getTime12():
now = dt.datetime.now()
currentTime = now.strftime("%I:%M:%S
%p")
return currentTime
# print(getTime12())
# input('')
#--------------------#
# 05:42:06 PM
#--------------------#
# Dedicated to God the Father
# All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
# getTime12.py
# https://github.com/ChristopherTopalian
#
https://github.com/ChristopherAndrewTopalia
n
#********************#
# getTime24.py
import datetime as dt
def getTime24():
now = dt.datetime.now()
currentTime = now.strftime("%H:%M:%S")
return currentTime
# print(getTime24())
# input('')
#--------------------#
# 17:07:29
#--------------------#
# Dedicated to God the Father
# All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
# getTime24.py
# https://github.com/ChristopherTopalian
#
https://github.com/ChristopherAndrewTopalia
n
#********************#
// getDateJS.js
function getDateJS()
{
let currentDate = new Date();
// add a zero
if (month.length < 2)
{
month = '0' + month;
}
return date;
}
// console.log(getDateJS());
//--------------------//
// 2024/06/07
//--------------------//
// Dedicated to God the Father
// All Rights Reserved Christopher Andrew
Topalian Copyright 2000-2024
// getDateJS.js
// https://github.com/ChristopherTopalian
//
https://github.com/ChristopherAndrewTopalia
n
//********************//
// getDateTimeJS.js
function getDateTimeJS()
{
let currentDate = new Date();
return currentDate.toLocaleString();
}
// console.log(getDateTimeJS());
//--------------------//
// 5/18/2024, 12:33:45 AM
//--------------------//
//********************//
// getDayOfMonthJS.js
function getDayOfMonthJS()
{
let currentDate = new Date();
return day;
}
// console.log(getDayOfMonthJS());
//--------------------//
// 12
//--------------------//
//********************//
// getDayOfWeekNameJS.js
function getDayOfWeekNameJS()
{
let currentDate = new Date();
// 0-6
let dayNumber = currentDate.getDay();
return dayName;
}
// console.log(getDayOfWeekNameJS());
//--------------------//
// Tuesday
//--------------------//
//********************//
// getDayOfWeekNumber7JS.js
function getDayOfWeekNumber7JS()
{
let currentDate = new Date();
let dayOfWeekNumber =
currentDate.getDay();
dayOfWeekNumberAdjusted =
dayOfWeekNumber + 1
return dayOfWeekNumberAdjusted;
}
// console.log(getDayOfWeekNumber7JS());
//--------------------//
// If today is Wednesday, it returns:
// 3
//--------------------//
//********************//
// getDayOfWeekNumberJS.js
function getDayOfWeekNumberJS()
{
let currentDate = new Date();
// sunday returns as 0
let dayOfWeekNumber =
currentDate.getDay();
return dayOfWeekNumberAdjusted;
}
// console.log(getDayOfWeekNumberJS());
//--------------------//
// If today is Wednesday, it returns:
// 4
//--------------------//
//********************//
// getMonthNumberJS.js
function getMonthNumberJS()
{
let currentDate = new Date();
monthNumber = currentDate.getMonth();
monthNumberAdjusted = monthNumber +
1;
return monthNumberAdjusted;
}
// console.log(getMonthNumberJS());
//--------------------//
// 6
//--------------------//
//********************//
// getYearJS.js
function getYearJS()
{
let currentDate = new Date();
return year;
}
// console.log(getYearJS());
//--------------------//
// 2024
//--------------------//
//********************//
// getTime12JS.js
function getTime12JS()
{
let currentDate = new Date();
// am or pm
if(hours < 12)
{
amOrPm = "AM";
}
else
{
amOrPm = "PM"
}
// add a zero
if (hours < 10)
{
hours = "0" + hours;
}
if (minutes < 10)
{
minutes = "0" + minutes;
}
return time;
}
// console.log(getTime12JS());
//--------------------//
// 04:57:38 AM
//--------------------//
//********************//
// getTime24JS.js
function getTime24JS()
{
let currentDate = new Date();
return time;
}
// console.log(getTime24JS());
//--------------------//
// 04:57:08
//--------------------//
//********************//
How to Paste Code from a PDF
that has Junk Characters.
When we paste from a pdf into VSCode,
it might look like this:
OR NOR
0111 1000
RC LC
1010 1100
XOR NAND
0110 1110
CNI MNI
Contra-
0100 0010
-diction
0000
For More Tutorials:
GitHub.com/ChristopherTopalian
GitHub.com/ChristopherAndrewTopalian
Sites.google.com/view/CollegeOfScripting
CollegeOfScripting.weebly.com
CollegeOfScripting.wordpress.com
Youtube.com/ScriptingCollege
Twitter.com/CollegeOfScript
Rumble.com/user/CollegeOfScripting
Dedicated to God the Father
This book is created by the
College of Scripting Music & Science.
Always remember, that each time you write a script
with a pencil and paper, it becomes imprinted so
deeply in memory that the material and methods are
learned extremely well.
When you Type the scripts, the same is true. The
more you type and write out the scripts by keyboard
or pencil and paper, the more you will learn
programming!
Write and Type every example that you find.
Keep all of your scripts organized.
Every script that you create increases your
programming abilities.
SEEING CODE, is one thing,
but WRITING CODE is another.
Write it, Type it, Speak it, See it, Dream it.
CollegeOfScripting.weebly.com