Lines 33-48
function addBibToContext( bibnum ) {
Link Here
|
33 |
setContextBiblioNumbers( $.uniqueArray( bibnums ) ); |
33 |
setContextBiblioNumbers( $.uniqueArray( bibnums ) ); |
34 |
} |
34 |
} |
35 |
|
35 |
|
|
|
36 |
function addAuthToContext( authid ) { |
37 |
var authids = getContextAuthIds(); |
38 |
authids.push( authid ); |
39 |
setContextAuthIds( authids ); |
40 |
} |
41 |
|
36 |
function delBibToContext( bibnum ) { |
42 |
function delBibToContext( bibnum ) { |
37 |
var bibnums = getContextBiblioNumbers(); |
43 |
var bibnums = getContextBiblioNumbers(); |
38 |
removeByValue( bibnums, bibnum ); |
44 |
removeByValue( bibnums, bibnum ); |
39 |
setContextBiblioNumbers( $.uniqueArray( bibnums ) ); |
45 |
setContextBiblioNumbers( $.uniqueArray( bibnums ) ); |
40 |
} |
46 |
} |
41 |
|
47 |
|
|
|
48 |
function delAuthToContext( authid ) { |
49 |
var authids = getContextAuthIds(); |
50 |
removeByValue( authids, authid ); |
51 |
setContextAuthIds( $.uniqueArray( authids ) ); |
52 |
} |
53 |
|
42 |
function setContextBiblioNumbers( bibnums ) { |
54 |
function setContextBiblioNumbers( bibnums ) { |
43 |
$.cookie('bibs_selected', JSON.stringify( bibnums )); |
55 |
$.cookie('bibs_selected', JSON.stringify( bibnums )); |
44 |
} |
56 |
} |
45 |
|
57 |
|
|
|
58 |
function setContextAuthIds( authids ) { |
59 |
$.cookie('auths_selected', JSON.stringify( authids )); |
60 |
} |
61 |
|
46 |
function getContextBiblioNumbers() { |
62 |
function getContextBiblioNumbers() { |
47 |
var r = $.cookie('bibs_selected'); |
63 |
var r = $.cookie('bibs_selected'); |
48 |
if ( r ) { |
64 |
if ( r ) { |
Lines 52-72
function getContextBiblioNumbers() {
Link Here
|
52 |
return r; |
68 |
return r; |
53 |
} |
69 |
} |
54 |
|
70 |
|
55 |
function resetSearchContext() { |
71 |
function getContextAuthIds() { |
|
|
72 |
var r = $.cookie('auths_selected'); |
73 |
if ( r ) { |
74 |
return JSON.parse(r); |
75 |
} |
76 |
r = new Array(); |
77 |
return r; |
78 |
} |
79 |
|
80 |
function resetBiblioSearchContext() { |
56 |
setContextBiblioNumbers( new Array() ); |
81 |
setContextBiblioNumbers( new Array() ); |
57 |
} |
82 |
} |
58 |
|
83 |
|
|
|
84 |
function resetAuthSearchContext() { |
85 |
setContextAuthIds( new Array() ); |
86 |
} |
87 |
|
59 |
$(document).ready(function(){ |
88 |
$(document).ready(function(){ |
60 |
// forms with action leading to search |
89 |
// forms with action leading to search |
61 |
$("form[action*='opac-search.pl']").submit(function(){ |
90 |
$("form[action*='opac-search.pl']").submit(function(){ |
62 |
resetSearchContext(); |
91 |
resetBiblioSearchContext(); |
63 |
}); |
92 |
}); |
64 |
// any link to launch a search except navigation links |
93 |
// any link to launch a search except navigation links |
65 |
$("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){ |
94 |
$("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){ |
66 |
resetSearchContext(); |
95 |
resetBiblioSearchContext(); |
67 |
}); |
96 |
}); |
68 |
// any link to a detail page from the results page. |
97 |
// any link to a detail page from the results page. |
69 |
$("#bookbag_form a[href*='opac-detail.pl?']").click(function(){ |
98 |
$("#bookbag_form a[href*='opac-detail.pl?']").click(function(){ |
70 |
resetSearchContext(); |
99 |
resetBiblioSearchContext(); |
|
|
100 |
}); |
101 |
|
102 |
$("form[action*='opac-authorities-home.pl']").submit(function(){ |
103 |
resetAuthSearchContext(); |
104 |
}); |
105 |
$("[href*='opac-authorities-home.pl?']").not(".nav").not('.searchwithcontext').click(function(){ |
106 |
resetBiblioSearchContext(); |
107 |
}); |
108 |
$("#opac-authorities-home.pl a[href*='opac-authorities-home.pl?']").click(function(){ |
109 |
resetAuthSearchContext(); |
71 |
}); |
110 |
}); |
72 |
}); |
111 |
}); |