Created
February 4, 2014 12:17
-
-
Save jsicot/8802606 to your computer and use it in GitHub Desktop.
Ajouters des langues dans la recherche avancée de l'opac Koha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function() { | |
if (jQuery('body#advsearch').size() > 0) { | |
addOptionsInSelectLangs(); | |
jQuery('#subtypes_unimarc fieldset:first-child').hide(); | |
} | |
}); | |
function addOptionsInSelectLangs(){ | |
AddOptionToSelect('language-limit', 'Brezhoneg (Breton)', 'ln,rtrn:bre'); | |
AddOptionToSelect('language-limit', 'Català (Catalan)', 'ln,rtrn:cat'); | |
sortDropDownListByText('language-limit'); | |
} | |
function sortDropDownListByText(selectId) { | |
var foption = $('#'+ selectId + ' option:first'); | |
var soptions = $('#'+ selectId + ' option:not(:first)').sort(function(a, b) { | |
return a.text == b.text ? 0 : a.text < b.text ? -1 : 1 | |
}); | |
$('#' + selectId).html(soptions).prepend(foption); | |
} | |
function AddOptionToSelect(selectId, optionText, optionValue) { | |
var opt = new Option(optionText, optionValue); | |
$(opt).html(optionText); | |
$('#'+ selectId).append(opt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment