From fcbc6d84fbf560048f01f74dce36bbe480922a4f Mon Sep 17 00:00:00 2001 From: geeyan Date: Fri, 8 Jan 2016 18:00:44 +0800 Subject: [PATCH 1/2] while use locally, no need of ribbon --- themes/daux/js/daux.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/daux/js/daux.js b/themes/daux/js/daux.js index 070a144..7dcbcb3 100644 --- a/themes/daux/js/daux.js +++ b/themes/daux/js/daux.js @@ -108,10 +108,12 @@ $(function () { function onResize() { //Fix GitHub Ribbon overlapping Scrollbar var a = $('article'); - if (ribbon[0] && a[0] && a[0].scrollHeight > $('.right-column').height()) { - ribbon[0].style.right = '16px'; - } else { - ribbon[0].style.right = ''; + if (ribbon.length) { + if (a[0] && a[0].scrollHeight > $('.right-column').height()) { + ribbon[0].style.right = '16px'; + } else { + ribbon[0].style.right = ''; + } } } $(window).resize(_.debounce(onResize, 100)); From d52c377d215d971aa8344053b46a918674c2cb66 Mon Sep 17 00:00:00 2001 From: geeyan Date: Fri, 8 Jan 2016 18:04:35 +0800 Subject: [PATCH 2/2] safer --- themes/daux/js/daux.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/daux/js/daux.js b/themes/daux/js/daux.js index 7dcbcb3..9633977 100644 --- a/themes/daux/js/daux.js +++ b/themes/daux/js/daux.js @@ -108,7 +108,7 @@ $(function () { function onResize() { //Fix GitHub Ribbon overlapping Scrollbar var a = $('article'); - if (ribbon.length) { + if (ribbon.length && a.length) { if (a[0] && a[0].scrollHeight > $('.right-column').height()) { ribbon[0].style.right = '16px'; } else {