summaryrefslogtreecommitdiff
path: root/assets/js/red-links.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/js/red-links.js')
-rw-r--r--assets/js/red-links.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/assets/js/red-links.js b/assets/js/red-links.js
new file mode 100644
index 0000000..446db02
--- /dev/null
+++ b/assets/js/red-links.js
@@ -0,0 +1,28 @@
+
+(function ($) {
+ //
+ // RED LINK FEATURE (Hacky)
+ // TODO: filter external links
+ $.fn.redLinks = function () {
+ $('a').each(function () {
+ // avoid red link for external urls
+ if (this.hostname != window.location.hostname)
+ return;
+
+ var that = this;
+ $.ajax({
+ type: 'HEAD',
+ url: this.href,
+ success: function () {
+
+ },
+ error: function (xhr, ajaxOptions, thrownError) {
+ if (xhr.status == 404) {
+ $(that).css('color', 'red');
+ }
+ }
+ });
+ });
+ };
+
+})(jQuery);