From 26cf69892a1ce55af498fc03408e8120b606e98c Mon Sep 17 00:00:00 2001 From: Samuel Clay Date: Wed, 8 Jan 2014 11:25:32 -0800 Subject: [PATCH] Fixing broken BBC links which have oddball hashes. --- media/js/newsblur/views/story_detail_view.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/media/js/newsblur/views/story_detail_view.js b/media/js/newsblur/views/story_detail_view.js index 6ae431394..fd196d2ed 100644 --- a/media/js/newsblur/views/story_detail_view.js +++ b/media/js/newsblur/views/story_detail_view.js @@ -568,9 +568,13 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({ // Fix footnotes if (_.string.contains(href, "#")) { - footnote_href = href.replace(/^.*?\#(.*?)$/, "\#$1") - .replace(':', "\\\:"); - var $footnote = $(footnote_href); + try { + footnote_href = href.replace(/^.*?\#(.*?)$/, "\#$1") + .replace(':', "\\\:"); + var $footnote = $(footnote_href); + } catch (err) { + $footnote = []; + } if ($footnote.length) { href = footnote_href; var offset = $(href).offset().top;