<commit_before>(function(){
	var optionsEle = document.querySelector('.quiz-container');
	var choicesArray = choices.split('|');
	var optionsHTML = '';
	var quizAnswered = false;

	function shuffle(array) {
	  var currentIndex = array.length, temporaryValue, randomIndex;
	  // While there remain elements to shuffle...
	  while (0 !== currentIndex) {

	    // Pick a remaining element...
	    randomIndex = Math.floor(Math.random() * currentIndex);
	    currentIndex -= 1;

	    // And swap it with the current element.
	    temporaryValue = array[currentIndex];
	    array[currentIndex] = array[randomIndex];
	    array[randomIndex] = temporaryValue;
	  }
	  return array;
	}

	function checkAnwser(ele) {
		if (quizAnswered === true) {
			return;
		}
		var theAnswer = ele.innerHTML;
		var answerExplain = '';
		if (theAnswer === rightAnswer) {
			//alert ('right');
			answerExplain = '<div class="answer-correct answer-title">回答正确</div>';
			ele.className += ' quiz-selected quiz-correct';
		} else {
			answerExplain = '<div class="answer-wrong answer-title">回答错误，正确答案应为' + rightAnswer +'</div>';
			ele.className += ' quiz-selected quiz-wrong';
		}
		if (typeof explainImage === 'string') {
			var storyWidth = ele.offsetWidth;
			var imageUrl = '//image.webservices.ft.com/v1/images/raw/' + encodeURIComponent(window.explainImage) + '?source=ftchinese&width=' + storyWidth;
			//alert (storyWidth);
			answerExplain += '<img src="'+ imageUrl +'">';
		}
		answerExplain += '<div class="answer-explain-detail">' + explain + '</div>';
		document.getElementById('answer-explain').innerHTML = answerExplain;
		quizAnswered = true;
	}

	choicesArray.push(rightAnswer);
	shuffle(choicesArray);
	for (var i=0; i<choicesArray.length; i++) {
		optionsHTML += '<div class="single-choice">' + choicesArray[i] + '</div>';
	}
	optionsHTML += '<div id="answer-explain"></div>';
	optionsEle.innerHTML = optionsHTML;

	delegate.on('click', '.single-choice', function(){
		checkAnwser(this);
	});

})();
<commit_msg>update sticky effects for quiz<commit_after>(function(){
	var optionsEle = document.querySelector('.quiz-container');
	var choicesArray = choices.split('|');
	var optionsHTML = '';
	var quizAnswered = false;

	function shuffle(array) {
	  var currentIndex = array.length, temporaryValue, randomIndex;
	  // While there remain elements to shuffle...
	  while (0 !== currentIndex) {

	    // Pick a remaining element...
	    randomIndex = Math.floor(Math.random() * currentIndex);
	    currentIndex -= 1;

	    // And swap it with the current element.
	    temporaryValue = array[currentIndex];
	    array[currentIndex] = array[randomIndex];
	    array[randomIndex] = temporaryValue;
	  }
	  return array;
	}

	function checkAnwser(ele) {
		if (quizAnswered === true) {
			return;
		}
		var theAnswer = ele.innerHTML;
		var answerExplain = '';
		if (theAnswer === rightAnswer) {
			//alert ('right');
			answerExplain = '<div class="answer-correct answer-title">回答正确</div>';
			ele.className += ' quiz-selected quiz-correct';
		} else {
			answerExplain = '<div class="answer-wrong answer-title">回答错误，正确答案应为' + rightAnswer +'</div>';
			ele.className += ' quiz-selected quiz-wrong';
		}
		if (typeof explainImage === 'string') {
			var storyWidth = ele.offsetWidth;
			var imageUrl = '//image.webservices.ft.com/v1/images/raw/' + encodeURIComponent(window.explainImage) + '?source=ftchinese&width=' + storyWidth;
			//alert (storyWidth);
			//answerExplain += '<img src="'+ imageUrl +'">';
			answerExplain += '<div class=" story-image image"><figure><img src="'+ imageUrl +'"></figure></div>';
		}
		answerExplain += '<div class="answer-explain-detail">' + explain + '</div>';
		document.getElementById('answer-explain').innerHTML = answerExplain;
		stickyBottomPrepare();
		stickyAdsPrepare();
		quizAnswered = true;
	}

	choicesArray.push(rightAnswer);
	shuffle(choicesArray);
	for (var i=0; i<choicesArray.length; i++) {
		optionsHTML += '<div class="single-choice">' + choicesArray[i] + '</div>';
	}
	optionsHTML += '<div id="answer-explain"></div>';
	optionsEle.innerHTML = optionsHTML;

	delegate.on('click', '.single-choice', function(){
		checkAnwser(this);
	});

})();

{'fraction_non_alphanumeric': 0.16877838871623238, 'fraction_numerical': 0.0019125029882859192, 'mean_word_length': 4.127450980392157, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4597905', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1334, 'n_words': 282}