aider: Check if there is a mdurl param and skip the rest if not.

# Aider chat conversation:

USER: check to make sure there is a mdurl param, skip the rest if not

ASSISTANT: To implement this change, we need to modify the `share/index.md` file. We will add a condition to check if the `mdurl` parameter exists before proceeding with the rest of the script.

Here is the proposed change:

```markdown
share/index.md
<<<<<<< ORIGINAL
window.onload = function() {
    var urlParams = new URLSearchParams(window.location.search);
    var conv = urlParams.get('mdurl');
    fetch(conv)
=======
window.onload = function() {
    var urlParams = new URLSearchParams(window.location.search);
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
    fetch(conv)
>>>>>>> UPDATED
```

This change checks if `conv` (which holds the value of the `mdurl` parameter) is not present. If it's not, the function returns immediately, skipping the rest of the script.
This commit is contained in:
Paul Gauthier 2023-08-07 11:10:28 -03:00
parent 49b1b228bd
commit c5d80e9f7a

View file

@ -12,6 +12,9 @@ created using <a href="https://aider.chat">aider</a>.
window.onload = function() {
var urlParams = new URLSearchParams(window.location.search);
var conv = urlParams.get('mdurl');
if (!conv) {
return;
}
fetch(conv)
.then(response => response.text())
.then(markdown => {