From b2c50510101cf47e21d5ca50f04ea46d09477893 Mon Sep 17 00:00:00 2001 From: Crucial-hash Date: Tue, 28 May 2024 14:43:16 +0100 Subject: [PATCH] removed extra lines --- .gitattributes | 2 +- .github/workflows/trigger-workflow.yml | 2 +- adhan.py | 20 ------ script.js | 45 +++--------- style.css | 98 +++++++++++++------------- 5 files changed, 62 insertions(+), 105 deletions(-) diff --git a/.gitattributes b/.gitattributes index 3320b4c..c0f3e8c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,4 +3,4 @@ info.txt export-ignore LICENSE export-ignore images/ export-ignore .gitattributes export-ignore -.github/ export-ignore +.github/ export-ignore \ No newline at end of file diff --git a/.github/workflows/trigger-workflow.yml b/.github/workflows/trigger-workflow.yml index a065619..4014538 100644 --- a/.github/workflows/trigger-workflow.yml +++ b/.github/workflows/trigger-workflow.yml @@ -17,4 +17,4 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token $GITHUB_TOKEN" \ https://api.github.com/repos/Crucial-hash/crucial/actions/workflows/update-submodule-push.yml/dispatches \ - -d '{"ref":"main"}' + -d '{"ref":"main"}' \ No newline at end of file diff --git a/adhan.py b/adhan.py index 3a8e8f1..441e02d 100644 --- a/adhan.py +++ b/adhan.py @@ -1,30 +1,24 @@ while True: try: - from bs4 import BeautifulSoup import requests from datetime import datetime, time - website = 'https://www.halaltrip.com/prayertimes/muslim-salat-prayer-times/?name=Slough&f=Slough%2C+UK&l=Slough&s=&c=United+Kingdom&lat=51.4989355&lng=-0.5612772&no_days=7&cal_method=3&asr_method=2&higher_lat=2&cruising_height=11800' #Change the URL to the placve you live result = requests.get(website) content = result.text - soup = BeautifulSoup(content, 'lxml') - prayerTime = soup.find('ul', class_='tm-horizontal-listitem clearfix highlighted').get_text() - lines = prayerTime.split('\n')[1:-1] lines = prayerTime.split('\n')[1:-1] lines = prayerTime.split('\n')[1:-1] del lines[0] lines = [line.replace(':00', ':0') for line in lines] - fajrHour, fajrMin = map(int, lines[0].split(':')) sunriseHour, sunriseMin = map(int, lines[1].replace('00', '0').split(':')) zuhrHour, zuhrMin = map(int, lines[2].replace('00', '0').split(':')) @@ -32,11 +26,9 @@ maghribHour, maghribMin = map(int, lines[4].split(':')) ishaHour, ishaMin = map(int, lines[5].split(':')) - lines = [line.lstrip('0') if line[0] == '0' else line for line in lines] lines = [line[:-2] + line[-1] if line[-2] == '0' else line for line in lines] - fajrHour, fajrMin = map(int, lines[0].split(':')) sunriseHour, sunriseMin = map(int, lines[1].split(':')) zuhrHour, zuhrMin = map(int, lines[2].split(':')) @@ -44,10 +36,8 @@ maghribHour, maghribMin = map(int, lines[4].split(':')) ishaHour, ishaMin = map(int, lines[5].split(':')) - current_time = datetime.now().time() - fajr_time = time(fajrHour, fajrMin) sunrise_time = time(sunriseHour, sunriseMin) zuhr_time = time(zuhrHour, zuhrMin) @@ -55,7 +45,6 @@ maghrib_time = time(maghribHour, maghribMin) isha_time = time(ishaHour, ishaMin) - if current_time < fajr_time: next_prayer = "Fajr" next_prayer_hour = fajrHour @@ -81,18 +70,15 @@ next_prayer_hour = fajrHour next_prayer_min = fajrMin - diff = datetime.combine(datetime.today(), time(next_prayer_hour, next_prayer_min)) - datetime.combine(datetime.today(), current_time) diff_seconds = diff.total_seconds() diff_hour = int(diff_seconds // 3600) diff_minute = int((diff_seconds % 3600) // 60) - if diff_hour < 0: diff_hour += 24 diff_minute *= 1 - with open('name.txt', 'w') as file: file.write(f'{next_prayer}\n') @@ -102,7 +88,6 @@ with open('minutes.txt', 'w') as file: file.write(f'{diff_minute}\n') - if current_time < sunrise_time: sun_state = "Sunrise" sun_state_hour = sunriseHour @@ -116,18 +101,15 @@ sun_state_hour = sunriseHour sun_state_min = sunriseMin - diff2 = datetime.combine(datetime.today(), time(sun_state_hour, sun_state_min)) - datetime.combine(datetime.today(), current_time) diff_seconds2 = diff2.total_seconds() diff_hour2 = int(diff_seconds2 // 3600) diff_minute2 = int((diff_seconds2 % 3600) // 60) - if diff_hour2 < 0: diff_hour2 += 24 diff_minute2 *= 1 - with open('sunstate.txt', 'w') as file: file.write(f'{sun_state}\n') @@ -137,9 +119,7 @@ with open('sunminutes.txt', 'w') as file: file.write(f'{diff_minute2}\n') - print("finished") - except Exception as e: print("error") \ No newline at end of file diff --git a/script.js b/script.js index c861b62..77f45b6 100644 --- a/script.js +++ b/script.js @@ -3,7 +3,6 @@ function displayTime(){ var hrs = dateTime.getHours(); var min = dateTime.getMinutes(); - function isDaylightSavingTime() { const today = new Date(); const month = today.getMonth(); @@ -16,10 +15,8 @@ function displayTime(){ return dstResult; } - isDaylightSavingTime(); - if (hrs == 0){ hrs = hrs +12 } @@ -36,19 +33,16 @@ function displayTime(){ min = "0" + min } - document.getElementById('hours').innerHTML = hrs; document.getElementById('minutes').innerHTML = min; } - setInterval(displayTime, 10); var width = screen.width; var height = screen.height; document.documentElement.style.cursor = 'none'; - var root = document.querySelector(':root'); var rootStyles = getComputedStyle(root); var trackurl = rootStyles.getPropertyValue('--trackurl'); @@ -57,10 +51,8 @@ var tracknameallign = rootStyles.getPropertyValue('--tracknameallign'); var flagallign = rootStyles.getPropertyValue('--flagallign'); var raceweekend = rootStyles.getPropertyValue('--raceweekend'); - function setProperties(trackImage,trackNameAllignX,trackNameAllignY,flagAllignX,flagAllignY,flagImage,raceWeekendX,raceWeekendY,raceWeekendTime,session,trackName){ - root.style.setProperty('--trackurl', 'url(' + trackImage + ')') root.style.setProperty('--tracknameallign', 'translate(' + trackNameAllignX + ',' + trackNameAllignY + ')') root.style.setProperty('--flagallign', 'translate(' + flagAllignX + ',' + flagAllignY + ')') @@ -71,13 +63,11 @@ document.getElementById('session').innerHTML = session; document.getElementById('trackname').innerHTML = trackName; } - const button = document.getElementById("prayerbutton"); const prayer = document.getElementById("prayertext"); const sun = document.getElementById("suntext"); let state = 0; - button.addEventListener("click", function() { if (state === 0) { state = 1; @@ -101,10 +91,8 @@ button.addEventListener("click", function() { } }); - minuteChanged() - function minuteChanged() { if (state === 1) { @@ -113,73 +101,68 @@ function minuteChanged() { prayer.style.transform = "none"; } - if (state === 2) { sun.style.transform = "translate(1%, 2260%)"; } else { sun.style.transform = "none"; } - var xhrName = new XMLHttpRequest(); xhrName.open("GET", "./name.txt", false); xhrName.send(); - + if(xhrName.readyState === 4 && xhrName.status === 200) { var prayerName = xhrName.responseText; } - + var xhrHours = new XMLHttpRequest(); xhrHours.open("GET", "./hours.txt", false); xhrHours.send(); - + if(xhrHours.readyState === 4 && xhrHours.status === 200) { var prayerHours = parseInt(xhrHours.responseText); } - + var xhrMinutes = new XMLHttpRequest(); xhrMinutes.open("GET", "./minutes.txt", false); xhrMinutes.send(); - + if(xhrMinutes.readyState === 4 && xhrMinutes.status === 200) { var prayerMinutes = parseInt(xhrMinutes.responseText); } - var xhrSunState = new XMLHttpRequest(); xhrSunState.open("GET", "./sunstate.txt", false); xhrSunState.send(); - + if(xhrSunState.readyState === 4 && xhrSunState.status === 200) { var sunState = xhrSunState.responseText; } - + var xhrSunHours = new XMLHttpRequest(); xhrSunHours.open("GET", "./sunhours.txt", false); xhrSunHours.send(); - + if(xhrSunHours.readyState === 4 && xhrSunHours.status === 200) { var sunHours = parseInt(xhrSunHours.responseText); } - + var xhrSunMinutes = new XMLHttpRequest(); xhrSunMinutes.open("GET", "./sunminutes.txt", false); xhrSunMinutes.send(); - + if(xhrSunMinutes.readyState === 4 && xhrSunMinutes.status === 200) { var sunMinutes = parseInt(xhrSunMinutes.responseText); } - document.getElementById('prayertext').innerHTML = prayerName + " In " + (prayerHours === 1 ? prayerHours + " Hour, " : prayerHours + " Hours, ") + (prayerMinutes === 1 ? prayerMinutes + " Minute" : prayerMinutes + " Minutes").replace("1 Minutes", "1 Minute"); - + document.getElementById('suntext').innerHTML = sunState + " In " + (sunHours === 1 ? sunHours + " Hour, " : sunHours + " Hours, ") + (sunMinutes === 1 ? sunMinutes + " Minute" : sunMinutes + " Minutes").replace("1 Minutes", "1 Minute"); - function isDaylightSavingTime() { const today = new Date(); const month = today.getMonth(); @@ -192,7 +175,6 @@ function minuteChanged() { return false; } - var tracktime; var hrs24; if (isDaylightSavingTime()) { @@ -203,7 +185,6 @@ function minuteChanged() { hrs24 = moment().format('HHmm'); } - if ( hrs24 == '0645' || hrs24 == '1000' || @@ -219,7 +200,6 @@ function minuteChanged() { document.body.style.backgroundColor = '#000000'; } - //BAHRAIN if (tracktime < '03021630') { setProperties("./image/bahrain.png","37.5%","-24%","630%","140%","./image/bahrainflag.png","54.1%","145%","29 - 02 Feb/March","P1 P2 P3 Q R","Bahrain") } @@ -320,7 +300,6 @@ function minuteChanged() { if (tracktime >= '12081430') { setProperties("./image/australia.png","37.5%","-24%","640%","140%","./image/australiaflag.png","60%","145%"," ","P1 P2 P3 Q R","Australia") } - function boldString(str, find){ var re = new RegExp(find, 'g'); return str.replace(re, ''+find+''); @@ -330,12 +309,10 @@ function minuteChanged() { document.getElementById("session").innerHTML = result; } - function getCurrentMinute() { return new Date().getMinutes(); } - let currentMinute = getCurrentMinute(); setInterval(function() { const newMinute = getCurrentMinute(); diff --git a/style.css b/style.css index e5ad384..56e866c 100644 --- a/style.css +++ b/style.css @@ -34,6 +34,32 @@ span{ text-overflow: ellipsis; } +#prayerbutton { + height: 200px; + width: 500px; + background-color: transparent; + border: none; + transform: translate(60%, 395%); + top: 100px; + left: 50px; + cursor: none; + position:absolute; top:0; right:0; + z-index:2 +} + +#reloadbutton { + height: 150px; + width: 150px; + background-color: transparent; + border: none; + transform: translate(430%, 130%); + top: 100px; + left: 50px; + cursor: none; + position:absolute; top:0; right:0; + z-index:2 +} + .container{ font-family: 'thin'; color: #ffffff; @@ -89,56 +115,30 @@ span{ color: #ffffff; } -#prayerbutton { - height: 200px; - width: 500px; - background-color: transparent; - border: none; - transform: translate(60%, 395%); - top: 100px; - left: 50px; - cursor: none; - position:absolute; top:0; right:0; - z-index:2 - } - - #reloadbutton { - height: 150px; - width: 150px; - background-color: transparent; - border: none; - transform: translate(430%, 130%); - top: 100px; - left: 50px; - cursor: none; - position:absolute; top:0; right:0; - z-index:2 - } - - .prayertextdiv { - font-size: 32px; - color: transparent; - transform: translate(-1.5%, 2260%); - font-family: 'reg'; - position:absolute; top:0; right:0; - } +.prayertextdiv { + font-size: 32px; + color: transparent; + transform: translate(-1.5%, 2260%); + font-family: 'reg'; + position:absolute; top:0; right:0; +} - .prayertext { - position:absolute; top:0; right:0; - } +.prayertext { + position:absolute; top:0; right:0; +} - .suntextdiv { - font-size: 32px; - color: transparent; - transform: translate(-1.5%, 2260%); - font-family: 'reg'; - position:absolute; top:0; right:0; - } +.suntextdiv { + font-size: 32px; + color: transparent; + transform: translate(-1.5%, 2260%); + font-family: 'reg'; + position:absolute; top:0; right:0; +} - .suntext { - position:absolute; top:0; right:0; - } +.suntext { + position:absolute; top:0; right:0; +} - .white { - color: #ffffff; - } \ No newline at end of file +.white { + color: #ffffff; +} \ No newline at end of file