Fossil SCM

Improvements to the javascript that enables hyperlinks for anonymous users.

drh 2012-05-05 13:53 trunk
Commit 7fb59a67dc6ecf144d29b0d2e9ecff679bd6e034
1 file changed +10 -5
+10 -5
--- src/style.c
+++ src/style.c
@@ -122,14 +122,17 @@
122122
** Generate javascript that will set the href= attribute on all anchors.
123123
*/
124124
void style_resolve_href(void){
125125
int i;
126126
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; }
128130
for(i=0; i<nHref; i++){
129
- @ document.getElementById(%d(i+1)).href="%s(aHref[i])";
131
+ @ u(%d(i+1),"%s(aHref[i])");
130132
}
133
+ @ /* ]]> */
131134
@ </script>
132135
}
133136
134137
/*
135138
** Add a new element to the submenu
@@ -237,10 +240,15 @@
237240
** part to the end of an optional sidebox.
238241
*/
239242
@ <div class="endContent"></div>
240243
}
241244
@ </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
+
242250
zFooter = db_get("footer", (char*)zDefaultFooter);
243251
if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
244252
Th_Render(zFooter);
245253
if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
246254
@@ -248,13 +256,10 @@
248256
if( g.thTrace ){
249257
cgi_append_content("<span class=\"thTrace\"><hr />\n", -1);
250258
cgi_append_content(blob_str(&g.thLog), blob_size(&g.thLog));
251259
cgi_append_content("</span>\n", -1);
252260
}
253
-
254
- /* Set the href= field on hyperlinks */
255
- style_resolve_href();
256261
}
257262
258263
/*
259264
** Begin a side-box on the right-hand side of a page. The title and
260265
** the width of the box are given as arguments. The width is usually
261266
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button