var chunks;
function play() {
	chunks = getSelectionText().split('.');
	console.log(chunks);
	var i = 0;
	var msg = new SpeechSynthesisUtterance(chunks[0]+'.');
	msg.onend = function callback() {
		i=i+1;
		if(i==chunks.length) 
			return;
		var newMsg = new SpeechSynthesisUtterance(chunks[i]);
		newMsg.onend = callback;
		window.speechSynthesis.speak(newMsg);
	}
	window.speechSynthesis.speak(msg);
}

function stop() {
	window.speechSynthesis.cancel();
}

function getSelectionText() {
    var text = "";
    if (window.getSelection) {
        text = window.getSelection().toString();
    } else if (document.selection && document.selection.type != "Control") {
        text = document.selection.createRange().text;
    }
    return text;
}


window.onload=function() {
  upTime(0);
}

function upTime(secs) {
  document.getElementById('seconds').value = secs;

  clearTimeout(upTime.to);
  upTime.to=setTimeout(function(){ upTime(secs+1); },1000);
}

@@ -416,16 +416,29 @@
 top() %7B%0A
+%09chunks = %5B%5D%0A
 %09window.

Fix pause button