Show More
@@ -366,15 +366,9 b' function offsetScroll(element, offset){' | |||
|
366 | 366 | // At the time of development, Chrome didn't seem to support jquery's :target |
|
367 | 367 | // element, so I had to scroll manually |
|
368 | 368 | if (location.hash) { |
|
369 |
var |
|
|
370 | if (splitIx !== -1){ | |
|
371 | var loc = location.hash.slice(0, splitIx); | |
|
372 | var remainder = location.hash.slice(splitIx + 2); | |
|
373 | } | |
|
374 | else{ | |
|
375 | var loc = location.hash; | |
|
376 | var remainder = null; | |
|
377 | } | |
|
369 | var result = splitDelimitedHash(location.hash); | |
|
370 | var loc = result.loc; | |
|
371 | var remainder = result.remainder; | |
|
378 | 372 | if (loc.length > 1){ |
|
379 | 373 | var lineno = $(loc+'.lineno'); |
|
380 | 374 | if (lineno.length > 0){ |
@@ -74,6 +74,29 b' String.prototype.capitalizeFirstLetter =' | |||
|
74 | 74 | |
|
75 | 75 | |
|
76 | 76 | /** |
|
77 | * Splits remainder | |
|
78 | * | |
|
79 | * @param input | |
|
80 | */ | |
|
81 | function splitDelimitedHash(input){ | |
|
82 | var splitIx = input.indexOf('/?/'); | |
|
83 | if (splitIx !== -1){ | |
|
84 | var loc = input.slice(0, splitIx); | |
|
85 | var remainder = input.slice(splitIx + 2); | |
|
86 | } | |
|
87 | else{ | |
|
88 | var loc = input; | |
|
89 | var remainder = null; | |
|
90 | } | |
|
91 | //fixes for some urls generated incorrectly | |
|
92 | var result = loc.match('#+(.*)'); | |
|
93 | if (result !== null){ | |
|
94 | loc = '#' + result[1]; | |
|
95 | } | |
|
96 | return {loc:loc, remainder: remainder} | |
|
97 | } | |
|
98 | ||
|
99 | /** | |
|
77 | 100 | * Escape html characters in string |
|
78 | 101 | */ |
|
79 | 102 | var entityMap = { |
@@ -372,9 +372,9 b'' | |||
|
372 | 372 | } |
|
373 | 373 | }); |
|
374 | 374 | |
|
375 |
if (location.h |
|
|
376 | var id = '#'+location.href.substring(location.href.indexOf('#') + 1).split('#'); | |
|
377 |
var line = $('html').find( |
|
|
375 | if (location.hash) { | |
|
376 | var result = splitDelimitedHash(location.hash); | |
|
377 | var line = $('html').find(result.loc); | |
|
378 | 378 | offsetScroll(line, 70); |
|
379 | 379 | } |
|
380 | 380 |
@@ -412,9 +412,9 b'' | |||
|
412 | 412 | %endif |
|
413 | 413 | |
|
414 | 414 | <script type="text/javascript"> |
|
415 |
if (location.h |
|
|
416 | var id = '#'+location.href.substring(location.href.indexOf('#') + 1).split('#'); | |
|
417 |
var line = $('html').find( |
|
|
415 | if (location.hash) { | |
|
416 | var result = splitDelimitedHash(location.hash); | |
|
417 | var line = $('html').find(result.loc); | |
|
418 | 418 | offsetScroll(line, 70); |
|
419 | 419 | } |
|
420 | 420 | $(function(){ |
General Comments 0
You need to be logged in to leave comments.
Login now