SocialShare

Sets social share elements in article, in main nav and in submenu popup

Source:
Properties:
Name Type Description
socialShare Object

DOM reference to the navigation bar

selector String

DOM selector for social share attributes

commentsSelector String

DOM selector for comments section

articleUrl String

Article URL from meta tags

articleUrlEncoded String

encoded article URL from meta tags

articleTitle String

Article title from meta tags

articleTitleEncoded String

encoded article title from meta tags

navbarLongformClass String

DOM selector for navbar on longform template

longformHeaderClass String

DOM selector for header on longform template

interactiveHeaderClass String

DOM selector for header on interactive template

$notificationContainer Object

DOM reference to notification container

copiedLinkSelector String

DOM selector for 'Link Copied!' popup

Methods

Source:

Gets href attribute for each social share button

Parameters:
Name Type Description
provider String

Social share provider name

(inner) getMedia() → {String}

Source:

Gets social media image from

Returns:
  • URL of the og:image.
Type
String

(inner) handleClick(ev)

Source:

Handles click event when social share button is clicked

Parameters:
Name Type Description
ev Object

Social share button click event

(inner) handleCopyClick(ev)

Source:

Handles click event for 'Copy' button in social share

Parameters:
Name Type Description
ev Object

Social share 'Comments' button click event

(inner) init()

Source:

Initializes social share elements on the page

(inner) setId($item, index)

Source:

Sets id attribute for each social share container

Parameters:
Name Type Description
$item Element

Social share container element

index Integer

Element index

(inner) setup($item)

Source:

Sets up functionality for each social share container. Assigns 'title' and 'url' attributes to container, bind click event

Parameters:
Name Type Description
$item Element

Social share container element

(inner) trackClick($elem)

Source:

Analytics tracking for social share.

Parameters:
Name Type Description
$elem HTMLElement

HTML Element that triggered the click.