|
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 | 6 | <title>Edit Scratch Coding Hut Wiki</title>
|
7 | 7 | <style>
|
8 |
| - /* Your existing CSS styles here */ |
| 8 | + /* Global reset */ |
| 9 | + * { |
| 10 | + margin: 0; |
| 11 | + padding: 0; |
| 12 | + box-sizing: border-box; |
| 13 | + } |
| 14 | + |
| 15 | + body { |
| 16 | + font-family: 'Arial', sans-serif; |
| 17 | + background: #fff4f4; |
| 18 | + color: #333; |
| 19 | + padding: 40px; |
| 20 | + display: flex; |
| 21 | + flex-direction: column; |
| 22 | + align-items: center; |
| 23 | + text-align: center; |
| 24 | + } |
| 25 | + |
| 26 | + h1 { |
| 27 | + font-size: 3rem; |
| 28 | + color: #ff4d4d; |
| 29 | + margin-bottom: 30px; |
| 30 | + font-weight: bold; |
| 31 | + } |
| 32 | + |
| 33 | + .form-container { |
| 34 | + background-color: #ffcccc; |
| 35 | + padding: 30px; |
| 36 | + border-radius: 10px; |
| 37 | + box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); |
| 38 | + width: 100%; |
| 39 | + max-width: 500px; |
| 40 | + margin-bottom: 30px; |
| 41 | + } |
| 42 | + |
| 43 | + .form-container h2 { |
| 44 | + font-size: 1.5rem; |
| 45 | + color: #e60000; |
| 46 | + margin-bottom: 20px; |
| 47 | + } |
| 48 | + |
| 49 | + input, textarea { |
| 50 | + width: 100%; |
| 51 | + padding: 15px; |
| 52 | + margin-bottom: 15px; |
| 53 | + border-radius: 8px; |
| 54 | + border: 2px solid #e60000; |
| 55 | + font-size: 1rem; |
| 56 | + outline: none; |
| 57 | + } |
| 58 | + |
| 59 | + input:focus, textarea:focus { |
| 60 | + border-color: #ff4d4d; |
| 61 | + box-shadow: 0 0 5px rgba(255, 77, 77, 0.5); |
| 62 | + } |
| 63 | + |
| 64 | + button { |
| 65 | + background-color: #ff4d4d; |
| 66 | + color: white; |
| 67 | + padding: 15px 30px; |
| 68 | + border: none; |
| 69 | + border-radius: 8px; |
| 70 | + cursor: pointer; |
| 71 | + font-size: 1.1rem; |
| 72 | + transition: background-color 0.3s ease; |
| 73 | + } |
| 74 | + |
| 75 | + button:hover { |
| 76 | + background-color: #ff1a1a; |
| 77 | + } |
| 78 | + |
| 79 | + /* Mobile Responsive Styling */ |
| 80 | + @media (max-width: 768px) { |
| 81 | + .form-container { |
| 82 | + width: 90%; |
| 83 | + padding: 20px; |
| 84 | + } |
| 85 | + |
| 86 | + h1 { |
| 87 | + font-size: 2.5rem; |
| 88 | + } |
| 89 | + |
| 90 | + button { |
| 91 | + font-size: 1rem; |
| 92 | + padding: 12px 25px; |
| 93 | + } |
| 94 | + } |
9 | 95 | </style>
|
10 | 96 | </head>
|
11 | 97 | <body>
|
@@ -52,6 +138,13 @@ <h2>Edit Wiki Post</h2>
|
52 | 138 | wikiId = wiki.id; // Store the wiki ID
|
53 | 139 | wikiTitleInput.value = wiki.title;
|
54 | 140 | wikiContentInput.value = wiki.content;
|
| 141 | + |
| 142 | + // Check if the user is authorized to edit the wiki |
| 143 | + const username = localStorage.getItem('username'); |
| 144 | + if (username !== wiki.owner && !['kRxZy_kRxZy', 'mcgdj', 'MyScratchedAccount'].includes(username)) { |
| 145 | + alert('You are not authorized to edit this wiki.'); |
| 146 | + window.location.href = 'sitemaplinks.html'; // Redirect to wiki list if not authorized |
| 147 | + } |
55 | 148 | }
|
56 | 149 | } catch (error) {
|
57 | 150 | console.error('Error fetching wiki:', error);
|
|
0 commit comments