2022.2

Table Of Contents
Note: TranslationsareappliedbeforetheStandardScriptsrun,andalsoeverytimeaStandard
Scriptaddscontenttoasection,forexamplewiththeresults.html()function.
Finally, Post Pagination Scripts run,intheorderinwhichtheyappearintheScriptspane(see"Post
PaginationScripts"onpage850).
PostPaginationScriptsareruninaPrintcontextafterthecontenthasbeenpaginated.Becausethey
cansearchthroughtheoutputofallPrintsections,andmodifyPrintsections(oneatatime),theymay
beusedtocreateaTableOfContents(TOC),asexplainedinthetopic:"CreatingaTableOfContents"
onpage852.
Tip: Doyoufindyourselfcopy-pastingthesamefunctionintoeverynewscript?Youcanavoid
thisbydefiningyourfunctioninaControlScript.ControlScriptsareexecutedfirst,sothefunction
willthenbeavailableinallStandardScriptsandPostPaginationScripts.
Note: AnyJavaScriptfilesincludedinasectionrunafterthescriptsintheScriptspane.
Selectors in OL Connect
SelectorsarepatternsusedtoselectoneormoreHTMLelements.Theywereoriginallydevelopedto
beabletodefinethelayoutofwebpageswithouttouchingtheircontent,throughCascadingStyle
Sheets(CSS).InOLConnect,sinceeachsectioninatemplateisinfactanHTMLfile(see"Editing
HTML"onpage568),theverysameselectorscanbeusedinstylesheets(see"Stylingtemplateswith
CSSfiles"onpage672)andStandardScripts(see"Personalizingcontent"onpage708and"Writing
yourownscripts"onpage808).Usingselectorsforscriptingcanincreasethespeedwithwhichatem-
plateanddataaremerged;see"UseanIDorclassasselector"onpage821.
StandardCSSselectors
Selectorsaremadeupofoneormoreofthefollowingcomponents:
l
AnHTML element.TypetheHTMLtagwithouttheanglebrackets(e.g.p)toselectallelements
ofthattype(pselectsallparagraphs).
l
Aclass.Typetheclassname,precededbyadot,e.g.:.green,toselectHTMLelementswith
thatclass.
l
AnID.TypetheID,precededby#,e.g.:#intro,toselectanHTMLelementwiththatID.
Note: InanHTMLfile,eachIDshouldbeunique.ThismeansthataparticularIDcanbe
usedonlyonceineachsection.
Page 825