Skip to content

Instantly share code, notes, and snippets.

@brianjmiller
brianjmiller / gist:649049
Created Oct 27, 2010
YUI3 Dynamic Context Menu on YUI2 Data Table Record
View gist:649049
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 Sep 24, 2015
YUI3 Module template
View gist:672556
YUI.add(
"!!!",
function(Y, NAME) {
var Clazz = Y.namespace("!!!").!!! = Y.Base.create(
NAME,
!!!,
[],
{
initializer: function (config) {
Y.log("initializer", "debug", Clazz.NAME);
View gist:706770
YUI.add(
"lw-table_wrapper",
function(Y) {
var Clazz = Y.namespace("LW").TableWrapper = Y.Base.create(
"lw_table_wrapper",
Y.Base,
[],
{
_data_table: null,
View gist:706777
YUI.use(
"lw-table-wrapper",
function (Y) {
var myDT = new Y.LW.TableWrapper (....);
}
);
View gist:760148
/*
* Validator Attribute
*
* @attribute validators
* @type {object}
* @default {isNumber & customVal}
* @since 1.0.0
*/
validators : {
value : {
@brianjmiller
brianjmiller / gist:776202
Created Jan 12, 2011
YUI3 AutoComplete Spinner
View gist:776202
//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 Mar 1, 2011
YUI: Post initialization of an extension
View gist:849130
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 Mar 7, 2011
[delayed_query] tag for Interchange
View gist:858523
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 Mar 23, 2011
YUI positive/negative Node method
View gist:883760
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);
}
View gist:906188
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,