root/trunk/SimpleTemplateSets/templates/vanilla+authentication/readme_javascript.txt @ 891

Revision 891, 2.6 kB (checked in by bsmith, 16 months ago)

committing initial Vanilla sets

Line 
1<$mt:var name="user-auth" value="signin-content"$>
2// The cookie name to use for storing the blog-side comment session cookie.
3var mtCookieName = "<$mt:UserSessionCookieName$>";
4var mtCookieDomain = "<$mt:UserSessionCookieDomain$>";
5var mtCookiePath = "<$mt:UserSessionCookiePath$>";
6var mtCookieTimeout = <$mt:UserSessionCookieTimeout$>;
7var is_preview;
8var user;
9
10var mtFetchedUser = false;
11function mtFetchUser(cb) // Issues a request to the MT comment script to retrieve the currently logged-in user (if any).
12function mtUpdateSignInWidget(u) // A routine that displays various phrases based upon users authenticated status
13function mtGetUser() // Retrieves an object of the currently logged in user's state. If no user is logged in or cookied, this will return null.
14function mtSetUser(u) // Assigns a user object as the actively logged in user; also saves the user information in a browser cookie.
15function mtSaveUser(f) // Persists a copy of the current user cookie into the browser cookie stash.
16function mtSignIn() // Handles the action of the "Sign in" link. First clears any existing user cookie, then directs to the MT comment script to sign the user in.
17function mtSignInOnClick(sign_in_element) //
18function mtSetUserOrLogin(u) //
19function mtSignOut(entry_id) // Handles sign out from the web site. First clears any existing user cookie, then direts to the MT comment script to sign the user out.
20function mtSignOutOnClick() // Handles the action of the "Sign out" link.
21
22/* Cookie *****************************************************************/
23
24function mtSaveUser(f) // Persists a copy of the current user cookie into the browser cookie stash.
25function mtClearUser() // Clears the blog-side user cookie.
26function mtSetCookie(name, value, expires, path, domain, secure) // Sets a browser cookie.
27function mtGetCookie(name) // Retrieves a browser cookie.
28function mtDeleteCookie(name, path, domain, secure) // Deletes a browser cookie.
29function mtBakeUserCookie(u) // Serializes a user object into a string, suitable for storing as a cookie.
30function mtUnbakeUserCookie(s) // Unserializes a user cookie and returns a user object with the restored state.
31
32/* Utility Functions *****************************************************************/
33
34function mtFireEvent(eventName,param) // Calls the event named, if there are handlers for it.
35function mtFixDate(date) //
36function mtEscapeJS(s) // Simple function that escapes single quote characters for storing in a cookie.
37function mtUnescapeJS(s) // Simple function that unescapes single quote characters that were stored in a cookie.
38function mtAttachEvent(eventName,func) // A utility function for assigning/adding handlers to window events.
Note: See TracBrowser for help on using the browser.