// bxA 1.1.4 core var bxA = {}; bxA.sDs = 30; // summary display size bxA.sDt = 'w'; // summary display type: [w] words; [p] %; [c] chars bxA.pSr = 1.5; // post to summary ratio bxA.dPa = 'i'; // display post action: [i] inline or [p] post page bxA.ePc = false; // entire post is clickable bxA.eSc = false; // entire summary is clickable bxA.aTs = '…'; // append to summary bxA.rMl = 'More ▼'; // read more link bxA.rLl = '▲'; // read less link bxA.rPl = 'More ►'; // read page link bxA.lCn = 'bxAlink'; // read more/less link class name function bx(id) { return document.getElementById(id); } function bxAnoHTML(h) { var t = h; t = t.replace(/((.|\n)*?)(<\/script>)/gi, ' '); t = t.replace(/<.*?>/g, ' '); t = t.replace(/\s/g, ' '); t = t.replace(/[ ]{2,}/g, ' '); t = t.substring(1); return t; } function bxAclean(id) { var eB = bx('bxAb' + id); var a = eB.innerHTML; var b = a.indexOf('[bxA'); var c = a.indexOf(']', b); var d = a.indexOf('[BXA'); var e = ''; if (d < 0 && b > -1) { e = a.substring(b, c + 1); eB.innerHTML = a.replace(e, '' + e.toUpperCase() + '<\/span>'); } } function bxAitem(id) { bxAclean(id); } function bxAindex(id) { var eS = bx('bxAs' + id); var eB = bx('bxAb' + id); var eM = bx('bxAm' + id); var eL = bx('bxAl' + id); var eP = bx('bxAp' + id); var bwt, bnt, swt, snt, x, y, z, c, i, q, dpa, epc, esc, psr; var aWords = []; bwt = eB.innerHTML; bnt = bxAnoHTML(bwt); x = bwt.indexOf('[bxA'); y = bwt.indexOf('[BXA'); if (y > -1) { x = y; } psr = bxA.pSr; dpa = bxA.dPa; if (x > -1) { z = bwt.indexOf(']', x); c = bwt.substring(x + 4, z); c = c.toLowerCase(); switch (c) { case 'i': dpa = 'i'; break; case 'p': dpa = 'p'; break; default: break; } if (y < 0) { bxAclean(id); } } if (x > -1) { swt = bwt.substring(0, x); snt = bxAnoHTML(swt); if ((bnt.length - snt.length) == (z - x + 2)) { psr = 1000; } else { psr = 0.1; } } else { switch (bxA.sDt) { case 'w': aWords = bnt.split(' '); aWords = aWords.slice(0, bxA.sDs); snt = aWords.join(' '); break; case 'p': snt = bnt.substring(0, parseInt((bnt.length * (bxA.sDs / 100)), 10)); break; default: snt = bnt.substring(0, bxA.sDs); break; } aWords = snt.split(' '); for (i = 0; i < aWords.length; i++) { q = bwt.indexOf(aWords[i], q); } q = q + aWords[i - 1].length; swt = bwt.substring(0, q); } epc = bxA.ePc; esc = bxA.eSc; eM.style.display = eL.style.display = eS.style.display = eP.style.display = eB.style.display = 'none'; if ((bnt.length) > (snt.length * psr)) { swt += bxA.aTs; eS.innerHTML = swt; eS.style.display = 'inline'; eP.innerHTML = bxA.rPl; eM.innerHTML = bxA.rMl; eL.innerHTML = bxA.rLl; eM.className = eL.className = eP.className = bxA.lCn; if (dpa === 'i') { eM.style.display = 'inline'; } else { eP.style.display = 'inline'; } } else { eB.style.display = 'inline'; epc = esc = false; } if (!epc) { eB.setAttribute('onclick', ''); } if (!esc) { eS.setAttribute('onclick', ''); } } function bxAclick(id) { var eS = bx('bxAs' + id); var eB = bx('bxAb' + id); var eM = bx('bxAm' + id); var eP = bx('bxAp' + id); var eL = bx('bxAl' + id); if (eP.style.display === 'none') { if (eB.style.display === 'none') { eB.style.display = eL.style.display = 'inline'; eS.style.display = eM.style.display = 'none'; } else { eB.style.display = eL.style.display = 'none'; eS.style.display = eM.style.display = 'inline'; } } } // bxA 1.1.4 core