diff options
| author | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-20 18:23:58 +0100 |
|---|---|---|
| committer | Yehonal <yehonal.azeroth@gmail.com> | 2018-12-21 20:17:07 +0100 |
| commit | 55814019cacf484b8d6882c91b90bd7758e295c9 (patch) | |
| tree | 3648dfbb95ceb4a060e107f04ef7af158c6838fd | |
| parent | bffe8bad0f1e22a7d58b691e0023efebc9b8db8e (diff) | |
| download | wiki-55814019cacf484b8d6882c91b90bd7758e295c9.tar.gz wiki-55814019cacf484b8d6882c91b90bd7758e295c9.tar.bz2 wiki-55814019cacf484b8d6882c91b90bd7758e295c9.zip | |
improved rl
| -rw-r--r-- | assets/js/red-links.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/assets/js/red-links.js b/assets/js/red-links.js index 1b7b94b..de3bb25 100644 --- a/assets/js/red-links.js +++ b/assets/js/red-links.js @@ -11,21 +11,22 @@ var ext = this.href.split('.').pop().split(/\#|\?/)[0]; - if (ext != "html") - $(this).css('color', 'red'); // pessimistic condition + // [Performance tip] pessimistic condition based on the fact that + // markdown files are automatically converted in html + // if they are part of the wiki (the real check is right below) + if (ext.toLowerCase() == "md" || ext.toLowerCase() == "markdown") + $(this).css('color', 'red'); var that = this; $.ajax({ type: 'HEAD', url: this.href, success: function () { - + $(that).css('color', ''); }, error: function (xhr, ajaxOptions, thrownError) { if (xhr.status == 404) { $(that).css('color', 'red'); - } else if (xhr.status == 200) { - $(that).css('color', ''); } } }); |
