root/trunk/Vanilla/readme_javascript.txt @ 924

Revision 924, 8.5 kB (checked in by bsmith, 16 months ago)

adding vanilla+search+tags

RevLine 
[891]1<$mt:var name="user-auth" value="signin-content"$>
[916]2<mt:Ignore>
3    Set show_userpic to 1 to enable userpics in the signin line
4    - Requires Community Solution
5    - Note: This will update username to link to Community Solution "edit profile" script. This script assumes that you are using profiles and thus links to "view profile" screen. If the template set is not using profiles then the Community Solution "Profile Edit" Global System Template should be updated.
6</mt:Ignore>
7<$mt:var name="show_userpic" value="1"$>
8
[924]9/* MOVABLE TYPE CORE JAVASCRIPT *****************************************************************/
10
11/* Legacy Function Mappings *****************************************************************/
12/* The following functions are here to support legacy MT templates. If you have refreshed your JavaScript template but still use olderMT comment templates, you may need to uncomment this block in orderfor those templates to work properly. Simply remove the wrapping'mt:Ignore' tag to do so. */
13function hideDocumentElement(id) { return mtHide(id) }
14function showDocumentElement(id) { return mtShow(id) }
15function individualArchivesOnLoad() { return mtEntryOnLoad() }
16function writeCommenterGreeting() { return mtShowGreeting() }
17function rememberMe(f) { return mtRememberMe(f) }
18function forgetMe(f) { return mtForgetMe(f) }
19function getXmlHttp() { return mtGetXmlHttp() }
20
[916]21/* Blog Variables *****************************************************************/
22var is_preview;
23var user;
24
25/* Utility Functions *****************************************************************/
26    function mtHide(id) // Simple routine for showing a DOM element (applying a CSS display attribute of 'none').
27    function mtShow(id) // Simple routine for showing a DOM element (applying a CSS display attribute of 'block').
28function mtFireEvent(eventName,param) // Calls the event named, if there are handlers for it.
29function mtFixDate(date) // **
30function mtEscapeJS(s) // Simple function that escapes single quote characters for storing in a cookie.
31function mtUnescapeJS(s) // Simple function that unescapes single quote characters that were stored in a cookie.
32function mtAttachEvent(eventName,func) // A utility function for assigning/adding handlers to window events.
33function mtGetXmlHttp() // Returns a XMLHttpRequest object (for Ajax operations).
34
[924]35/* Authentication Functions *****************************************************************/
[916]36var mtCookieName = "<$mt:UserSessionCookieName$>"; // The cookie name to use for storing the blog-side comment session cookie.
[891]37var mtCookieDomain = "<$mt:UserSessionCookieDomain$>";
38var mtCookiePath = "<$mt:UserSessionCookiePath$>";
39var mtCookieTimeout = <$mt:UserSessionCookieTimeout$>;
[916]40function mtSetCookie(name, value, expires, path, domain, secure) // Sets a browser cookie.
41function mtGetCookie(name) // Retrieves a browser cookie.
42function mtDeleteCookie(name, path, domain, secure) // Deletes a browser cookie.
43function mtBakeUserCookie(u) // Serializes a user object into a string, suitable for storing as a cookie.
44function mtUnbakeUserCookie(s) // Unserializes a user cookie and returns a user object with the restored state.
[924]45#_login/#_logout // If request contains a '#_login' or '#_logout' hash, use this to also delete the blog-side user cookie, since we're coming back from a login, logout or edit
46function mtSaveUser(f) // Persists a copy of the current user cookie into the browser cookie stash.
[919]47function mtClearUser() // Clears the blog-side user cookie.
48profile operation.
[891]49function mtFetchUser(cb) // Issues a request to the MT comment script to retrieve the currently logged-in user (if any).
[922]50    function mtUpdateSignInWidget(u) // A routine that displays various phrases based upon users authenticated status (works with Sign In Widget)
[891]51function mtGetUser() // Retrieves an object of the currently logged in user's state. If no user is logged in or cookied, this will return null.
52function 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.
[916]53function mtSignInOnClick(sign_in_element) // **Handles the action of the "Sign in" link.
54function mtSetUserOrLogin(u) // **Handles branching between users cookied in app vs not logged in
[919]55function mtSignOut(entry_id) // Handles sign out from the web site. First clears any existing user cookie, then directs to the MT comment script to sign the user out.
[891]56function mtSignOutOnClick() // Handles the action of the "Sign out" link.
57
[919]58    /* Commenting *****************************************************************/
59    function mtEntryOnLoad() // Called when an entry archive page is loaded. This routine controls which elements of the comment form are shown or hidden, depending on commenter type and blog configuration.
60    function mtEntryOnUnload() // **
[924]61    mtAttachEvent('usersignin', mtUserOnLoad); // **
62
[919]63    function mtShowGreeting() // Handles the display of the greeting message, depending on what kind of user is logged in and blog comment policy.
64    function mtRememberMeOnClick(b) // Called when the 'Remember me' checkbox is changed. If the checkbox is cleared, the cached user cookie is immediately cleared.
65    function mtReplyCommentOnClick(parent_id, author) // Handles the action of the 'Reply' links.
66    function mtSetCommentParentID() // Sets the parent comment ID when replying to a comment.
[924]67
[919]68    function mtCommentOnSubmit(f) // Called when comment form is sent. Required parameter: Form DOM object of comment form. If form has a 'bakecookie' member, it will be used to signal storing the anonymous commenter information to a cookie. If form has a 'armor' member, it will be used to store a token that is checked by the comment script.
69    function mtCommentSessionVerify(app_user) // **
[924]70    function mtUserOnLoad() // **Function to hide/show/prepopulate fields based upon type of user that has authenticated
71
[919]72    function mtCommentFormOnFocus() // Called when an input field on the comment form receives focus.
73    function mtShowCaptcha() // Displays a captcha field for anonymous commenters.
[891]74
[924]75    <mt:Ignore>
76    /* user object
77        -- saved in user cookie --
78        u.name (display name)
79        u.url (link to home page)
80        u.email (for anonymous only)
81        u.userpic (url for commenter/author)
82        u.profile (link to profile)
83        u.is_trusted (boolean)
84        u.is_author (user has posting rights)
85        u.is_banned (banned status; neither post/comment perms)
86        u.can_post (has permission to post)
87        u.can_comment (has permission to comment)
88
89        -- status fields --
90        u.is_authenticated (boolean)
91        u.is_anonymous (user is anonymous)
92    */
93    </mt:Ignore>
94
[916]95/* Initialize *****************************************************************/
96function mtInit() // Initialize
[891]97
[916]98/* Edit Entry *****************************************************************/
99function mtEditLink(entry_id, author_id) // Used to display an edit link for the given entry.
[891]100
[916]101/* Date Formatting *****************************************************************/
102function mtRelativeDate(ts, fds) // Displays a relative date. 'ts' is a Date object, 'fds' is a string of the date which will be displayed if the given date is older than 1 week.
[924]103    // ** extra closing "}" after this function
[916]104
[924]105/* END Movable Type Core Javascript *****************************************************************/
106
107
108
109/* MOVABLE TYPE COMMUNITY SOLUTION FUNCTIONS *****************************************************************/
110
111function conditional_block(cond, id) // **
112
113function mtScore(entry_id) // Functions for scoring entries. Scoring requires blog context, it is thus conditioned.
114function mtUpdateScores() // **
115function mtScore_cb(s_hash) // **
116
117function insert_score(s_hash, id, div_id, span, span_else) // Legacy functions for favoriting entries
118var favorite_cb_callbacks = [];
119function favorite_cb(s_hash) // **
120function anchor(id, eid, cl, score) // **
121function attachEvent(element, eventName, func) // **
122function favorite(evt, entry_id, score_span) // **
123
124function script_follow(id) // Functions to follow/leave feature
125function script_leave(id) // **
126function follow(user_info) // **
127function leave(user_info) // **
128
129// Utility functions
130req = null; // ** Not used anywhere?
131function getCommenterName() // **
132function trimString (str) // **
133DOM // ** review
134function switchTabs( id, el ) // **
135function defaultInputFocus( event ) // **
136function defaultInputBlur( event ) // **
137function setupInputDefault() // **
138function mtSetUser(u) // Assigns a user object as the actively logged in user; also saves the user information in a browser cookie.
Note: See TracBrowser for help on using the browser.