- [MOD] Increased billing module’s flexibility.
Monthly Archives: March 2010
Monitus Public Javascript Library
Monitus Public Javascript Library v1
(available at http://live..monitus.net/scripts/pantry/mmin.php/mui.js?x)
MUI.utilities
Return: (nothing)
Parameters:
event type (String): the event to add. (ex: “submit”, &quit;click”, …)
function (Function): the function to run when the event fires.
use capture (Bool): parameter of the same name in the DOM addEventListener function.
Description:
Cross-browser function to attach events to HTML elements.
Return: String
Parameters:
Description:
This function will inflate current form values into the template string. You insert special tokens in the template string, and they will be replaced by the equivalent form field value.
Tokens are delimited by the percentage character (“%”), as such:
The name field value is: %name%
In this case, the token “%name%” will be replaced by the current value of the form field whose ID is “name”.
Return: Bool
Parameters:
Description:
Tells you if the current page is a landing page. (visitor came form another domain, not in the list of domains to ignore)
Return: String
Parameters:
default value (String): default value to return, if “string” is null.
Description:
Function to ensure a string is never null.
Return: HTMLElement | null
Parameters:
object name (String): the name attribute to look for.
root (Object): the root of the search. Optional. Defaults to document. Version 2
Description:
Look for a particular HTMLElement by “name"e; attribute.
Return: (nothing)
Parameters:
suffix (String): suffix to use for the new name; the new name of the element will be <original name> + suffix.
deep (Bool): rename all the children nodes too?
Description:
This function will change both the name and id attributes of an element and, optionally, its children.
Return: (nothing)
Parameters:
callback function (Function): a function to call when the object exists.
callback arguments (Array): array of arguments to pass to the callback function.
Description:
Allows you to wait until a particular javascript object has been created on the page. The callback function will be called as soon as the object becomes available.
MUI.ga
Return: (nothing)
Parameters:
event category (String): the event category to send to GA.
event action (String): the event action to send to GA..
event label (String): the event label to send to GA. (optional)
Description:
Easy function to send events to Google Analytics.
Return: (nothing)
Parameters:
tracker object (GA Tracker): the tracker object to use for event tracking.
event category (String): the event category to send to GA.
event action (String): the event action to send to GA..
event label (String): the event label to send to GA. (optional)
Description:
Allows you to attach the event information to a particular object, for later use, usually by the MUI.ga.track_event_attached_to_object function.
Return: True
Parameters:
Description:
Sends an event to Google analytics, based on the info attached to the object by the MUI.ga.track_event_attached_to_object function.
Parameters:
Description:
This is the function that actually adds all the custom variables queued by the “MUI.ga.track_event_attached_to_object” function.
For more information on custom variable, please refer to GA’s documentation.
Parameters:
name (String): the name of the variable sent to GA.
value (String): the value of the variable.
scope (Constant): the scope of this variable: MUI.ga.kvariable_scope_visitor, MUI.ga.kvariable_scope_session or MUI.ga.kvariable_scope_page
Description:
Custom variables need to be sent with the initial pageview sent to GA. Because the tracking object might not exist when you have the custom variable data ready, you use this function to “queue” a variable’s data so it can be added to the tracking object later.
Note that you should use this in all cases, whether or not the tracking object is ready or not, because the function warn us if two variables of the same scope use the same slot on a page.
For more information on custom variable, please refer to GA’s documentation.
MUI.gwo
Return: (nothing)
Parameters:
experiment name (String): the experiment’s name – sent as the event’s category
variation name (String): the variation’s name – sent as the event’s action..
Description:
Easy function to send Google Website Optimizer’s shown variations as events to Google Analytics. You would normally place a call to this funciton in each of your variation.
MUI.yahoo
Return: (nothing)
Parameters:
Description:
This function allows you to preserve the original referrer when you do a javascript redirect. It sets the “_mrrf” cookie.
Note: This function makes use of cookies, and so it will only work if the redirect is on the same domain.
Return: (nothing)
Parameters:
Description:
This function quite simply clears the cookie used by MUI.yahoo.save_referrer_for_redirect – to be called once you have read and used the “_mrrf” cookie.
Return: GA Tracker
Parameters:
ignored referrers (Array of strings): Referring domains to ignore, i.e. referrals from these domains are considered as coming from the same domain as the current page.
Description:
This function allows you to get a Monitus-compatible GA tracker. This needs to be used instead of the usual var pageTracker = _gat._getTracker(…); call, and will ensure that the tracking object is commpatible with the Monitus one, so that GA cookies are not corrupt.
The function adds a few referrers to ignore automatically: “paypal.com”, “stores.yahoo.net”, “order.store.yahoo.net”, “search.store.yahoo.com”, “search.store.yahoo.net” and the current page’s domain. So you should only pass additional referrers in the second arguments.
Return: (String)
Parameters: (none)
Description:
Will returned a standardized page identifier for the current page. On the store, it will either be the product ID or “homepage”. On the Checkout, it will be the value of the “sectionId” parameter: ysco.cart, ysco.review, etc…
Return: (nothing)
Parameters: (none)
Description:
On the order confirmation page, Yahoo! provides javascript arrays with detials of the current order. However, if an item was ordered twice with different options, Yahoo!’s arrays will show two lines with the same product ID. And since options are not considered in these arrays, that does not make much sense: a blue square box, as far as these arrays are concerned, should be the very same as a pink square box – if both have the same product ID.
So this function creates new arrays and merges lines with the same product ID and price, adding quantities to produce the new item’s quantity. The new arrays are:
mon_order_ids
mon_order_items
mon_order_codes
mon_order_price
mon_order_qtys
Return: (nothing)
Parameters:
event action (String): the event’s action
event label (String): the event’s label.
event category (String): the event’s category.
Description:
Attaches an event tracker to the “Update” button in the checkout cart page. Sends an event to GA when the button is clicked.
Return: (nothing)
Parameters:
event action (String): the event’s action
event label (String): the event’s label.
event category (String): the event’s category.
Description:
Attaches an event tracker to the Shipping Calculator button on the checkout. Sends an event to GA when the button is clicked.
Return: True
Parameters:
event action (String): the event’s action
event label (String): the event’s label.
event category (String): the event’s category.
Description:
To be used in an “onclick” function for the “Add to cart” button. Sends an event to GA when called.
Return: True
Parameters:
event action (String): the event’s action
event label (String): the event’s label.
event category (String): the event’s category.
Description:
To be used in an “onclick” function for a “Click to enlarge” button. Sends an event to GA when called.
Return: (nothing)
Parameters:
new image URL (String): the URL (absolute or relative) of the new image to swap on the button.
Description:
Allows swapping image type input’s image for a new one; particularely useful on the checkout.
Return: (nothing)
Parameters:
new caption (String): the new caption for the button.
Description:
Allows swapping submit type input’s caption for a new one; particularely useful on the checkout.
Return: (nothing)
Parameters:
new section ID (String): the ID of the section in which the subsection will be moved.
position (Integer): the position of the subsection in it’s new parent section. (zero-based)
Description:
Allows moving subsections to another section on the checkout page. The subsection will be added before the subsection at position position.
Return: (nothing)
Parameters:
new section ID (String): the ID of the section to create.
title (String): the title of the new section.
subtitle (String): the title of the new section’s first subsection.
Description:
Allows creating a new section on the checkout page. The new section will be added before the placeholder section.
Return: (nothing)
Parameters:
Description:
This function creates 3 fields (MM / DD / YYYY) to enter dates, and will update the original field’s value accordingly. The original field is usually a hidden field.
Return: (nothing)
Parameters:
button ID (String): the ID of button to duplicate.
insert after (Bool): insert the new button after (True) or before (False) the new sibling?
Description:
Duplicates a checkout button. You can define an optional MUI.community.yahoo.node_duplicated(pNewButton)
function to further customize the new button.
Return: (nothing)
Parameters:
original field container ID (String): the ID of original field’s container.
original field ID (String): the ID of original field.
focus (Bool): give the new field focus?
hide original (Bool): hide the original version?
Description:
Duplicates a checkout field. You can define an optional MUI.community.yahoo.node_duplicated(pNewField)
function to further customize the new field.
Return: (nothing)
Parameters:
mandatory field ID (String): the ID of mandatory field.
default value (String): the value to place in the mandatory field, when the optional version is empty.
Description:
This function duplicates the mandatory field and then hides-it. Values entered in the new (optional) field are automatically copied to the (hidden) mandatory field. You need to provide a default value to put in the mandatory version so the form will still validate when the user clears the optional version of the field.
Return: (nothing)
Parameters:
invalid marker callback (Function): a function to mark fields that failed validation; by default, they are marked with a warning icon. callback(mandatory field (object), valid value? (bool)) – Toggling function: use the second parameter to show or hide the marker.
failed validation callback (Function): a function to let the user know some values did not validate; by default, shows a generic alert message. callback()
ignored fiield list (Array of strings): n array of field names for fields that should not be considered by the validation mechanism; by default, all fields are considered.
Description:
This function installs a validation mechanism on the checkout pages. It will mark required fields, and make sure they are not empty when the user tries to go to the next checkout step. Note that this check, unlike Yahoo!’s implementation, will not reload the page nor will it show the normal Yahoo! error messages.
Video Test
Version 2.2.9
- [MOD] Memcache support for front-end javascript