confluence extraction for PamW

by Gerald Gillespie

HTML

<div id="main-content"><div>
    <table>
        <tbody>
            <tr>
                <td>
                    <p>Titles</p>
                </td>
                <td>How to troubleshoot long logins when using LDAP authentication on the K1000 appliance</td>
            </tr>
            <tr>
                <td>
                    <p>Description</p>
                </td>
                <td>This article describes how to troubleshoot delayed logins with the K1000 when LDAP is enabled.</td>
            </tr>
            <tr>
                <td colspan="1">Symptoms</td>
                <td colspan="1">
                    <ul>
                        <li>local admin user can login with no problems or delays, but single or multiple users experience delays</li>
                        <li>The access log will show a delay:
                            <ul>
                                <li><span data-mce-style="color: #0000ff;">[2013-06-27 10:45:55 -0500] 127.0.0.1 - "POST /adminui/check_login.php HTTP/1.1" 302 - 661 770 10</span>

                                    <ul>
                                        <li>The very last number ('10') is the number of seconds it took for the request to be processed.</li>
                                    </ul>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </td>
            </tr>
            <tr>
                <td colspan="1">Cause</td>
                <td colspan="1">
                    <p>Multiple causes:</p>
                    <ul>
                        <li>Misconfigured LDAP authentication schedules.</li>
                        <li>Misconfigured user LDAP labels.</li>
                        <li>Linked appliances' LDAP misconfiguration.</li>
                    </ul>
                </td>
            </tr>
            <tr>
                <td>
                    <p>Solution</p>
                </td>
            ...

CSS

td {
    border-style :solid;
    border-width : 1px;
    border-color : black
}
/* styling to make the link look like a button */
 .button {
    -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
    -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
    box-shadow:inset 0px 1px 0px 0px #ffffff;
    background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf));
    background:-moz-linear-gradient(center top, #ededed 5%, #dfdfdf 100%);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
    background-color:#ededed;
    -moz-border-radius:6px;
    -webkit-border-radius:6px;
    border-radius:6px;
    border:1px solid #dcdcdc;
    display:inline-block;
    color:#777777;
    font-family:arial;
    font-size:15px;
    font-weight:bold;
    padding:6px 24px;
    text-decoration:none;
    text-shadow:1px 1px 0px #ffffff;
}
.button:hover {
    background:-webkit-gradient(linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed));
    background:-moz-linear-gradient(center top, #dfdfdf 5%, #ededed 100%);
    filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');
    background-color:#dfdfdf;
}
.button:active {
    position:relative;
    top:1px;
}
/* This imageless css button was generated by CSSButtonGenerator.com */

JavaScript

(function ($) {
    /* created by Gerald Gillespie 
     * Dell Kace 2013
     */
    var $rows = $('#main-content > div > table > tbody > tr'), // need this precise hierarchy to ignore nested tables
        exportedClass = 'exported',

        //helper function to export encoded html jQuery style
        HtmlEncode = function (t) {
            return t ? $('<div/>').text(t).html() : t;
        },

        // get content relative to given KB attribute
        getContent = function (keyword, rows, newClass,text) {
            var $content = false, // default content is false which means it wasn't found
                newClass = newClass || 'exported';
            $(rows).each(function () {
                var $this = $(this).find('td:eq(0)');
                for (var i = 0, l = keyword.length; i < l; i++) {
                    var rgx = new RegExp('^' + keyword[i].trim() + '$', 'i');
                    if (rgx.test($this.text().trim().toLowerCase())) {
                        $this.addClass(newClass);
                        // if ($this.text().trim().toLowerCase() == keyword[i].trim().toLowerCase()) {
                        if(!text) { 
                            $content = !$content ? $this.next('td').html() : $content + $this.next('td').html();
                        } else {
                            $content = !$content ? $this.next('td').text() : $content + $this.next('td').text();   
                        } // end if
                        // return true to allow the each to continue and find more matches to occur
                        // in event of multiple items with same name (or more likely match same pattern) they will all be concatenated in one entry
                        return true;
                    }
                } // end for
            }); // end each
            return $content;
        }, // end getContent

        /* object of potential attributes of a KB  
         * 
         * "component" is the document attribute.
    ...