From f0cb0abf38d81269ceb2da819e730d6a471d5341 Mon Sep 17 00:00:00 2001 From: maxiwee69 Date: Wed, 24 Jan 2024 20:13:36 +0100 Subject: [PATCH] added some stuff modified: learntotweak/aarch64/style.css modified: learntotweak/step1/style.css modified: learntotweak/step2/style.css modified: learntotweak/step3/style.css deleted: tag.py --- footer.py | 36 ++++++++++++++++++++++++++++++++++ learntotweak/aarch64/style.css | 6 +----- learntotweak/step1/style.css | 9 ++++----- learntotweak/step2/style.css | 6 +----- learntotweak/step3/style.css | 6 +----- tag.py | 29 --------------------------- 6 files changed, 43 insertions(+), 49 deletions(-) create mode 100644 footer.py delete mode 100644 tag.py diff --git a/footer.py b/footer.py new file mode 100644 index 0000000..e85af1c --- /dev/null +++ b/footer.py @@ -0,0 +1,36 @@ +import os +import re + +# Specify the directory you want to start from +root_dir = r'C:\Users\maxi\maxiwee69.github.io' + +# Define the footer CSS you want to add +footer_css = """.footer { + background-color: #0a0a15; /* Darker blue */ + color: #e0e0e0; /* Lighter color for the footer text */ + font-family: Arial, sans-serif; + text-align: center; + padding: 20px; + width: 100%; + flex-shrink: 0; +}""" + +# Walk through all subdirectories +for dirpath, dirnames, filenames in os.walk(root_dir): + for filename in filenames: + # Check if the file is a CSS file + if filename.endswith('.css'): + filepath = os.path.join(dirpath, filename) + with open(filepath, 'r+') as file: + # Read the existing content + content = file.read() + # Check if the footer background-color is set to #0a0a15 + if re.search(r'\.footer\s*{\s*background-color:\s*#0a0a15;', content): + print(f'Found matching file: {filepath}') + # If yes, replace the entire .footer CSS with the new one + content = re.sub(r'(\.footer\s*{[^}]*})', footer_css, content) + # Write the new content back to the file + file.seek(0) + file.write(content) + file.truncate() + print(f'Updated file: {filepath}') diff --git a/learntotweak/aarch64/style.css b/learntotweak/aarch64/style.css index 6e1640b..9c77a40 100644 --- a/learntotweak/aarch64/style.css +++ b/learntotweak/aarch64/style.css @@ -128,10 +128,6 @@ html { font-family: Arial, sans-serif; text-align: center; padding: 20px; - position: absolute; - bottom: 0; - left: 0; /* Add this */ - right: 0; /* Add this */ - margin: auto; /* Add this */ width: 100%; + flex-shrink: 0; } \ No newline at end of file diff --git a/learntotweak/step1/style.css b/learntotweak/step1/style.css index be979b8..5ba82f4 100644 --- a/learntotweak/step1/style.css +++ b/learntotweak/step1/style.css @@ -7,6 +7,9 @@ body { background-color: #1a1a2e; /* Softer dark blue */ color: #e0e0e0; /* Lighter text color */ padding: 20px; + display: flex; + flex-direction: column; + min-height: 100vh; } html { @@ -114,10 +117,6 @@ html { font-family: Arial, sans-serif; text-align: center; padding: 20px; - position: absolute; - bottom: 0; - left: 0; /* Add this */ - right: 0; /* Add this */ - margin: auto; /* Add this */ width: 100%; + flex-shrink: 0; } \ No newline at end of file diff --git a/learntotweak/step2/style.css b/learntotweak/step2/style.css index 6e1640b..9c77a40 100644 --- a/learntotweak/step2/style.css +++ b/learntotweak/step2/style.css @@ -128,10 +128,6 @@ html { font-family: Arial, sans-serif; text-align: center; padding: 20px; - position: absolute; - bottom: 0; - left: 0; /* Add this */ - right: 0; /* Add this */ - margin: auto; /* Add this */ width: 100%; + flex-shrink: 0; } \ No newline at end of file diff --git a/learntotweak/step3/style.css b/learntotweak/step3/style.css index 6e1640b..9c77a40 100644 --- a/learntotweak/step3/style.css +++ b/learntotweak/step3/style.css @@ -128,10 +128,6 @@ html { font-family: Arial, sans-serif; text-align: center; padding: 20px; - position: absolute; - bottom: 0; - left: 0; /* Add this */ - right: 0; /* Add this */ - margin: auto; /* Add this */ width: 100%; + flex-shrink: 0; } \ No newline at end of file diff --git a/tag.py b/tag.py deleted file mode 100644 index 5de32ca..0000000 --- a/tag.py +++ /dev/null @@ -1,29 +0,0 @@ -import os - -# Define the meta tag you want to add -meta_tag = '' - -# Specify the directory you want to start from -root_dir = r'C:\Users\maxi\maxiwee69.github.io' - -# Walk through all subdirectories -for dirpath, dirnames, filenames in os.walk(root_dir): - for filename in filenames: - # Check if the file is an index.html file - if filename == 'index.html': - filepath = os.path.join(dirpath, filename) - print(f'Found file: {filepath}') - with open(filepath, 'r+') as file: - # Read the existing content - content = file.read() - # Check if the meta tag already exists - if meta_tag not in content: - # If not, add the meta tag after the opening head tag - content = content.replace('', '\n' + meta_tag, 1) - # Write the new content back to the file - file.seek(0) - file.write(content) - file.truncate() - print(f'Meta tag added to: {filepath}') - else: - print(f'Meta tag already exists in: {filepath}')