Skip to content

Commit

Permalink
changeName fix
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninvf committed Sep 2, 2023
1 parent 1318d00 commit fb4d7dc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@

<body>
<div class="d-flex align-items-center vw-100 main flex-column">
<h1 id="title">GANGNAMSTYLE.DEV</h1>
<script src="js/changeTitle.js"></script>
<h1 id="replaceName">GANGNAMSTYLE.DEV</h1>

<div class="middle">
<div class="main-section">
<div class="module">
<h2>WELCOME TO GANGNAMSTYLE.DEV</h2>
<h2 id="replaceName">WELCOME TO GANGNAMSTYLE.DEV</h2>
<p>Hi, I'm Flowyan and this is my website.</p>
<p>I host several of my personal projects and stuff that I'm currently working on.</p>
<p>Some things that I have on here currently is a media website with funny pictures, a website for
Expand Down Expand Up @@ -94,6 +93,10 @@ <h2>PLANS FOR THE FUTURE <small>(of this website)</small></h2>
</ul>
</div>
</div>

<!-- Replace mentions of gangnamstyle.dev with the current window.location.hostname -->
<script src="js/changeName.js"></script>

<div class="side-section">
<div class="module">
<h2>STUFF</h2>
Expand Down
10 changes: 10 additions & 0 deletions js/changeName.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
var replaceList = document.querySelectorAll('[id=replaceName]');


// Change the title of the page according to window.location.hostname

document.title = window.location.hostname;

for (var i = 0; i < replaceList.length; i++) {
replaceList[i].innerText = replaceList[i].innerText.replace("GANGNAMSTYLE.DEV", window.location.hostname);
}
5 changes: 0 additions & 5 deletions js/changeTitle.js

This file was deleted.

0 comments on commit fb4d7dc

Please sign in to comment.