@@ -4,10 +4,36 @@ var localStorage = {}, sessionStorage = {};
4
4
try { localStorage = window . localStorage ; } catch ( e ) { }
5
5
try { sessionStorage = window . sessionStorage ; } catch ( e ) { }
6
6
7
+ jQuery . fn . oldToggle = function ( fn , fn2 ) {
8
+ // Save reference to arguments for access in closure
9
+ var args = arguments ,
10
+ guid = fn . guid || jQuery . guid ++ ,
11
+ i = 0 ,
12
+ toggler = function ( event ) {
13
+ // Figure out which function to execute
14
+ var lastToggle = ( jQuery . _data ( this , "lastToggle" + fn . guid ) || 0 ) % i ;
15
+ jQuery . _data ( this , "lastToggle" + fn . guid , lastToggle + 1 ) ;
16
+
17
+ // Make sure that clicks stop
18
+ event . preventDefault ( ) ;
19
+
20
+ // and execute the function
21
+ return args [ lastToggle ] . apply ( this , arguments ) || false ;
22
+ } ;
23
+
24
+ // link all the functions, so any of them can unbind this click handler
25
+ toggler . guid = guid ;
26
+ while ( i < args . length ) {
27
+ args [ i ++ ] . guid = guid ;
28
+ }
29
+
30
+ return this . click ( toggler ) ;
31
+ } ;
32
+
7
33
function createSourceLinks ( ) {
8
34
$ ( '.method_details_list .source_code' ) .
9
35
before ( "<span class='showSource'>[<a href='#' class='toggleSource'>View source</a>]</span>" ) ;
10
- $ ( '.toggleSource' ) . toggle ( function ( ) {
36
+ $ ( '.toggleSource' ) . oldToggle ( function ( ) {
11
37
$ ( this ) . parent ( ) . nextAll ( '.source_code' ) . slideDown ( 100 ) ;
12
38
$ ( this ) . text ( "Hide source" ) ;
13
39
} ,
@@ -20,7 +46,7 @@ function createSourceLinks() {
20
46
function createDefineLinks ( ) {
21
47
var tHeight = 0 ;
22
48
$ ( '.defines' ) . after ( " <a href='#' class='toggleDefines'>more...</a>" ) ;
23
- $ ( '.toggleDefines' ) . toggle ( function ( ) {
49
+ $ ( '.toggleDefines' ) . oldToggle ( function ( ) {
24
50
tHeight = $ ( this ) . parent ( ) . prev ( ) . height ( ) ;
25
51
$ ( this ) . prev ( ) . css ( 'display' , 'inline' ) ;
26
52
$ ( this ) . parent ( ) . prev ( ) . height ( $ ( this ) . parent ( ) . height ( ) ) ;
@@ -35,7 +61,7 @@ function createDefineLinks() {
35
61
36
62
function createFullTreeLinks ( ) {
37
63
var tHeight = 0 ;
38
- $ ( '.inheritanceTree' ) . toggle ( function ( ) {
64
+ $ ( '.inheritanceTree' ) . oldToggle ( function ( ) {
39
65
tHeight = $ ( this ) . parent ( ) . prev ( ) . height ( ) ;
40
66
$ ( this ) . parent ( ) . toggleClass ( 'showAll' ) ;
41
67
$ ( this ) . text ( "(hide)" ) ;
@@ -216,7 +242,7 @@ function generateTOC() {
216
242
html = '<div id="toc"><p class="title hide_toc"><a href="#"><strong>Table of Contents</strong></a></p></div>' ;
217
243
$ ( '#content' ) . prepend ( html ) ;
218
244
$ ( '#toc' ) . append ( _toc ) ;
219
- $ ( '#toc .hide_toc' ) . toggle ( function ( ) {
245
+ $ ( '#toc .hide_toc' ) . oldToggle ( function ( ) {
220
246
$ ( '#toc .top' ) . slideUp ( 'fast' ) ;
221
247
$ ( '#toc' ) . toggleClass ( 'hidden' ) ;
222
248
$ ( '#toc .title small' ) . toggle ( ) ;
0 commit comments