Fossil SCM

Make gebi() work on browsers with javascipt < 5.1

jan.nijtmans 2015-02-26 12:25 trunk
Commit e7ec49815b988811f8a8c4493209a5951a3a5e30
1 file changed +2 -2
+2 -2
--- src/style.c
+++ src/style.c
@@ -406,13 +406,13 @@
406406
** HEAD code can make use of it, but because the client can replace
407407
** the HEAD, and some fossil pages rely on gebi(), we put it here.
408408
*/
409409
@ <script>
410410
@ function gebi(x){
411
- @ if(/^#/.test(x)) x = x.substr(1);
411
+ @ if(x.substr(0,1)=='#') x = x.substr(1);
412412
@ var e = document.getElementById(x);
413
- @ if(!e) throw new Error("Expecting element with ID "+x);
413
+ @ if(!e) throw new Error('Expecting element with ID '+x);
414414
@ else return e;}
415415
@ </script>
416416
}
417417
418418
#if INTERFACE
419419
--- src/style.c
+++ src/style.c
@@ -406,13 +406,13 @@
406 ** HEAD code can make use of it, but because the client can replace
407 ** the HEAD, and some fossil pages rely on gebi(), we put it here.
408 */
409 @ <script>
410 @ function gebi(x){
411 @ if(/^#/.test(x)) x = x.substr(1);
412 @ var e = document.getElementById(x);
413 @ if(!e) throw new Error("Expecting element with ID "+x);
414 @ else return e;}
415 @ </script>
416 }
417
418 #if INTERFACE
419
--- src/style.c
+++ src/style.c
@@ -406,13 +406,13 @@
406 ** HEAD code can make use of it, but because the client can replace
407 ** the HEAD, and some fossil pages rely on gebi(), we put it here.
408 */
409 @ <script>
410 @ function gebi(x){
411 @ if(x.substr(0,1)=='#') x = x.substr(1);
412 @ var e = document.getElementById(x);
413 @ if(!e) throw new Error('Expecting element with ID '+x);
414 @ else return e;}
415 @ </script>
416 }
417
418 #if INTERFACE
419

Keyboard Shortcuts

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