From 55814019cacf484b8d6882c91b90bd7758e295c9 Mon Sep 17 00:00:00 2001 From: Yehonal Date: Thu, 20 Dec 2018 18:23:58 +0100 Subject: improved rl --- assets/js/red-links.js | 11 ++++++----- 1 file 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', ''); } } }); -- cgit