Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<div class="alpha-controls" id="alpha-controls">
<div class="letter" id="see-all" onclick="alpha.search('');">Tous</div>
<div class="letter" id="letter-a" onclick="alpha.search('a');">a</div>
<div class="letter" id="letter-b" onclick="alpha.search('b');">b</div>
<div class="letter" id="letter-c" onclick="alpha.search('c');">c</div>
<div class="letter" id="letter-d" onclick="alpha.search('d');">d</div>
<div class="letter" id="letter-e" onclick="alpha.search('e');">e</div>
<div class="letter" id="letter-f" onclick="alpha.search('f');">f</div>
<div class="letter" id="letter-g" onclick="alpha.search('g');">g</div>
<div class="letter" id="letter-h" onclick="alpha.search('h');">h</div>
<div class="letter" id="letter-i" onclick="alpha.search('i');">i</div>
<div class="letter" id="letter-j" onclick="alpha.search('j');">j</div>
<div class="letter" id="letter-k" onclick="alpha.search('k');">k</div>
<div class="letter" id="letter-l" onclick="alpha.search('l');">l</div>
<div class="letter" id="letter-m" onclick="alpha.search('m');">m</div>
<div class="letter" id="letter-n" onclick="alpha.search('n');">n</div>
<div class="letter" id="letter-o" onclick="alpha.search('o');">o</div>
<div class="letter" id="letter-p" onclick="alpha.search('p');">p</div>
<div class="letter" id="letter-p" onclick="alpha.search('q');">q</div>
<div class="letter" id="letter-r" onclick="alpha.search('r');">r</div>
<div class="letter" id="letter-s" onclick="alpha.search('s');">s</div>
<div class="letter" id="letter-t" onclick="alpha.search('t');">t</div>
<div class="letter" id="letter-u" onclick="alpha.search('u');">u</div>
<div class="letter" id="letter-v" onclick="alpha.search('v');">v</div>
<div class="letter" id="letter-w" onclick="alpha.search('w');">w</div>
<div class="letter" id="letter-x" onclick="alpha.search('x');">x</div>
<div class="letter" id="letter-y" onclick="alpha.search('y');">y</div>
<div class="letter" id="letter-z" onclick="alpha.search('z');">z</div>
</div>
<script>
(function() {
window.alpha = window.alpha || {};
alpha.globals = {
"alphaControlsId": "alpha-controls",
"alphaActiveLetterAttr": "data-active-letter"
}
alpha.clearSelectedLetter = function () {
var alphaControls = document.getElementById(alpha.globals.alphaControlsId);
var activeLetterId = alphaControls.getAttribute(alpha.globals.alphaActiveLetterAttr);
if(activeLetterId) {
var activeLetter = document.getElementById(activeLetterId);
if(activeLetter) {
activeLetter.className = activeLetter.className.split(' ')[0];
}
}
};
alpha.search = function(letter) {
var alphaControls = document.getElementById(alpha.globals.alphaControlsId);
var currentLetterId = "letter-" + letter;
var activeLetterId = alphaControls.getAttribute(alpha.globals.alphaActiveLetterAttr);
var searchKeyword, searchKeywordDefaultValue, searchFilter, searchBoxInput, updateParts, filter;
alpha.clearSelectedLetter();
if(letter === "" || letter.length === 0 || currentLetterId === activeLetterId) {
filter = "";
alphaControls.setAttribute(alpha.globals.alphaActiveLetterAttr, "");
}
else {
//if not the same letter - set a new letter
var currentLetter = document.getElementById(currentLetterId);
currentLetter.className = currentLetter.className + " active";
alphaControls.setAttribute(alpha.globals.alphaActiveLetterAttr, currentLetterId);
filter = "Sujet:" + letter + "*";
}
updateParts = { k: filter, s: "" };
ajaxNavigate.update(null, updateParts);
}
})();
EnsureScriptFunc("sp.ui.dialog.js", "SP.UI.ModalDialog.showModalDialog", null);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.