Skip to content

Commit

Permalink
Improve validation of articles
Browse files Browse the repository at this point in the history
  • Loading branch information
anasserhussien committed Apr 28, 2024
1 parent f0aa78c commit cc18e3d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
font-size: 18px;
margin-top: 10px;
}
.error-message{
color: rgb(227, 5, 49);
}


</style>
Expand All @@ -87,7 +90,7 @@
<div class="spinner"></div>
<p id="loading-message">Please wait...</p>
</div>

<br>
<div id="error-message" class="error-message"></div>
</div>
<script>
Expand Down Expand Up @@ -122,7 +125,7 @@


function isValidWikipediaUrl(url) {
const wikipediaUrlPattern = /^(https?:\/\/)?([\w-]+\.)*wikipe(?:dia\.org).*/i;
const wikipediaUrlPattern = /^(https?:\/\/)?([\w-]+\.)*wikipedia\.org*/i;
return wikipediaUrlPattern.test(url);
}
function navigateToPage(page) {
Expand Down Expand Up @@ -162,7 +165,9 @@
document.getElementById('loading').style.display = 'none';

// If there was a network error, display it on the page
document.getElementById('error-message').innerText = text;
console.log(text)
document.getElementById('error-message').innerText = "Can't Fetch your article, please try again later.";

});
}
})
Expand All @@ -171,7 +176,7 @@

})
.catch((error) => {

console.log(error)
});
}
</script>
Expand Down

0 comments on commit cc18e3d

Please sign in to comment.