You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
219 lines
5.8 KiB
219 lines
5.8 KiB
13 years ago
|
var sankoreLang = {
|
||
12 years ago
|
view: "Afficher",
|
||
13 years ago
|
edit: "Modifier",
|
||
|
example: "Ceci est une série de mots à séparer correctement",
|
||
|
wgt_name: "Séparer une phrase",
|
||
|
reload: "Recharger",
|
||
13 years ago
|
slate: "ardoise",
|
||
13 years ago
|
pad: "tablette",
|
||
12 years ago
|
none: "aucun",
|
||
12 years ago
|
help: "Aide",
|
||
|
help_content: "<p><h2>Séparer une phrase</h2></p>"+
|
||
12 years ago
|
"<p><h3>Séparer les mots d’une phrase.</h3></p>"+
|
||
12 years ago
|
|
||
12 years ago
|
"<p>Une phrase est écrite sans que les mots ne soient séparés. Le but de cette activité est d’insérer les espaces aux bons endroits. Une fois que les séparations sont placées correctement, la phrase se colore en vert.</p>"+
|
||
12 years ago
|
|
||
12 years ago
|
"<p>Pour ajouter des séparations entre les mots, déplacez le curseur et cliquez entre deux lettres, une séparation s’ajoute alors.</p>"+
|
||
12 years ago
|
|
||
|
|
||
12 years ago
|
"<p>Le bouton “Recharger” réinitialise l’exercice.</p>"+
|
||
12 years ago
|
|
||
|
|
||
12 years ago
|
"<p>Le bouton “Modifier” vous permet de :</p>"+
|
||
12 years ago
|
|
||
12 years ago
|
"<ul><li>choisir le thème de l’interactivité : tablette, ardoise ou aucun (par défaut aucun), </li>"+
|
||
|
"<li>déterminer la phrase sur laquelle travailler.</li></ul>"+
|
||
12 years ago
|
|
||
12 years ago
|
"<p>Ecrivez simplement une phrase dans la zone de texte.</p>"+
|
||
12 years ago
|
|
||
|
|
||
12 years ago
|
"<p>Le bouton “Afficher” vous permet d’utiliser l’activité.</p>",
|
||
|
theme: "Thème"
|
||
12 years ago
|
|
||
13 years ago
|
};
|
||
|
|
||
|
// if use the "view/edit" button or rely on the api instead
|
||
|
var isSankore = false;
|
||
|
// whether to do window.resize or not (window = widget area)
|
||
|
var isBrowser = ( typeof( widget ) == "undefined" );
|
||
|
|
||
|
function wcontainer( containerID )
|
||
|
{
|
||
12 years ago
|
// some protecred variables
|
||
|
var thisInstance = this;
|
||
|
this.editMode = false;
|
||
|
var data = {}; // see setData and getData
|
||
13 years ago
|
|
||
12 years ago
|
// widget size parameters
|
||
|
this.minHeight = 100;
|
||
|
this.minWidth = 400;
|
||
13 years ago
|
|
||
12 years ago
|
// set to 0 for no max width restriction
|
||
|
this.maxWidth = 0;
|
||
13 years ago
|
|
||
12 years ago
|
// links to the elements of the widget
|
||
|
this.elements = {};
|
||
13 years ago
|
|
||
12 years ago
|
/*
|
||
13 years ago
|
============
|
||
|
create
|
||
|
============
|
||
|
- creates html base, inits this.elements, assings events
|
||
|
*/
|
||
12 years ago
|
this.create = function( containerID )
|
||
|
{
|
||
|
var html =
|
||
|
'<div id="mp_content">' +
|
||
|
'<div class="viewmode" id="mp_view">' +
|
||
|
'</div>' +
|
||
|
'<div class="editmode" id="mp_edit">' +
|
||
|
'</div>' +
|
||
|
'</div>';
|
||
13 years ago
|
|
||
12 years ago
|
var container = $( containerID );
|
||
13 years ago
|
|
||
12 years ago
|
container.append( html );
|
||
|
this.elements.edit = container.find( ".editmode" );
|
||
|
this.elements.view = container.find( ".viewmode" );
|
||
|
this.elements.container = container;
|
||
|
this.elements.subcontainer = container.find( "#mp_content" );
|
||
|
this.elements.containerView = this.elements.subcontainer.find( ".viewmode" );
|
||
|
this.elements.containerEdit = this.elements.subcontainer.find( ".editmode" );
|
||
13 years ago
|
|
||
12 years ago
|
$("#wgt_edit").live("click", function(){
|
||
|
thisInstance.modeEdit();
|
||
|
} );
|
||
13 years ago
|
|
||
12 years ago
|
$("#wgt_display").live("click", function(){
|
||
|
thisInstance.modeView();
|
||
|
} );
|
||
|
};
|
||
13 years ago
|
|
||
|
|
||
12 years ago
|
/*
|
||
13 years ago
|
===============
|
||
|
setViewContent
|
||
|
===============
|
||
|
- assigns custom html to the viewmode container
|
||
|
*/
|
||
12 years ago
|
this.setViewContent = function( html )
|
||
|
{
|
||
|
this.elements.container.find( "#mp_content .viewmode" ).html( html );
|
||
|
};
|
||
13 years ago
|
|
||
12 years ago
|
/*
|
||
13 years ago
|
===============
|
||
|
setEditContent
|
||
|
===============
|
||
|
- assigns custom html to the editmode container
|
||
|
*/
|
||
12 years ago
|
this.setEditContent = function( html )
|
||
|
{
|
||
|
this.elements.container.find( "#mp_content .editmode" ).html( html );
|
||
|
};
|
||
13 years ago
|
|
||
|
|
||
|
|
||
12 years ago
|
/*
|
||
13 years ago
|
=========================
|
||
|
modeEdit and modeView
|
||
|
=========================
|
||
|
- switch the widget betweed modes
|
||
|
* for customization extend onEditMode and onViewMode
|
||
|
*/
|
||
12 years ago
|
this.modeEdit = function()
|
||
|
{
|
||
|
this.onEditMode();
|
||
|
this.editMode = true;
|
||
|
this.elements.edit.removeClass( "hide" );
|
||
|
this.elements.view.addClass( "hide" );
|
||
13 years ago
|
|
||
12 years ago
|
//this.adjustSize();
|
||
|
};
|
||
|
this.modeView = function()
|
||
|
{
|
||
|
this.onViewMode();
|
||
|
this.editMode = false;
|
||
|
this.elements.edit.addClass( "hide" );
|
||
|
this.elements.view.removeClass( "hide" );
|
||
13 years ago
|
|
||
12 years ago
|
//this.adjustSize();
|
||
|
};
|
||
13 years ago
|
|
||
|
|
||
12 years ago
|
/*
|
||
13 years ago
|
======================
|
||
|
setData and getData
|
||
|
======================
|
||
|
- store some data inside
|
||
|
*/
|
||
12 years ago
|
this.setData = function( name, value ){
|
||
|
data[name] = value;
|
||
|
};
|
||
|
this.getData = function( name ){
|
||
|
if( typeof( data[name] ) == "undefined" ){
|
||
|
return null;
|
||
|
} else return data[name];
|
||
|
};
|
||
13 years ago
|
|
||
|
|
||
12 years ago
|
// redefinable methods
|
||
13 years ago
|
|
||
12 years ago
|
/*
|
||
13 years ago
|
==========================
|
||
|
onEditMode and onViewMode
|
||
|
==========================
|
||
|
- these are called when the mode is being changed
|
||
|
*/
|
||
12 years ago
|
this.onEditMode = function(){
|
||
|
//
|
||
|
};
|
||
|
this.onViewMode = function(){
|
||
|
//
|
||
|
};
|
||
|
|
||
|
/*
|
||
13 years ago
|
======================
|
||
|
viewSize and editSize
|
||
|
======================
|
||
|
- calculate container size for the adjustSize method
|
||
|
* they are likely to be redefined for each particular widget
|
||
|
*/
|
||
12 years ago
|
this.viewSize = function(){
|
||
|
return {
|
||
|
w: this.elements.containerView.outerWidth(),
|
||
|
h: this.elements.containerView.outerHeight()
|
||
|
};
|
||
|
};
|
||
|
this.editSize = function(){
|
||
|
return {
|
||
|
w: this.elements.containerEdit.outerWidth(),
|
||
|
h: this.elements.containerEdit.outerHeight()
|
||
|
};
|
||
|
};
|
||
|
|
||
|
/*
|
||
13 years ago
|
=====================
|
||
|
checkAnswer
|
||
|
=====================
|
||
|
- check if the exercise in the view mode was done right
|
||
|
* redefine it for each particular widget
|
||
|
*/
|
||
12 years ago
|
this.checkAnswer = function()
|
||
|
{
|
||
|
//
|
||
|
};
|
||
|
|
||
|
|
||
|
// constructor end
|
||
|
|
||
|
// if the constructor was called with a parameter,
|
||
|
// call create() automatically
|
||
|
if( arguments.length > 0 ){
|
||
|
this.create( containerID );
|
||
|
}
|
||
|
this.setData( "dw", this.elements.container.outerWidth( true ) - this.elements.container.width() );
|
||
|
this.setData( "dh", this.elements.container.outerHeight( true ) - this.elements.container.height() );
|
||
|
window.winstance = thisInstance;
|
||
13 years ago
|
}
|