[wiki] [sites] Surf link_hints script supports pages without predefined styles. || Ellington Santos

From: <git_AT_suckless.org>
Date: Fri, 23 Feb 2018 18:05:04 +0100

commit c037d3558f41bd9be7c97056cb89ffcc801eabcf
Author: Ellington Santos <ellingtonsantos_AT_gmail.com>
Date: Fri Feb 23 13:23:51 2018 -0300

    Surf link_hints script supports pages without predefined styles.

diff --git a/surf.suckless.org/files/link_hints.md b/surf.suckless.org/files/link_hints.md
index fe086537..5d034300 100644
--- a/surf.suckless.org/files/link_hints.md
+++ b/surf.suckless.org/files/link_hints.md
_AT_@ -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);
Received on Fri Feb 23 2018 - 18:05:04 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 23 2018 - 18:12:29 CET