>From c037d3558f41bd9be7c97056cb89ffcc801eabcf Mon Sep 17 00:00:00 2001
From: Ellington Santos <ellingtonsan...@gmail.com>
Date: Fri, 23 Feb 2018 13:23:51 -0300
Subject: [sites][PATCH] Surf link_hints script supports pages without
 predefined styles.

---
 surf.suckless.org/files/link_hints.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/surf.suckless.org/files/link_hints.md b/surf.suckless.org/files/link_hints.md
index fe08653..5d03430 100644
--- a/surf.suckless.org/files/link_hints.md
+++ b/surf.suckless.org/files/link_hints.md
@@ -90,6 +90,11 @@ Code
 	}
 
 	function setHintRules() {
+		 if (document.styleSheets.length < 1) {
+		    var style = document.createElement("style");
+		    style.appendChild(document.createTextNode(""));
+		    document.head.appendChild(style);
+		}
 		var ss = document.styleSheets[0];
 		ss.insertRule('a[highlight=hint_elem] {background-color: yellow}', 0);
 		ss.insertRule('a[highlight=hint_active] {background-color: lime}', 0);
-- 
2.16.1

        
-- 
Atenciosamente,

Ellington Santos

Reply via email to