| 1 | <$mt:var name="user-auth" value="signin-content"$> |
|---|
| 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 | |
|---|
| 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. */ |
|---|
| 13 | function hideDocumentElement(id) { return mtHide(id) } |
|---|
| 14 | function showDocumentElement(id) { return mtShow(id) } |
|---|
| 15 | function individualArchivesOnLoad() { return mtEntryOnLoad() } |
|---|
| 16 | function writeCommenterGreeting() { return mtShowGreeting() } |
|---|
| 17 | function rememberMe(f) { return mtRememberMe(f) } |
|---|
| 18 | function forgetMe(f) { return mtForgetMe(f) } |
|---|
| 19 | function getXmlHttp() { return mtGetXmlHttp() } |
|---|
| 20 | |
|---|
| 21 | /* Blog Variables *****************************************************************/ |
|---|
| 22 | var is_preview; |
|---|
| 23 | var 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'). |
|---|
| 28 | function mtFireEvent(eventName,param) // Calls the event named, if there are handlers for it. |
|---|
| 29 | function mtFixDate(date) // ** |
|---|
| 30 | function mtEscapeJS(s) // Simple function that escapes single quote characters for storing in a cookie. |
|---|
| 31 | function mtUnescapeJS(s) // Simple function that unescapes single quote characters that were stored in a cookie. |
|---|
| 32 | function mtAttachEvent(eventName,func) // A utility function for assigning/adding handlers to window events. |
|---|
| 33 | function mtGetXmlHttp() // Returns a XMLHttpRequest object (for Ajax operations). |
|---|
| 34 | |
|---|
| 35 | /* Authentication Functions *****************************************************************/ |
|---|
| 36 | var mtCookieName = "<$mt:UserSessionCookieName$>"; // The cookie name to use for storing the blog-side comment session cookie. |
|---|
| 37 | var mtCookieDomain = "<$mt:UserSessionCookieDomain$>"; |
|---|
| 38 | var mtCookiePath = "<$mt:UserSessionCookiePath$>"; |
|---|
| 39 | var mtCookieTimeout = <$mt:UserSessionCookieTimeout$>; |
|---|
| 40 | function mtSetCookie(name, value, expires, path, domain, secure) // Sets a browser cookie. |
|---|
| 41 | function mtGetCookie(name) // Retrieves a browser cookie. |
|---|
| 42 | function mtDeleteCookie(name, path, domain, secure) // Deletes a browser cookie. |
|---|
| 43 | function mtBakeUserCookie(u) // Serializes a user object into a string, suitable for storing as a cookie. |
|---|
| 44 | function mtUnbakeUserCookie(s) // Unserializes a user cookie and returns a user object with the restored state. |
|---|
| 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 |
|---|
| 46 | function mtSaveUser(f) // Persists a copy of the current user cookie into the browser cookie stash. |
|---|
| 47 | function mtClearUser() // Clears the blog-side user cookie. |
|---|
| 48 | profile operation. |
|---|
| 49 | function mtFetchUser(cb) // Issues a request to the MT comment script to retrieve the currently logged-in user (if any). |
|---|
| 50 | function mtUpdateSignInWidget(u) // A routine that displays various phrases based upon users authenticated status (works with Sign In Widget) |
|---|
| 51 | function mtGetUser() // Retrieves an object of the currently logged in user's state. If no user is logged in or cookied, this will return null. |
|---|
| 52 | function 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. |
|---|
| 53 | function mtSignInOnClick(sign_in_element) // **Handles the action of the "Sign in" link. |
|---|
| 54 | function mtSetUserOrLogin(u) // **Handles branching between users cookied in app vs not logged in |
|---|
| 55 | function 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. |
|---|
| 56 | function mtSignOutOnClick() // Handles the action of the "Sign out" link. |
|---|
| 57 | |
|---|
| 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() // ** |
|---|
| 61 | mtAttachEvent('usersignin', mtUserOnLoad); // ** |
|---|
| 62 | |
|---|
| 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. |
|---|
| 67 | |
|---|
| 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) // ** |
|---|
| 70 | function mtUserOnLoad() // **Function to hide/show/prepopulate fields based upon type of user that has authenticated |
|---|
| 71 | |
|---|
| 72 | function mtCommentFormOnFocus() // Called when an input field on the comment form receives focus. |
|---|
| 73 | function mtShowCaptcha() // Displays a captcha field for anonymous commenters. |
|---|
| 74 | |
|---|
| 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 | |
|---|
| 95 | /* Initialize *****************************************************************/ |
|---|
| 96 | function mtInit() // Initialize |
|---|
| 97 | |
|---|
| 98 | /* Edit Entry *****************************************************************/ |
|---|
| 99 | function mtEditLink(entry_id, author_id) // Used to display an edit link for the given entry. |
|---|
| 100 | |
|---|
| 101 | /* Date Formatting *****************************************************************/ |
|---|
| 102 | function 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. |
|---|
| 103 | // ** extra closing "}" after this function |
|---|
| 104 | |
|---|
| 105 | /* END Movable Type Core Javascript *****************************************************************/ |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | /* MOVABLE TYPE COMMUNITY SOLUTION FUNCTIONS *****************************************************************/ |
|---|
| 110 | |
|---|
| 111 | function conditional_block(cond, id) // ** |
|---|
| 112 | |
|---|
| 113 | function mtScore(entry_id) // Functions for scoring entries. Scoring requires blog context, it is thus conditioned. |
|---|
| 114 | function mtUpdateScores() // ** |
|---|
| 115 | function mtScore_cb(s_hash) // ** |
|---|
| 116 | |
|---|
| 117 | function insert_score(s_hash, id, div_id, span, span_else) // Legacy functions for favoriting entries |
|---|
| 118 | var favorite_cb_callbacks = []; |
|---|
| 119 | function favorite_cb(s_hash) // ** |
|---|
| 120 | function anchor(id, eid, cl, score) // ** |
|---|
| 121 | function attachEvent(element, eventName, func) // ** |
|---|
| 122 | function favorite(evt, entry_id, score_span) // ** |
|---|
| 123 | |
|---|
| 124 | function script_follow(id) // Functions to follow/leave feature |
|---|
| 125 | function script_leave(id) // ** |
|---|
| 126 | function follow(user_info) // ** |
|---|
| 127 | function leave(user_info) // ** |
|---|
| 128 | |
|---|
| 129 | // Utility functions |
|---|
| 130 | req = null; // ** Not used anywhere? |
|---|
| 131 | function getCommenterName() // ** |
|---|
| 132 | function trimString (str) // ** |
|---|
| 133 | DOM // ** review |
|---|
| 134 | function switchTabs( id, el ) // ** |
|---|
| 135 | function defaultInputFocus( event ) // ** |
|---|
| 136 | function defaultInputBlur( event ) // ** |
|---|
| 137 | function setupInputDefault() // ** |
|---|
| 138 | function mtSetUser(u) // Assigns a user object as the actively logged in user; also saves the user information in a browser cookie. |
|---|