| Server IP : 180.180.241.3 / Your IP : 216.73.216.35 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /AppServ/www/app/webroot/new_news/wp-content/plugins/jetpack/modules/shortcodes/js/ |
Upload File : |
(function($){
$.fn.shuffleQuiz = function() {
var allElems = this.get(),
getRandom = function(max) {
return Math.floor(Math.random() * max);
},
shuffled = $.map(allElems, function(){
var random = getRandom(allElems.length),
randEl = $(allElems[random]).clone(true)[0];
allElems.splice(random, 1);
return randEl;
});
this.each(function(i){
$(this).replaceWith($(shuffled[i]));
});
return $(shuffled);
};
})(jQuery);
jQuery( function( $ ) {
$( '.jetpack-quiz' ).each( function() {
var quiz = $(this);
quiz.find( 'div.jetpack-quiz-answer' ).shuffleQuiz();
quiz.find( 'div[data-correct]' ).removeAttr( 'data-correct' ).data( 'correct', 1 );
quiz.find( 'div.jetpack-quiz-answer:last' ).addClass( 'last' );
});
$( 'div.jetpack-quiz' ).on( 'click', 'div.jetpack-quiz-answer', function() {
var trackid, answer = $( this ),
quiz = answer.closest( 'div.jetpack-quiz' );
if ( quiz.data( 'a8ctraining' ) ) {
new Image().src = '//pixel.wp.com/b.gif?v=wpcom-no-pv&x_trainingchaos-' + quiz.data( 'username' ) + '=' + quiz.data( 'a8ctraining' ) + '&rand=' + Math.random();
quiz.data( 'a8ctraining', false );
quiz.data( 'trackid', false );
}
trackid = quiz.data( 'trackid' );
if ( answer.data( 'correct' ) ) {
answer.addClass( 'correct' );
if ( trackid ) {
new Image().src = '//pixel.wp.com/b.gif?v=wpcom-no-pv&x_quiz-' + trackid + '=correct&rand=' + Math.random();
}
} else {
answer.addClass( 'wrong' );
if ( trackid ) {
new Image().src = '//pixel.wp.com/b.gif?v=wpcom-no-pv&x_quiz-' + trackid + '=wrong&rand=' + Math.random();
}
}
// only track the first answer
quiz.data( 'trackid', false );
});
} );