class SAPO.Widget.ShareThis
Allows to put a share widget on the known services like links sapo, delicious, google bookmarks etc, pdf export and send link by email
 requires SAPO.Communication.Syndication
 requires SAPO.Utility.I18n
 requires SAPO.Utility.Array
 requires SAPO.Dom.Element
 requires SAPO.Dom.Event
 requires SAPO.Dom.Css
 requires lang.js (optional)
 
Defined in Widget/ShareThis/1.1/lib.js

Constructor Summary
ShareThis ([Object options])

Function Summary
addCss()
add the ShareThis css to the head of the page
DOMElement createActionLink (String content)
creates an anchor element with the provided content
create the email form
creates the floating email balloon
DOMElement createTab (String title, Boolean visible)
generates a tab for the widget
debug (String thing)
debug stuff
email form submit handler
emailSendInPlace (DOMEvent evt)
sets Email floating balloon display to block
removes the services passed on exclude array on the options object
getPDF ([DOMEvent evt])
make print to PDF via SAPO.Comunication.Syndication
init (Object options)
constructor alias
observePDFVarChange (Object json)
check if pdf was generated succesfully
generates the DOM to the widget on mode 0
DOMElement outputLink (Object service, String type)
creates the link to the service
generates the DOM to the widget on mode 2
outputServiceList ([DOMElement target], [Array visible], [Boolean returnwho])
generates in the target element the service list or if no target is provided it returns a array with the elements created
generates the DOM to the widget on mode 4
generates the DOM to the widget on mode 1
generates the overlay DOM element to the tooltip View
generates the DOM to the widget on mode 3
adds PDF and Email if they are enabled
statisticsCallback (String urlToShare, String title, String type)
internal statistics function

Constructor Details

constructor ShareThis

ShareThis([Object options])
Parameters:
[options]
  • [ Boolean debug ]
  • [ String target ] - DOM Element Id from the widget container
  • [ String url ]
  • [ Number mode ] - widget mode type (0 => Show just icon from the services, 1 => Show only names of the services, 2 => Show icons and names of the services, 3 => Tooltip Mode)
  • [ Array only ]
  • [ Array exclude ]
  • [ Boolean clickOutClose ] - if true, on Tooltip mode, closes the tooltip when click outside the tooltip
  • [ Object custom_services ]
  • [ String tooltip_title ]
  • [ String email_tab_title ]
  • [ String email_link_title ] - text to display on the link that sends the mail
  • [ String pdf_tab_title ]
  • [ String pdf_link_title ] - text to display on the link that generates pdf of the page
  • [ String web_tab_title ]
  • [ String pdf_json_url ] - json service that generates the pdf
  • [ String email_url ] - json service that sends the email
  • [ Boolean pdf ] - if false hide tab print pdf
  • [ Boolean email ] - if false hide tab email send
  • [ Number max_retries ] - Number of retries
  • [ String pageTitle ] - page title to bookmark/print/send
  • [ String closeTitle ] - text to appear on close button (Tooltip mode)
  • [ String cssURI ] - url of alternative stylesheet
  • [ Function servicesCallback ] - function to be called when a service link is clicked (arguments[0] -> link; arguments[1] -> title )
  • [ Function pdfCallback ] - function to be called when a pdf is printed (arguments[0] -> link; arguments[1] -> title )
  • [ Function emailCallback ] - function to be called when a email is succesfully sent (arguments[0] -> link; arguments[1] -> title )
  • [ String language ] - language to use in Share This. Accepted values ['pt','en','es','fr','ar','zh','ru',de]
  • [ Object lang_values ] - values to be overrided in the default language set
  • [ String email_name_from ] (of lang_values)
  • [ String email_name_to ] (of lang_values)
  • [ String email_to ] (of lang_values)
  • [ String email_send ] (of lang_values)
  • [ String email_sending ] (of lang_values)
  • [ String email_sending_error ] (of lang_values)
  • [ String email_invalid ] (of lang_values)
  • [ String email_required ] (of lang_values)
  • [ String email_share ] (of lang_values)
  • [ String email_close ] (of lang_values)
  • [ String pdf_download ]
  • [ String pdf_error ]
  • [ String closeTitle ]
  • [ String tooltip_title ]
  • [ String email_tab_title ]
  • [ String email_link_text ]
  • [ String pdf_tab_title ]
  • [ String pdf_link_text ]
  • [ Array visible ]
  • [ String showMoreSymbol ]
  • [ Boolean useSprite ]
  • [ String unknownIcon ]

Function Details

function addCss

addCss()
add the ShareThis css to the head of the page

function createActionLink

DOMElement createActionLink(String content)
creates an anchor element with the provided content
Parameters:
content

function createEmailForm

createEmailForm()
create the email form

function createFloatingEmailBalloon

createFloatingEmailBalloon()
creates the floating email balloon

function createTab

DOMElement createTab(String title, Boolean visible)
generates a tab for the widget
Parameters:
title - Tab Title
visible - True if selected

function debug

debug(String thing)
debug stuff
Parameters:
thing

function emailFormSubmit

emailFormSubmit()
email form submit handler

function emailSendInPlace

emailSendInPlace(DOMEvent evt)
sets Email floating balloon display to block
Parameters:
evt

function filterServices

filterServices()
removes the services passed on exclude array on the options object

function getPDF

getPDF([DOMEvent evt])
make print to PDF via SAPO.Comunication.Syndication
Parameters:
[evt]

function init

init(Object options)
constructor alias
Parameters:
options - the object with the startup options

function observePDFVarChange

observePDFVarChange(Object json)
check if pdf was generated succesfully
Parameters:
json - the returned json

function outputIconView

outputIconView()
generates the DOM to the widget on mode 0

function outputLink

DOMElement outputLink(Object service, String type)
creates the link to the service
Parameters:
service
type

function outputMixedView

outputMixedView()
generates the DOM to the widget on mode 2

function outputServiceList

outputServiceList([DOMElement target], [Array visible], [Boolean returnwho])
generates in the target element the service list or if no target is provided it returns a array with the elements created
Parameters:
[target]
[visible] - array with the ones to show
[returnwho] - false for the visible,true for the invisible

function outputShowMoreView

outputShowMoreView()
generates the DOM to the widget on mode 4

function outputTextView

outputTextView()
generates the DOM to the widget on mode 1

function outputTooltipSkeleton

outputTooltipSkeleton()
generates the overlay DOM element to the tooltip View

function outputTooltipView

outputTooltipView()
generates the DOM to the widget on mode 3

function setBehaviours

setBehaviours()
adds PDF and Email if they are enabled

function statisticsCallback

statisticsCallback(String urlToShare, String title, String type)
internal statistics function
Parameters:
urlToShare
title
type