Please, see the code down. I was thinking in a way to help the InkWeb grow and help user needs related to this feature request:
(what you think?)
// makeSimpleStyleSetTestMethods
// Dinamicaly create methods to set a style value and test if
// the style configuration was applied
InkWeb.makeSimpleStyleSetTestMethods = function ( method, att, val ) {
var code = 'this.setStyle(el, "'+att+'", "'+val+'")';
this[method] = new Function( "el", code );
this[method].inkWeb = this;
code += 'var att = this.inkWeb.getStyle(el, "'+att+'");'
code += 'return att && display.match("'+val+'");'
this[method].wasApplied = new Function( "el", code );
}
InkWeb.makeSimpleStyleSetTestMethods( "hide", "display", "none" );
/* The above line will create this:
* InkWeb.hide = function (el) {
* this.setStyle(el, "display", "none");
* }
* InkWeb.hide.wasApplied (el) {
* var display = this.inkWeb.getStyle(el, "display");
* return display && display.match("none");
* }
*/
Please, see the code down. I was thinking in a way to help the InkWeb grow and help user needs related to this feature request:
(what you think?)
// makeSimpleStyle SetTestMethods makeSimpleStyle SetTestMethods = function ( method, att, val ) { method] .inkWeb = this; getStyle( el, "'+att+'");' match(" '+val+' ");' method] .wasApplied = new Function( "el", code );
// Dinamicaly create methods to set a style value and test if
// the style configuration was applied
InkWeb.
var code = 'this.setStyle(el, "'+att+'", "'+val+'")';
this[method] = new Function( "el", code );
this[
code += 'var att = this.inkWeb.
code += 'return att && display.
this[
}
InkWeb. makeSimpleStyle SetTestMethods( "hide", "display", "none" ); hide.wasApplied (el) { getStyle( el, "display"); match(" none");
/* The above line will create this:
* InkWeb.hide = function (el) {
* this.setStyle(el, "display", "none");
* }
* InkWeb.
* var display = this.inkWeb.
* return display && display.
* }
*/
InkWeb. makeSimpleStyle SetTestMethods( "show", "display", "inline" );
InkWeb.toggleStats = function ( el, method1, method2 ) { method1] .wasApplied( el)) { method2( el); method1( el);
if(this[
this.
} else {
this.
}
}
// if we need:
InkWeb. toggleVisible( el) {
this.toggleStats( el, hide, show );
}