Class: PageHTMLParser

PageHTMLParser($container)

new PageHTMLParser($container)

Parameters:
Name Type Description
$container jQuery.Object

Used when parsing to find children within this container

Source:

Members

(static) HEADING_SELECTOR

Selector for matching headings

Source:

Methods

findChildInSectionLead(sectionIndex, selector) → {jQuery.Object}

Finds all child elements that match the selector in a given section or subsection. Returns any direct child elements that match the selector, (i.e. searches only one level deep) as well as any elements that match the selector within those children. If the Page has no headings (e.g. a stub), then the search will target all nodes within the page.

This code should work on desktop (PHP parser HTML) as well as mobile formatted HTML (PHP parser + MobileFormatter)

Parameters:
Name Type Description
sectionIndex number

as defined by the PHP parser. It should correspond to the section id used in the edit link for the section. Note, confusingly, this is different from section "ID" which is used in methods

selector string

to match

Source:
Returns:
Type
jQuery.Object

findSectionHeadingByIndex(sectionIndex) → {jQuery.Object}

Find the heading in the page. This has the benefit of excluding any additional h2s and h3s that may have been added programatically.

Parameters:
Name Type Description
sectionIndex number

as defined by the PHP parser. It should correspond to the section id used in the edit link for the section. Note, confusingly, this is different from section "ID" which is used in methods

Source:
Returns:
Type
jQuery.Object

getLeadSectionElement() → {jQuery.Object|null}

Get the lead section of the page view.

Source:
Returns:
Type
jQuery.Object | null

Returns a jQuery object representing all redlinks on the page.

Source:
Returns:
Type
jQuery.Object

getThumbnails($elopt) → {Array.<Thumbnail>}

Return all the thumbnails in the article. Images which have a class or link container (.image|.thumbimage) that matches one of the items of the constant BLACKLISTED_THUMBNAIL_CLASS_SELECTORS will be excluded. A thumbnail nested inside one of these classes will still be returned. e.g. <div class="noviewer"><a class="image"><img></a></div> is not a valid thumbnail <a class="image noviewer"><img></a> is not a valid thumbnail <a class="image"><img class="noviewer"></a> is not a valid thumbnail

Parameters:
Name Type Attributes Description
$el jQuery <optional>

Container to search, defaults to this.$el.

Source:
Returns:
Type
Array.<Thumbnail>