Fossil SCM
Improvements to the javascript that enables hyperlinks for anonymous users.
Commit
7fb59a67dc6ecf144d29b0d2e9ecff679bd6e034
Parent
e2f5be6df11e71f…
1 file changed
+10
-5
+10
-5
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -122,14 +122,17 @@ | ||
| 122 | 122 | ** Generate javascript that will set the href= attribute on all anchors. |
| 123 | 123 | */ |
| 124 | 124 | void style_resolve_href(void){ |
| 125 | 125 | int i; |
| 126 | 126 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 127 | - @ <script> | |
| 127 | + @ <script type="text/JavaScript"> | |
| 128 | + @ /* <![CDATA[ */ | |
| 129 | + @ function u(i,h){ document.getElementById(i).href=h; } | |
| 128 | 130 | for(i=0; i<nHref; i++){ |
| 129 | - @ document.getElementById(%d(i+1)).href="%s(aHref[i])"; | |
| 131 | + @ u(%d(i+1),"%s(aHref[i])"); | |
| 130 | 132 | } |
| 133 | + @ /* ]]> */ | |
| 131 | 134 | @ </script> |
| 132 | 135 | } |
| 133 | 136 | |
| 134 | 137 | /* |
| 135 | 138 | ** Add a new element to the submenu |
| @@ -237,10 +240,15 @@ | ||
| 237 | 240 | ** part to the end of an optional sidebox. |
| 238 | 241 | */ |
| 239 | 242 | @ <div class="endContent"></div> |
| 240 | 243 | } |
| 241 | 244 | @ </div> |
| 245 | + | |
| 246 | + /* Set the href= field on hyperlinks. Do this before the footer since | |
| 247 | + ** the footer will be generating </html> */ | |
| 248 | + style_resolve_href(); | |
| 249 | + | |
| 242 | 250 | zFooter = db_get("footer", (char*)zDefaultFooter); |
| 243 | 251 | if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1); |
| 244 | 252 | Th_Render(zFooter); |
| 245 | 253 | if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1); |
| 246 | 254 | |
| @@ -248,13 +256,10 @@ | ||
| 248 | 256 | if( g.thTrace ){ |
| 249 | 257 | cgi_append_content("<span class=\"thTrace\"><hr />\n", -1); |
| 250 | 258 | cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog)); |
| 251 | 259 | cgi_append_content("</span>\n", -1); |
| 252 | 260 | } |
| 253 | - | |
| 254 | - /* Set the href= field on hyperlinks */ | |
| 255 | - style_resolve_href(); | |
| 256 | 261 | } |
| 257 | 262 | |
| 258 | 263 | /* |
| 259 | 264 | ** Begin a side-box on the right-hand side of a page. The title and |
| 260 | 265 | ** the width of the box are given as arguments. The width is usually |
| 261 | 266 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -122,14 +122,17 @@ | |
| 122 | ** Generate javascript that will set the href= attribute on all anchors. |
| 123 | */ |
| 124 | void style_resolve_href(void){ |
| 125 | int i; |
| 126 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 127 | @ <script> |
| 128 | for(i=0; i<nHref; i++){ |
| 129 | @ document.getElementById(%d(i+1)).href="%s(aHref[i])"; |
| 130 | } |
| 131 | @ </script> |
| 132 | } |
| 133 | |
| 134 | /* |
| 135 | ** Add a new element to the submenu |
| @@ -237,10 +240,15 @@ | |
| 237 | ** part to the end of an optional sidebox. |
| 238 | */ |
| 239 | @ <div class="endContent"></div> |
| 240 | } |
| 241 | @ </div> |
| 242 | zFooter = db_get("footer", (char*)zDefaultFooter); |
| 243 | if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1); |
| 244 | Th_Render(zFooter); |
| 245 | if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1); |
| 246 | |
| @@ -248,13 +256,10 @@ | |
| 248 | if( g.thTrace ){ |
| 249 | cgi_append_content("<span class=\"thTrace\"><hr />\n", -1); |
| 250 | cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog)); |
| 251 | cgi_append_content("</span>\n", -1); |
| 252 | } |
| 253 | |
| 254 | /* Set the href= field on hyperlinks */ |
| 255 | style_resolve_href(); |
| 256 | } |
| 257 | |
| 258 | /* |
| 259 | ** Begin a side-box on the right-hand side of a page. The title and |
| 260 | ** the width of the box are given as arguments. The width is usually |
| 261 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -122,14 +122,17 @@ | |
| 122 | ** Generate javascript that will set the href= attribute on all anchors. |
| 123 | */ |
| 124 | void style_resolve_href(void){ |
| 125 | int i; |
| 126 | if( !g.perm.Hyperlink || !g.javascriptHyperlink || nHref==0 ) return; |
| 127 | @ <script type="text/JavaScript"> |
| 128 | @ /* <![CDATA[ */ |
| 129 | @ function u(i,h){ document.getElementById(i).href=h; } |
| 130 | for(i=0; i<nHref; i++){ |
| 131 | @ u(%d(i+1),"%s(aHref[i])"); |
| 132 | } |
| 133 | @ /* ]]> */ |
| 134 | @ </script> |
| 135 | } |
| 136 | |
| 137 | /* |
| 138 | ** Add a new element to the submenu |
| @@ -237,10 +240,15 @@ | |
| 240 | ** part to the end of an optional sidebox. |
| 241 | */ |
| 242 | @ <div class="endContent"></div> |
| 243 | } |
| 244 | @ </div> |
| 245 | |
| 246 | /* Set the href= field on hyperlinks. Do this before the footer since |
| 247 | ** the footer will be generating </html> */ |
| 248 | style_resolve_href(); |
| 249 | |
| 250 | zFooter = db_get("footer", (char*)zDefaultFooter); |
| 251 | if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1); |
| 252 | Th_Render(zFooter); |
| 253 | if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1); |
| 254 | |
| @@ -248,13 +256,10 @@ | |
| 256 | if( g.thTrace ){ |
| 257 | cgi_append_content("<span class=\"thTrace\"><hr />\n", -1); |
| 258 | cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog)); |
| 259 | cgi_append_content("</span>\n", -1); |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | /* |
| 264 | ** Begin a side-box on the right-hand side of a page. The title and |
| 265 | ** the width of the box are given as arguments. The width is usually |
| 266 |