User:CWii/JB2script.js: Difference between revisions

Content deleted Content added
CWii (talk | contribs)
fix
CWii (talk | contribs)
bleh
Line 23:
value: 'yes'
} );
categories.append( {
type: 'option',
label: "No - It can't be moved by John Bot II",
Line 29:
value: 'no'
} );
categories.append( {
type: 'option',
label: "Not by a bot - It can't be moved by a robot",
Line 35:
value: 'notBot'
} );
form.append( {
type: 'field',
label:'Work area',
name: 'work_area'
} );
var result = form.render();
Window.setContent( result );
Window.display();
// We must init the
var evt = document.createEvent( "Event" );
evt.initEvent( 'change', true, true );
result.movable.dispatchEvent( evt );
}
jb2script.callback.change_category = function jb2scriptCallbackChangeCategory(e) {
var value = e.target.value;
var root = e.target.form;
var old_area;
var childNodes = root.childNodes;
for( var i = 0; i < childNodes.length; ++i ) {
var node = childNodes[i];
if(
node instanceof Element &&
node.getAttribute( 'name' ) == 'work_area'
) {
old_area = node;
break;
}
}
}
}
var work_area = null;
switch( value ) {
case 'yes':
work_area = new QuickForm.element( {
type: 'field',
label: 'Movable',
name: 'work_area'
} );
work_area.append( {
type: 'text',
name: 'xfdreason',
label: 'Reason: '
} );
work_area.append( { type:'submit' } );
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
default:
work_area = new QuickForm.element( {
type: 'field',
label: 'Nothing for anything',
name: 'work_area'
} );
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
switch( value ) {
}
case 'yes':
work_area = new QuickForm.element( {
type: 'field',
label: 'Movable',
name: 'work_area'
} );
work_area.append( {
type: 'textarea',
name: 'xfdreason',
label: 'Reason: '
} );
work_area.append( { type:'submit' } );
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
default:
work_area = new QuickForm.element( {
type: 'field',
label: 'Nothing for anything',
name: 'work_area'
} );
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
}
}