HLD
The webPages Flow:
LLD
Google Feature Used:
- Using the Tabs Feature in order to display each webPage in a new Tab.
- Using the PubSub Feature in order to listen to published messages, and act accordingly.
Functions Description:
init:
The function is called on load of the page.
It builds all the static tabs(usefull links, libarary and map). Goes over all saved webPages and UserPages in the userPrefs and add a new tab for each one of them.
addNewTab:
params: course
course structure:
- course.name : the name of the tab
- course.data : the URL
The Function adds a tab to the gadet according to the data in course.
updaeMsg:
The Function is called every time a message is recieved.
If the messae is a delete message it calls removeTabByNum with the num recieved in the message, and DeleteSite to remove it from the UserPrefs.
if not, it checks if the data string begins with "http", and if so it process it and call addNewTab. it also update the userPref and save them.
addSite:
This Function is called when the add Button is pressed. It adds a site according to the information in the 2 inputs "siteUrl" & "siteName".
It Uses addNewTab for that. it also saves the new information in the userPrefs.
removeTabByNum:
Parameter: num
The function delete a tab from the gadget using the serial number of the course, ehich is passed in num parameter.
It seeks the tab with matching name to the course name stored in the pref.
in IE the tab name is added with some spaces by google so the function strip it from the spaces and then compare.
removeCurTab:
The Function is called when the remove button is pressed. It delete the currentlly selected tab from the gadget.
It also search it in the userPref(both the "yedion" sites & user sites), and delete it from there.
It faces the same problem with IE and uses the same manipulation to solve it.
deleteSite:
Parameter:num
remove from the "yedion" added sites userPref the userPref in "num" index.Save the new userPref.
deleteUserSite:
Parameter:num
remove from the user added sites userPref the userPref in "num" index.Save the new userPref.
saveWebPages:
Saves the UserPref storing the "yedion" added sites.
saveUserPages:
Saves the UserPref storing the user added sites.
hideButton/showButton:
This functions are called when a tab is selected. this is done by issuing a callback function to every tab. if a static tab was selected we call hideButton. if a dinamiclly added tab is called we call showButton.
the purpouse of these functions is to show and hide the remove button to prevent users from deleting the static tabs.
This is done by changing the visibility property of the butto object.