Skip to content

Instantly share code, notes, and snippets.

@jdlich
Created August 10, 2011 21:42
Show Gist options
  • Save jdlich/1138352 to your computer and use it in GitHub Desktop.
Save jdlich/1138352 to your computer and use it in GitHub Desktop.
var up = up || {};
(function($, fluid){
var initialHide = function (that) {
$(that.locate("stacktracediv")).hide();
};
var addToggle = function (that) {
var toggleHandle = $(that.locate("stacktracetoggle"));
var stacktracediv = $(that.locate("stacktracediv"));
var hideMesg = that.options.hidemessage;
var showMesg = that.options.showmessage;
toggleHandle.toggle(
function() {
stacktracediv.show('fast', function() {
toggleHandle.text(hideMesg);
});
},
function() {
stacktracediv.hide('fast', function() {
toggleHandle.text(showMesg);
});
}
);
}
up.showHideToggle = function(container, options) {
var that = fluid.initView("up.showHideToggle", container, options);
initialHide(that);
addToggle(that);
return that;
};
fluid.defaults("up.showHideToggle", {
showmessage: 'Show Stack Trace',
hidemessage: 'Hide Stack Trace',
selectors: {
stacktracediv: '.stacktrace',
stacktracetoggle: '.stacktracetoggle'
}
});
})(jQuery, fluid);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment