Skip to content

Instantly share code, notes, and snippets.

@brianjmiller
brianjmiller / gist:649049
Created October 27, 2010 13:37
YUI3 Dynamic Context Menu on YUI2 Data Table Record
Y.delegate(
"contextmenu",
function (e) {
// prevent the browser's own context menu
e.preventDefault();
var record = this._data_table.getRecord( e.target.get("id") );
// build a list of menu items based on the _options data in the record
var menu_items = "";
@brianjmiller
brianjmiller / gist:672556
Last active September 24, 2015 05:08
YUI3 Module template
YUI.add(
"!!!",
function(Y, NAME) {
var Clazz = Y.namespace("!!!").!!! = Y.Base.create(
NAME,
!!!,
[],
{
initializer: function (config) {
Y.log("initializer", "debug", Clazz.NAME);
YUI.add(
"lw-table_wrapper",
function(Y) {
var Clazz = Y.namespace("LW").TableWrapper = Y.Base.create(
"lw_table_wrapper",
Y.Base,
[],
{
_data_table: null,
YUI.use(
"lw-table-wrapper",
function (Y) {
var myDT = new Y.LW.TableWrapper (....);
}
);
/*
* Validator Attribute
*
* @attribute validators
* @type {object}
* @default {isNumber & customVal}
* @since 1.0.0
*/
validators : {
value : {
@brianjmiller
brianjmiller / gist:776202
Created January 12, 2011 14:16
YUI3 AutoComplete Spinner
//input.yui3-aclist-input-loading {
// background-image: url(spinner.gif);
// background-repeat: no-repeat;
// background-position: right;
//}
desc_node.ac.on(
"query",
function (e) {
@brianjmiller
brianjmiller / gist:849130
Created March 1, 2011 13:40
YUI: Post initialization of an extension
YUI.add(
"ep-data-user",
function (Y) {
var DataUser = Y.namespace("EP").DataUser = function (config) {
//Y.log("DataUser constructor");
this.after("initializedChange", this.post_initialization, this);
};
//
// these values should be overridden with defaults in the class
@brianjmiller
brianjmiller / gist:858523
Created March 7, 2011 13:49
[delayed_query] tag for Interchange
UserTag delayed_query Order list
UserTag delayed_query addAttr
UserTag delayed_query attrAlias args list
UserTag delayed_query attrAlias arg list
UserTag delayed_query hasEndTag
UserTag delayed_query PosNumber 1
UserTag delayed_query Routine <<EOF
sub {
# This function operates as a wrapper for the [loop] coretag; the loop tag doesn't work very
# well with the scan/more-list functionality if the list it has is the formatted output of the
@brianjmiller
brianjmiller / gist:883760
Created March 23, 2011 19:22
YUI positive/negative Node method
Y.Node.prototype.setNumberSignClass = function (value) {
var POSITIVE = 'positive',
NEGATIVE = 'negative';
if (value < 0) {
this.replaceClass(POSITIVE, NEGATIVE);
}
else if (value > 0) {
this.replaceClass(NEGATIVE, POSITIVE);
}
@brianjmiller
brianjmiller / gist:906188
Created April 6, 2011 18:13
YUI3 Cart Builder
YUI.add(
"custom-manage-cart_builder",
function(Y) {
var base_new_line_config = {
qty: 0,
subtotal: 0,
display_sku: '',
product_desc: '',
variant_id: null,
variant_price: 0,