Skip to content

Commit 4ca7151

Browse files
committed
Fixed #14 - $.browser deprecated
1 parent 49e6856 commit 4ca7151

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

demos/default.html

-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ <h3 class="headerDoc well"><a href="http://bonsaiden.github.com/JavaScript-Garde
389389
<script src="javascripts/bootstrap.js"></script>
390390
<script src="../src/javascripts/jquery.tocify.js"></script>
391391
<script src="javascripts/prettify.js"></script>
392-
<script src="javascripts/githubrepo.js"></script>
393392
<script>
394393
$(function() {
395394

libs/jquery/jquery-1.8.3.min.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/javascripts/jquery.tocify.js

+22-2
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,31 @@
114114
// Adds CSS classes to the newly generated table of contents HTML
115115
self._addCSSClasses();
116116

117+
self.webkit = (function() {
118+
119+
for(var prop in window) {
120+
121+
if(prop) {
122+
123+
if(prop.toLowerCase().indexOf("webkit") !== -1) {
124+
125+
return true;
126+
127+
}
128+
129+
}
130+
131+
}
132+
133+
return false;
134+
135+
}());
136+
117137
// Adds jQuery event handlers to the newly generated table of contents
118138
self._setEventHandlers();
119139

120140
// Binding to the Window load event to make sure the correct scrollTop is calculated
121-
window.addEventListener("load", function() {
141+
$(window).load(function() {
122142

123143
// Sets the active TOC item
124144
self._setActiveElement();
@@ -452,7 +472,7 @@
452472
if(self.options.extendPage) {
453473

454474
// If the user has scrolled to the bottom of the page and the last toc item is not focused
455-
if(($.browser.webkit && winScrollTop >= scrollHeight - winHeight - self.options.extendPageOffset) || (!$.browser.webkit && winHeight + winScrollTop > docHeight - self.options.extendPageOffset)) {
475+
if((self.webkit && winScrollTop >= scrollHeight - winHeight - self.options.extendPageOffset) || (!self.webkit && winHeight + winScrollTop > docHeight - self.options.extendPageOffset)) {
456476

457477
self.element.scrollTop(winScrollTop);
458478

src/javascripts/jquery.tocify.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)