Diferencia entre revisiones de «Widget:QuizStyle»

De CNB
Ir a la navegación Ir a la búsqueda
Busca en cnbGuatemala con Google

(Página creada con «<script> /** * ***** BEGIN LICENSE BLOCK ***** * This file is part of Quiz. * Copyright © 2007 Louis-Rémi Babe. All rights reserved. * * Quiz is free software; you c...»)
(Sin diferencias)

Revisión del 21:55 7 jul 2016

<script> /**

* ***** BEGIN LICENSE BLOCK *****
* This file is part of Quiz.
* Copyright © 2007 Louis-Rémi Babe. All rights reserved.
*
* Quiz is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Quiz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Quiz; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*
* ***** END LICENSE BLOCK *****
*
* Quiz is a quiz tool for mediawiki.
*
* To activate this extension :
* * Create a new directory named Quiz into the "extensions" directory of MediaWiki.
* * Place this file and the files Quiz.i18n.php and Quiz.php there.
* * Add this line at the end of your LocalSettings.php file :
* require_once 'extensions/Quiz/Quiz.php';
*
* @file
* @version 1.0
* @link http://www.mediawiki.org/wiki/Extension:Quiz Documentation
* @author Louis-Rémi Babe <[email protected]>
*/

(function() { 'use strict';

// Shuffle questions function shuffle( area ) { var div = area.childNodes; for( var i = 0, questions = []; i < div.length; ++i ) { if( div[i].className ) { if( questions.length === 0 && div[i].className === 'quizText' ) { var quizText = div[i]; } else { questions.push( div[i] ); if( div[i].className === 'shuffle' || div[i].className === 'noshuffle' ) { shuffle( div[i] ); } } } } if( area.className !== 'noshuffle' ) { for( var l, x, m = questions.length; m; l = parseInt( Math.random() * m ), x = questions[--m], questions[m] = questions[l], questions[l] = x ); } if( quizText ) { questions.unshift( quizText ); } for( var j = 0, areaHTML = ; j < questions.length; ++j ) {

areaHTML += '

' + questions[j].innerHTML + '

';

} area.innerHTML = areaHTML; }

// Prepare the quiz for "javascriptable" browsers function prepareQuiz() { var bodyContentDiv = document.getElementById( 'bodyContent' ).getElementsByTagName( 'div' ); for( var i = 0; i < bodyContentDiv.length; ++i ) { if( bodyContentDiv[i].className === 'quiz' ) { var input = bodyContentDiv[i].getElementsByTagName( 'input' ); for( var j = 0; j < input.length; ++j ) { // Add the possibility of unchecking radio buttons if( input[j].type === 'radio' ) { input[j].ondblclick = function() { this.checked = false; }; } // Displays the shuffle buttons. else if( input[j].className === 'shuffle' ) { input[j].style.display = 'inline'; input[j].onclick = function() { shuffle( this.form.getElementsByTagName( 'div' )[0] ); var sh_input = this.form.getElementsByTagName( 'input' ); for( var k = 0; k < sh_input.length; ++k ) { // Add the possibility of unchecking radio buttons if( input[k].type === 'radio' ) { input[k].ondblclick = function() { this.checked = false; }; } } }; } // Display the reset button else if( input[j].className === 'reset' ) { input[j].style.display = 'inline'; input[j].onclick = function() { this.form.quizId.value = ; this.form.submit(); }; } // Correct the bug of ie6 on textfields else if( input[j].className === 'numbers' || input[j].className === 'words' ) { if( typeof document.body.style.maxHeight === 'undefined' ) { input[j].parentNode.onclick = function() { this.parentNode.firstChild.style.display = 'inline'; this.parentNode.firstChild.style.position = 'absolute'; this.parentNode.firstChild.style.marginTop = '1.7em'; }; input[j].parentNode.onmouseout = function() { this.parentNode.firstChild.style.display = 'none'; }; } input[j].onkeydown = function() { if( this.form.shuffleButton ) { this.form.shuffleButton.disabled = true; } }; } if( input[j].className === 'check' ) { input[j].onclick = function() { if( this.form.shuffleButton ) { this.form.shuffleButton.disabled = true; } }; } // Disable the submit button if the page is in preview mode if( input[j].type === 'submit' && document.editform ) { input[j].disabled = true; } } } } }

function addLoadListener( func ) { if ( window.addEventListener ) { window.addEventListener( 'load', func, false ); } else if ( document.addEventListener ) { document.addEventListener( 'load', func, false ); } else if ( window.attachEvent ) { window.attachEvent( 'onload', func ); } }

if ( document.getElementById && document.createTextNode ) { addLoadListener( prepareQuiz ); } })();

</script> <style> .quiz .settings input.numerical { width: 2em; }

  • >.quiz .header .questionId {

text-indent: -1.5em; }

.quiz table.object, .quiz table.correction { background-color: transparent; }

.quiz .hideCorrection .correction { display: none; }

.quiz .settings td { padding: 0.1em 0.4em 0.1em 0.4em; }

.quiz table.settings { background-color: transparent; }

.quiz .sign { text-align: center; }

.quiz a.input, .quiz a.input:hover, .quiz a.input:active, .quiz a.input:visited { text-decoration: none; color: black; outline: 0; }

.quiz a.input span { outline: #7F9DB9 solid 1px; *border: 1px solid #7F9DB9; }

.quiz a.input:active span.correction, .quiz a.input:focus span.correction { display: inline; position: absolute; margin: 1.8em 0 0 0.1em; }

</style>