User:Alexis Jazz/SelectRangeTest.js

mw.loader.using(['oojs-ui-core','oojs-ui-windows']).then(function{	window.scrTest = {};	var scrTest = window.scrTest;	scrTest.text = '';	for (scrTest.int=0;scrTest.int<1002;scrTest.int++) {		scrTest.text = scrTest.text+' \n';	}	scrTest.input = new OO.ui.MultilineTextInputWidget({ rows:10, value: scrTest.text } );	scrTest.btn1 = new OO.ui.ButtonInputWidget({ label:'scroll to foo0' });	scrTest.btn1.on('click',function{scrTest.input.selectRange(scrTest.text.split(/foo0/)[0].length-5,scrTest.text.split(/foo1/)[0].length-5);});	scrTest.btn2 = new OO.ui.ButtonInputWidget({ label:'scroll to foo250' });	scrTest.btn2.on('click',function{scrTest.input.selectRange(scrTest.text.split(/foo250/)[0].length-5,scrTest.text.split(/foo251/)[0].length-5);});	scrTest.btn3 = new OO.ui.ButtonInputWidget({ label:'scroll to foo500' });	scrTest.btn3.on('click',function{scrTest.input.selectRange(scrTest.text.split(/foo500/)[0].length-5,scrTest.text.split(/foo501/)[0].length-5);});	scrTest.btn4 = new OO.ui.ButtonInputWidget({ label:'scroll to foo750' });	scrTest.btn4.on('click',function{scrTest.input.selectRange(scrTest.text.split(/foo750/)[0].length-5,scrTest.text.split(/foo751/)[0].length-5);});	scrTest.btn5 = new OO.ui.ButtonInputWidget({ label:'scroll to foo1000' });	scrTest.btn5.on('click',function{scrTest.input.selectRange(scrTest.text.split(/foo1000/)[0].length-5,scrTest.text.split(/foo1001/)[0].length-5);});	scrTest.div = document.createElement('div');	scrTest.div.id = 'scrTestDiv';	$('#mw-content-text').prepend(scrTest.div);	$('#scrTestDiv').append(scrTest.input.$element);	$('#scrTestDiv').append(scrTest.btn1.$element);	$('#scrTestDiv').append(scrTest.btn2.$element);	$('#scrTestDiv').append(scrTest.btn3.$element);	$('#scrTestDiv').append(scrTest.btn4.$element);	$('#scrTestDiv').append(scrTest.btn5.$element); });