From 42cd267e187e0cf17f742cc2b71f5c5c8e5b0150 Mon Sep 17 00:00:00 2001 From: Koen Reefman Date: Thu, 9 Feb 2017 08:49:37 +0000 Subject: [PATCH] VGLD#39349 geen clone, nu met prefix en postfix icoontjes sorteren svn path=/Website/branches/v2016.3/; revision=32761 --- APPL/Localscripts/sorttable.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/APPL/Localscripts/sorttable.js b/APPL/Localscripts/sorttable.js index 0ab5c93ade..a18a109d90 100644 --- a/APPL/Localscripts/sorttable.js +++ b/APPL/Localscripts/sorttable.js @@ -239,31 +239,32 @@ var sorttable = { var hasInputs = (typeof node.getElementsByTagName == 'function') && node.getElementsByTagName('input').length; - var hasIcons = node.querySelectorAll('i.fa').length > 0; + var hasFontAwesome = node.querySelectorAll('i.fa').length > 0; + var prefix, infix, postfix = ""; - if (hasIcons) + if (hasFontAwesome) { - var iconClass; - node = node.cloneNode(true); - var icons = node.querySelectorAll('i.fa'); - for(var icon = 0; icon < icons.length; icon++) + for (var i = 0; i < node.childNodes.length; i++) { + if (node.childNodes[i].className != "") { - iconClass = document.createTextNode(icons[icon].className); - node.replaceChild(iconClass, icons[icon]); // just for sorting purposes + if (i == 0) prefix = node.childNodes[i].className; + else if (i == node.childNodes.length - 1) postfix = node.childNodes[i].className; + else postfix = node.childNodes[i].className; // infix maar even als postfix } + } } if (node.getAttribute("sorttable_customkey") != null) { return node.getAttribute("sorttable_customkey"); } else if (typeof node.textContent != 'undefined' && !hasInputs) { - return node.textContent.replace(/^\s+|\s+$/g, ''); + return prefix + node.textContent.replace(/^\s+|\s+$/g, '') + postfix; } else if (typeof node.innerText != 'undefined' && !hasInputs) { - return node.innerText.replace(/^\s+|\s+$/g, ''); + return prefix + node.innerText.replace(/^\s+|\s+$/g, '') + postfix; } else if (typeof node.text != 'undefined' && !hasInputs) { - return node.text.replace(/^\s+|\s+$/g, ''); + return prefix + node.text.replace(/^\s+|\s+$/g, '') + postfix; } else { switch (node.nodeType) {