Lines 449-455
Link Here
|
449 |
|
449 |
|
450 |
[% BLOCK jsinclude %] |
450 |
[% BLOCK jsinclude %] |
451 |
[% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %] |
451 |
[% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %] |
452 |
[% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %] |
|
|
453 |
<script> |
452 |
<script> |
454 |
$(document).ready(function() { |
453 |
$(document).ready(function() { |
455 |
[% IF search_groups %] |
454 |
[% IF search_groups %] |
Lines 472-483
$(document).ready(function() {
Link Here
|
472 |
[% END %] |
471 |
[% END %] |
473 |
|
472 |
|
474 |
$('#advsearches').tabs(); |
473 |
$('#advsearches').tabs(); |
475 |
jQuery.cookie.json = true; |
|
|
476 |
|
474 |
|
477 |
$('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide(); |
475 |
$('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide(); |
478 |
|
476 |
|
479 |
[% IF ( ReturnToSearch ) %] |
477 |
[% IF ( ReturnToSearch ) %] |
480 |
if (form_serialized = jQuery.cookie("form_serialized")) { |
478 |
if (form_serialized = JSON.parse( Cookies.get("form_serialized") ) ) { |
481 |
// Add missing term inputs if there were more than 3 |
479 |
// Add missing term inputs if there were more than 3 |
482 |
var count = (form_serialized.match(/&q=/g) || []).length; |
480 |
var count = (form_serialized.match(/&q=/g) || []).length; |
483 |
for(var i = 3 ; i < count ; i++) { |
481 |
for(var i = 3 ; i < count ; i++) { |
Lines 485-491
$(document).ready(function() {
Link Here
|
485 |
} |
483 |
} |
486 |
$('#advsearch form').deserialize(form_serialized); |
484 |
$('#advsearch form').deserialize(form_serialized); |
487 |
} |
485 |
} |
488 |
if (form_serialized_limits = jQuery.cookie("form_serialized_limits")) { |
486 |
if (form_serialized_limits = JSON.parse( Cookies.get("form_serialized_limits") ) ) { |
489 |
$('#language-limit') .val(form_serialized_limits[0]); |
487 |
$('#language-limit') .val(form_serialized_limits[0]); |
490 |
$('#branchloop') .val(form_serialized_limits[1]); |
488 |
$('#branchloop') .val(form_serialized_limits[1]); |
491 |
$('#subtype_audience') .val(form_serialized_limits[2]); |
489 |
$('#subtype_audience') .val(form_serialized_limits[2]); |
Lines 496-504
$(document).ready(function() {
Link Here
|
496 |
} |
494 |
} |
497 |
[% ELSE %] |
495 |
[% ELSE %] |
498 |
//Clear all form cookies |
496 |
//Clear all form cookies |
499 |
jQuery.removeCookie("form_serialized", { path: '/'}); |
497 |
Cookies.remove("form_serialized", { path: '/'}); |
500 |
jQuery.removeCookie("form_serialized_limits", { path: '/'}); |
498 |
Cookies.remove("form_serialized_limits", { path: '/'}); |
501 |
jQuery.removeCookie("search_path_code", { path: '/'}); |
499 |
Cookies.remove("search_path_code", { path: '/'}); |
502 |
[% END %] |
500 |
[% END %] |
503 |
$('#advsearch_form').submit(function() { |
501 |
$('#advsearch_form').submit(function() { |
504 |
$('[name^="limit"]').each(function(){ |
502 |
$('[name^="limit"]').each(function(){ |
Lines 514-531
$(document).ready(function() {
Link Here
|
514 |
} |
512 |
} |
515 |
}); |
513 |
}); |
516 |
form_serialized = $(this).serialize(); |
514 |
form_serialized = $(this).serialize(); |
517 |
jQuery.cookie("form_serialized", form_serialized,{ path: '/'}); |
515 |
Cookies.set("form_serialized", JSON.stringify( form_serialized ), { path: '/'}); |
518 |
form_serialized_limits = [ |
516 |
form_serialized_limits = [ |
519 |
$('#language-limit').val(), $('#branchloop').val(), |
517 |
$('#language-limit').val(), $('#branchloop').val(), |
520 |
$('#subtype_audience').val(), $('#subtype_content').val(), |
518 |
$('#subtype_audience').val(), $('#subtype_content').val(), |
521 |
$('#subtype_format').val(), $('#subtype_additional').val(), |
519 |
$('#subtype_format').val(), $('#subtype_additional').val(), |
522 |
$('#locloop').val() |
520 |
$('#locloop').val() |
523 |
]; |
521 |
]; |
524 |
jQuery.cookie("form_serialized_limits", form_serialized_limits,{ path: '/'}); |
522 |
Cookies.set("form_serialized_limits", JSON.stringify( form_serialized_limits ),{ path: '/'}); |
525 |
[% IF ( expanded_options ) %] |
523 |
[% IF ( expanded_options ) %] |
526 |
jQuery.cookie("search_path_code", 'exs',{ path: '/'}); |
524 |
Cookies.set("search_path_code", JSON.stringify('exs'), { path: '/'}); |
527 |
[% ELSE %] |
525 |
[% ELSE %] |
528 |
jQuery.cookie("search_path_code", 'ads',{ path: '/'}); |
526 |
Cookies.set("search_path_code", JSON.stringify('ads'), { path: '/'}); |
529 |
[% END %] |
527 |
[% END %] |
530 |
}); |
528 |
}); |
531 |
|
529 |
|