Skip to content

WFES Base version 1.0

AlterTobi edited this page Aug 23, 2023 · 18 revisions

Developer Documentation - Events and Data Structures

Events

Page Event since Description
home WFESHomePageLoaded 0.1 Wayfarer Home page (showcase) is loaded
hone WFESShowCaseClick 1.1 click arrow to switch between Wayspots on showcase
review WFESReviewPageLoaded 0.2 review candidate page loaded (all)
review WFESReviewPageNewLoaded 0.5 review loaded - new candidate
review WFESReviewPageEditLoaded 0.5 review loaded - title/location/description edit
review WFESReviewPagePhotoLoaded 0.5 review loaded - photo edit
review WFESReviewDecisionSent 0.2 decision made and sent to Wayfarer server
review WFESReviewAppealSent 0.9 appeal made and sent to Wayfarer server
skip WFESReviewDecisionSent 0.2 candidate skipped
profile WFESProfileLoaded 0.3 user profile loaded
nominations WFESNominationListLoaded 0.4 nominations list loaded
nominations WFESNominationDetailLoaded 0.4 selected nomination loaded
--- WFESPropertiesLoaded 0.6 properties loaded
--- WFESVersionChanged 1.0 got wf Version from request
all WFESPageLoaded 1.8 page loaded
settings WFESSettingsLoaded 1.8 settings page loaded

usage example

...
function homePageLoaded() {
  // YOUR CODE HERE
}
window.addEventListener("WFESHomePageLoaded",homePageLoaded);
...

getter

all functions are prefixed by window.wfes.g

nominationsList()

returns the nominations list

nominationDetail()

returns details of selected nomination

baseVersion()

returns wfes-Base's version

canAppeal()

wfVersion()

reviewPageData()

edit()

reviewDecision()

reviewAppeal()

properties()

settings()

messages()

userId()

returns a hash, based on user's email

setter

public functions

all functions are prefixed by window.wfes.f

addCSS(id, styles)

Add CSS-Element to document's head section as long it does not yet exist.

param description
id id for HTML style tag
styles text containing the CSS

localGet(name, content="") - Promise

get saved data from localStorage, or content if nothing exists

localGetIDBcompat (name, content="") - Promise (since v1.9.0)

get saved data from IndexedDB, or content if nothing exists, compatible to localStorage (name-value-pairs)

localSave(name, content) - Promise

Save content as name in localStorage

localSaveIDBcompat(name, content) - Promise (since v1.9.0)

Save content as name in IndexedDB, compatible to localStorage (name-value-pairs)

sessionGet(name, content="") - Promise

get saved data from sessionStorage, or content if nothing exists

sessionSave(name, content) - Promise

Save content as name in sessionStorage

makeIDbasedDictionary(itemlist)

return id based dict from itemlist

createNotification(msg[, color])

create a notification message in lower right corner

param type description
msg string the message string
color string, optional background color, must be one of "red", "blue", "orange", "green", default is "green"

hasMinVersion(minversion)

returns true if version of wfes-Base is greater or equal minversion

waitForElem(selector, maxWaitTime = 5000) - Promise (since v1.7.0)

wait until a DOM element appears

param type description
selector string the query selector of the element
maxWaitTime integer, optional max time to wait for element in ms, default = 5 seconds

Data Structures - discontinued / how to get them now

Page/URL Variable since Description get with
home window.wfes.showcase.list 0.1 lists the 3 showcase objects showcase()
review window.wfes.review.pageData 0.2 candidate data reviewPageData()
review window.wfes.review.decision 0.2 candidate data and review decision made reviewDecision
review window.wfes.edit 0.6 information about types of edits edit()
review window.wfes.review.appeal 0.9 appeal data (id, statement) reviewAppeal()
profile window.wfes.profile 0.3 user profile data profile()
nominations window.wfes.nominations.list 0.4 list of nominations nominationsList()
nominations window.wfes.nominations.detail 0.4 details of selected nomination nominationDetail()
--- window.wfes.properties 0.6 properties properties()
messages window.wfes.messages 0.7 language strings messages()
nominations window.wfes.nominations.canAppeal 0.8 appeal available? canAppeal()
nominations window.wfes.nominations.wayspots 0.8 -empty-