Add Slovak translations for OpenBoard and interactivities

Credit: Jaroslav Ryník
preferencesAboutTextFull
Craig Watson 9 years ago
parent d1eefcf507
commit a3be4d5999
  1. 5265
      resources/i18n/OpenBoard_sk.ts
  2. BIN
      resources/library/interactivities/Ass audio.wgt/locales/sk/img/drop_img.png
  3. 60
      resources/library/interactivities/Ass audio.wgt/locales/sk/index.html
  4. 942
      resources/library/interactivities/Ass audio.wgt/locales/sk/js/script.js
  5. BIN
      resources/library/interactivities/Ass images.wgt/locales/sk/img/drop_img.png
  6. 60
      resources/library/interactivities/Ass images.wgt/locales/sk/index.html
  7. 828
      resources/library/interactivities/Ass images.wgt/locales/sk/js/script.js
  8. 16
      resources/library/interactivities/Calculation.wgt/i18n/Messages_sk.properties
  9. 19
      resources/library/interactivities/Calculation.wgt/js/help_sk-template.js
  10. 60
      resources/library/interactivities/Cat pict.wgt/locales/sk/index.html
  11. 836
      resources/library/interactivities/Cat pict.wgt/locales/sk/js/script.js
  12. 60
      resources/library/interactivities/Cat text.wgt/locales/sk/index.html
  13. 753
      resources/library/interactivities/Cat text.wgt/locales/sk/js/script.js
  14. 59
      resources/library/interactivities/Choose.wgt/locales/sk/index.html
  15. 792
      resources/library/interactivities/Choose.wgt/locales/sk/scripts/selQuestionApp.js
  16. 66
      resources/library/interactivities/Constrast.wgt/locales/sk/index.html
  17. 626
      resources/library/interactivities/Constrast.wgt/locales/sk/scripts/blackYellow.js
  18. 11
      resources/library/interactivities/Dial.wgt/i18n/Messages_sk.properties
  19. 16
      resources/library/interactivities/Dial.wgt/js/help_sk-template.js
  20. 14
      resources/library/interactivities/Dice.wgt/i18n/Messages_sk.properties
  21. 14
      resources/library/interactivities/Dice.wgt/js/help_sk-template.js
  22. 15
      resources/library/interactivities/Envelope.wgt/i18n/Messages_sk.properties
  23. 12
      resources/library/interactivities/Envelope.wgt/js/help_sk-template.js
  24. 19
      resources/library/interactivities/Memory.wgt/i18n/Messages_sk.properties
  25. 20
      resources/library/interactivities/Memory.wgt/js/help_sk-template.js
  26. 60
      resources/library/interactivities/Order Letters.wgt/locales/sk/index.html
  27. 566
      resources/library/interactivities/Order Letters.wgt/locales/sk/js/script.js
  28. BIN
      resources/library/interactivities/Order Pictures.wgt/locales/sk/img/drop_img.png
  29. 61
      resources/library/interactivities/Order Pictures.wgt/locales/sk/index.html
  30. 592
      resources/library/interactivities/Order Pictures.wgt/locales/sk/js/script.js
  31. 68
      resources/library/interactivities/Order Sentence.wgt/locales/sk/index.html
  32. 391
      resources/library/interactivities/Order Sentence.wgt/locales/sk/script/template2.js
  33. 68
      resources/library/interactivities/Order Words.wgt/locales/sk/index.html
  34. 435
      resources/library/interactivities/Order Words.wgt/locales/sk/scripts/template2.js
  35. 13
      resources/library/interactivities/Scale.wgt/i18n/Messages_sk.properties
  36. 18
      resources/library/interactivities/Scale.wgt/js/help_sk-template.js
  37. 60
      resources/library/interactivities/Select.wgt/locales/sk/index.html
  38. 575
      resources/library/interactivities/Select.wgt/locales/sk/js/script.js
  39. 64
      resources/library/interactivities/Slider.wgt/locales/sk/index.html
  40. 720
      resources/library/interactivities/Slider.wgt/locales/sk/js/script.js
  41. 70
      resources/library/interactivities/Split Sentence.wgt/locales/sk/index.html
  42. 211
      resources/library/interactivities/Split Sentence.wgt/locales/sk/scripts/wcontainer.js
  43. 70
      resources/library/interactivities/Split Text.wgt/locales/sk/index.html
  44. 208
      resources/library/interactivities/Split Text.wgt/locales/sk/scripts/wcontainer.js
  45. 69
      resources/library/interactivities/Syllables.wgt/locales/sk/index.html
  46. 203
      resources/library/interactivities/Syllables.wgt/locales/sk/scripts/wcontainer.js
  47. 16
      resources/library/interactivities/Tables.wgt/i18n/Messages_sk.properties
  48. 15
      resources/library/interactivities/Tables.wgt/js/help_sk-template.js
  49. 14
      resources/library/interactivities/Tic Tac Toe.wgt/i18n/Messages_sk.properties
  50. 21
      resources/library/interactivities/Tic Tac Toe.wgt/js/help_sk-template.js
  51. 15
      resources/library/interactivities/Train.wgt/i18n/Messages_sk.properties
  52. 16
      resources/library/interactivities/Train.wgt/js/help_sk-template.js

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,942 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
short_desc: "Koľko zvukových signálov počujete?",
add: "Pridať nový blok",
enter: "Sem zadajte pokyny.",
wgt_name: "Priradenie ku zvuku",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p> <h2>Priradenie k zvuku</h2> </p>" +
"<p> <h3> Priradenie správneho obrázka k zvukovej nahrávke</h3> </p>" +
"<p> Kliknite na obrázok a presuňte ho do poľa na odpoveď. Pri nesprávnej odpovedi sa pole zafarbí dočervena, pri správnej dozelena. </p> "+
"<p> Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu. </p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li> upraviť cvičenie.</li> </ul>" +
"<p>Úprava cvičenia v režime úprav: </p>" +
"<ul><li>ak chcete zmeniť pokyn, kliknite na textové pole,</li>" +
"<li>novú zvukovú nahrávku pridáte jej potiahnutím z&nbsp;knižnice,</li>" +
"<li>rámy pre ďalšie obrázky pridáte kliknutím na „+“,</li>" +
"<li>kliknite na obrázky v&nbsp;knižnici a&nbsp;presuňte ich do rámov,</li>" +
"<li>kliknutím na fajku na ráme obrázka označte správnu odpoveď,</li>" +
"<li>rám môžete vymazať kliknutím na krížik, ktorý nájdete priamo na ňom,</li>" +
"<li>súčasné obrázky nahradíte novými presunom nových obrázkov z&nbsp;knižnice na miesto súčasných.</li></ul>" +
"<p>Tlačidlom „Zobraziť“ sa z&nbsp;režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("associer_sound","")){
var data = jQuery.parseJSON(sankore.preference("associer_sound",""));
importData(data);
}
else
showExample();
if(sankore.preference("as_snd_style","")){
changeStyle(sankore.preference("as_snd_style",""));
$("#style_select").val(sankore.preference("as_snd_style",""));
} else
changeStyle("3")
}
else
showExample();
//events
if (window.widget) {
window.widget.onleave = function(){
exportData();
sankore.setPreference("as_snd_style", $("#style_select").find("option:selected").val());
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(false);
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display", "none");
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_array = [];
container.find(".text_cont .audio_desc").removeAttr("contenteditable");
container.find(".audio_block").removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop")
container.find(".add_img").remove();
// container.find(".close_cont").remove();
container.find(".img_block").each(function(){
if($(this).find("img").attr("src") != "img/drop_img.png"){
$(this).find(".close_img").remove();
$(this).find(".true_img").remove();
$(this).find(".false_img").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop")
.addClass("img_gray");
} else
$(this).remove();
});
var img_answers = $("<div class='imgs_answers imgs_answers_gray'><img src='img/drop_img.png' style='margin-top: 11px;'/></div>").insertAfter(container.find(".sub_cont"));
container.find(".img_block").each(function(){
$(this).css("float","");
tmp_array.push($(this));
});
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(container.find(".imgs_cont"));
}
img_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
container.find(".imgs_cont").droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(true);
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display", "block");
$(".cont").each(function(){
var container = $(this);
container.find(".imgs_answers").find(".img_block").each(function(){
$(this).appendTo(container.find(".imgs_cont"))
});
container.find(".imgs_answers").remove();
// $("<div class='close_cont'>").appendTo(container);
container.find(".imgs_cont").css("background-color", "");
container.find(".text_cont .audio_desc").attr("contenteditable","true");
container.find(".audio_block").attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).removeClass('audio_gray'); return false;")
.attr("ondragover", "$(this).addClass('audio_gray'); return false;")
.attr("ondrop", "$(this).removeClass('audio_gray'); return onDropAudio(this,event);");
var add_img = $("<div class='add_img'>");
container.find(".img_block").each(function(){
$(this).draggable("destroy");
$(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);")
.css("float","left");
$("<div class='close_img'>").appendTo($(this));
if($(this).find("input").val() == "1"){
$("<div class='false_img'>").appendTo($(this));
}
else{
$("<div class='true_img'>").appendTo($(this));
}
});
container.find(".imgs_cont").append(add_img)
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
$("audio").each(function(){
this.pause();
$(this).parent().find(":first-child").removeClass("stop").addClass("play");
});
});
//add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
//N/C - NNE - 20140318 : Deleting the image on the hard drive
var src = $(this).parent().find('img').attr("src");
removeAsset(src);
$(this).parent().remove();
});
//correct image
$(".true_img").live("click",function(){
$(this).parent().parent().find(".img_block").each(function(){
$(this).find("input").val(0);
var tmp_div = $(this).find(".false_img");
if(tmp_div)
tmp_div.removeClass("false_img").addClass("true_img");
})
$(this).parent().find("input").val(1);
$(this).removeClass("true_img").addClass("false_img");
});
//wrong image
$(".false_img").live("click",function(){
$(this).parent().find("input").val(0);
$(this).removeClass("false_img").addClass("true_img");
});
//play/pause event
$(".play, .stop").live("click", function(){
var tmp_audio = $(this);
var audio = tmp_audio.parent().find("audio").get(0);
if($(this).hasClass("play")){
if(tmp_audio.parent().find("source").attr("src")){
tmp_audio.removeClass("play").addClass("stop");
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.play();
}
} else {
$(this).removeClass("stop").addClass("play");
clearInterval( tmp_audio.parent().find("input").val())
audio.pause();
}
});
$(".replay").live("click", function(){
var tmp_audio = $(this).prev();
var audio = $(this).parent().find("audio").get(0);
if(tmp_audio.parent().find("source").attr("src")){
$(this).prev().removeClass("play").addClass("stop");
clearInterval($(this).parent().find("input").val());
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.currentTime = 0;
audio.play();
}
});
}
//N/C - NNE - 20140318 : Remove an asset (resource) throught the sankore API
function removeAsset(src)
{
if(src != 'img/drop_img.png' && sankore){
sankore.removeFile(src);
}
}
//N/C - NNE - 20140318 : END
//export
function exportData(){
var array_to_export = [];
if($("#wgt_edit").hasClass("selected")){
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".audio_desc").text();
cont_obj.audio = $(this).find("source").attr("src").replace("../../","");;
cont_obj.mode = "edit";
cont_obj.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
} else {
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".audio_desc").text();
cont_obj.audio = $(this).find("source").attr("src").replace("../../","");
cont_obj.mode = "display";
cont_obj.imgs = [];
if($(this).find(".imgs_answers").children()[0].tagName == "DIV"){
var tmp_cont = $(this).find(".imgs_answers").find(".img_block");
var img_obj = new Object();
img_obj.value = tmp_cont.find("input").val();
img_obj.link = tmp_cont.find("img").attr("src").replace("../../","");
img_obj.ht = tmp_cont.find("img").height();
img_obj.wd = tmp_cont.find("img").width();
img_obj.cont = "answers";
cont_obj.imgs.push(img_obj);
}
$(this).find(".imgs_cont .img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
img_obj.cont = "cont";
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
}
if(window.sankore)
sankore.setPreference("associer_sound", JSON.stringify(array_to_export));
}
//import
function importData(data){
for(var i in data){
if(data[i].mode == "edit"){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_answers = $("<div class='imgs_answers imgs_answers_gray'><img src='img/drop_img.png' style='margin-top: 11px;'/></div>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>").appendTo(sub_container);
var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../" + data[i].audio);
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block);
$("<div class='audio_desc'>" + data[i].text + "</div>").appendTo(text);
for(var j in data[i].imgs){
var img_block = $("<div class='img_block img_gray' style='text-align: center;'>");
var img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
var hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
tmp_array.push(img_block);
}
tmp_array = shuffle(tmp_array);
for(j in tmp_array){
tmp_array[j].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[j].appendTo(imgs_container);
}
imgs_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
imgs_container.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
container.appendTo("#data");
} else {
container = $("<div class='cont'>");
sub_container = $("<div class='sub_cont'>").appendTo(container);
imgs_answers = $("<div class='imgs_answers'></div>").appendTo(container);
$("<img src='img/drop_img.png' style='margin-top: 11px;'/>").appendTo(imgs_answers);
imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
text = $("<div class='text_cont'>").appendTo(sub_container);
audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
source = $("<source/>").attr("src", "../../" + data[i].audio);
audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block);
$("<div class='audio_desc'>" + data[i].text + "</div>").appendTo(text);
for(j in data[i].imgs){
img_block = $("<div class='img_block img_gray' style='text-align: center;'>");
img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
img_block.draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
if(data[i].imgs[j].cont == "cont")
img_block.appendTo(imgs_container);
else{
imgs_answers.empty();
img_block.appendTo(imgs_answers);
if(data[i].imgs[j].value == "1")
imgs_answers.addClass("imgs_answers_green");
else
imgs_answers.addClass("imgs_answers_red");
}
}
imgs_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
imgs_container.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
container.appendTo("#data");
}
}
}
//example
function showExample(){
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_answers = $("<div class='imgs_answers imgs_answers_gray'><img src='img/drop_img.png' style='margin-top: 11px;'/></div>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>").appendTo(sub_container);
var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../objects/beep.wav");
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block);
var audio_desc = $("<div class='audio_desc'>" + sankoreLang.short_desc + "</div>").appendTo(text);
$("<input type='hidden' value='1'/>").appendTo(imgs_container);
var img1 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img1);
$("<img src=\"../../objects/0.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img1);
var img2 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var img3 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img3);
$("<img src=\"../../objects/2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img3);
var img4 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img4);
$("<img src=\"../../objects/3.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img4);
var img5 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img5);
$("<img src=\"../../objects/4.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img5);
tmp_array.push(img1, img2, img3, img4, img5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(imgs_container);
}
imgs_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
imgs_container.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
}
//check result
function checkResult(event)
{
var str = "";
var right_str = $(event.target).find("input").val();
$(event.target).find(".img_block").each(function(){
str += $(this).find("input").val() + "*";
});
if(str == right_str)
$(event.target).css("background-color","#9f9");
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
// var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
//
// var close = $("<div class='close_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
// var text = $("<div class='text_cont'>").appendTo(sub_container);
// var audio_block = $("<div class='audio_block'>").appendTo(text);
// audio_block.attr("ondragenter", "return false;")
// .attr("ondragleave", "$(this).removeClass('audio_gray'); return false;")
// .attr("ondragover", "$(this).addClass('audio_gray'); return false;")
// .attr("ondrop", "$(this).removeClass('audio_gray'); return onDropAudio(this,event);");
// $("<div class='play'>").appendTo(audio_block);
// $("<div class='replay'>").appendTo(audio_block);
// var source = $("<source/>").attr("src", "");
// var audio = $("<audio>").appendTo(audio_block);
// audio.append(source);
// $("<input type='hidden'/>").appendTo(audio_block);
// var audio_desc = $("<div class='audio_desc' contenteditable>" + sankoreLang.enter + "</div>").appendTo(text);
//
// $("<input type='hidden' value='1'/>").appendTo(imgs_container);
// var add_img = $("<div class='add_img'>").appendTo(imgs_container);
// container.insertBefore($(".add_block"));
//}
//add new img block
function addImgBlock(dest){
var img_block = $("<div class='img_block img_gray' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);' style='text-align: center; float: left;'></div>").insertBefore(dest);
$("<div class='close_img'>").appendTo(img_block);
$("<div class='true_img'>").appendTo(img_block);
$("<input type='hidden' value='0'/>").appendTo(img_block);
$("<img src='img/drop_img.png' height='120'/>").appendTo(img_block);
}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
function onDropTarget(obj, event) {
//N/C - NNE - 20140318
var img = $(obj).find("img");
removeAsset(img.attr("src"));
img.remove();
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_img = $("<img/>").attr("src", "../../" + tmp);
$(obj).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}
function onDropAudio(obj, event) {
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_type = textData.getElementsByTagName("type")[0].firstChild.textContent;
if(tmp_type.substr(0, 5) == "audio"){
var audio_block = $(obj);
//N/C - NNE - 20140318
var audioAsset = $(obj).find("audio");
removeAsset(audioAsset.find('source').attr("src"));
audioAsset.remove();
audio_block.find(":first-child").removeClass("stop").addClass("play");
var source = $("<source/>").attr("src", "../../" + tmp);
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
}
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}
if (window.widget) {
window.widget.onremove = function(){
$("audio").each(function(){
this.pause();
$(this).parent().find(":first-child").removeClass("stop").addClass("play");
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,828 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
short_desc: "Vyberte číslo tri.",
add: "Pridať novú otázku",
enter: "Sem napíšte pokyny.",
wgt_name: "Priradenie obrázkov",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomocník",
help_content:
"<p> <h2>Priradenie obrázka</h2> </p>" +
"<p> <h3>Výber správneho obrázka</h3> </p>" +
"<p> Kliknite na obrázok a presuňte ho do poľa na odpoveď. Pri nesprávnej odpovedi sa pole zafarbí dočervena, pri správnej dozelena.</p> "+
"<p> Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu. </p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li> upraviť cvičenie.</li> </ul>" +
"<p>Úprava cvičenia v režime úprav: </p>" +
"<div style='margin-left:20px;'><p>Ak chcete zmeniť pokyn, kliknite na textové pole.<br>" +
"<p>Rámy pre ďalšie obrázky pridáte kliknutím na „+“.</p>" +
"<p>Kliknite na obrázky v knižnici a potiahnite ich do rámov.</p>" +
"<p>Kliknutím na fajku na ráme obrázka označte správnu odpoveď.</p>" +
"<p>Rám môžete vymazať kliknutím na krížik, ktorý nájdete priamo na ňom.</p>" +
"<p>Obrázok môžete nahradiť kliknutím na ikonu obnovenia (okrúhla šípka) na ráme obrázka.</p></div>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme:"Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("associer","")){
var data = jQuery.parseJSON(sankore.preference("associer",""));
importData(data);
} else {
showExample();
}
}
else
showExample();
//events
if (window.widget) {
window.widget.onleave = function(){
exportData();
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(false);
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display", "none");
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_array = [];
container.find(".text_cont").removeAttr("contenteditable");
container.find(".add_img").remove();
// container.find(".close_cont").remove();
container.find(".img_block").each(function(){
if($(this).find("img").attr("src") != "img/drop_img.png"){
$(this).find(".close_img").remove();
$(this).find(".clear_img").remove();
$(this).find(".true_img").remove();
$(this).find(".false_img").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop")
.addClass("img_gray");
} else
$(this).remove();
});
var img_answers = $("<div class='imgs_answers imgs_answers_gray'><img src='img/drop_img.png' style='margin-top: 11px;'/></div>").insertAfter(container.find(".sub_cont"));
container.find(".img_block").each(function(){
$(this).css("float","");
tmp_array.push($(this));
});
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(container.find(".imgs_cont"));
}
img_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
container.find(".imgs_cont").droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(true);
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display", "block");
$(".cont").each(function(){
var container = $(this);
container.find(".imgs_answers").find(".img_block").each(function(){
$(this).appendTo(container.find(".imgs_cont"))
});
container.find(".imgs_answers").remove();
// $("<div class='close_cont'>").appendTo(container);
container.find(".text_cont").attr("contenteditable","true");
var add_img = $("<div class='add_img'>");
container.find(".img_block").each(function(){
$(this).draggable("destroy");
$(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);")
.css("float","left");
$("<div class='close_img'>").appendTo($(this));
$("<div class='clear_img'>").appendTo($(this));
if($(this).find("input").val() == "1"){
$("<div class='false_img'>").appendTo($(this));
}
else{
$("<div class='true_img'>").appendTo($(this));
}
});
container.find(".imgs_cont").append(add_img)
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
});
//add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
//N/C - NNE - 20140318 : Deleting the image on the hard drive
var src = $(this).parent().find('img').attr("src");
removeAsset(src);
$(this).parent().remove();
});
//cleaning an image
$(".clear_img").live("click",function(){
//N/C - NNE - 20140318 : Deleting the image on the hard drive
var img = $(this).parent().find("img");
removeAsset(img.attr("src"));
img.attr("src","img/drop_img.png");
});
//correct image
$(".true_img").live("click",function(){
$(this).parent().parent().find(".img_block").each(function(){
$(this).find("input").val(0);
var tmp_div = $(this).find(".false_img");
if(tmp_div)
tmp_div.removeClass("false_img").addClass("true_img");
})
$(this).parent().find("input").val(1);
$(this).removeClass("true_img").addClass("false_img");
});
//wrong image
$(".false_img").live("click",function(){
$(this).parent().find("input").val(0);
$(this).removeClass("false_img").addClass("true_img");
});
}
//N/C - NNE - 20140318 : Remove an asset (resource) throught the sankore API
function removeAsset(src)
{
if(src != 'img/drop_img.png' && sankore){
sankore.removeFile(src);
}
}
//N/C - NNE - 20140318 : END
//export
function exportData(){
var array_to_export = [];
if($("#wgt_edit").hasClass("selected")){
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.text = $(this).find(".text_cont").text();
cont_obj.mode = "edit";
cont_obj.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
} else {
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.text = $(this).find(".text_cont").text();
cont_obj.mode = "display";
cont_obj.imgs = [];
if($(this).find(".imgs_answers").children()[0].tagName == "DIV"){
var tmp_cont = $(this).find(".imgs_answers").find(".img_block");
var img_obj = new Object();
img_obj.value = tmp_cont.find("input").val();
img_obj.link = tmp_cont.find("img").attr("src").replace("../../","");
img_obj.ht = tmp_cont.find("img").height();
img_obj.wd = tmp_cont.find("img").width();
img_obj.cont = "answers";
cont_obj.imgs.push(img_obj);
}
$(this).find(".imgs_cont .img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
img_obj.cont = "cont";
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
}
if($(".cont").size() == 0){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.tmp = "clear";
array_to_export.push(cont_obj);
}
if(window.sankore)
sankore.setPreference("associer", JSON.stringify(array_to_export));
}
//import
function importData(data){
for(var i in data){
if(data[i].tmp){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
} else {
if(i == 0){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
}
if(data[i].mode == "edit"){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_answers = $("<div class='imgs_answers imgs_answers_gray'><img src='img/drop_img.png' style='margin-top: 11px;'/></div>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + data[i].text + "</div>").appendTo(sub_container);
for(var j in data[i].imgs){
var img_block = $("<div class='img_block img_gray' style='text-align: center;'>");
var img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
var hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
tmp_array.push(img_block);
}
tmp_array = shuffle(tmp_array);
for(j in tmp_array){
tmp_array[j].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[j].appendTo(imgs_container);
}
imgs_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
imgs_container.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
container.appendTo("#data");
} else {
container = $("<div class='cont'>");
sub_container = $("<div class='sub_cont'>").appendTo(container);
imgs_answers = $("<div class='imgs_answers'></div>").appendTo(container);
$("<img src='img/drop_img.png' style='margin-top: 11px;'/>").appendTo(imgs_answers);
imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
text = $("<div class='text_cont'>" + data[i].text + "</div>").appendTo(sub_container);
for(j in data[i].imgs){
img_block = $("<div class='img_block img_gray' style='text-align: center;'>");
img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
img_block.draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
if(data[i].imgs[j].cont == "cont")
img_block.appendTo(imgs_container);
else{
imgs_answers.empty();
img_block.appendTo(imgs_answers);
if(data[i].imgs[j].value == "1")
imgs_answers.addClass("imgs_answers_green");
else
imgs_answers.addClass("imgs_answers_red");
}
}
imgs_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
imgs_container.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
container.appendTo("#data");
}
}
}
}
//example
function showExample(){
changeStyle("3");
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_answers = $("<div class='imgs_answers imgs_answers_gray'><img src='img/drop_img.png' style='margin-top: 11px;'/></div>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + sankoreLang.short_desc + "</div>").appendTo(sub_container);
$("<input type='hidden' value='1'/>").appendTo(imgs_container);
var img1 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img1);
$("<img src=\"../../objects/0.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img1);
var img2 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var img3 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img3);
$("<img src=\"../../objects/2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img3);
var img4 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img4);
$("<img src=\"../../objects/3.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img4);
var img5 = $("<div class='img_block img_gray' style='text-align: center;'></div>");
$("<input type='hidden' value='0'/>").appendTo(img5);
$("<img src=\"../../objects/4.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img5);
tmp_array.push(img1, img2, img3, img4, img5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(imgs_container);
}
imgs_answers.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if($(this).children()[0].tagName == "IMG")
$(this).children().remove();
else
$(ui.draggable).parent().append($(this).children());
$(this).append($(ui.draggable));
if($(this).children().length == 1){
if($(this).children().find("input").val() == "1")
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(this).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
});
imgs_container.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_cont = $(ui.draggable).parent();
$(this).append($(ui.draggable));
tmp_cont.append("<img src='img/drop_img.png' style='margin-top: 11px;'/>");
var answers = "";
$(this).parent().find(".imgs_answers .img_block").each(function(){
answers += $(this).find("input").val();
});
if(tmp_cont.children()[0].tagName == "IMG")
tmp_cont.removeClass("imgs_answers_green")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_gray");
else
if(tmp_cont.children().length == 1){
if(tmp_cont.children().find("input").val() == "1")
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
tmp_cont.removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_red");
}
}
}
}
});
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
//check result
function checkResult(event)
{
var str = "";
var right_str = $(event.target).find("input").val();
$(event.target).find(".img_block").each(function(){
str += $(this).find("input").val() + "*";
});
if(str == right_str)
$(event.target).css("background-color","#9f9");
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
// var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
//
// var close = $("<div class='close_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
// var text = $("<div class='text_cont' contenteditable>" + sankoreLang.enter + "</div>").appendTo(sub_container);
//
// $("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
// var add_img = $("<div class='add_img'>").appendTo(imgs_container);
// container.insertBefore($(".add_block"));
//}
//add new img block
function addImgBlock(dest){
var img_block = $("<div class='img_block img_gray' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);' style='text-align: center; float: left;'></div>").insertBefore(dest);
$("<div class='close_img'>").appendTo(img_block);
$("<div class='clear_img'>").appendTo(img_block);
$("<div class='true_img'>").appendTo(img_block);
$("<input type='hidden' value='0'/>").appendTo(img_block);
$("<img src='img/drop_img.png' height='120'/>").appendTo(img_block);
}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
function onDropTarget(obj, event) {
//N/C - NNE - 20140318
var img = $(obj).find("img");
removeAsset(img.attr("src"));
img.remove();
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_img = $("<img/>").attr("src", "../../" + tmp);
$(obj).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}

@ -0,0 +1,16 @@
fr.njin.i18n.document.title = Príklady
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zobraziť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomoc
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.calcul.parameters.label.operator = Znamienko
fr.njin.i18n.calcul.parameters.label.range = Veľkosť
fr.njin.i18n.calcul.parameters.label.count = Počet čísel
fr.njin.i18n.calcul.parameters.label.operations = Počet príkladov

@ -0,0 +1,19 @@
<h3> Príklady </h3>
<h4> Aritmetika, jednoduché úkony </h4>
<p>Táto interaktívna aktivita slúži na pre&shy;cvičenie sčítania, odčítania a&nbsp;násobenia. Treba zadať správne výsledky príkladov. Na kontrolu odpovede použite tlačidlo v&nbsp;tvare fajky.
Ak výsledok nie je správny, výpočet sa zafarbí dočervena. Ak je výsledok správny, výpočet sa zafarbí dozelena.</p>
<p>Po vypočítaní a&nbsp;skontrolovaní všetkých príkladov sa všetky výpočty zobrazia na jednej stránke.</p>
<p>Po stlačení tlačidla Obnoviť sa zobrazia nové príklady.</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul><li>farebný motív na tablet, bridlicu alebo na žiadny (predvolený je tablet), </li>
<li>počtový úkon (sčítanie, odčítanie, násobenie),</li>
<li>veľkosť zobrazovaných čísel,</li>
<li>počet čísel v&nbsp;zadaní príkladu (od 2 &ndash; 4),</li>
<li>počet príkladov (od 2 &ndash; 10).</li></ul>
<p>Výsledky pre účely kontroly si interaktívna aktivita vypočíta automaticky.</p>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,836 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
first_desc: "Nepárne čísla",
second_desc: "Párne čísla",
enter: "Sem zadajte názov kategórie.",
add: "Pridať nový blok",
wgt_name: "Triedenie obrázkov",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Triedenie obrázkov</h2></p>" +
"<p><h3>Zaraďte obrázky do správnej kategórie</h3></p>" +
"<p>Úlohou žiakov je kliknúť na každý obrázok a&nbsp;presunúť ho do príslušnej kategórie. Interaktívna aktivita bude vyhodnotená, až keď zaradia všetky obrázky. Pri nesprávnej odpovedi sa priestor okolo obrázkov zafarbí dočervena, pri správnej dozelena.</p>"+
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li>upraviť cvičenie.</li> </ul>" +
"<p>Úprava cvičenia v režime úprav: </p>" +
"<ul> <li> názov kategórie zmeníte tak, že naň kliknete a ten pôvodný prepíšete,</li>" +
"<li> novú kategóriu pridáte kliknutím na „+“,</li>" +
"<li> obrázky z knižnice potiahnite do správnej kategórie,</li>" +
"<li> obrázok vymažete kliknutím na tlačidlo v&nbsp;tvare krížika, ktoré nájdete na jeho ráme,</li>" +
"<li> kategóriu odstránite kliknutím na znamienko „-“ na pravej strane.</li></ul>" +
"<p> Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("categoriser_images","")){
var data = jQuery.parseJSON(sankore.preference("categoriser_images",""));
importData(data);
} else {
showExample();
}
}
else
showExample();
if (window.widget) {
window.widget.onleave = function(){
exportData();
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
if(window.sankore)
sankore.enableDropOnWidget(false);
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_right = "";
var tmp_array = [];
// container.find(".close_cont").remove();
container.find(".imgs_cont").each(function(){
$(this).find(".del_category").remove();
$(this).find(".add_category").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop")
.find(".cat_desc").attr("disabled","disabled");
var tmp_count = $(this).find(".img_block").size();
$(this).find("input[name='count']").val(tmp_count);
$(this).find(".img_block").each(function(){
$(this).find(".close_img").remove();
tmp_array.push($(this));
$(this).remove();
});
$(this).droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
$(this).removeAttr("style");
});
var all_imgs = $("<div class='all_imgs'>").appendTo(container);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(all_imgs);
}
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
if(window.sankore)
sankore.enableDropOnWidget(true);
$(".cont").each(function(){
var container = $(this);
// $("<div class='close_cont'>").appendTo(container);
container.find(".imgs_cont").each(function(){
$("<button class='del_category'></button>").appendTo($(this));
$("<button class='add_category'></button>").appendTo($(this));
$(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"#E6F6FF\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#C3E9FF\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"#E6F6FF\"); return onDropTarget(this,event);")
.removeClass("red_cont")
.removeClass("green_cont")
.addClass("def_cont")
.droppable("destroy")
.find(".cat_desc").removeAttr("disabled");
var tmp_img_cont = $(this);
var tmp_mask = $(this).find("input[name='mask']").val();
container.find(".img_block").each(function(){
if($(this).find("input").val() == tmp_mask){
$("<div class='close_img'>").appendTo($(this));
$(this).appendTo(tmp_img_cont);
}
});
});
container.find(".all_imgs").remove();
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
});
//add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
var img = $(this).parent().children('img');
//N/C - NNE - 20140314 : deleting the image on the disk
sankore.removeFile(img.attr('src'));
$(this).parent().remove();
});
//adding new category
$(".add_category").live("click",function(){
addCategory($(this).parent());
});
//deleting the category
$(".del_category").live("click",function(){
if($(this).parent().parent().find(".imgs_cont").size() == 1){
//N/C - NNE - 20140314 : deleting the images on the disk
var imgBlock = $(this).parent().find(".img_block");
var img = imgBlock.find('img');
for(var i = 0; i < img.length; i++){
sankore.removeFile(img.attr('src'));
}
$(this).parent().find(".cat_desc").val(sankoreLang.enter);
} else {
//N/C - NNE - 20140314 : deleting the images on the disk
var img = $(this).parent().find('img');
img.each(function(){
sankore.removeFile($(this).attr('src'));
});
$(this).parent().remove();
}
});
}
//export
function exportData(){
var array_to_export = [];
if($("#wgt_edit").hasClass("selected")){
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.mode = "edit";
cont_obj.conts = [];
$(this).find(".imgs_cont").each(function(){
var img_cont = new Object();
img_cont.mask = $(this).find("input[name='mask']").val();
img_cont.count = $(this).find(".img_block").size();
img_cont.text = $(this).find(".cat_desc").val();
img_cont.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
img_cont.imgs.push(img_obj);
});
cont_obj.conts.push(img_cont);
});
array_to_export.push(cont_obj);
});
} else {
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.mode = "display";
cont_obj.conts = [];
$(this).find(".imgs_cont").each(function(){
var img_cont = new Object();
img_cont.mask = $(this).find("input[name='mask']").val();
img_cont.count = $(this).find("input[name='count']").val();
img_cont.text = $(this).find(".cat_desc").val();
img_cont.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
img_cont.imgs.push(img_obj);
});
cont_obj.conts.push(img_cont);
});
cont_obj.all_imgs = [];
$(this).find(".all_imgs .img_block").each(function(){
var img = new Object();
img.value = $(this).find("input").val();
img.link = $(this).find("img").attr("src").replace("../../","");
img.ht = $(this).find("img").height();
img.wd = $(this).find("img").width();
cont_obj.all_imgs.push(img);
});
array_to_export.push(cont_obj);
});
}
if($(".cont").size() == 0){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.tmp = "clear";
array_to_export.push(cont_obj);
}
if(window.sankore)
sankore.setPreference("categoriser_images", JSON.stringify(array_to_export));
}
//import
function importData(data){
for(var i in data){
if(data[i].tmp){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
} else {
if(i == 0){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
}
if(data[i].mode == "edit"){
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
// $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
for(var j in data[i].conts){
var imgs_container = $("<div class='imgs_cont def_cont'>").appendTo(container);
$("<input type='hidden' name='mask' value='" + data[i].conts[j].mask + "'/>").appendTo(imgs_container);
$("<input type='hidden' name='count' value='" + data[i].conts[j].count + "'/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
// Issue 1516 - CFA - 20131029 : gestion des quotes dans le input
html_text = data[i].conts[j].text.replace(/"/g, '&quot;');
$('<input type="text" class="cat_desc" value="' + html_text + '" disabled/>').appendTo(tmp_div);
for(var k in data[i].conts[j].imgs){
var block_img = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='" + data[i].conts[j].imgs[k].value + "'/>").appendTo(block_img);
var img = $("<img src=\"../../" + data[i].conts[j].imgs[k].link + "\" style=\"display: inline;\"/>").appendTo(block_img);
img.height(data[i].conts[j].imgs[k].ht);
if((120 - data[i].conts[j].imgs[k].ht) > 0)
img.css("margin",(120 - data[i].conts[j].imgs[k].ht)/2 + "px 0");
tmp_array.push(block_img);
}
imgs_container.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
}
var all_imgs = $("<div class='all_imgs'>").appendTo(container);
tmp_array = shuffle(tmp_array);
for(j in tmp_array){
tmp_array[j].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[j].appendTo(all_imgs);
}
all_imgs.sortable();
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
container.appendTo("#data");
} else {
container = $("<div class='cont'>");
sub_container = $("<div class='sub_cont'>").appendTo(container);
// $("<div class='number_cont'>" + (++tmp) + "</div>").appendTo(sub_container);
for(j in data[i].conts){
var tmp_img_array = [];
imgs_container = $("<div class='imgs_cont def_cont'>").appendTo(container);
$("<input type='hidden' name='mask' value='" + data[i].conts[j].mask + "'/>").appendTo(imgs_container);
$("<input type='hidden' name='count' value='" + data[i].conts[j].count + "'/>").appendTo(imgs_container);
tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
// Issue 1516 - CFA - 20131029 : gestion des quotes dans le input
html_text = data[i].conts[j].text.replace(/"/g, '&quot;');
$('<input type="text" class="cat_desc" value="' + html_text + '" disabled/>').appendTo(tmp_div);
for(k in data[i].conts[j].imgs){
block_img = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='" + data[i].conts[j].imgs[k].value + "'/>").appendTo(block_img);
img = $("<img src=\"../../" + data[i].conts[j].imgs[k].link + "\" style=\"display: inline;\"/>").appendTo(block_img);
img.height(data[i].conts[j].imgs[k].ht);
if((120 - data[i].conts[j].imgs[k].ht) > 0)
img.css("margin",(120 - data[i].conts[j].imgs[k].ht)/2 + "px 0");
tmp_img_array.push(block_img);
}
tmp_img_array = shuffle(tmp_img_array);
for(k in tmp_img_array){
tmp_img_array[k].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_img_array[k].appendTo(imgs_container);
}
imgs_container.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
}
all_imgs = $("<div class='all_imgs'>").appendTo(container);
var all_imgs_arr = [];
for(j in data[i].all_imgs){
block_img = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='" + data[i].all_imgs[j].value + "'/>").appendTo(block_img);
img = $("<img src=\"../../" + data[i].all_imgs[j].link + "\" style=\"display: inline;\"/>").appendTo(block_img);
img.height(data[i].all_imgs[j].ht);
if((120 - data[i].all_imgs[j].ht) > 0)
img.css("margin",(120 - data[i].all_imgs[j].ht)/2 + "px 0");
all_imgs_arr.push(block_img);
}
all_imgs_arr = shuffle(all_imgs_arr);
for(k in all_imgs_arr){
all_imgs_arr[k].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
all_imgs_arr[k].appendTo(all_imgs);
}
all_imgs.sortable();
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
container.appendTo("#data");
checkCorrectness(all_imgs);
}
}
}
}
//example
function showExample(){
changeStyle("3");
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container_one = $("<div class='imgs_cont def_cont'>").appendTo(container);
var imgs_container_two = $("<div class='imgs_cont def_cont'>").appendTo(container);
var all_imgs = $("<div class='all_imgs'>").appendTo(container);
// var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
$("<input type='hidden' name='mask' value='1'/>").appendTo(imgs_container_one);
$("<input type='hidden' name='count' value='2'/>").appendTo(imgs_container_one);
var tmp_div_one = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container_one);
$("<input type='text' class='cat_desc' value='" + sankoreLang.first_desc + "' disabled/>").appendTo(tmp_div_one);
$("<input type='hidden' name='mask' value='2'/>").appendTo(imgs_container_two);
$("<input type='hidden' name='count' value='3'/>").appendTo(imgs_container_two);
var tmp_div_two = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container_two);
$("<input type='text' class='cat_desc' value='" + sankoreLang.second_desc + "' disabled/>").appendTo(tmp_div_two);
var img1 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(img1);
$("<img src=\"../../objects/0.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img1);
var img2 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var img3 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(img3);
$("<img src=\"../../objects/2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img3);
var img4 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img4);
$("<img src=\"../../objects/3.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img4);
var img5 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(img5);
$("<img src=\"../../objects/4.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img5);
tmp_array.push(img1, img2, img3, img4, img5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(all_imgs);
}
all_imgs.sortable();
imgs_container_one.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
imgs_container_two.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
}
//function that allows to add new category
function addCategory(obj){
var imgs_container = $("<div class='imgs_cont def_cont'>").insertAfter(obj);
$("<input type='hidden' name='mask' value='" + returnId() + "'/>").appendTo(imgs_container);
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div);
$("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container);
imgs_container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
// var imgs_container = $("<div class='imgs_cont def_cont'>").appendTo(container);
//
// var close = $("<div class='close_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
//
// $("<input type='hidden' name='mask' value='" + returnId() + "'/>").appendTo(imgs_container);
// $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
// var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
// $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div);
// $("<button class='del_category'></button>").appendTo(imgs_container);
// $("<button class='add_category'></button>").appendTo(imgs_container);
// imgs_container.attr("ondragenter", "return false;")
// .attr("ondragleave", "$(this).css(\"background-color\",\"#e6f6ff\"); return false;")
// .attr("ondragover", "$(this).css(\"background-color\",\"#c3e9ff\"); return false;")
// .attr("ondrop", "$(this).css(\"background-color\",\"#e6f6ff\"); return onDropTarget(this,event);");
// container.insertBefore($(".add_block"));
//}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
//return id
function returnId(){
var tmp = Math.random().toString();
return tmp.substr(2);
}
//a func for checking when smth will drop
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
var tmp_right = true;
dest.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}
function onDropTarget(obj, event) {
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
if(textData.getElementsByTagName("ready")[0].firstChild.textContent == "true"){
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var img_block = $("<div class='img_block' style='text-align: center;'>");
$("<div class='close_img'>").appendTo(img_block);
$("<input type='hidden' value='" + $(obj).find("input[name='mask']").val() + "'/>").appendTo(img_block);
var tmp_img = $("<img style='display: inline;'/>").attr("src", "../../" + tmp).appendTo(img_block);
img_block.draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
$(obj).append(img_block);
if(tmp_img.height() == 0){
var tmp_id = setInterval(function(){
if(tmp_img.height() != 0){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
clearInterval(tmp_id);
}
}, 10);
} else {
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}
}
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,753 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
first_desc: "Ovocie",
second_desc: "Zelenina",
potatoes: "zemiak",
carrot: "mrkva",
onion: "cibuľa",
apple: "jablko",
pear: "hruška",
enter: "Sem zadajte názov kategórie.",
add: "Pridať nový blok",
text: "Nejaký text",
wgt_name: "Triedenie textu",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Triedenie textu</h2></p>" +
"<p><h3>Zaraďte slová do správnej kategórie</h3></p>" +
"<p>Úlohou žiakov je kliknúť na každé slovo a&nbsp;presunúť ho do príslušnej kategórie. Interaktívna aktivita bude vyhodnotená, až keď zaradia všetky slová. Pri nesprávnom zaradení sa kategória zafarbí dočervena, pri správnom dozelena.</p>" +
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul><li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li>upraviť cvičenie.</li> </ul>" +
"<p>Úprava cvičenia v režime úprav: </p>" +
"<ul><li>názov kategórie zmeníte tak, že naň kliknete a&nbsp;ten pôvodný prepíšete,</li>" +
"<li>novú kategóriu pridáte kliknutím na „(malé) +“,</li>" +
"<li>nové slovo pridáte kliknutím na „(veľké) +“ v&nbsp;príslušnej kategórii,</li>" +
"<li>textové pole môžete upraviť, keď naň kliknite,</li>" +
"<li>slovo vymažete kliknutím na tlačidlo s krížikom na ráme štítka,</li>" +
"<li>kategóriu odstránite kliknutím na znamienko „-“ na pravej strane.</li></ul>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("categoriser_text","")){
var data = jQuery.parseJSON(sankore.preference("categoriser_text",""));
importData(data);
} else {
showExample();
}
}
else
showExample();
if (window.widget) {
window.widget.onleave = function(){
exportData();
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_right = "";
var tmp_array = [];
// container.find(".close_cont").remove();
container.find(".imgs_cont").each(function(){
$(this).find(".del_category").remove();
$(this).find(".add_img").remove();
$(this).find(".add_category").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop")
.find(".cat_desc").attr("disabled","disabled");
var tmp_count = $(this).find(".img_block").size();
$(this).find("input[name='count']").val(tmp_count);
$(this).find(".img_block").each(function(){
$(this).find(".close_img").remove();
var tmp_text = $(this).find(".text_cont");
tmp_text.removeAttr("contenteditable")
.css("margin", ($(this).height() - tmp_text.height())/2 + "px 0px");
tmp_array.push($(this));
$(this).remove();
});
$(this).droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
$(this).removeAttr("style");
});
var all_imgs = $("<div class='all_imgs'>").appendTo(container);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].appendTo(all_imgs);
}
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(".cont").each(function(){
var container = $(this);
// $("<div class='close_cont'>").appendTo(container);
container.find(".imgs_cont").each(function(){
$("<button class='del_category'></button>").appendTo($(this));
$("<button class='add_category'></button>").appendTo($(this));
$(this).removeClass("red_cont")
.removeClass("green_cont")
.addClass("def_cont")
.droppable("destroy")
.find(".cat_desc").removeAttr("disabled");
var tmp_img_cont = $(this);
var tmp_mask = $(this).find("input[name='mask']").val();
container.find(".img_block").each(function(){
$(this).draggable("destroy")
.find(".text_cont").attr("contenteditable","true")
.removeAttr("style");
if($(this).find("input").val() == tmp_mask){
$("<div class='close_img'>").appendTo($(this));
$(this).appendTo(tmp_img_cont);
}
});
$("<div class='add_img'>").appendTo($(this));
});
container.find(".all_imgs").remove();
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
});
// //add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//adding new img
$(".add_img").live("click", function(){
addText($(this).parent(), $(this));
});
// //deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
$(this).parent().remove();
});
//adding new category
$(".add_category").live("click",function(){
addCategory($(this).parent());
});
//deleting the category
$(".del_category").live("click",function(){
if($(this).parent().parent().find(".imgs_cont").size() == 1){
$(this).parent().find(".img_block").remove();
$(this).parent().find(".cat_desc").val(sankoreLang.enter);
} else {
$(this).parent().remove();
}
});
}
//export
function exportData(){
var array_to_export = [];
if($("#wgt_edit").hasClass("selected")){
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.mode = "edit";
cont_obj.conts = [];
$(this).find(".imgs_cont").each(function(){
var img_cont = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
img_cont.mask = $(this).find("input[name='mask']").val();
img_cont.count = $(this).find(".img_block").size();
img_cont.text = $(this).find(".cat_desc").val();
img_cont.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.text = $(this).find(".text_cont").text();
img_cont.imgs.push(img_obj);
});
cont_obj.conts.push(img_cont);
});
array_to_export.push(cont_obj);
});
} else {
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.mode = "display";
cont_obj.conts = [];
$(this).find(".imgs_cont").each(function(){
var img_cont = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
img_cont.mask = $(this).find("input[name='mask']").val();
img_cont.count = $(this).find("input[name='count']").val();
img_cont.text = $(this).find(".cat_desc").val();
img_cont.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.text = $(this).find(".text_cont").text();
img_cont.imgs.push(img_obj);
});
cont_obj.conts.push(img_cont);
});
cont_obj.all_imgs = [];
$(this).find(".all_imgs .img_block").each(function(){
var img = new Object();
img.value = $(this).find("input").val();
img.text = $(this).find(".text_cont").text();
cont_obj.all_imgs.push(img);
});
array_to_export.push(cont_obj);
});
}
if($(".cont").size() == 0){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.tmp = "clear";
array_to_export.push(cont_obj);
}
if(window.sankore)
sankore.setPreference("categoriser_text", JSON.stringify(array_to_export));
}
//import
function importData(data){
for(var i in data){
if(data[i].tmp){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
}
else {
if(i == 0){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
}
if(data[i].mode == "edit"){
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
// $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
for(var j in data[i].conts){
var imgs_container = $("<div class='imgs_cont def_cont'>").appendTo(container);
$("<input type='hidden' name='mask' value='" + data[i].conts[j].mask + "'/>").appendTo(imgs_container);
$("<input type='hidden' name='count' value='" + data[i].conts[j].count + "'/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
// Issue 1516 - CFA - 20131029 : gestion des quotes dans le input
html_text = data[i].conts[j].text.replace(/"/g, '&quot;');
$('<input type="text" class="cat_desc" value="' + html_text + '" disabled/>').appendTo(tmp_div);
for(var k in data[i].conts[j].imgs){
var block_img = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='" + data[i].conts[j].imgs[k].value + "'/>").appendTo(block_img);
$("<div class='text_cont'>" + data[i].conts[j].imgs[k].text + "</div>").appendTo(block_img);
tmp_array.push(block_img);
}
imgs_container.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
}
var all_imgs = $("<div class='all_imgs'>").appendTo(container);
tmp_array = shuffle(tmp_array);
for(j in tmp_array){
tmp_array[j].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[j].appendTo(all_imgs);
var tmp_text = tmp_array[j].find(".text_cont");
tmp_text.css("margin", (tmp_array[j].height() - tmp_text.height())/2 + "px 0px");
}
all_imgs.sortable();
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
} else {
container = $("<div class='cont'>").appendTo("#data");
sub_container = $("<div class='sub_cont'>").appendTo(container);
// $("<div class='number_cont'>" + (++tmp) + "</div>").appendTo(sub_container);
for(j in data[i].conts){
var tmp_img_array = [];
imgs_container = $("<div class='imgs_cont def_cont'>").appendTo(container);
$("<input type='hidden' name='mask' value='" + data[i].conts[j].mask + "'/>").appendTo(imgs_container);
$("<input type='hidden' name='count' value='" + data[i].conts[j].count + "'/>").appendTo(imgs_container);
tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
// Issue 1516 - CFA - 20131029 : gestion des quotes dans le input
html_text = data[i].conts[j].text.replace(/"/g, '&quot;');
$('<input type="text" class="cat_desc" value="' + html_text + '" disabled/>').appendTo(tmp_div);
for(k in data[i].conts[j].imgs){
block_img = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='" + data[i].conts[j].imgs[k].value + "'/>").appendTo(block_img);
$("<div class='text_cont'>" + data[i].conts[j].imgs[k].text + "</div>").appendTo(block_img);
tmp_img_array.push(block_img);
}
tmp_img_array = shuffle(tmp_img_array);
for(k in tmp_img_array){
tmp_img_array[k].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_img_array[k].appendTo(imgs_container);
tmp_text = tmp_img_array[k].find(".text_cont");
tmp_text.css("margin", (tmp_img_array[k].height() - tmp_text.height())/2 + "px 0px");
}
imgs_container.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
}
all_imgs = $("<div class='all_imgs'>").appendTo(container);
var all_imgs_arr = [];
for(j in data[i].all_imgs){
block_img = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='" + data[i].all_imgs[j].value + "'/>").appendTo(block_img);
$("<div class='text_cont'>" + data[i].all_imgs[j].text + "</div>").appendTo(block_img);
all_imgs_arr.push(block_img);
}
all_imgs_arr = shuffle(all_imgs_arr);
for(k in all_imgs_arr){
all_imgs_arr[k].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
all_imgs_arr[k].appendTo(all_imgs);
tmp_text = all_imgs_arr[k].find(".text_cont");
tmp_text.css("margin", (all_imgs_arr[k].height() - tmp_text.height())/2 + "px 0px");
}
all_imgs.sortable();
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
checkCorrectness(all_imgs);
}
}
}
}
//example
function showExample(){
changeStyle("3");
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container_one = $("<div class='imgs_cont def_cont'>").appendTo(container);
var imgs_container_two = $("<div class='imgs_cont def_cont'>").appendTo(container);
var all_imgs = $("<div class='all_imgs'>").appendTo(container);
// var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
$("<input type='hidden' name='mask' value='1'/>").appendTo(imgs_container_one);
$("<input type='hidden' name='count' value='2'/>").appendTo(imgs_container_one);
var tmp_div_one = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container_one);
$("<input type='text' class='cat_desc' value='" + sankoreLang.first_desc + "' disabled/>").appendTo(tmp_div_one);
$("<input type='hidden' name='mask' value='2'/>").appendTo(imgs_container_two);
$("<input type='hidden' name='count' value='3'/>").appendTo(imgs_container_two);
var tmp_div_two = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container_two);
$("<input type='text' class='cat_desc' value='" + sankoreLang.second_desc + "' disabled/>").appendTo(tmp_div_two);
var text1 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(text1);
$("<div class='text_cont'>" + sankoreLang.potatoes + "</div>").appendTo(text1);
var text2 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(text2);
$("<div class='text_cont'>" + sankoreLang.apple + "</div>").appendTo(text2);
var text3 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(text3);
$("<div class='text_cont'>" + sankoreLang.carrot + "</div>").appendTo(text3);
var text4 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(text4);
$("<div class='text_cont'>" + sankoreLang.pear + "</div>").appendTo(text4);
var text5 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(text5);
$("<div class='text_cont'>" + sankoreLang.onion + "</div>").appendTo(text5);
tmp_array.push(text1, text2, text3, text4, text5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++){
tmp_array[i].draggable({
helper:'clone',
zIndex:100,
appendTo: '#data'
});
tmp_array[i].find(".text_cont").css("margin", "21px 0px");
tmp_array[i].appendTo(all_imgs);
}
all_imgs.sortable();
imgs_container_one.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
imgs_container_two.droppable({
hoverClass: 'dropHere',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
});
all_imgs.droppable({
hoverClass: 'dropBack',
drop: function(event, ui) {
if($(ui.draggable).parent().parent().html() == $(this).parent().html()){
if(this != $(ui.draggable).parent()[0]){
var tmp_ui = $(ui.draggable).parent();
$(this).append($(ui.draggable));
checkCorrectness(tmp_ui);
}
}
}
});
}
//add text block
function addText(dest, source){
var text_block = $("<div class='img_block' style='text-align: center;'>").insertBefore(source);
$("<div class='close_img'>").appendTo(text_block);
$("<input type='hidden' value='" + dest.find("input[name='mask']").val() + "'/>").appendTo(text_block);
$("<div class='text_cont' contenteditable='true'>" + sankoreLang.text + "</div>").appendTo(text_block);
}
//function that allows to add new category
function addCategory(obj){
var imgs_container = $("<div class='imgs_cont def_cont'>").insertAfter(obj);
$("<input type='hidden' name='mask' value='" + returnId() + "'/>").appendTo(imgs_container);
$("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
$("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'>").appendTo(tmp_div);
$("<button class='del_category'></button>").appendTo(imgs_container);
$("<button class='add_category'></button>").appendTo(imgs_container);
$("<div class='add_img'>").appendTo(imgs_container);
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
// var imgs_container = $("<div class='imgs_cont def_cont'>").appendTo(container);
//
// var close = $("<div class='close_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
//
// $("<input type='hidden' name='mask' value='" + returnId() + "'/>").appendTo(imgs_container);
// $("<input type='hidden' name='count' value=''/>").appendTo(imgs_container);
// var tmp_div = $("<div style='width: 100%; overflow: hidden;'>").appendTo(imgs_container);
// $("<input type='text' class='cat_desc' value='" + sankoreLang.enter + "'/>").appendTo(tmp_div);
// $("<button class='del_category'></button>").appendTo(imgs_container);
// $("<button class='add_category'></button>").appendTo(imgs_container);
// $("<div class='add_img'>").appendTo(imgs_container);
// container.insertBefore($(".add_block"));
//}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
//return id
function returnId(){
var tmp = Math.random().toString();
return tmp.substr(2);
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
//a func for checking when smth will drop
function checkOnDrop(dest){
var tmp_count = dest.find("input[name='count']").val();
var tmp_mask = dest.find("input[name='mask']").val();
if(dest.find(".img_block").size() == tmp_count){
var tmp_right = true;
dest.find(".img_block").each(function(){
if($(this).find("input").val() != tmp_mask)
tmp_right = false;
});
if(tmp_right)
dest.removeClass("def_cont").removeClass("red_cont").addClass("green_cont");
else
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
} else
dest.removeClass("def_cont").removeClass("green_cont").addClass("red_cont");
}
//checking source on correctness
function checkCorrectness(source){
if(!source.hasClass("all_imgs")){
if(source.parent().find(".all_imgs").find(".img_block").size() == 0){
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
} else {
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
}
} else {
if(source.find(".img_block").size() > 0){
source.parent().find(".imgs_cont").each(function(){
$(this).addClass("def_cont").removeClass("green_cont").removeClass("red_cont");
})
} else {
source.parent().find(".imgs_cont").each(function(){
checkOnDrop($(this))
})
}
}
}

@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="scripts/selQuestionApp.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,792 @@
/*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
var sankoreLang = {
edit: "Upraviť",
display:"Zobraziť",
question:"Otázka",
example_question:"Sem zadajte otázku.",
answer:"Toto je možná odpoveď č. ",
q:"Ot",
add_new_question:"Pridajte novú otázku.",
options:"Možnosti",
close:"Zatvoriť",
delete_question:"Vymazať otázku",
delete_answer:"Vymazať možnosť",
right_answer:"Správna odpoveď",
template_question:"Sem zadajte otázku.",
template_answer:"Sem zadajte jednu odpoveď.",
add_answer:"Pridať možnú odpoveď",
select_text:"Vyberte správnu odpoveď",
options_desc:"Môžete si vybrať jeden z troch variantov zobrazenia možností.",
radio_desc:"Iba jedna správna odpoveď a&nbsp;možnosti zobrazené ako gombíky na rádiu.",
checkbox_desc:"Viac správnych odpovedí a&nbsp;možnosti zobrazené ako zaškrtávacie políčka.",
select_desc:"Iba jedna správna odpoveď a&nbsp;možnosti zobrazené v&nbsp;rozbaľovacom menu.",
a:"Od",
wgt_name: "Výber správnej odpovede",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2> Výber správnej odpovede</h2></p>" +
"<p><h3> Výber z viacerých možností</h3></p>" +
"<p>Otázka s výberom odpovede. Cieľom je vybrať správnu odpoveď.</p>" +
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li> upraviť cvičenie.</li> </ul>" +
"<p>Úprava cvičenia v režime úprav:</p>" +
"<ul><li> kliknite na tlačidlo „Pridať novú otázku“,</li>" +
"<li>po kliknutí na textové pole a&nbsp;prepísaní textu „Sem zadajte otázku.“ môžete zadať vlastnú otázku,</li>" +
"<li>kliknite na „Možnosti“ a&nbsp;zvoľte si typ otázky s&nbsp;výberom správnej odpovede (jedna správna odpoveď, viac správnych odpovedí, rozbaľovacie menu) a&nbsp;zatvorte „Možnosti“,</li>" +
"<li>ak treba, pridajte novú odpoveď,</li> " +
"<li>textové pole môžete upravovať, keď naň kliknete,</li>" +
"<li>správnu odpoveď označte kliknutím na zaškrtávacie políčko, ktoré nájdete naľavo od textového poľa,</li>" +
"<li>interaktívnu aktivitu odstránite kliknutím na tlačidlo v&nbsp;tvare krížika, ktoré nájdete na jej ráme,</li>" +
"<li>odpoveď odstránite po kliknutím na krížik, ktorý sa nachádza napravo od odpovede.</li></ul>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
var questionArray;
var currentQstId = "";
var lang = ""; //locale language
var begin = true;
function init(){
//variables
var toggleFlag = false;
var endFlag = false;
var mode = true;
questionArray = new Array();
var popupFlag = false
var flagForSelect = false;
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
//popup message
var popupText = $("<div id='popupWordInfo' class='popupWordInfo'></div>").appendTo("#data");
// adding question block
var addQstDiv = $("<div id='addQstDiv' class='addQstDiv'>").appendTo("#data");
var addQstButton = $("<button id='addQstButton' class='addQstButton'>").appendTo("#addQstDiv");
var addQsqSpan1 = $("<span id='addQsqSpan1'>" + sankoreLang.q + "1</span>").appendTo("#addQstButton");
var addQsqSpan2 = $("<span id='addQsqSpan2'>" + sankoreLang.add_new_question + "</span>").appendTo("#addQstButton");
//import saved data
if(window.sankore){
if(sankore.preference("qstArrayData","") && sankore.preference("qstArrayData","") != "[]")
questionArray = jQuery.parseJSON(sankore.preference("qstArrayData",""));
else
questionArray = jQuery.parseJSON('[{"text":"' + sankoreLang.example_question + '","type":"1","id":538,"rightAns":"2","answers":[{"id":953,"text":"' + sankoreLang.answer + ' 1.","value":1,"state":"","was":false},{"id":526,"text":"' + sankoreLang.answer + ' 2.","value":2,"state":"","was":false},{"id":473,"text":"' + sankoreLang.answer + ' 3.","value":3,"state":"","was":false}]}]');
for(i in questionArray){
addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'");
for(j in questionArray[i].answers)
addAnsBlock(questionArray[i].answers[j].id, questionArray[i].id, questionArray[i].answers[j].text, true, questionArray[i].rightAns, questionArray[i].type);
}
displayData();
}
else{
questionArray = jQuery.parseJSON('[{"text":"' + sankoreLang.example_question + '","type":"1","id":538,"rightAns":"2","answers":[{"id":953,"text":"' + sankoreLang.answer + ' 1.","value":1,"state":"","was":false},{"id":526,"text":"' + sankoreLang.answer + ' 2.","value":2,"state":"","was":false},{"id":473,"text":"' + sankoreLang.answer + ' 3.","value":3,"state":"","was":false}]}]');
for(i in questionArray){
addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'");
for(j in questionArray[i].answers)
addAnsBlock(questionArray[i].answers[j].id, questionArray[i].id, questionArray[i].answers[j].text, true, questionArray[i].rightAns, questionArray[i].type);
}
displayData();
}
//saving widget data into sankore object for a correct import
if (window.widget) {
window.widget.onleave = function(){
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
sankore.setPreference("choisir_style", $("#style_select").find("option:selected").val());
}
}
if(window.sankore)
if(sankore.preference("choisir_style","")){
changeStyle(sankore.preference("choisir_style",""));
$("#style_select").val(sankore.preference("choisir_style",""));
} else
changeStyle("3")
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
displayData(true);
mode = true;
if(window.sankore){
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
sankore.setPreference("choisir_style", $("#style_select").find("option:selected").val());
}
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
editData();
mode = false;
}
}
});
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").text(sankoreLang.reload).click(function(){
if($("#wgt_edit").css("display") == "none")
$("#wgt_display").trigger("click");
else{
editData();
mode = false;
displayData(true);
mode = true;
}
});
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
// add question
addQstButton.click(function(){
//question block
var id = Math.round(Math.random()*1000);
var obj = new Question();
obj.id = id;
questionArray.push(obj);
addQstBlock(id, sankoreLang.template_question, "","");
if(window.sankore)
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
});
//set used at this moment question id into the variable
$(".qstDiv").live('mouseover', function() {
currentQstId = this.id;
});
//set used at this moment question id into the variable
$(".qstDivDisplay").live('mouseover', function() {
if(!flagForSelect)
currentQstId = this.id.replace("qstDivDisplay","");
});
//adding new answer
$(".ansAdd").live('click', function(){
var id = Math.round(Math.random()*1000);
var obj = new Answer();
obj.id = id;
getNeededElement(questionArray, currentQstId).answers.push(obj);
addAnsBlock(id, currentQstId, sankoreLang.template_answer);
});
//set answer text
$(".ansContent").live('keyup', function(event){
var id = $(event.target).attr("id").replace("ansContent","");
getNeededElement(getNeededElement(questionArray, currentQstId).answers,id).text = $(event.target).text();
});
//set question text
$(".qstContent").live('keyup', function(event){
var id = $(event.target).attr("id").replace("qstContent","");
getNeededElement(questionArray, id).text = $(event.target).text();
});
//question div border
$(".qstContent").live('mouseover', function(event){
$(event.target).css({
border:"3px solid #00C6FF"
});
});
// deleting question div border
$(".qstContent").live('mouseout', function(event){
$(event.target).css({
border:"3px solid #ccc"
});
});
//answer div border
$(".ansContent").live('mouseover', function(event){
$(event.target).css({
border:"3px solid #00C6FF"
});
});
// deleting answer div border
$(".ansContent").live('mouseout', function(event){
$(event.target).css({
border:"3px solid #ccc"
});
});
//delete answer
$(".ansDelete").live('click', function(){
popupText.hide();
var id = this.id.replace("ansDelete","");
$("#" + currentQstId + " #" + id).remove();
for(var i in questionArray)
if(questionArray[i].id == currentQstId){
questionArray[i].rightAns = questionArray[i].rightAns.replace($("#" + currentQstId + " #" + id + " input:checkbox").val(),"");
for(var j in questionArray[i].answers)
if(questionArray[i].answers[j].id == id){
if(j == 0)
questionArray[i].answers.shift();
else
if((j+1) == questionArray[i].answers.length)
questionArray[i].answers.pop();
else
questionArray[i].answers = questionArray[i].answers.slice(0,j).concat(questionArray[i].answers.slice(j+1));
break;
}
}
refreshAns();
});
//delete question
// $(".qstDelete").live('click', function(){
// popupText.hide();
// $("#" + currentQstId).remove();
// for(var i in questionArray)
// if(questionArray[i].id == currentQstId){
// if(i == 0)
// questionArray.shift();
// else
// if((i+1) == questionArray.length)
// questionArray.pop();
// else
// questionArray = questionArray.slice(0,i).concat(questionArray.slice(i+1));
// break;
// }
// refreshQst();
// });
//change options
$(".changeOptions").live('click', function(){
$("#" + currentQstId + "qstOptions .changeOptions").hide();
$("#" + currentQstId + "qstOptions .applyChanges").show();
$("#" + currentQstId + "qstOptChoice").show('fast');
});
//apply changes
$(".applyChanges").live('click', function(){
$("#" + currentQstId + "qstOptions .applyChanges").hide();
$("#" + currentQstId + "qstOptions .changeOptions").show();
$("#" + currentQstId + "qstOptChoice").hide('fast');
});
//select option
$(".qstOptChoice input:radio").live('click', function(event){
if(!mode){
$("#" + currentQstId + "qstOptChoice input:radio").removeAttr("checked");
$(event.target).attr("checked", "checked");
getNeededElement(questionArray, currentQstId).type = $(event.target).attr("value");
}
});
//select right ansver in edit mode and answer question in display mode
$(".newAnswer input").live('click', function(event){
if(!mode){
if(getNeededElement(questionArray, currentQstId).type == "1" || getNeededElement(questionArray, currentQstId).type == "3"){
$("#" + currentQstId + "ansDiv input").removeAttr("checked");
$(event.target).attr("checked", "checked");
getNeededElement(questionArray, currentQstId).rightAns = $(event.target).attr("value");
} else {
(event.target.checked) ? $(event.target).attr("checked", "checked") : $(event.target).removeAttr("checked", "checked");
getNeededElement(questionArray, currentQstId).rightAns = "";
for(var i in $("#" + currentQstId + "ansDiv input")){
if($("#" + currentQstId + "ansDiv input")[i].checked)
getNeededElement(questionArray, currentQstId).rightAns += $("#" + currentQstId + "ansDiv input")[i].value + ", ";
}
}
} else {
if(event.target.type == "radio"){
checkingAnswers("radio", getNeededElement(questionArray, currentQstId).answers, event.target.value);
if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns)
$(event.target).next().next().css("background-color","#6c0");
else
$(event.target).next().next().css("background-color","red");
} else {
checkingAnswers("box", getNeededElement(questionArray, currentQstId).answers, event.target.value, event.target.checked);
if(getNeededElement(questionArray, currentQstId).rightAns.replace(/,/g,"").indexOf(event.target.value + " ", 0) != -1)
$(event.target).next().next().css("background-color","#6c0");
else
$(event.target).next().next().css("background-color","red");
}
}
});
//popup messages
// $(".qstDelete").live('mouseover', function(evt){
// popupFlag = true;
// popupText.text(sankoreLang.delete_question)
// .css("top", evt.pageY + 15)
// .css("left", evt.pageX - 40)
// .css({
// width:"130px"
// })
// .show("fast", function(){
// if(!popupFlag)
// popupText.hide();
// });
// });
$(".ansDelete").live('mouseover', function(evt){
popupFlag = true;
popupText.text(sankoreLang.delete_answer)
.css("top", evt.pageY + 15)
.css("left", evt.pageX - 40)
.css({
width:"130px"
})
.show("fast", function(){
if(!popupFlag)
popupText.hide();
});
});
$(".newAnswer input").live('mouseover', function(evt){
if(!mode){
popupFlag = true;
popupText.text(sankoreLang.right_answer)
.css("top", evt.pageY + 15)
.css("left", evt.pageX - 40)
.css({
width:"130px"
})
.show("fast", function(){
if(!popupFlag)
popupText.hide();
});
}
});
$(".ansDelete, .newAnswer input").live('mousemove', function(evt){
if(!mode){
popupText.css("top", evt.pageY + 15)
.css("left", evt.pageX - 40);
}
});
$(".ansDelete, .newAnswer input").live('mouseout', function(evt){
if(!mode){
popupFlag = false;
popupText.hide();
}
});
//answer the questions
$("select").live('change', function(evt){
if(mode){
checkingAnswers("sel", getNeededElement(questionArray, currentQstId).answers, event.target.value);
if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns)
$(event.target).css("background-color","#6c0");
else
$(event.target).css("background-color","red");
if(event.target.value == 0)
$(event.target).css("background-color","");
flagForSelect = false;
}
});
$("select").live('mousedown', function(evt){
if(mode){
flagForSelect = true;
}
});
//toggle button click trigger
//toggleButton.trigger("click");
//show data in display mode
function displayData(){
// $("#addQstDiv").hide();
$(".qstDiv").hide();
addToPage(questionArray);
}
//set widget in edit mode
function editData(){
for(var i in questionArray)
for(var j in questionArray[i].answers){
questionArray[i].answers[j].state = "";
questionArray[i].answers[j].was = false
}
$(".qstDivDisplay").remove();
// $("#addQstDiv").show('fast');
$(".qstDiv").show('fast');
}
// show questions and answers in display mode
function addToPage(array){
var counter = 1;
for(var i in array){
var qstDiv = $("<div class='qstDivDisplay' id='" + array[i].id + "qstDivDisplay'>");
var spanOptConn = $("<div class='spanOptConn'>").appendTo(qstDiv);
// var qstNumber = $("<span class='qstNumber'>" + sankoreLang.question + " " + counter + "</span>").appendTo(spanOptConn);
var qstContent = $("<div class='qstContentDisplay'>" + array[i].text + "</div>").appendTo(qstDiv);
var ansDiv = $("<div class='ansDiv' id='" + array[i].id + "ansDiv'>").appendTo(qstDiv);
var ansCount = 1;
var type = array[i].type;
var selInput = $("<select>");
if(type == 3){
var newAnswer = $("<div class='newAnswer'>");
newAnswer.appendTo(ansDiv);
var selectSpan = $("<span id='answerText'>").appendTo(newAnswer);
selInput.appendTo(selectSpan);
$("<option value='0'>" + sankoreLang.select_text + "</option>").appendTo(selInput);
}
for(var j in array[i].answers){
switch(type){
case "1":
var local_state = "";
var local_color = "";
if(begin){
local_state = array[i].answers[j].state;
local_color = (array[i].answers[j].value == array[i].rightAns)?((array[i].answers[j].was)?"style='background-color: #6c0;'":""):((array[i].answers[j].was)?"style='background-color: red;'":"");
}
newAnswer = $("<div class='newAnswer'>");
var ansInput = $("<input type='radio' name='" + counter + "' value='" + array[i].answers[j].value + "' " + local_state + " style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
var ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
var ansContent = $("<div class='ansContentDisplay' " + local_color + "><span id='answerText'>" + array[i].answers[j].text + "</span></div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv);
break;
case "2":
local_state = "";
local_color = "";
if(begin){
local_state = (array[i].answers[j].state)?"checked":"";
local_color = (array[i].rightAns.replace(/,/g,"").indexOf(array[i].answers[j].value + " ", 0) != -1)?((array[i].answers[j].was)?"style='background-color: #6c0;'":""):((array[i].answers[j].was)?"style='background-color: red;'":"");
}
newAnswer = $("<div class='newAnswer'>");
ansInput = $("<input type='checkbox' value='" + array[i].answers[j].value + "' " + local_state + " style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
ansContent = $("<div class='ansContentDisplay' " + local_color + "><span id='answerText'>" + array[i].answers[j].text + "</span></div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv);
break;
case "3":
local_state = "";
local_color = "";
if(begin){
local_state = (array[i].answers[j].state)?"selected":"";
local_color = (array[i].answers[j].value == array[i].rightAns)?((array[i].answers[j].was)?"#6c0":""):((array[i].answers[j].was)?"red":"");
}
ansInput = $("<option value='" + array[i].answers[j].value + "' " + local_state + ">" + array[i].answers[j].text + "</option>").appendTo(selInput);
if(local_state && local_color)
selInput.css("background-color",local_color);
break;
}
ansCount++;
}
qstDiv.appendTo("#data");
counter++;
}
begin = false;
}
}
//add new question block in a edit mode
function addQstBlock(id, text, type, style){
var qstDiv = $("<div class='qstDiv' id='" + id + "' " + style + ">");
var spanOptConn = $("<div class='spanOptConn'>").appendTo(qstDiv);
// var count = $(".qstNumber").size();
// var qstNumber = $("<span class='qstNumber'>" + sankoreLang.q + (count + 1) + "</span>").appendTo(spanOptConn);
var qstOptions = $("<div class='qstOptions' id='" + id + "qstOptions'>").appendTo(spanOptConn);
var changeOptions = $("<button class='changeOptions'>" + sankoreLang.options + "</button>").appendTo(qstOptions);
var applyChanges = $("<button class='applyChanges' style='display: none;'>" + sankoreLang.close + "</button>").appendTo(qstOptions);
// var qstDelete = $("<button class='qstDelete'>").appendTo(qstOptions);
var qstOptChoice = $("<div class='qstOptChoice' id='" + id + "qstOptChoice' style='display: none;'>").appendTo(qstDiv);
var optDesc = $("<div style='height: 65px;'>").appendTo(qstOptChoice);
var optDescImg = $("<div class='optDescImg'>").appendTo(optDesc);
var optDescText = $("<div class='optDescText'>" + sankoreLang.options_desc + "</div>").appendTo(optDesc);
var type1 = $("<div class='type'>").appendTo(qstOptChoice);
var contentType1 = $("<div class='contentType'>").appendTo(type1);
var divType1 = $("<div class='divType1'>").appendTo(contentType1);
var textType1 = $("<div class='textType'>" + sankoreLang.radio_desc + "</div>").appendTo(contentType1);
var type2 = $("<div class='type'>").appendTo(qstOptChoice);
var contentType2 = $("<div class='contentType'>").appendTo(type2);
var divType2 = $("<div class='divType2'>").appendTo(contentType2);
var textType2 = $("<div class='textType'>" + sankoreLang.checkbox_desc + "</div>").appendTo(contentType2);
var type3 = $("<div class='type'>").appendTo(qstOptChoice);
var contentType3 = $("<div class='contentType'>").appendTo(type3);
var divType3 = $("<div class='divType3'>").appendTo(contentType3);
var textType3 = $("<div class='textType'>" + sankoreLang.select_desc + "</div>").appendTo(contentType3);
switch(type){
case "1":
var radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1' checked/><div></div>").appendTo(type1);
var radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2'/><div></div>").appendTo(type2);
var radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3'/><div></div>").appendTo(type3);
break;
case "2":
radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1'/><div></div>").appendTo(type1);
radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2' checked/><div></div>").appendTo(type2);
radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3'/><div></div>").appendTo(type3);
break;
case "3":
radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1'/><div></div>").appendTo(type1);
radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2'/><div></div>").appendTo(type2);
radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3' checked/><div></div>").appendTo(type3);
break;
default:
radioType1 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='1'/><div></div>").appendTo(type1);
radioType2 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='2'/><div></div>").appendTo(type2);
radioType3 = $("<div class='radioDiv'><div class='radioType'><input type='radio' value='3'/><div></div>").appendTo(type3);
break;
}
var qstContent = $("<div class='qstContent' id='" + id + "qstContent' contenteditable='true'>" + text + "</div>").appendTo(qstDiv);
var ansDiv = $("<div class='ansDiv' id='" + id + "ansDiv'>").appendTo(qstDiv);
var ansAdd = $("<button class='ansAdd'>" + sankoreLang.add_answer + "</button>").appendTo(ansDiv);
qstDiv.insertBefore("#addQstDiv");
// $("#addQsqSpan1").text(sankoreLang.q + (count + 2));
}
//add answers
function addAnsBlock(id, currId, text, stage, rightAns, type){
var newAnswer = $("<div class='newAnswer' id='" + id + "'>");
var value;
var check = "";
if(stage){
value = getNeededElement(getNeededElement(questionArray, currId).answers,id).value;
if(type != "2"){
if(rightAns == value)
check = "checked='true'";
}
else {
rightAns = rightAns.replace(/,/g,"");
if(rightAns.indexOf(value + " ", 0) != -1)
check = "checked='true'";
}
}
else {
value = ($("#" + currId + " .newAnswer input:checkbox").last().val()) ? parseInt($("#" + currId + " .newAnswer input:checkbox").last().val()) + 1 : 1;
getNeededElement(getNeededElement(questionArray, currId).answers,id).value = value;
}
var count = $("#" + currId + " .newAnswer").size() + 1;
var input = $("<input type='checkbox' style='float: left;' value='" + value + "' " + check + ">").appendTo(newAnswer);
var ansSpan = $("<span class='ansSpan'>" + sankoreLang.a + count + "</span>").appendTo(newAnswer);
var ansContent = $("<div class='ansContent' id='" + id +"ansContent' contenteditable='true'>" + text + "</div>").appendTo(newAnswer);
var ansDelete = $("<button class='ansDelete' id='" + id + "ansDelete'>").appendTo(newAnswer);
newAnswer.insertBefore("#" + currId + "ansDiv .ansAdd");
if(window.sankore)
sankore.setPreference("qstArrayData", JSON.stringify(questionArray));
}
//get needed array element
function getNeededElement(array,id){
for(var i in array)
if(array[i].id == id)
return array[i];
}
//check on fill
function checkArrayOnFill(array){
var count = 0;
for(var i in array)
count++;
return count;
}
//refresh answers numbers
function refreshAns(){
var count = $("#" + currentQstId + " .newAnswer").size();
for(var i = 0; i < count; i ++)
$($("#" + currentQstId + " .newAnswer span")[i]).text(sankoreLang.a + (i+1));
}
//refresh questions numbers
function refreshQst(){
var count = $(".qstNumber").size();
for(var i = 0; i < count; i ++)
$($(".qstNumber")[i]).text(sankoreLang.q + (i+1));
$("#addQsqSpan1").text(sankoreLang.q + ++count);
}
//check answers
function checkingAnswers(type, array, value, state){
switch(type){
case "radio":
for(var i in array)
if(array[i].value == value){
array[i].state = "checked";
array[i].was = true;
} else
array[i].state = "";
break;
case "box":
for(i in array)
if(array[i].value == value){
array[i].state = state;
array[i].was = true;
}
break;
case "sel":
for(i in array)
if(array[i].value == value){
array[i].state = "selected";
array[i].was = true;
} else
array[i].state = "";
break;
}
}
//question constructor
function Question(){
this.text = "";
this.type = "1";
this.id = "";
this.rightAns = "";
this.answers = new Array();
}
//answer constructor
function Answer(){
this.id = "";
this.text = "";
this.value = "";
this.state = "";
this.was = false;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}

@ -0,0 +1,66 @@
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script src="../../scripts/jquery.disable.text.select.js" type="text/javascript"></script>
<script type="text/javascript" src="scripts/blackYellow.js"></script>
<script type="text/javascript">
$(document).ready(function(){
init();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
<button id="wgt_add"></button>
</div>
</div>
<div id="data">
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,626 @@
/*
* This program 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 3 of the License, or
* (at your option) any later version.
*
* This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
*/
var sankoreLang = {
display: "Zatvoriť",
edit: "Upraviť",
add: "Pridať",
enter_data: "Zadajte vstupné údaje:",
enter_result: "Zadajte výsledok:",
ok: "OK",
cancel: "Zrušiť",
wgt_name: "Kontrast",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Kontrast</h2> </p>" +
"<p><h3>Hra farieb</h3> </p>" +
"<p>Schovávajte a odkrývajte text pomocou (žltého alebo čierneho) pozadia. Skryť jednu časť textu a&nbsp;zobraziť druhú časť textu môžete potiahnutím textového poľa doprava alebo doľava.</p> "+
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul><li>zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li>upraviť cvičenie alebo vytvoriť nové.</li></ul>" +
"<p>Ak chcete pridať nový štítok:</p>" +
"<ol><li> Kliknite na tlačidlo „Pridať“.</li>" +
"<li>Do jedného poľa zadajte údaje, napr. 3 x 5.</li>" +
"<li>Do druhého zadajte výsledok, napr. 15 a kliknite na „OK“. </li> </ol>" +
"<p>Ak chcete upraviť vstupné údaje alebo výsledok, kliknite priamo na dané textové pole.</p>" +
"<p>Ak ho chcete vymazať, kliknite na „X“.</p>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
function init(){
//variables
var toggleFlag = false; // detects toggling in toggle button
var endFlag = false; // ending of toggling in toggle button
var addToggleStart = false; // detects toggling in add button
var addToggleEnd = false; // ending of toggling in add button
var shadowOver = false;
var mode = false;
var popupFlag = false
var flagForSelect = false;
var dragElement = null; //the element that must be dragging
var lang = ""; //locale language
var resizeFlag = true;
var coords = {
left:0,
top:0
}
var resizeObj = {
y:false,
x:false,
width:0,
height:0
}
var opacityChanged = false;
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_add").text(sankoreLang.add);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("blackYellowData","")){
var importArray = jQuery.parseJSON(sankore.preference("blackYellowData",""));
for(var i in importArray){
var tmpReadyTask = $("<div class='readyTask'>");
var exprContainer = $("<div class='taskContainer' style='color: yellow;'>" + importArray[i].data1 + "</div>").appendTo(tmpReadyTask);
var resContainer = $("<div class='taskContainer' style='color: black;'>"+ importArray[i].data2 + "</div>").appendTo(tmpReadyTask);
tmpReadyTask.width(importArray[i].width)
.height(importArray[i].height)
.css("position","absolute")
.css("top",importArray[i].top)
.css("left",importArray[i].left);
tmpReadyTask.appendTo("#data");
}
}
$(document).disableTextSelect();
}
/* ------------- BUTTONS -------------*/
if(window.sankore){
if(sankore.preference("by_style","")){
changeStyle(sankore.preference("by_style",""));
$("#style_select").val(sankore.preference("by_style",""));
} else
changeStyle("3")
} else
changeStyle("3")
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
var tmpwh = $(window).height();
var tmpww = $(window).width();
resizeFlag = true;
window.resizeTo(tmpww, tmpwh - 44)
$("#data").css("padding-bottom","");
$("#leftDiv").css("border-top-left-radius","7px");
$("#rightDiv").css("border-top-right-radius","7px");
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
mode = false;
$(".leftDiv, .rightDiv").animate({
"opacity":"1"
},"fast",function(){
if(opacityChanged){
if($(".editContainer").size() != 0){
$(".editContainer").each(function(index, domElem){
var tmpReadyTask = $(domElem).find(".readyTask");
tmpReadyTask.width($(domElem).width())
.height($(domElem).height())
.css("position","absolute")
.css("top",$(domElem).position().top - 40)
.css("left",$(domElem).position().left)
.find(".taskContainer").removeAttr("contenteditable");
$(domElem).remove();
tmpReadyTask.appendTo("#data");
});
}
opacityChanged = false;
}
});
$(document).disableTextSelect();
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
tmpwh = $(window).height();
tmpww = $(window).width();
resizeFlag = true;
window.resizeTo(tmpww, tmpwh + 44)
$("#data").css("padding-bottom","42px");
$("#leftDiv").css("border-top-left-radius","0px");
$("#rightDiv").css("border-top-right-radius","0px");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
mode = true;
$(document).enableTextSelect();
$(".leftDiv, .rightDiv").animate({
"opacity":"0.4"
},"fast",function(){
if(!opacityChanged){
if($(".readyTask").size() != 0){
var tmp_arr = [];
$(".readyTask").each(function(){
tmp_arr.push($(this));
})
orderItems(tmp_arr);
$(".readyTask").each(function(index, domElem){
var editContent = $("<div class='editContainer'>").width($(domElem).width() + 10).height($(domElem) + 10).appendTo("#data");
var closeItem = $("<div class='closeItem'>").appendTo(editContent);
editContent.css("top", $(domElem).position().top).css("left", $(domElem).position().left);
$(domElem).css("position","static")
.width("100%")
.height("100%")
.find(".taskContainer").attr("contenteditable", "true");
$(domElem).appendTo(editContent);
});
}
opacityChanged = true;
}
});
}
}
});
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
($("#wgt_edit").hasClass("selected"))?$("#parameters").show():'';
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data, #parameters").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
reloadItems();
});
$("#wgt_add").click(function(){
if($("#wgt_help").hasClass("open")){
$("#help").slideUp("100", function(){
$("#wgt_help").removeClass("open");
$("#data").show();
});
}
shadowDiv.show();
shadowOver = true;
popupBack.show("slow");
$(document).disableTextSelect();
});
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
/* -------------- END OF WORK WITH BUTTONS ---------------*/
//basic divs
var leftDiv = $("<div id='leftDiv' class='leftDiv'>").appendTo("#data");
var rightDiv = $("<div id='rightDiv' class='rightDiv'>").appendTo("#data");
//divs for adding a new item
var shadowDiv = $("<div id='shadowDiv' class='shadowDiv'>").appendTo("html");
var popupBack = $("<div id='popupBack' class='popupBack'>").appendTo("#data");
//input fields and buttons for a popup window
var expressionDiv = $("<div id='expressionDiv' class='popupContainers'>").appendTo(popupBack);
var experssionLabel = $("<span id='experssionLabel' class='popupLabels'><b>" + sankoreLang.enter_data + "</b></span>").appendTo(expressionDiv);
var expresionText = $("<input type='text' id='expresionText' class='expresionInput'/>").appendTo(expressionDiv);
var resultDiv = $("<div id='resultDiv' class='popupContainers'>").appendTo(popupBack);
var resultLabel = $("<span id='resultLabel' class='popupLabels'><b>" + sankoreLang.enter_result + "</b></span>").appendTo(resultDiv);
var resultText = $("<input type='text' id='resultText' class='expresionInput'/>").appendTo(resultDiv);
var popupButtonsDiv= $("<div id='popupButtonsDiv' class='popupContainers'>").appendTo(popupBack);
var cancelButton = $("<input type='button' id='cancelButton' class='popupButtons' value='" + sankoreLang.cancel + "'/>").appendTo(popupButtonsDiv);
var okButton = $("<input type='button' id='okButton' class='popupButtons' value='" + sankoreLang.ok + "'/>").appendTo(popupButtonsDiv);
/* -------------- A WORK WITH POPUP BUTTONS AND FIELDS ---------------*/
$("#resultText, #expresionText").keyup(function(){
if($(this).val()){
$(this).css("background-color", "#ff9");
}
});
cancelButton.click(function(){
popupBack.hide("slow", function(){
$("#resultText, #expresionText").val("")
.css("background-color", "#ffc");
shadowDiv.hide();
shadowOver = false;
$(document).enableTextSelect();
});
});
okButton.click(function(){
if(checkEmptyFields(expresionText) && checkEmptyFields(resultText)){
popupBack.hide("slow", function(){
shadowDiv.hide();
shadowOver = false;
addTask(expresionText.val(), resultText.val());
exportToSankore();
$("#resultText, #expresionText").val("")
.css("background-color", "#ffc");
$(document).enableTextSelect();
})
}
});
/* -------------- THE END OF WORK WITH POPUP BUTTONS AND FIELDS ---------------*/
// a work with dragging possibility
$("input:text").mouseover(function(){
$(document).enableTextSelect();
});
$("input:text").mouseout(function(){
$(document).disableTextSelect();
});
$(".readyTask, .editContainer").live("mousedown",function(event){
if($("#wgt_display").hasClass("selected")){
if(!shadowOver){
dragElement = $(this);
coords.left = event.pageX - $(this).position().left;
coords.top = event.pageY - $(this).position().top;
resizeObj.width = $(this).width();
resizeObj.height = $(this).height();
}
$(document).disableTextSelect();
}
});
$("body").mouseup(function(event){
if($("#wgt_display").hasClass("selected")){
if(!shadowOver){
if (dragElement) {
exportToSankore();
}
dragElement = null;
resizeObj.x = false;
resizeObj.y = false;
}
}
});
$("body").mousemove(function(event){
if(dragElement && !shadowOver && $("#wgt_display").hasClass("selected")){
var top = event.pageY - coords.top;
var left = event.pageX - coords.left;
var bottom = top + dragElement.height();
var right = left + dragElement.width();
if(resizeObj.x){
if(right < ($(window).width() - 54))
dragElement.width(event.pageX - dragElement.position().left);
}
else if(resizeObj.y){
if(bottom < ($(window).height() - 54))
dragElement.height(event.pageY - dragElement.position().top);
}
else {
if((top > 54) && (bottom < ($(window).height() - 54)))
dragElement.css("top",event.pageY - coords.top);
if((left >= 54) && (right < ($(window).width() - 54)))
dragElement.css("left", event.pageX - coords.left);
}
}
});
//closing item
$(".closeItem").live("click", function(){
if(!shadowOver){
$(this).parent().remove();
if($(".editContainer").size() > 0){
var prev = $(".editContainer:first");
if((prev.position().left == 54) && (prev.position().top != 60))
prev.css("top", "60px");
var prevBottom = prev.position().top + prev.height(),
prevLeft = prev.position().left;
if(prev.next().length)
recursionCall(prevBottom, prevLeft, prev.next());
}
}
});
$(".taskContainer").live("keyup", function(){
if($(".editContainer").size() > 1){
var prev = $(".editContainer:first"),
prevBottom = prev.position().top + prev.height(),
prevLeft = prev.position().left;
recursionCall(prevBottom, prevLeft, prev.next());
}
})
function recursionCall(prevBottom, prevLeft, curr){
var curHeight = curr.height(),
curLeft = curr.position().left;
if(prevLeft == curLeft){
if((prevBottom + 15 + curHeight) < ($(window).height() - 54))
curr.css("top", prevBottom + 15 + "px");
else
curr.css("top", "100px").css("left", prevLeft + 255 + "px");
} else {
if((prevBottom + 15 + curHeight) < ($(window).height() - 54))
curr.css("top", prevBottom + 15 + "px").css("left", prevLeft + "px");
else
curr.css("top", "100px").css("left", prevLeft + 255 + "px");
}
prevBottom = curr.position().top + curr.height(),
prevLeft = curr.position().left;
if(curr.next().length)
recursionCall(prevBottom, prevLeft, curr.next());
}
//$("#leftDiv,#rightDiv,#shadowDiv").css("height", $(window).height());
popupBack.css("top", ($(window).height() - 138)*50/$(window).height() + "%");
popupBack.css("left", ($(window).width() - 360)*50/$(window).width() + "%");
$(window).resize(function(){
if(!resizeFlag){
if($("#wgt_edit").hasClass("selected")){
if($(".editContainer").size() > 1){
var prev = $(".editContainer:first"),
prevBottom = prev.position().top + prev.height(),
prevLeft = prev.position().left;
recursionCall(prevBottom, prevLeft, prev.next());
}
} else {
var tmp_array = [];
$(".readyTask").each(function(){
tmp_array.push($(this));
});
orderItems(tmp_array);
}
popupBack.css("top", ($(window).height() - 138)*50/$(window).height() + "%");
popupBack.css("left", ($(window).width() - 360)*50/$(window).width() + "%");
} else
resizeFlag = false;
});
if (window.widget) {
window.widget.onleave = function(){
exportToSankore();
sankore.setPreference("by_style", $("#style_select").find("option:selected").val());
}
}
// export data
function exportToSankore(){
var arrayToExport = new Array();
if(mode){
if($(".editContainer").size() != 0){
$(".editContainer").each(function(index, domElem){
var objToExport = {
data1:"",
data2:"",
width:0,
height:0,
top:0,
left:0
}
objToExport.data1 = $(domElem).find(".readyTask").find(":first-child").text();
objToExport.data2 = $(domElem).find(".readyTask").find(":last-child").text();
objToExport.width = $(domElem).width();
objToExport.height = $(domElem).height();
objToExport.top = $(domElem).position().top - 40;
objToExport.left = $(domElem).position().left;
arrayToExport.push(objToExport);
});
}
} else {
if($(".readyTask").size() != 0){
$(".readyTask").each(function(index, domElem){
var objToExport = {
data1:"",
data2:"",
width:0,
height:0,
top:0,
left:0
}
objToExport.data1 = $(domElem).find(":first-child").text();
objToExport.data2 = $(domElem).find(":last-child").text();
objToExport.width = $(domElem).width();
objToExport.height = $(domElem).height();
objToExport.top = $(domElem).position().top;
objToExport.left = $(domElem).position().left;
arrayToExport.push(objToExport);
});
}
}
if(window.sankore)
sankore.setPreference("blackYellowData", JSON.stringify(arrayToExport));
}
}
//checking empty fields
function checkEmptyFields(field){
if(field.val() == ""){
field.css("background-color", "red");
return false;
} else {
field.css("background-color", "#ff9");
return true;
}
}
//reload
function reloadItems(){
if($("#wgt_edit").hasClass("selected"))
$("#wgt_display").trigger("click");
else{
var tmp_array = [];
$(".readyTask").each(function(){
tmp_array.push($(this));
});
tmp_array = shuffle(tmp_array);
orderItems(tmp_array);
}
}
//order items
function orderItems(items){
var bottom = ($("#wgt_edit").hasClass("selected"))?85:45,
lastItemLeft = 54;
for (var i in items){
if((bottom + items[i].height()) < ($(window).height() - 54)){
items[i].css("top", bottom + 15 + "px").css("left", lastItemLeft + "px").appendTo("#data");
bottom += items[i].height() + 15;
} else {
bottom = 100;
lastItemLeft += 255;
items[i].css("top", bottom + "px").css("left", lastItemLeft + "px").appendTo("#data");
bottom += items[i].height();
}
}
}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
//adding a new task to the page
function addTask(expression, result){
var lastItem = $(".editContainer:last"),
lastItemPos = lastItem.length ? lastItem.position().top : 85,
lastItemHeight = lastItem.length ? lastItem.height() : 0,
lastItemLeft = lastItem.length ? lastItem.position().left : 54;
var bottom = lastItemPos + lastItemHeight + 85;
var editContent = $("<div class='editContainer'>");
$("<div class='closeItem'>").appendTo(editContent);
var main = $("<div class='readyTask'>");
$("<div class='taskContainer' style='color: yellow;' contenteditable='true'>" + expression + "</div>").appendTo(main);
$("<div class='taskContainer' style='color: black;' contenteditable='true'>"+ result + "</div>").appendTo(main);
if(bottom < ($(window).height() - 54)){
editContent.css("top", lastItemPos + lastItemHeight + 15 + "px").css("left", lastItemLeft + "px").appendTo("#data");
} else {
lastItemPos = 85;
editContent.css("top", lastItemPos + 15 + "px").css("left", lastItemLeft + 255 + "px").appendTo("#data");
}
main.appendTo(editContent);
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
if($("#wgt_edit").hasClass("selected"))
$(document).enableTextSelect();
}

@ -0,0 +1,11 @@
fr.njin.i18n.document.title = Ciferník
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zobraziť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomoc
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny

@ -0,0 +1,16 @@
<h3>Ciferník</h3>
<h4>Počítanie spamäti</h4>
<p>V tejto interaktívnej aktivite treba zistiť neznáme číslo (počet dní) sčítaním, odčítaním, násobením alebo delením
čísel na ciferníku. Jej cieľom je precvičiť počítanie spamäti. Kliknite na číslo a&nbsp;znamienko na ciferníku.
Po kliknutí na otáznik sa zobrazí výsledok (neznáme číslo, čiže počet dní).</p>
<p>Výber čísla a znamienka zrušíte tlačidlom Obnoviť. </p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul><li>farebný motív na tablet, bridlicu alebo na žiadny (predvolený je tablet),</li>
<li>číslo v strede ciferníka.</li></ul>
<p>Ak chcete zmeniť číslo v strede ciferníka, kliknite naň a prepíšte ho.</p>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,14 @@
fr.njin.i18n.document.title = Kocky
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zobraziť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomoc
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.de.parameters.label.count = Počet kociek
fr.njin.i18n.de.actions.label.launch = Hodiť!

@ -0,0 +1,14 @@
<h3>Kocky</h3>
<h4>Na počítanie nahlas alebo iné hry</h4>
<p>Interaktívna aktivita Kocky vám umožňuje zobraziť náhodne vybrané steny hracích kociek.</p>
<p>Po kliknutí na šípku alebo na tlačidlo Hodiť! sa zobrazia iné čísla.
So zo&shy;brazenými číslami môžete precvičovať počítanie nahlas alebo hrať iné hry.
</p>
<p>Výpočty a ich postup môžu byť za&shy;písané na interaktívnu tabuľu (mimo interaktívnej aktivity).</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul>
<li>farebný motív na bridlicu, tablet alebo na žiadny (predvolená je bridlica),<br></li>
<li>počet kociek, ktoré vo svojej aktivite použijete (2 &ndash; 6).</li>
</ul>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,15 @@
fr.njin.i18n.document.title = Obálka
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zatvoriť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomocník
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.boite.parameters.label.count = Počet sponiek
fr.njin.i18n.boite.parameters.label.remove = -
fr.njin.i18n.boite.parameters.label.duplicate = +

@ -0,0 +1,12 @@
<h3>Obálka</h3>
<h4>Vyjadrenie množstva</h4>
<p>Kliknite na zopár kancelárskych sponiek a&nbsp;presuňte ich obálky.</p>
<p>Ak ich chcete odtiaľ vybrať, stačí kliknúť na obálku. Sponky z&nbsp;obálky budú mať inú farbu.</p>
<p>Ak chcete znova spustiť hru, kliknite na tlačidlo Obnoviť .</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul>
<li>farebný motív na bridlicu, tablet alebo na žiadny (predvolený je tablet),</li>
<li>počet sponiek.</li>
</ul>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,19 @@
fr.njin.i18n.document.title = Pexeso
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zatvoriť
fr.njin.i18n.toolbar.reload=Obnoviť
fr.njin.i18n.toolbar.help = Pomocník
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.memory.parameters.label.cards = Počet kariet
fr.njin.i18n.memory.parameters.option.cards = {0}
fr.njin.i18n.memory.parameters.label.timeout = Čas zobrazenia kariet
fr.njin.i18n.memory.label.usePicture = Obrázok
fr.njin.i18n.memory.label.drop = Vyberte si obrázok a&nbsp;presuňte ho sem.
fr.njin.i18n.memory.action.flip = Otočiť kartu

@ -0,0 +1,20 @@
<h3>Pexeso</h3>
<h4>Počítanie spamäti, pexeso</h4>
<p>Cieľom hry Pexeso je zapamätať si umiestnenie rôznych kariet a nájsť ich dvojice.</p>
<p>Karty rozmiestnené v mriežke a&nbsp;o&shy;točené lícom nadol.
Hráč si zvolí dve karty. Ak rovnaké, zostanú otočené lícom nahor.
Ak nie rovnaké, znova sa otočia lícom nadol.</p>
<p>Hra sa končí, keď hráč nájde všetky dvojice.</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav:</p>
<ul>
<li>zmeniť farebný motív na bridlicu, tablet alebo na žiadny (predvolená je bridlica),</li>
<li>zvoliť si počet kariet (4 karty, 6 alebo 8 kariet),</li>
<li>nastaviť čas zobrazenia kariet,</li>
<li>zmeniť obsah kariet.</li>
</ul>
<p>Každá karta textové pole. Ak chcete zadať text, kliknite naň.</p>
<p>Ak chcete pridať obrázok z knižnice, zaškrtnite položku Obrázok, kliknite na obrázok a presuňte ho do karty.</p>
<p>V hre karty usporiadané náhodne.</p>
<p>Aplikácia dokáže rozoznať matematický zápis &ndash; povolené znamienka: +, * (krát), -, / (delené) a&nbsp;zátvorky. Vyhnite sa však deleniu 0.</p>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.23.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,566 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
short_desc: "Počúvajte a vytvorte správne slovo.",
add: "Pridať nový blok",
enter: "Sem zadajte pokyny.",
example: "príklad",
wgt_name: "Zoradenie písmen",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2> Zoradenie písmen </ h2> </p>" +
"<p><h3>Kliknite na písmeno a presuňte ho na správne miesto.</h3> </p>" +
"<p>Žiaci si vypočujú nahrávku. Interaktívna aktivita zobrazí slovo, v ktorom budú poprehadzované písmená. Žiaci majú dať písmená na správne miesta. Ak žiaci vytvoria správne slová, priestor okolo slov sa zafarbí dozelena.</p> "+
"<p>V tejto aktivite môžete použiť aj čísla.</p>" +
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li> upraviť cvičenie.</li> </ul>" +
"<p>Pri úprave cvičenia v režime úprav môžete:</p>" +
"<ul><li>vkladať zvukové nahrávky z knižnice tak,"+
" že na ne kliknete a presuniete ich do cvičenia, </li>" +
"<li>upravovať pokyny v textovom poli,</li>" +
"<li>namiesto slova „príklad“ zadať vlastné slová,</li>" +
"<li>kliknutím na potvrdzovacie tlačidlo „V“ na ráme vybrať pre svoju aktivitu správny obrázok, </li>" +
"<li>nahradiť zvukový súbor vlastnou nahrávkou z knižnice. </li></ul>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("ord_let","")){
var data = jQuery.parseJSON(sankore.preference("ord_let",""));
importData(data);
}
else
showExample();
if(sankore.preference("ord_let_style","")){
changeStyle(sankore.preference("ord_let_style",""));
$("#style_select").val(sankore.preference("ord_let_style",""));
} else
changeStyle("3")
}
else
showExample();
//events
if (window.widget) {
window.widget.onleave = function(){
exportData();
sankore.setPreference("ord_let_style", $("#style_select").find("option:selected").val());
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
setTimeout('$("#wgt_display").trigger("click")', 10)
$("#wgt_edit").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(false);
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_array = [];
var ans_container = container.find(".audio_answer");
container.find(".text_cont .audio_desc").removeAttr("contenteditable");
container.find(".audio_block").removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop")
// container.find(".close_cont").remove();
var answer = ans_container.text();
ans_container.prev().val(answer)
ans_container.remove();
var ul_cont = $("<ul id='sortable' class='imgs_answers_gray'>").insertAfter(container.find(".sub_cont"));
for(var j in answer){
var tmp_letter = $("<li class='ui-state-default'>" + answer[j] + "</li>");
tmp_array.push(tmp_letter);
}
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(ul_cont);
ul_cont.sortable({
revert: true,
placeholder: "highlight",
update: checkResult
});
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(true);
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(".cont").each(function(){
var container = $(this);
// $("<div class='close_cont'>").appendTo(container);
container.find("#sortable").removeClass("imgs_answers_red")
.removeClass("imgs_answers_green")
.addClass("imgs_answers_gray")
.sortable("destroy");
container.find(".text_cont .audio_desc").attr("contenteditable","true");
container.find(".audio_block").attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).removeClass('audio_gray'); return false;")
.attr("ondragover", "$(this).addClass('audio_gray'); return false;")
.attr("ondrop", "$(this).removeClass('audio_gray'); return onDropAudio(this,event);");
$("<div class='audio_answer' contenteditable>" + container.find("ul").next().val() + "</div>").appendTo(container);
container.find("ul").remove();
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
$("audio").each(function(){
this.pause();
$(this).parent().find(":first-child").removeClass("stop").addClass("play");
});
});
//add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
var i = 0;
var tmp_obj = $(this).parent().parent();
$(this).parent().remove();
});
//correct image
$(".true_img").live("click",function(){
$(this).parent().parent().find(".img_block").each(function(){
$(this).find("input").val(0);
var tmp_div = $(this).find(".false_img");
if(tmp_div)
tmp_div.removeClass("false_img").addClass("true_img");
})
$(this).parent().find("input").val(1);
$(this).removeClass("true_img").addClass("false_img");
});
//wrong image
$(".false_img").live("click",function(){
$(this).parent().find("input").val(0);
$(this).removeClass("false_img").addClass("true_img");
});
//play/pause event
$(".play, .stop").live("click", function(){
var tmp_audio = $(this);
var audio = tmp_audio.parent().find("audio").get(0);
if($(this).hasClass("play")){
if(tmp_audio.parent().find("source").attr("src")){
tmp_audio.removeClass("play").addClass("stop");
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.play();
}
} else {
$(this).removeClass("stop").addClass("play");
clearInterval( tmp_audio.parent().find("input").val())
audio.pause();
}
});
$(".replay").live("click", function(){
var tmp_audio = $(this).prev();
var audio = $(this).parent().find("audio").get(0);
if(tmp_audio.parent().find("source").attr("src")){
$(this).prev().removeClass("play").addClass("stop");
clearInterval($(this).parent().find("input").val());
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.currentTime = 0;
audio.play();
}
});
}
//export
function exportData(){
var array_to_export = [];
if($("#wgt_edit").hasClass("selected")){
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".audio_desc").text();
cont_obj.audio = $(this).find("source").attr("src");
cont_obj.answer = $(this).find(".audio_answer").text();
cont_obj.cur_answer = "";
array_to_export.push(cont_obj);
});
} else {
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".audio_desc").text();
cont_obj.audio = $(this).find("source").attr("src");
cont_obj.answer = $(this).find("ul").next().val();
cont_obj.cur_answer = getAnswer($(this).find("ul"));
array_to_export.push(cont_obj);
});
}
sankore.setPreference("ord_let", JSON.stringify(array_to_export));
if($("#wgt_display").hasClass("selected"))
sankore.setPreference("ord_let_state", "display");
else
sankore.setPreference("ord_let_state", "edit");
}
//import
function importData(data){
for(var i in data){
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<ul id='sortable' class='imgs_answers_gray'>").appendTo(container);
// $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>").appendTo(sub_container);
var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", data[i].audio);
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block);
$("<div class='audio_desc'>" + data[i].text + "</div>").appendTo(text);
$("<input type='hidden' value='" + data[i].answer + "'/>").appendTo(container);
if(data[i].cur_answer)
for(var j in data[i].cur_answer){
var tmp_letter = $("<li class='ui-state-default'>" + data[i].cur_answer[j] + "</li>");
tmp_array.push(tmp_letter);
}
else
for(j in data[i].answer){
tmp_letter = $("<li class='ui-state-default'>" + data[i].answer[j] + "</li>");
tmp_array.push(tmp_letter);
}
if(sankore.preference("ord_let_state","")){
if(sankore.preference("ord_let_state","") == "edit")
tmp_array = shuffle(tmp_array);
} else
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container);
imgs_container.sortable({
revert: true,
placeholder: "highlight"
}).bind('sortupdate', function(event, ui) {
checkResult(event);
});
if(data[i].cur_answer)
imgs_container.trigger("sortupdate")
}
}
//example
function showExample(){
var tmp_array = [];
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<ul id='sortable' class='imgs_answers_gray'>").appendTo(container);
// var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>").appendTo(sub_container);
var audio_block = $("<div class='audio_block'>").appendTo(text);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../objects/example_en.mp3");
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden'/>").appendTo(audio_block);
var audio_desc = $("<div class='audio_desc'>" + sankoreLang.short_desc + "</div>").appendTo(text);
$("<input type='hidden' value='" + sankoreLang.example + "'/>").appendTo(container);
for(var j in sankoreLang.example){
var tmp_letter = $("<li class='ui-state-default'>" + sankoreLang.example[j] + "</li>");
tmp_array.push(tmp_letter);
}
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container);
imgs_container.sortable({
revert: true,
placeholder: "highlight"
}).bind('sortupdate', function(event, ui) {
checkResult(event);
});
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
//
// $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
// var text = $("<div class='text_cont'>").appendTo(sub_container);
// var audio_block = $("<div class='audio_block'>").appendTo(text);
// audio_block.attr("ondragenter", "return false;")
// .attr("ondragleave", "$(this).removeClass('audio_gray'); return false;")
// .attr("ondragover", "$(this).addClass('audio_gray'); return false;")
// .attr("ondrop", "$(this).removeClass('audio_gray'); return onDropAudio(this,event);");
// $("<div class='play'>").appendTo(audio_block);
// $("<div class='replay'>").appendTo(audio_block);
// var source = $("<source/>").attr("src", "");
// var audio = $("<audio>").appendTo(audio_block);
// audio.append(source);
// $("<input type='hidden'/>").appendTo(audio_block);
// $("<div class='audio_desc' contenteditable>" + sankoreLang.enter + "</div>").appendTo(text);
//
// var tmp_input = $("<input type='hidden' value=''/>").insertAfter(sub_container);
// var close = $("<div class='close_cont'>").insertAfter(tmp_input);
// $("<div class='audio_answer' contenteditable>" + sankoreLang.example + "</div>").insertAfter(close);
// container.insertBefore($(".add_block"));
//}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
//check result
function checkResult(event)
{
var str = "";
var right_str = $(event.target).next().val();
$(event.target).find("li.ui-state-default").each(function(){
str += $(this).text();
});
if(str == right_str)
$(event.target).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_red")
.addClass("imgs_answers_green");
else
$(event.target).removeClass("imgs_answers_gray")
.removeClass("imgs_answers_green");
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
function onDropAudio(obj, event) {
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_type = textData.getElementsByTagName("type")[0].firstChild.textContent;
if(tmp_type.substr(0, 5) == "audio"){
$(obj).find("audio").remove();
$(obj).find(":first-child").removeClass("stop").addClass("play");
var source = $("<source/>").attr("src", "../../" + tmp);
var audio = $("<audio>").appendTo($(obj));
audio.append(source);
}
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}
//get text
function getAnswer(obj){
var answer = "";
obj.find("li.ui-state-default").each(function(){
answer += $(this).text();
});
return answer;
}
if (window.widget) {
window.widget.onremove = function(){
$("audio").each(function(){
this.pause();
$(this).parent().find(":first-child").removeClass("stop").addClass("play");
});
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,592 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
short_desc: "Obrázky zoraďte vzostupne.",
add: "Pridať nový blok",
enter: "Sem zadajte pokyny.",
wgt_name: "Zoradenie obrázkov",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p> <h2> Zoradenie obrázkov </h2> </p>" +
"<p> <h3> Zoradenie obrázkov v určitom poradí </h3> </p>" +
"<p> Číslo označuje poradie obrázka. Treba kliknúť na každý obrázok a presunúť ho na správne miesto."+
" Ak žiaci správne zoradia všetky obrázky, priestor okolo obrázkov sa zafarbí dozelena.</p> "+
"<p> Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu. </p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li> upraviť cvičenie.</li> </ul>" +
"<p>Pri úprave cvičenia v režime úprav môžete:</p>" +
"<ul><li> po kliknutí na textové pole upravovať pokyny,</li>" +
"<li> kliknutím na „+“ pridávať rámy pre ďalšie obrázky,</li>" +
"<li> pridávať obrázky ich potiahnutím z knižnice,</li>" +
"<li> posúvaním obrázkov v cvičení meniť ich poradie,</li>" +
"<li> vymazať rám obrázka kliknutím na krížik (X),</li>" +
"<li> zmeniť obrázok kliknutím na tlačidlo „Obnoviť“ na jeho ráme.</li></ul>" +
"<p> Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("odr_des_imgs","")){
var data = jQuery.parseJSON(sankore.preference("odr_des_imgs",""));
importData(data);
} else {
showExample();
}
}
else
showExample();
//events
if (window.widget) {
window.widget.onleave = function(){
exportData();
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
$("#wgt_edit").trigger("click");
$("#wgt_display").trigger("click");
} else {
$("#wgt_display").trigger("click");
}
});
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
exportData();
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(false);
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
var tmp_i = 0;
var tmp_right = "";
var tmp_array = [];
container.find(".text_cont").removeAttr("contenteditable");
container.find(".add_img").remove();
// container.find(".close_cont").remove();
container.find(".img_block").each(function(){
if($(this).find("img").attr("src") != "img/drop_img.png"){
$(this).find(".close_img").remove();
$(this).find(".clear_img").remove();
$(this).find(".numb_img").remove();
$(this).removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop");
$(this).find("input").val(++tmp_i)
tmp_right += tmp_i + "*";
} else
$(this).remove();
});
container.find(".imgs_cont>input").val(tmp_right);
container.find(".img_block").each(function(){
$(this).css("float","");
tmp_array.push($(this));
});
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(container.find(".imgs_cont"));
container.find(".imgs_cont").sortable( {
update: checkResult
} );
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(true);
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(".cont").each(function(){
var container = $(this);
// $("<div class='close_cont'>").appendTo(container);
container.find(".text_cont").attr("contenteditable","true");
//container.find(".imgs_cont").sortable("destroy");
container.find(".imgs_cont").css("background-color", "");
var add_img = $("<div class='add_img'>");
container.find(".img_block").each(function(){
$(this).attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);")
//.css("float","left");
$("<div class='close_img'>").appendTo($(this));
$("<div class='clear_img'>").appendTo($(this));
$("<div class='numb_img'>" + $(this).find("input").val() + "</div>").appendTo($(this));
});
rightOrder(container.find(".imgs_cont"));
container.find(".imgs_cont").append(add_img)
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
});
//add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//adding new img
$(".add_img").live("click", function(){
addImgBlock($(this));
});
//deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
var i = 0;
var tmp_obj = $(this).parent().parent();
//N/C - NNE - 20140318 : Deleting the image on the hard drive
var src = $(this).parent().find('img').attr("src");
removeAsset(src);
$(this).parent().remove();
if(tmp_obj.find(".img_block").size() > 0){
refreshImgNumbers(tmp_obj);
}
});
//cleaning an image
$(".clear_img").live("click",function(){
//$(this).parent().find(".fill_img").remove();
//N/C - NNE - 20140318 : Deleting the image on the hard drive
var src = $(this).parent().find('img').attr("src");
removeAsset(src);
$(this).parent().find("img").attr("src","img/drop_img.png");
});
}
//N/C - NNE - 20140318 : Remove an asset (resource) throught the sankore API
function removeAsset(src)
{
if(src != 'img/drop_img.png' && sankore){
sankore.removeFile(src);
}
}
//N/C - NNE - 20140318 : END
//export
function exportData(){
var array_to_export = [];
if($("#edit").hasClass("selected")){
$(".cont").each(function(){
var container = $(this);
var tmp_right = "";
var tmp_i = 0;
container.find(".img_block").each(function(){
if($(this).html().match(/<img/)){
$(this).find("input").val(++tmp_i)
tmp_right += tmp_i + "*";
}
});
container.find(".imgs_cont>input").val(tmp_right);
});
}
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.text = $(this).find(".text_cont").text();
cont_obj.right = $(this).find(".imgs_cont>input").val();
cont_obj.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.value = $(this).find("input").val();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.ht = $(this).find("img").height();
img_obj.wd = $(this).find("img").width();
cont_obj.imgs.push(img_obj);
});
array_to_export.push(cont_obj);
});
if($(".cont").size() == 0){
var cont_obj = new Object();
cont_obj.style = $("#style_select").find("option:selected").val();
cont_obj.tmp = "clear";
array_to_export.push(cont_obj);
}
if(window.sankore)
sankore.setPreference("odr_des_imgs", JSON.stringify(array_to_export));
if($("#wgt_display").hasClass("selected")){
if(window.sankore)
sankore.setPreference("odr_des_imgs_state", "display");
}
else{
if(window.sankore)
sankore.setPreference("odr_des_imgs_state", "edit");
}
}
//import
function importData(data){
for(var i in data){
if(data[i].tmp){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
}
else {
if(i == 0){
changeStyle(data[i].style);
$("#style_select").val(data[i].style);
}
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ (++tmp) +"</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + data[i].text + "</div>").appendTo(sub_container);
$("<input type='hidden' value='" + data[i].right + "'/>").appendTo(imgs_container);
for(var j in data[i].imgs){
var img_block = $("<div class='img_block' style='text-align: center;'>");
var img = $("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;'>");
img.height(data[i].imgs[j].ht);
if((120 - data[i].imgs[j].ht) > 0)
img.css("margin",(120 - data[i].imgs[j].ht)/2 + "px 0");
var hidden_input = $("<input type='hidden'>").val(data[i].imgs[j].value);
img_block.append(hidden_input).append(img);
tmp_array.push(img_block);
}
if(sankore.preference("odr_des_imgs_state","")){
if(sankore.preference("odr_des_imgs_state","") == "edit")
tmp_array = shuffle(tmp_array);
} else
tmp_array = shuffle(tmp_array);
for(j = 0; j<tmp_array.length;j++)
tmp_array[j].appendTo(imgs_container);
imgs_container.sortable().bind('sortupdate', function(event, ui) {
checkResult(event);
});
container.appendTo("#data");
imgs_container.trigger("sortupdate")
}
}
}
//example
function showExample(){
changeStyle("3");
var tmp_array = [];
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>1</div>").appendTo(sub_container);
var text = $("<div class='text_cont'>" + sankoreLang.short_desc + "</div>").appendTo(sub_container);
$("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
var img1 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='1'/>").appendTo(img1);
$("<img src=\"../../objects/0.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img1);
var img2 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='2'/>").appendTo(img2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var img3 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='3'/>").appendTo(img3);
$("<img src=\"../../objects/2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img3);
var img4 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='4'/>").appendTo(img4);
$("<img src=\"../../objects/3.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img4);
var img5 = $("<div class='img_block' style='text-align: center;'></div>");
$("<input type='hidden' value='5'/>").appendTo(img5);
$("<img src=\"../../objects/4.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img5);
tmp_array.push(img1, img2, img3, img4, img5);
tmp_array = shuffle(tmp_array);
for(var i = 0; i<tmp_array.length;i++)
tmp_array[i].appendTo(imgs_container);
imgs_container.sortable().bind('sortupdate', function(event, ui) {
checkResult(event);
});
container.appendTo("#data");
}
//check result
function checkResult(event)
{
if($("#wgt_display").hasClass("selected")){
var str = "";
var right_str = $(event.target).find("input").val();
$(event.target).find(".img_block").each(function(){
str += $(this).find("input").val() + "*";
});
if(str == right_str)
$(event.target).css("background-color","#9f9");
else
$(event.target).css("background-color","");
} else {
refreshImgNumbers($(event.target));
}
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
// var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
//
// var close = $("<div class='close_cont'>").appendTo(container);
// var number = $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
// var text = $("<div class='text_cont' contenteditable>" + sankoreLang.enter + "</div>").appendTo(sub_container);
//
// $("<input type='hidden' value='1*2*3*4*5*'/>").appendTo(imgs_container);
// var add_img = $("<div class='add_img'>").appendTo(imgs_container);
// container.insertBefore($(".add_block"));
//}
//add new img block
function addImgBlock(dest){
var img_block = $("<div class='img_block' ondragenter='return false;' ondragleave='$(this).css(\"background-color\",\"\"); return false;' ondragover='$(this).css(\"background-color\",\"#ccc\"); return false;' ondrop='$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);' style='text-align: center;'></div>").insertBefore(dest);
var tmp_counter = dest.parent().find(".img_block").size();
$("<div class='close_img'>").appendTo(img_block);
$("<div class='clear_img'>").appendTo(img_block);
$("<div class='numb_img'>" + tmp_counter + "</div>").appendTo(img_block);
$("<input type='hidden' value='" + tmp_counter + "'/>").appendTo(img_block);
$("<img src='img/drop_img.png' height='120'/>").appendTo(img_block);
}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
//shuffles an array
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
//regulation the images in right order
function rightOrder(source){
var tmp_arr = [];
var tmp_var;
source.find(".img_block").each(function(){
tmp_arr.push($(this));
$(this).remove();
});
for(var i = 0; i < tmp_arr.length; i++)
for(var j = 0; j < tmp_arr.length - 1; j++){
if(tmp_arr[j].find("input").val() > tmp_arr[j+1].find("input").val()){
tmp_var = tmp_arr[j];
tmp_arr[j] = tmp_arr[j+1];
tmp_arr[j+1] = tmp_var;
}
}
for(i in tmp_arr)
source.append(tmp_arr[i]);
}
//refresh the numbers of the images
function refreshImgNumbers(source){
var tmp = 1;
source.find(".img_block").each(function(){
$(this).find("input").val(tmp);
$(this).find(".numb_img").text(tmp);
tmp++;
});
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
function onDropTarget(obj, event) {
//N/C - NNE - 20140318
var img = $(obj).find("img");
removeAsset(img.attr("src"));
img.remove();
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_img = $("<img/>").attr("src", "../../" + tmp);
$(obj).append(tmp_img);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template</title>
<!--Styles-->
<link rel="stylesheet" type="text/css" href="../../styles/master.css">
<link rel="stylesheet" type="text/css" href="../../styles/of_puppets.css">
<!--Scripts-->
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../scripts/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="script/template2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
$("#ub-widget").append('<div id="mp_setup"></div><div id="mp_word"></div>');
modeView();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,391 @@

/*
Sankore API
*/
function startEditing()
{
modeEdit();
}
function stopEditing()
{
modeView();
}
function initialize()
{
}
function checkResponse()
{
checkWord();
}
/*
/ END sankore api
*/
var sankoreLang = {
edit: "Upraviť",
view: "Zobraziť",
example: "toto\nje\nveta",
wgt_name: "Zoradenie slov. spojení",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2> Zoradenie slovných spojení</h2></p>" +
"<p><h3> Úprava textu zmenou poradia slov.</h3> </p>" +
"<p>Interaktívna aktivita zobrazí slovné spojenia v náhodnom poradí. Treba ich správne zoradiť. Ak sa to žiakom podarí, slová sa zafarbia dozelena.</p> "+
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny), </li>" +
"<li>oddeliť slovné spojenia vo vete. </li></ul>" +
"<p>Ak chcete vytvoriť nové cvičenie: </p>" +
"<ul><li>text zadávajte do textového poľa,</li>" +
"<li>jednotlivé slová a slovné spojenia, ktoré majú žiaci zoradiť, píšte do nového riadka.</li></ul> "+
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
}
var sentence = "";
var curSentence = "";
if(window.sankore){
sentence = (sankore.preference("rightOrdPhrases", ""))?sankore.preference("rightOrdPhrases", ""):sankoreLang.example;
curSentence = (sankore.preference("currentOrdPhrases", ""))?sankore.preference("currentOrdPhrases", ""):"";
} else {
sentence = sankoreLang.example;
}
var doCheck = true;
// array of dom elements
var phrases = [];
var editMode = false; // just a flag
var wgtState = false; // just another flag
// if use the "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" );
// hardcoded parameters, not very good
var input_width = 606;
var widget_padding = 0;
$(document).ready(function(){
if(window.sankore)
if(sankore.preference("ord_phrases_style","")){
changeStyle(sankore.preference("ord_phrases_style",""));
$("#style_select").val(sankore.preference("ord_phrases_style",""));
} else
changeStyle("3")
$("#wgt_display").text(sankoreLang.view);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
modeView();
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
modeEdit();
}
}
});
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#ub-widget").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").text(sankoreLang.reload).click(function(){
if(wgtState)
$("#wgt_display").trigger("click");
else
{
$( "#mp_word" ).empty();
var phrases;
phrases = shuffle( createElements( sentence ) );
for( i in phrases ){
$("#mp_word").append( phrases[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
$( "#mp_word" ).sortable();
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
}
});
})
function str_replace( w, b, s ){
while( s.indexOf( w ) != -1 ){
s = s.replace( w, b );
}
return s;
}
/*
==============
shuffle
==============
shuffles an array
*/
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
/*
=================
createWordLetters
=================
returns array of dom elements
*/
function createElements( sentence )
{
var el;
var elements = [];
var phrases = sentence.split( "\n" );
for( i in phrases )
{
el = document.createElement( "div" );
$( el ).addClass( "phrase" ).text( phrases[i] );
elements.push( el );
}
return elements;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
function checkSentence()
{
if( !doCheck )
return;
var ph = [];
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
if( ph.join( "\n" ) == str_replace( "\r", "", sentence ) ){
$( "#mp_word .phrase" ).addClass( "right" );
} else {
$( "#mp_word .phrase" ).removeClass( "right" );
}
}
/*
==================
modeView()
==================
turns the widget into the view mode
*/
function modeView()
{
if( editMode ){
sentence = str_replace( "\r", "", $( "#mp_word textarea" ).attr( "value" ) );
var p = sentence.split( "\n" );
var p2 = [];
var t;
for( var i in p )
{
t = jQuery.trim( p[i] );
if( t ) p2.push( t );
}
sentence = p2.join( "\n" );
}
wgtState = false;
// clean the previous word
$( "#mp_word" ).empty();
var phrases;
// create new set of elements
if(window.sankore && curSentence && !editMode)
phrases = createElements( curSentence );
else
phrases = shuffle( createElements( sentence ) );
for( i in phrases ){
$("#mp_word").append( phrases[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
$( "#mp_word" ).sortable();
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkSentence
} );
} else
$( "#mp_word" ).sortable();
checkSentence();
}
/*
================
modeEdit
================
*/
function modeEdit()
{
editMode = true;
wgtState = true;
$( "#mp_word").css( "margin-left", 0 ).empty()
.append('<textarea cols="50" rows="5">'+sentence+'</textarea>');
}
if (window.widget) {
window.widget.onleave = function(){
sankore.setPreference("ord_phrases_style", $("#style_select").find("option:selected").val());
if($( "#mp_word textarea" ).val())
{
modeView();
var ph = [];
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
modeEdit();
}
else{
ph = [];
$( "#mp_word .phrase" ).each( function()
{
ph.push( $( this ).text() );
});
sankore.setPreference("currentOrdPhrases", ph.join( "\n" ));
}
sankore.setPreference("rightOrdPhrases", sentence);
}
}

@ -0,0 +1,68 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template</title>
<!--Styles-->
<link rel="stylesheet" type="text/css" href="../../styles/master.css">
<link rel="stylesheet" type="text/css" href="../../styles/of_puppets.css">
<!--Scripts-->
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../scripts/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="scripts/template2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#ub-widget").append('<div id="mp_setup"></div><div id="mp_word"></div>');
modeView();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,435 @@

/*
Sankore API
*/
function startEditing()
{
modeEdit();
}
function stopEditing()
{
modeView();
}
function initialize()
{
}
function checkResponse()
{
checkWord();
}
/*
/ END sankore api
*/
var sankoreLang = {
edit: "Upraviť",
view: "Zobraziť",
example: "Kde*sa*piesok*lial*a*voda*sypala*...",
wgt_name: "Zoradenie slov",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Zoradenie slov</h2> </p>" +
"<p><h3>Zoradenie slov a vytvorenie pôvodnej vety</h3></p>" +
"<p>Interaktívna aktivita zobrazí slová v náhodnom poradí. Treba z nich vytvoriť zmysluplnú vetu. Ak sa to žiakom podarí, slová sa zafarbia dozelena.</p> "+
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu. </p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul><li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny), </li>" +
"<li> oddeliť jednotlivé slová vo vete. </li> </ul>" +
"<p>Ak chcete vytvoriť nové cvičenie:</p>" +
"<ul><li>zadajte vetu,</li>" +
"<li> každé slovo oddeľte *. Hviezdičku nedávajte na začiatok ani na koniec vety.</li></ul>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
var word = "";
var curWord = "";
if(window.sankore){
word = (sankore.preference("rightOrdWords", ""))?sankore.preference("rightOrdWords", ""):sankoreLang.example;
curWord = (sankore.preference("currentOrdWords", ""))?sankore.preference("currentOrdWords", ""):"";
} else {
word = sankoreLang.example;
}
// array of dom elements
var letters = [];
var editMode = false; // just a flag
var wgtState = false; // just another flag
// if use the "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" );
// hardcoded parameters, not very good
var input_width = 606;
var widget_padding = 0;
var min_view_width = 400;
$(document).ready(function(){
if(window.sankore){
if(sankore.preference("ord_words_style","")){
changeStyle(sankore.preference("ord_words_style",""));
} else
changeStyle("3")
} else
changeStyle("3")
$("#wgt_display").text(sankoreLang.view);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
modeView();
}
} else {
if(!$(this).hasClass("selected")){
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
modeEdit();
}
}
});
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#ub-widget").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#ub-widget").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").text(sankoreLang.reload).click(function(){
if(wgtState)
$("#wgt_display").trigger("click");
else
{
$( "#mp_word" ).empty();
// create new set of letters
var letters;
letters = shuffle( createWordLetters( word ) );
for( i in letters ){
$("#mp_word").append( letters[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkWord
} );
} else $( "#mp_word" ).sortable();
// adjustWidth
var totalLettersWidth = 0;
for( i in letters ){
var currentWidth = $( letters[i] ).outerWidth( true );
totalLettersWidth += currentWidth;
}
totalLettersWidth += 1;
var width = Math.max(
totalLettersWidth,
min_view_width
);
// shift the words to the right to center them
if( width > totalLettersWidth ){
$( "#mp_word" ).css( "margin-left", Math.round( (width - totalLettersWidth)/2 ) );
}
else{
$( "#mp_word" ).css( "margin-left", 0 );
}
}
});
})
/*
=================
createWordLetters
=================
returns array of dom elements
*/
function createWordLetters( word )
{
var ch, el;
var letters = [];
if( word.indexOf( '*' ) != -1 )
{
var tmp = word.split( '*' );
for( i in tmp )
{
ch = tmp[i];
el = document.createElement( "div" );
$(el).addClass( "letter" ).text( ch );
letters.push( el );
}
}
else
{
for( var i = 0; i < word.length; i++ )
{
ch = word.charAt( i );
el = document.createElement( "div" );
$(el).addClass( "letter" ).text( ch );
letters.push( el );
}
}
return letters;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select option:first").attr('selected',true);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select option:first").next().attr('selected',true);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select option:last").attr('selected',true);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
/*
=====================
checkWord
=====================
scans the letters and checks
if they are in the right order
*/
function checkWord()
{
var str = "";
$( "#mp_word .letter" ).each( function(){
str += $(this).text();
});
var w = word;
while( w.indexOf( '*' ) != -1 )
{
w = w.replace( '*', '' );
}
//alert(str + " | " + w)
if( str == w ){
$( "#mp_word .letter" ).addClass( "right" );
//message( "Right!" );
} else {
$( "#mp_word .letter" ).removeClass( "right" );
}
}
/*
==============
shuffle
==============
shuffles an array
*/
function shuffle( arr )
{
var pos, tmp;
for( var i = 0; i < arr.length; i++ )
{
pos = Math.round( Math.random() * ( arr.length - 1 ) );
tmp = arr[pos];
arr[pos] = arr[i];
arr[i] = tmp;
}
return arr;
}
/*
==================
modeView()
==================
turns the widget into the view mode
*/
function modeView()
{
if( editMode ){
word = $( "#mp_word .wgt_cont" ).val();
}
wgtState = false;
// clean the previous word
$( "#mp_word" ).empty();
// create new set of letters
var letters;
if(window.sankore && curWord && !editMode)
letters = createWordLetters( curWord );
else
letters = shuffle( createWordLetters( word ) );
for( i in letters ){
$("#mp_word").append( letters[i] );
}
// in sankore api there would be a function to check
// the answer, so no update parameter would be needed
if( !isSankore ){
$( "#mp_word" ).sortable( {
update: checkWord
} );
} else $( "#mp_word" ).sortable();
// adjustWidth
var totalLettersWidth = 0;
for( i in letters ){
var currentWidth = $( letters[i] ).outerWidth( true );
totalLettersWidth += currentWidth;
}
totalLettersWidth += 1;
var width = Math.max(
totalLettersWidth,
min_view_width
);
// shift the words to the right to center them
if( width > totalLettersWidth ){
$( "#mp_word" ).css( "margin-left", Math.round( (width - totalLettersWidth)/2 ) );
}
else{
$( "#mp_word" ).css( "margin-left", 0 );
}
checkWord();
}
/*
================
modeEdit
================
*/
function modeEdit()
{
editMode = true;
wgtState = true;
$( "#mp_word").sortable( "destroy" );
$( "#mp_word").css( "margin-left", 0 ).empty().append('<textarea class="wgt_cont">'+word+'</textarea>');
}
if (window.widget) {
window.widget.onleave = function(){
sankore.setPreference("ord_words_style", $("#style_select").find("option:selected").val());
if($( "#mp_word .wgt_cont" ).val())
{
modeView();
var str = "";
$( "#mp_word .letter" ).each( function(){
str += $(this).text() + "*";
});
str = str.substr(0, str.length - 1);
sankore.setPreference("currentOrdWords", str);
modeEdit();
}
else{
str = "";
$( "#mp_word .letter" ).each( function(){
str += $(this).text() + "*";
});
str = str.substr(0, str.length - 1);
sankore.setPreference("currentOrdWords", str);
}
sankore.setPreference("rightOrdWords", word);
}
}

@ -0,0 +1,13 @@
fr.njin.i18n.document.title = Váha
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zobraziť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomoc
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.balance.parameters.label.remove = Odstrániť

@ -0,0 +1,18 @@
<h3>Váha</h3>
<h4>Rovnaká hmotnosť, počítanie spamäti</h4>
<p>Na ľavú misku váhy treba dať toľko závaží, aby na nej bola rovnaká hmotnosť ako na pravej miske.</p>
<p>Závažie na ľavú misku pridáte tak, že naň kliknete a&nbsp;presuniete ho tam.</p>
<p>Možnosti riešenia si môžu žiaci zapísať na tabuľu alebo ich môžu vyskúšať priamo na váhe.</p>
<p>Tlačidlom Obnoviť odoberiete z ľavej misky váhy všetky závažia.</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul><li> farebný motív na tablet, bridlicu alebo na žiadny (predvolený je tablet),</li>
<li>počet závaží na pravej miske váhy,</li>
<li>hmotnosť závaží, ktoré budú žiaci dokladať na ľavú misku váhy.</li></ul>
<p>Ak chcete presunúť závažie na pravú misku váhy, kliknite naň a&nbsp;presuňte ho tam.</p>
<p>Ak chcete pridať ďalšie závažie, kliknite na tlačidlo + a&nbsp;zadajte hmotnosť závažia. (Nepoužívajte desatinné čísla.)</p>
<p>Každé závažie číselné pole. Kliknite na toto pole a&nbsp;zadajte doň príslušné číslice.</p>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,60 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="data">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,575 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
short_desc: "Zo zoznamu vyber zvieratá:",
add: "Pridať nový blok",
enter: "Sem napíšte pokyny.",
cat: "mačka",
ball: "lopta",
shovel: "lopata",
dog: "pes",
tree: "strom",
wgt_name: "Výber",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p> <h2>Výber</h2> </p>" +
"<p> <h3> Výber správnej možnosti zo zoznamu </h3> </p>" +
"<p> V zozname treba zaškrtnúť správne možnosti. Ak sa to žiakom podarí, priestor okolo odpovede sa zafarbí dozelena.</p>" +
"<p> Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul> <li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li> upraviť cvičenie.</li> </ul>" +
"<p>Úprava cvičenia v režime úprav:</p>" +
"<ul><li> upravovať pokyny môžete po kliknutí na textové pole,</li>" +
"<li> pridávať textové polia môžete pomocou tlačidla „+T“,</li>" +
"<li> správnu odpoveď označíte zaškrtnutím políčka vpravo dole,</li>" +
"<li> poradie obrázkov môžete zmeniť ich presunom na iné miesto,</li>" +
"<li> rám vymažete kliknutím na krížik (X).</li></ul>" +
"<p> Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_reload").text(sankoreLang.reload);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("selectionner","")){
var data = jQuery.parseJSON(sankore.preference("selectionner",""));
importData(data);
} else
showExample();
if(sankore.preference("sel_style","")){
changeStyle(sankore.preference("sel_style",""));
$("#style_select").val(sankore.preference("sel_style",""));
} else
changeStyle("3")
}
else
showExample();
//events
if (window.widget) {
window.widget.onleave = function(){
exportData();
sankore.setPreference("sel_style", $("#style_select").find("option:selected").val());
}
}
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").slideUp("100", function(){
tmp.removeClass("open");
$("#data").show();
});
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
$("#data").hide();
$("#help").slideDown("100", function(){
tmp.addClass("open");
});
}
});
$("#wgt_reload").click(function(){
if($("#wgt_display").hasClass("selected")){
$(".cont").each(function(){
var container = $(this);
container.find(".img_block, .text_block").each(function(){
$(this).find("input:checkbox").removeAttr("checked");
$(this).find("input:checkbox").parent().parent().removeClass("right");
});
});
}
else
$("#wgt_display").trigger("click");
});
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(false);
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
// $(".add_block").remove();
$(".cont").each(function(){
var container = $(this);
container.find(".text_cont").removeAttr("contenteditable");
container.find(".add_img").remove();
// container.find(".close_cont").remove();
container.find(".imgs_cont").removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop");
container.find(".img_block, .text_block").each(function(){
$(this).find(".close_img").remove();
$(this).find(".text_subblock").removeAttr("contenteditable");
$(this).find("input:checkbox").removeAttr("checked")
});
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(true);
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
$(".cont").each(function(){
var container = $(this);
// $("<div class='close_cont'>").appendTo(container);
container.find(".text_cont").attr("contenteditable","true");
container.find(".imgs_cont").removeClass("right")
.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).removeClass('over'); return false;")
.attr("ondragover", "$(this).addClass('over'); return false;")
.attr("ondrop", "$(this).removeClass('over'); return onDropTarget(this,event);");
var add_img = $("<div class='add_img'>");
container.find(".img_block, .text_block").each(function(){
$("<div class='close_img'>").appendTo($(this));
if($(this).find("input:hidden").val() == 0)
$(this).find("input:checkbox").attr('checked', false);
else
$(this).find("input:checkbox").attr('checked', true);
$(this).find(".text_subblock").attr("contenteditable","true");
});
add_img.insertBefore(container.find(".clear"));
});
// $("<div class='add_block'>" + sankoreLang.add + "</div>").appendTo("#data");
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
});
//add new block
// $(".add_block").live("click", function(){
// addContainer();
// });
//checkbox events
$("input:checkbox").live("click", function(){
if($("#wgt_display").hasClass("selected")){
var flag = true;
var block = $(this).parent().parent();
block.find(".text_block, .img_block, .audio_block").each(function(){
if($(this).find("input:checkbox").is(':checked') && $(this).find("input:hidden").val() == 0)
flag = false;
else if(!$(this).find("input:checkbox").is(':checked') && $(this).find("input:hidden").val() == 1)
flag = false;
});
if(flag)
block.addClass("right");
else
block.removeClass("right");
} else {
if($(this).is(":checked"))
$(this).parent().find("input:hidden").val(1);
else
$(this).parent().find("input:hidden").val(0);
}
});
//play/pause event
$(".play, .stop").live("click", function(){
var tmp_audio = $(this);
var audio = tmp_audio.parent().find("audio").get(0);
if($(this).hasClass("play")){
if(tmp_audio.parent().find("source").attr("src")){
tmp_audio.removeClass("play").addClass("stop");
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.play();
}
} else {
$(this).removeClass("stop").addClass("play");
clearInterval( tmp_audio.parent().find("input").val())
audio.pause();
}
});
$(".replay").live("click", function(){
var tmp_audio = $(this).prev();
var audio = $(this).parent().find("audio").get(0);
if(tmp_audio.parent().find("source").attr("src")){
$(this).prev().removeClass("play").addClass("stop");
clearInterval($(this).parent().find("input").val());
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.currentTime = 0;
audio.play();
}
});
//adding new img
$(".add_img").live("click", function(){
addTextBlock($(this));
});
//deleting a block
// $(".close_cont").live("click",function(){
// $(this).parent().remove();
// refreshBlockNumbers();
// });
//deleting the img block
$(".close_img").live("click", function(){
//N/C - NNE - 20140319
if(sankore){
$(this).parent().find('img').each(function(){
sankore.removeFile($(this).attr('src'));
});
$(this).parent().find('source').each(function(){
sankore.removeFile($(this).attr('src'));
});
}
//N/C - NNE - 20140319 : END
$(this).parent().remove();
});
$("#wgt_reload, #wgt_display, #wgt_edit").live("mouseover",function(){
exportData();
})
}
//export
function exportData(){
var array_to_export = [];
$(".cont").each(function(){
var cont_obj = new Object();
cont_obj.text = $(this).find(".text_cont").text();
cont_obj.blocks = [];
$(this).find(".img_block, .audio_block, .text_block").each(function(){
var tmp_block = new Object();
if($("#wgt_display").hasClass("selected"))
tmp_block.state = "display";
else
tmp_block.state = "edit";
if($(this).hasClass("img_block")){
if($(this).find(".audio_block").size() == 0){
tmp_block.src = $(this).find("img").attr("src").replace("../../","");
tmp_block.hidden = $(this).find("input:hidden").val();
tmp_block.h = $(this).find("img").height();
tmp_block.w = $(this).find("img").width();
tmp_block.type = "img";
tmp_block.checked = $(this).find("input:checkbox").attr("checked");
}
}
if($(this).hasClass("audio_block")){
tmp_block.src = $(this).find("source").attr("src").replace("../../","");
tmp_block.hidden = $(this).parent().find("input:hidden").val();
tmp_block.type = "audio";
tmp_block.checked = $(this).parent().find("input:checkbox").attr("checked");
}
if($(this).hasClass("text_block")){
tmp_block.text = $(this).find(".text_subblock").text();
tmp_block.hidden = $(this).find("input:hidden").val();
tmp_block.type = "text";
tmp_block.checked = $(this).find("input:checkbox").attr("checked");
}
cont_obj.blocks.push(tmp_block);
});
array_to_export.push(cont_obj);
});
if(window.sankore)
sankore.setPreference("selectionner", JSON.stringify(array_to_export));
}
//import
function importData(data){
for(var i in data){
var container = $("<div class='cont'>").appendTo("#data");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
$("<div class='clear'>").appendTo(imgs_container);
// $("<div class='number_cont'>" + (++tmp) + "</div>").appendTo(sub_container);
$("<div class='text_cont'>" + data[i].text + "</div>").appendTo(sub_container);
for(var j in data[i].blocks){
switch(data[i].blocks[j].type){
case "text":
var text_block = $("<div class='text_block'>").insertBefore(imgs_container.find(".clear"));
$("<div class='text_subblock'>" + data[i].blocks[j].text + "</div>").appendTo(text_block);
$("<input type='hidden' value='" + data[i].blocks[j].hidden + "'/>").appendTo(text_block);
$("<input type='checkbox' class='ch_box'/>").attr("checked",(data[i].blocks[j].state == "display")?((data[i].blocks[j].checked == "checked")?true:false):false).appendTo(text_block);
break;
case "img":
var img_block = $("<div class='img_block' style='text-align: center;'></div>").insertBefore(imgs_container.find(".clear"));
$("<input type='hidden' value='" + data[i].blocks[j].hidden + "'/>").appendTo(img_block);
$("<input type='checkbox' class='ch_box'/>").attr("checked",(data[i].blocks[j].state == "display")?((data[i].blocks[j].checked == "checked")?true:false):false).appendTo(img_block)
var img = $("<img src=\"../../" + data[i].blocks[j].src + "\" style=\"display: inline;\"/>").appendTo(img_block);
img.height(data[i].blocks[j].h);
if((120 - data[i].blocks[j].h) > 0)
img.css("margin",(120 - data[i].blocks[j].h)/2 + "px 0");
break;
case "audio":
var img_tmp = $("<div class='img_block'>").insertBefore(imgs_container.find(".clear"));
var audio_block = $("<div class='audio_block'>").appendTo(img_tmp);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../" + data[i].blocks[j].src);
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden' value='" + data[i].blocks[j].hidden + "'/>").appendTo(img_tmp);
$("<input type='checkbox' class='ch_box'/>").attr("checked",(data[i].blocks[j].state == "display")?((data[i].blocks[j].checked == "checked")?true:false):false).appendTo(img_tmp)
break;
}
}
}
var block = $("input:checkbox").parent().parent();
block.each(function(){
var flag = true;
$(this).find(".text_block, .img_block, .audio_block").each(function(){
if($(this).find("input:checkbox").is(':checked') && $(this).find("input:hidden").val() == 0)
flag = false;
else if(!$(this).find("input:checkbox").is(':checked') && $(this).find("input:hidden").val() == 1)
flag = false;
});
if(flag)
$(this).addClass("right");
else
$(this).removeClass("right");
})
}
//example
function showExample(){
var container = $("<div class='cont'>");
var sub_container = $("<div class='sub_cont'>").appendTo(container);
var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// $("<div class='number_cont'>1</div>").appendTo(sub_container);
$("<div class='text_cont'>" + sankoreLang.short_desc + "</div>").appendTo(sub_container);
var tmp1 = $("<div class='text_block'>").appendTo(imgs_container);
$("<div class='text_subblock'>" + sankoreLang.cat + "</div>").appendTo(tmp1);
$("<input type='hidden' value='1'/>").appendTo(tmp1);
$("<input type='checkbox' class='ch_box'/>").appendTo(tmp1)
var tmp2 = $("<div class='text_block'>").appendTo(imgs_container);
$("<div class='text_subblock'>" + sankoreLang.ball + "</div>").appendTo(tmp2);
$("<input type='hidden' value='0'/>").appendTo(tmp2);
$("<input type='checkbox' class='ch_box'/>").appendTo(tmp2)
var tmp3 = $("<div class='text_block'>").appendTo(imgs_container);
$("<div class='text_subblock'>" + sankoreLang.shovel + "</div>").appendTo(tmp3);
$("<input type='hidden' value='0'/>").appendTo(tmp3);
$("<input type='checkbox' class='ch_box'/>").appendTo(tmp3)
var tmp4 = $("<div class='text_block'>").appendTo(imgs_container);
$("<div class='text_subblock'>" + sankoreLang.dog + "</div>").appendTo(tmp4);
$("<input type='hidden' value='1'/>").appendTo(tmp4);
$("<input type='checkbox' class='ch_box'/>").appendTo(tmp4)
var tmp5 = $("<div class='text_block'>").appendTo(imgs_container);
$("<div class='text_subblock'>" + sankoreLang.tree + "</div>").appendTo(tmp5);
$("<input type='hidden' value='0'/>").appendTo(tmp5);
$("<input type='checkbox' class='ch_box'/>").appendTo(tmp5)
$("<div class='clear'>").appendTo(imgs_container);
container.appendTo("#data")
}
//add new container
//function addContainer(){
// var container = $("<div class='cont'>");
// var sub_container = $("<div class='sub_cont'>").appendTo(container);
// var imgs_container = $("<div class='imgs_cont'>").appendTo(container);
// imgs_container.attr("ondragenter", "return false;")
// .attr("ondragleave", "$(this).removeClass('over'); return false;")
// .attr("ondragover", "$(this).addClass('over'); return false;")
// .attr("ondrop", "$(this).removeClass('over'); return onDropTarget(this,event);");
//
// $("<div class='close_cont'>").appendTo(container);
// $("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
// var text = $("<div class='text_cont' contenteditable>" + sankoreLang.enter + "</div>").appendTo(sub_container);
//
// $("<div class='add_img'>").appendTo(imgs_container);
// $("<div class='clear'>").appendTo(imgs_container);
// container.insertBefore($(".add_block"));
//}
//add new img block
function addTextBlock(dest){
var tmp = $("<div class='text_block'>").insertBefore(dest)
$("<div class='text_subblock' contenteditable='true'>" + sankoreLang.enter + "</div>").appendTo(tmp);
$("<input type='hidden' value='0'/>").appendTo(tmp);
$("<input type='checkbox' class='ch_box'/>").appendTo(tmp);
$("<div class='close_img'>").appendTo(tmp);
}
//function refreshBlockNumbers(){
// var i = 0;
// $(".cont").each(function(){
// $(this).find(".number_cont").text(++i);
// })
//}
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").removeClass("pad_color").removeClass("pad_reload");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
function onDropTarget(obj, event) {
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_type = textData.getElementsByTagName("type")[0].firstChild.textContent;
if(tmp_type.substr(0, 5) == "audio"){
var img_tmp = $("<div class='img_block'>").insertBefore($(obj).find(".add_img"));
var audio_block = $("<div class='audio_block'>").appendTo(img_tmp)
$("<div class='close_img'>").appendTo(img_tmp);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../" + tmp);
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("<input type='hidden' value='0'/>").appendTo(img_tmp);
$("<input type='checkbox' class='ch_box'/>").appendTo(img_tmp)
} else {
var img_block = $("<div class='img_block' style='text-align: center;'></div>").insertBefore($(obj).find(".add_img"));
$("<div class='close_img'>").appendTo(img_block);
$("<input type='hidden' value='0'/>").appendTo(img_block);
$("<input type='checkbox' class='ch_box'/>").appendTo(img_block)
var tmp_img = $("<img src=\"../../" + tmp + "\" style=\"display: inline;\"/>").appendTo(img_block);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
var h = tmp_img.height();
tmp_img.attr("height",h);
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6);
}
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<title>D'n'd</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="../../css/basic.css"/>
<script type="text/javascript" src="../../js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="../../js/easySlider1.5.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
start();
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="slider">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
<ul>
</ul>
</div>
<span id="prevBtn"><a href="javascript:void(0);"></a></span>
<span id="nextBtn"><a href="javascript:void(0);"></a></span>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,720 @@
var sankoreLang = {
display: "Zobraziť",
edit: "Upraviť",
text_content: "Toto je príklad. Namiesto neho sem po stačení tlačidla „Upraviť“ môžete zadať, čo chcete.",
new_txt: "Nový blok textu",
new_slide: "Toto je nová snímka.",
wgt_name: "Snímky",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Snímky</h2></p>" +
"<p><h3>Brožúrka.</h3></p>" +
"<p>Snímky sú stránkami brožúrky. Do tejto brožúrky môžete pridať text, obrázky, zvukové nahrávky a videá.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul><li>zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li>upravovať stránky brožúrky.</li></ul>" +
"<p><b>Úprava brožúrky v režime úprav</b></p>"+
"<p>Na každej stránke môžete:</p>" +
"<ul><li> pomocou tlačidla „T+“ na ľavej strane pridať textové pole (ak ho chcete upraviť, kliknite naň a prepíšte predvolený text),</li>" +
"<li>potiahnutím z knižnice pridať súbory obrázkov, zvukov a videí,</li>" +
"<li>po kliknutí na štvorsmernú šípku na ráme každého z&nbsp;týchto objektov presúvať texty, obrázky, zvukové nahrávky a&nbsp;videá,</li>" +
"<li>pomocou dvojitej šípky, ktorú nájdete na ráme vpravo dole, meniť veľkosť objektov </li>" +
"<li>mazať položky tlačidlom „X“.</li></ul>" +
"<p>Ak chcete pridať stránku, kliknite na zelené tlačidlo „+“ na spodku stránky.</p>" +
"<p>Ak chcete vymazať stránku, kliknite na červený krížik.</p>" +
"<p>Tlačidlom „Zobraziť“ sa z&nbsp;režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
//some flags
var mouse_state = false;
//object for resize
var resize_obj = {
object: null,
top: 0,
left: 0,
clicked: false,
k: 0
}
//main function
function start(){
$("#wgt_display").text(sankoreLang.display);
$("#wgt_edit").text(sankoreLang.edit);
$("#wgt_name").text(sankoreLang.wgt_name);
$("#wgt_help").text(sankoreLang.help);
$("#help").html(sankoreLang.help_content);
$("#style_select option[value='1']").text(sankoreLang.slate);
$("#style_select option[value='2']").text(sankoreLang.pad);
$("#style_select option[value='3']").text(sankoreLang.none);
var tmpl = $("div.inline label").html();
$("div.inline label").html(sankoreLang.theme + tmpl)
if(window.sankore){
if(sankore.preference("etudier","")){
var data = jQuery.parseJSON(sankore.preference("etudier",""));
importData(data);
}
else
showExample();
if(sankore.preference("etudier_style","")){
changeStyle(sankore.preference("etudier_style",""));
$("#style_select").val(sankore.preference("etudier_style",""));
} else
changeStyle("3")
}
else
showExample();
//events
if (window.widget) {
window.widget.onleave = function(){
if(!$("#wgt_help").hasClass("open")){
exportData();
sankore.setPreference("etudier_style", $("#style_select").find("option:selected").val());
sankore.setPreference("etudier_cur_page", $("#slider").getPage());
sankore.setPreference("etudier_left_nav", $("#prevBtn a").css("display"));
sankore.setPreference("etudier_right_nav", $("#nextBtn a").css("display"));
}
}
}
$("#style_select").change(function (event){
changeStyle($(this).find("option:selected").val());
})
$("#wgt_help").click(function(){
var tmp = $(this);
if($(this).hasClass("open")){
$(this).removeClass("help_pad").removeClass("help_wood")
$("#help").hide();
tmp.removeClass("open");
$("#slider").show();
} else {
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
exportData();
sankore.setPreference("etudier_style", $("#style_select").find("option:selected").val());
sankore.setPreference("etudier_cur_page", $("#slider").getPage());
sankore.setPreference("etudier_left_nav", $("#prevBtn a").css("display"));
sankore.setPreference("etudier_right_nav", $("#nextBtn a").css("display"));
$("#slider").hide();
$("#help").show();
tmp.addClass("open");
}
});
$("#wgt_display, #wgt_edit").click(function(event){
if(this.id == "wgt_display"){
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(false);
$(this).addClass("selected");
$("#wgt_edit").removeClass("selected");
$("#parameters").css("display","none");
var tmpwh = $(window).height();
var tmpww = $(window).width();
window.resizeTo(tmpww, tmpwh - 44)
$("#slider li>div").each(function(){
var container = $(this);
container.removeAttr("ondragenter")
.removeAttr("ondragleave")
.removeAttr("ondragover")
.removeAttr("ondrop");
container.find(".text_block").each(function(){
$(this).draggable();
$(this).find(".move_block").remove();
$(this).find(".close_img").remove();
$(this).find(".size_up").remove();
$(this).find(".size_down").remove();
$(this).find(".resize_block").remove();
$(this).find(".real_text").removeAttr("contenteditable");
$(this).removeClass("block_border");
$(this).css("position","absolute");
});
container.find(".img_block").each(function(){
$(this).draggable();
$(this).find(".close_img").remove();
$(this).find(".move_block").remove();
$(this).find(".resize_block").remove();
$(this).removeClass("block_border");
$(this).css("position","absolute");
});
container.find(".audio_block").each(function(){
$(this).find(".close_img").remove();
$(this).removeClass("block_border");
$(this).css("position","absolute");
});
container.find(".add_left").remove();
container.find(".add_right").remove();
container.find(".close_slide").remove();
container.find(".add_text").remove();
});
$(this).css("display", "none");
$("#wgt_edit").css("display", "block");
}
} else {
if(!$(this).hasClass("selected")){
if(window.sankore)
sankore.enableDropOnWidget(true);
$(this).addClass("selected");
$("#wgt_display").removeClass("selected");
$("#parameters").css("display","block");
tmpwh = $(window).height();
tmpww = $(window).width();
window.resizeTo(tmpww, tmpwh + 44)
$("#slider li>div").each(function(){
var container = $(this);
container.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background\",\"none\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background\",\"none\"); return onDropTarget(this,event);");
container.find(".text_block").each(function(){
$(this).draggable("destroy");
$("<div class='move_block' contenteditable='false'>").appendTo($(this));
$("<div class='close_img' contenteditable='false'>").appendTo($(this));
$("<div class='size_up' contenteditable='false'>").appendTo($(this));
$("<div class='size_down' contenteditable='false'>").appendTo($(this));
$("<div class='resize_block' contenteditable='false'>").appendTo($(this));
$(this).find(".real_text").attr("contenteditable", "true");
$(this).addClass("block_border");
});
container.find(".img_block").each(function(){
$(this).draggable("destroy");
$("<div class='move_block' contenteditable='false'>").appendTo($(this));
$("<div class='close_img' contenteditable='false'>").appendTo($(this));
$("<div class='resize_block' contenteditable='false'>").appendTo($(this));
$(this).addClass("block_border");
});
container.find(".audio_block").each(function(){
$("<div class='close_img' contenteditable='false'>").appendTo($(this));
$(this).addClass("block_border");
});
$("<div class='add_left'>").appendTo(container);
$("<div class='add_right'>").appendTo(container);
$("<div class='close_slide'>").appendTo(container);
$("<div class='add_text'>").appendTo(container);
$(window).trigger("resize")
});
$(this).css("display", "none");
$("#wgt_display").css("display", "block");
}
}
$("audio").each(function(){
this.pause();
$(this).parent().find(":first-child").removeClass("stop").addClass("play");
});
});
//deleting the img block
$(".close_img").live("click", function(){
var parent = $(this).parent();
var img = parent.find('img');
var sound = parent.find('audio');
var src;
if(img.length > 0){
src = img.attr('src');
}else if(sound.length > 0){
src = sound.find('source').attr('src');
}
if(src){
sankore.removeFile(src);
}
$(this).parent().remove();
});
//increase a size of text
$(".size_up").live("click", function(){
$(this).parent().height("");
var fz = parseInt($(this).parent().css("font-size").replace("px", ""));
$(this).parent().css("font-size", fz+1 + "px");
});
//decrease a size of text
$(".size_down").live("click", function(){
var fz = parseInt($(this).parent().css("font-size").replace("px", ""));
fz = ((fz - 1) < 8)?8:fz-1;
$(this).parent().css("font-size", fz + "px");
});
//play/pause event
$(".play, .stop").live("click", function(){
var tmp_audio = $(this);
var audio = tmp_audio.parent().find("audio").get(0);
if($(this).hasClass("play")){
if(tmp_audio.parent().find("source").attr("src")){
tmp_audio.removeClass("play").addClass("stop");
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.play();
}
} else {
$(this).removeClass("stop").addClass("play");
clearInterval( tmp_audio.parent().find("input").val())
audio.pause();
}
});
$(".replay").live("click", function(){
var tmp_audio = $(this).prev();
var audio = $(this).parent().find("audio").get(0);
if(tmp_audio.parent().find("source").attr("src")){
$(this).prev().removeClass("play").addClass("stop");
clearInterval($(this).parent().find("input").val());
var id = setInterval(function(){
if(audio.currentTime == audio.duration){
clearInterval(id);
tmp_audio.removeClass("stop").addClass("play");
}
}, 10);
tmp_audio.parent().find("input").val(id);
audio.currentTime = 0;
audio.play();
}
});
//moving objects
$(".move_block").live("mouseover",function(){
$(this).parent().draggable();
});
$(".move_block").live("mouseleave",function(){
if(!mouse_state)
$(this).parent().draggable("destroy");
});
$(".move_block").live("mousedown",function(){
mouse_state = true;
});
$(".move_block").live("mouseup",function(){
mouse_state = false;
});
//resize block
$(".resize_block").live("mousedown", function(){
resize_obj.object = $(this);
resize_obj.top = event.clientY;
resize_obj.left = event.clientX;
resize_obj.clicked = true;
if($(this).parent().hasClass("img_block"))
resize_obj.k = $(this).parent().find("img").width() / $(this).parent().find("img").height();
})
$("li>div").live("mouseup", function(){
resize_obj.object = null;
resize_obj.top = 0;
resize_obj.left = 0;
resize_obj.clicked = false;
})
$("li>div").live("mousemove", function(){
if(resize_obj.clicked){
if(resize_obj.object.parent().hasClass("text_block")){
var width = resize_obj.object.parent().width() - resize_obj.left + event.clientX;
resize_obj.left = event.clientX;
resize_obj.top = event.clientY;
resize_obj.object.parent().width(width).height("");
} else {
var img_width = resize_obj.object.parent().find("img").width() - resize_obj.left + event.clientX;
var img_height = img_width / resize_obj.k;
resize_obj.left = event.clientX;
resize_obj.top = event.clientY;
resize_obj.object.parent().find("img").width(img_width).height(img_height);
}
}
});
//closing a slide
$(".close_slide").live("click", function(){
$(this).parent().parent().remove();
//N/C - NNE - 20140318
if(sankore){
$(this).parent().find('img').each(function(){
sankore.removeFile($(this).attr('src'));
});
$(this).parent().find('source').each(function(){
sankore.removeFile($(this).attr('src'));
});
}
//N/C - NNE - 20140318 : END
$("#slider").removeSlide();
});
//adding new slides
$(".add_left").live("click", function(){
var cur_li = $(this).parent().parent();
var new_li = $("<li>");
new_li.width(cur_li.width()).height(cur_li.height()).css("float","left");
var new_div = $("<div>").appendTo(new_li);
new_div.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);");
var example = $("<div class='text_block' style='position: absolute;'>").addClass("block_border");
$("<div class='real_text' contenteditable='true'>" + sankoreLang.new_slide + "</div>").appendTo(example);
$("<div class='move_block' contenteditable='false'>").appendTo(example);
$("<div class='close_img' contenteditable='false'>").appendTo(example);
$("<div class='size_up' contenteditable='false'>").appendTo(example);
$("<div class='size_down' contenteditable='false'>").appendTo(example);
$("<div class='resize_block' contenteditable='false'>").appendTo(example);
example.css("top","40%").css("left","40%");
new_div.append(example);
$("<div class='add_left'>").appendTo(new_div);
$("<div class='add_right'>").appendTo(new_div);
$("<div class='close_slide'>").appendTo(new_div);
$("<div class='add_text'>").appendTo(new_div);
new_li.insertBefore(cur_li);
$("#slider").addSlide("before");
});
$(".add_right").live("click", function(){
var cur_li = $(this).parent().parent();
var new_li = $("<li>");
new_li.width(cur_li.width()).height(cur_li.height()).css("float","left");
var new_div = $("<div>").appendTo(new_li);
new_div.attr("ondragenter", "return false;")
.attr("ondragleave", "$(this).css(\"background-color\",\"\"); return false;")
.attr("ondragover", "$(this).css(\"background-color\",\"#ccc\"); return false;")
.attr("ondrop", "$(this).css(\"background-color\",\"\"); return onDropTarget(this,event);");
var example = $("<div class='text_block' style='position: absolute;'>").addClass("block_border");
$("<div class='real_text' contenteditable='true'>" + sankoreLang.new_slide + "</div>").appendTo(example);
$("<div class='move_block' contenteditable='false'>").appendTo(example);
$("<div class='close_img' contenteditable='false'>").appendTo(example);
$("<div class='size_up' contenteditable='false'>").appendTo(example);
$("<div class='size_down' contenteditable='false'>").appendTo(example);
$("<div class='resize_block' contenteditable='false'>").appendTo(example);
example.css("top","40%").css("left","40%");
new_div.append(example);
$("<div class='add_left'>").appendTo(new_div);
$("<div class='add_right'>").appendTo(new_div);
$("<div class='close_slide'>").appendTo(new_div);
$("<div class='add_text'>").appendTo(new_div);
new_li.insertAfter(cur_li);
$("#slider").addSlide("after");
});
$(".add_text").live("click", function(){
var container = $(this).parent();
var text_block = $("<div class='text_block'><div class='real_text' contenteditable='true'>" + sankoreLang.new_txt + "</div></div>").appendTo(container);
$("<div class='move_block' contenteditable='false'>").appendTo(text_block);
$("<div class='close_img' contenteditable='false'>").appendTo(text_block);
$("<div class='size_up' contenteditable='false'>").appendTo(text_block);
$("<div class='size_down' contenteditable='false'>").appendTo(text_block);
$("<div class='resize_block' contenteditable='false'>").appendTo(text_block);
text_block.addClass("block_border");
});
}
//export
function exportData(){
var array_to_export = [];
$("#slider li>div").each(function(){
var cont_obj = new Object();
cont_obj.w = $(this).parent().width();
cont_obj.h = $(this).parent().height();
cont_obj.text = [];
$(this).find(".text_block").each(function(){
var txt_block = new Object();
txt_block.top = $(this).position().top;
txt_block.left = $(this).position().left;
txt_block.w = $(this).width();
txt_block.fz = $(this).css("font-size");
txt_block.val = $(this).find(".real_text").html();
cont_obj.text.push(txt_block);
});
cont_obj.imgs = [];
$(this).find(".img_block").each(function(){
var img_obj = new Object();
img_obj.link = $(this).find("img").attr("src").replace("../../","");
img_obj.h = $(this).find("img").height();
img_obj.w = $(this).find("img").width();
img_obj.top = $(this).position().top;
img_obj.left = $(this).position().left;
cont_obj.imgs.push(img_obj);
});
cont_obj.audio = [];
$(this).find(".audio_block").each(function(){
var audio_block = new Object();
audio_block.top = $(this).position().top;
audio_block.left = $(this).position().left;
audio_block.val = $(this).find("source").attr("src").replace("../../","");
cont_obj.audio.push(audio_block);
});
array_to_export.push(cont_obj);
});
sankore.setPreference("etudier", JSON.stringify(array_to_export));
}
//import
function importData(data){
var width = 0;
var height = 0;
for(var i in data){
width = data[i].w;
height = data[i].h;
var li = $("<li style='float: left; width: " + data[i].w + "; height: " + data[i].h + ";'>");
var div = $("<div>").appendTo(li);
for(var j in data[i].text){
var text_div = $("<div class='text_block'><div class='real_text'>" + data[i].text[j].val + "</div></div>");
text_div.draggable().css("position","absolute")
.width(data[i].text[j].w)
.css("top", data[i].text[j].top)
.css("left", data[i].text[j].left)
.css("font-size", data[i].text[j].fz)
.appendTo(div);
}
for(j in data[i].imgs){
var img_div = $("<div class='img_block' style='text-align: center;'>");
img_div.draggable().css("position","absolute")
.css("top", data[i].imgs[j].top)
.css("left", data[i].imgs[j].left)
.appendTo(div);
$("<img src='../../" + data[i].imgs[j].link + "' style='display: inline;' width='" + data[i].imgs[j].w + "' height='" + data[i].imgs[j].h + "'/>").appendTo(img_div);
}
for(j in data[i].audio){
var audio_div = $("<div class='audio_block'>");
$("<div class='play'>").appendTo(audio_div);
$("<div class='replay'>").appendTo(audio_div);
var tmp_audio = $("<audio>").appendTo(audio_div);
$("<source src='../../" + data[i].audio[j].val + "' />").appendTo(tmp_audio);
audio_div.draggable().css("position","absolute")
.css("top", data[i].audio[j].top)
.css("left", data[i].audio[j].left)
.appendTo(div);
}
$("#slider ul").append(li);
}
$(window).trigger("resize")
$("#slider").width(width).height(height).easySlider({
prevText: '',
nextText: '',
controlsShow: false
});
$("#slider").goToSlide(sankore.preference("etudier_cur_page",""));
$("#prevBtn a").css("display", sankore.preference("etudier_left_nav",""));
$("#nextBtn a").css("display", sankore.preference("etudier_right_nav",""));
}
//example
function showExample(){
var li1 = $("<li>");
var div1 = $("<div>").appendTo(li1);
$("<div class='text_block'><div class='real_text'>" + sankoreLang.text_content + "</div></div>").draggable().appendTo(div1)
li1.width($("#slider").width()).height($("#slider").height());
$("#slider ul").append(li1);
var li2 = $("<li>");
var div2 = $("<div>").appendTo(li2);
var img = $("<div class='img_block' style='text-align: center;'></div>").draggable().appendTo(div2);
$("<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img);
li2.width($("#slider").width()).height($("#slider").height());
$("#slider ul").append(li2);
var li3 = $("<li>");
var div3 = $("<div>").appendTo(li3);
li3.width($("#slider").width()).height($("#slider").height());
$("<div class='text_block'><div class='real_text'>" + sankoreLang.text_content + "</div></div>").draggable().appendTo(div3);
var audio_block = $("<div class='audio_block'>").draggable().appendTo(div3);
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../objects/bateaux.mp3");
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
$("#slider ul").append(li3);
var li4 = $("<li>");
var div4 = $("<div>").appendTo(li4);
$("<div class='text_block'><div class='real_text'>" + sankoreLang.text_content + "</div></div>").draggable().appendTo(div4);
var img2 = $("<div class='img_block' style='text-align: center;'></div>").draggable().appendTo(div4);
$("<img src=\"../../objects/1_2.gif\" style=\"display: inline;\" height=\"120\"/>").appendTo(img2);
var audio_block2 = $("<div class='audio_block'>").draggable().appendTo(div4);
$("<div class='play'>").appendTo(audio_block2);
$("<div class='replay'>").appendTo(audio_block2);
var source2 = $("<source/>").attr("src", "../../objects/bateaux_2.mp3");
var audio2 = $("<audio>").appendTo(audio_block2);
audio2.append(source2);
li4.width($("#slider").width()).height($("#slider").height());
$("#slider ul").append(li4);
$(".text_block, .audio_block, .img_block").each(function(){
$(this).css("position","absolute");
});
$("#slider").easySlider({
prevText: '',
nextText: '',
controlsShow: false
});
}
//string into xml-format
function stringToXML(text){
if (window.ActiveXObject){
var doc=new ActiveXObject('Microsoft.XMLDOM');
doc.async='false';
doc.loadXML(text);
} else {
var parser=new DOMParser();
doc=parser.parseFromString(text,'text/xml');
}
return doc;
}
//changing the style
function changeStyle(val){
switch(val){
case "1":
$(".b_top_left").removeClass("btl_pad").removeClass("without_back");
$(".b_top_center").removeClass("btc_pad").removeClass("without_back");
$(".b_top_right").removeClass("btr_pad").removeClass("without_back");
$(".b_center_left").removeClass("bcl_pad").removeClass("without_back");
$(".b_center_right").removeClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").removeClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").removeClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").removeClass("bbc_pad").removeClass("without_back");
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
$("#wgt_name").removeClass("pad_color");
$("#wgt_display").addClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").addClass("radius_ft");
break;
case "2":
$(".b_top_left").addClass("btl_pad").removeClass("without_back");
$(".b_top_center").addClass("btc_pad").removeClass("without_back");
$(".b_top_right").addClass("btr_pad").removeClass("without_back");
$(".b_center_left").addClass("bcl_pad").removeClass("without_back");
$(".b_center_right").addClass("bcr_pad").removeClass("without_back");
$(".b_bottom_right").addClass("bbr_pad").removeClass("without_back");
$(".b_bottom_left").addClass("bbl_pad").removeClass("without_back");
$(".b_bottom_center").addClass("bbc_pad").removeClass("without_back");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").removeClass("without_radius").removeClass("radius_ft");
break;
case "3":
$(".b_top_left").addClass("without_back").removeClass("btl_pad");
$(".b_top_center").addClass("without_back").removeClass("btc_pad");
$(".b_top_right").addClass("without_back").removeClass("btr_pad");
$(".b_center_left").addClass("without_back").removeClass("bcl_pad");
$(".b_center_right").addClass("without_back").removeClass("bcr_pad");
$(".b_bottom_right").addClass("without_back").removeClass("bbr_pad");
$(".b_bottom_left").addClass("without_back").removeClass("bbl_pad");
$(".b_bottom_center").addClass("without_back").removeClass("bbc_pad");
$("#wgt_help").addClass("pad_color").addClass("pad_help");
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
$("#wgt_name").addClass("pad_color");
$("#wgt_display").removeClass("display_wood");
$("#style_select").val(val);
$("body, html").addClass("without_radius").removeClass("radius_ft");
break;
}
}
//drop handler
function onDropTarget(obj, event) {
if (event.dataTransfer) {
var format = "text/plain";
var textData = event.dataTransfer.getData(format);
if (!textData) {
alert(":(");
}
textData = stringToXML(textData);
var tmp = textData.getElementsByTagName("path")[0].firstChild.textContent;
var tmp_type = textData.getElementsByTagName("type")[0].firstChild.textContent;
if(tmp_type.substr(0, 5) == "audio"){
var audio_block = $("<div class='audio_block'>").draggable().appendTo($(obj));
audio_block.css("position","absolute").css("top",event.clientY - 54).css("left",event.clientX - 54);
$("<div class='close_img' contenteditable='false'>").appendTo(audio_block);
audio_block.addClass("block_border");
$("<div class='play'>").appendTo(audio_block);
$("<div class='replay'>").appendTo(audio_block);
var source = $("<source/>").attr("src", "../../" + tmp);
var audio = $("<audio>").appendTo(audio_block);
audio.append(source);
} else {
var img_block = $("<div class='img_block' style='text-align: center;'></div>").appendTo($(obj));
img_block.css("top",event.clientY - 54).css("left",event.clientX - 54);
$("<div class='move_block' contenteditable='false'>").appendTo(img_block);
$("<div class='close_img' contenteditable='false'>").appendTo(img_block);
$("<div class='resize_block' contenteditable='false'>").appendTo(img_block);
img_block.addClass("block_border");
var tmp_img = $("<img src=\"../../" + tmp + "\" style=\"display: inline;\"/>").appendTo(img_block);
setTimeout(function(){
if(tmp_img.height() >= tmp_img.width())
tmp_img.attr("height", "120");
else{
tmp_img.attr("width","120");
tmp_img.css("margin",(120 - tmp_img.height())/2 + "px 0");
}
}, 6)
}
}
else {
alert ("Your browser does not support the dataTransfer object.");
}
if (event.stopPropagation) {
event.stopPropagation ();
}
else {
event.cancelBubble = true;
}
return false;
}
if (window.widget) {
window.widget.onremove = function(){
$("audio").each(function(){
this.pause();
$(this).parent().find(":first-child").removeClass("stop").addClass("play");
});
}
}
$(window).resize(function(){
var slider = $("#slider");
slider.width($(this).width() - 108).height($(this).height() - 108);
$("#slider li").each(function(){
$(this).width(slider.width()).height(slider.height());
});
slider.setSize(slider.width(), slider.height());
})

@ -0,0 +1,70 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template</title>
<!--Styles-->
<link rel="stylesheet" type="text/css" href="../../styles/master.css">
<link rel="stylesheet" type="text/css" href="../../styles/wcontainer.css">
<link rel="stylesheet" type="text/css" href="../../styles/app.css">
<!--Scripts-->
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../scripts/ext.js"></script>
<script type="text/javascript" src="scripts/wcontainer.js"></script>
<script type="text/javascript" src="../../scripts/app.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,211 @@
var sankoreLang = {
view: "Zobraziť",
edit: "Upraviť",
example: "treba oddeliť niekoľko slov",
wgt_name: "Delenie viet",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Delenie viet</h2></p>" +
"<p><h3> Oddelenie slov vo vetách</h3></p>" +
"<p>Slová v texte sú napísané bez medzier. Cieľom aktivity je, aby žiaci doplnili do textu všetky medzery. Ak sa im to podarí, celý text sa zafarbí dozelena.</p> "+
"<p>Ak chcete slová oddeliť medzerami, nastavte kurzor medzi príslušné znaky a kliknite myšou (resp. stylusom).</p>" +
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>" +
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>" +
"<ul><li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>" +
"<li>upraviť vetu (v textovom poli).</li></ul>" +
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
// 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 )
{
// some protecred variables
var thisInstance = this;
this.editMode = false;
var data = {}; // see setData and getData
// widget size parameters
this.minHeight = 100;
this.minWidth = 400;
// set to 0 for no max width restriction
this.maxWidth = 0;
// links to the elements of the widget
this.elements = {};
/*
============
create
============
- creates html base, inits this.elements, assings events
*/
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>';
var container = $( containerID );
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" );
$("#wgt_edit").live("click", function(){
thisInstance.modeEdit();
} );
$("#wgt_display").live("click", function(){
thisInstance.modeView();
} );
};
/*
===============
setViewContent
===============
- assigns custom html to the viewmode container
*/
this.setViewContent = function( html )
{
this.elements.container.find( "#mp_content .viewmode" ).html( html );
};
/*
===============
setEditContent
===============
- assigns custom html to the editmode container
*/
this.setEditContent = function( html )
{
this.elements.container.find( "#mp_content .editmode" ).html( html );
};
/*
=========================
modeEdit and modeView
=========================
- switch the widget betweed modes
* for customization extend onEditMode and onViewMode
*/
this.modeEdit = function()
{
this.onEditMode();
this.editMode = true;
this.elements.edit.removeClass( "hide" );
this.elements.view.addClass( "hide" );
//this.adjustSize();
};
this.modeView = function()
{
this.onViewMode();
this.editMode = false;
this.elements.edit.addClass( "hide" );
this.elements.view.removeClass( "hide" );
//this.adjustSize();
};
/*
======================
setData and getData
======================
- store some data inside
*/
this.setData = function( name, value ){
data[name] = value;
};
this.getData = function( name ){
if( typeof( data[name] ) == "undefined" ){
return null;
} else return data[name];
};
// redefinable methods
/*
==========================
onEditMode and onViewMode
==========================
- these are called when the mode is being changed
*/
this.onEditMode = function(){
//
};
this.onViewMode = function(){
//
};
/*
======================
viewSize and editSize
======================
- calculate container size for the adjustSize method
* they are likely to be redefined for each particular widget
*/
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()
};
};
/*
=====================
checkAnswer
=====================
- check if the exercise in the view mode was done right
* redefine it for each particular widget
*/
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;
}

@ -0,0 +1,70 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template</title>
<!--Styles-->
<link rel="stylesheet" type="text/css" href="../../styles/master.css">
<link rel="stylesheet" type="text/css" href="../../styles/wcontainer.css">
<link rel="stylesheet" type="text/css" href="../../styles/app.css">
<!--Scripts-->
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../scripts/ext.js"></script>
<script type="text/javascript" src="scripts/wcontainer.js"></script>
<script type="text/javascript" src="../../scripts/app2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,208 @@
var sankoreLang = {
view: "Zobraziť",
edit: "Upraviť",
example: "Ahoj, toto je prvá veta. Ahoj, toto je druhá veta. Ahoj, toto je tretia veta. Zdravím, toto je štvrtá veta. Ahoj, prepáč, že meškám, ja som piata veta.",
wgt_name: "Rozdelenie textu",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2>Rozdelenie textu</h2></p>"+
"<p><h3>Rozdelenie textu na vety</h3></p>"+
"<p>Vety v texte sú napísané bez bodiek. Cieľom aktivity je, aby žiaci doplnili bodku za každou vetou. Ak sa im to podarí, celý text sa zafarbí dozelena.</p>"+
"<p>Ak chcete dať za vetou bodku (alebo ju zrušiť), nastavte kurzor medzi príslušné slová a kliknite myšou (resp. stylusom).</p>"+
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu.</p>"+
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>"+
"<ul><li>zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>"+
"<li>upraviť text (vety s bodkami píšte do textového poľa).</li></ul>"+
"<p>Nepoužívajte otázniky ani výkričníky.</p>"+
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme: "Farebný motív"
};
// 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 )
{
// some protecred variables
var thisInstance = this;
this.editMode = false;
var data = {}; // see setData and getData
// widget size parameters
this.minHeight = 100;
this.minWidth = 400;
// set to 0 for no max width restriction
this.maxWidth = 0;
// links to the elements of the widget
this.elements = {};
/*
============
create
============
- creates html base, inits this.elements, assings events
*/
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>';
var container = $( containerID );
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" );
$("#wgt_edit").live("click", function(){
thisInstance.modeEdit();
} );
$("#wgt_display").live("click", function(){
thisInstance.modeView();
} );
};
/*
===============
setViewContent
===============
- assigns custom html to the viewmode container
*/
this.setViewContent = function( html )
{
this.elements.container.find( "#mp_content .viewmode" ).html( html );
};
/*
===============
setEditContent
===============
- assigns custom html to the editmode container
*/
this.setEditContent = function( html )
{
this.elements.container.find( "#mp_content .editmode" ).html( html );
};
/*
=========================
modeEdit and modeView
=========================
- switch the widget betweed modes
* for customization extend onEditMode and onViewMode
*/
this.modeEdit = function()
{
this.onEditMode();
this.editMode = true;
this.elements.edit.removeClass( "hide" );
this.elements.view.addClass( "hide" );
//this.adjustSize();
};
this.modeView = function()
{
this.onViewMode();
this.editMode = false;
this.elements.edit.addClass( "hide" );
this.elements.view.removeClass( "hide" );
//this.adjustSize();
};
/*
======================
setData and getData
======================
- store some data inside
*/
this.setData = function( name, value ){
data[name] = value;
};
this.getData = function( name ){
if( typeof( data[name] ) == "undefined" ){
return null;
} else return data[name];
};
// redefinable methods
/*
==========================
onEditMode and onViewMode
==========================
- these are called when the mode is being changed
*/
this.onEditMode = function(){
//
};
this.onViewMode = function(){
//
};
/*
======================
viewSize and editSize
======================
- calculate container size for the adjustSize method
* they are likely to be redefined for each particular widget
*/
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()
};
};
/*
=====================
checkAnswer
=====================
- check if the exercise in the view mode was done right
* redefine it for each particular widget
*/
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;
}

@ -0,0 +1,69 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Template</title>
<!--Styles-->
<link rel="stylesheet" type="text/css" href="../../styles/master.css">
<link rel="stylesheet" type="text/css" href="../../styles/wcontainer.css">
<link rel="stylesheet" type="text/css" href="../../styles/spl-word.css">
<!--Scripts-->
<script type="text/javascript" src="../../scripts/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="../../scripts/jquery-ui-1.8.9.custom.min.js"></script>
<script type="text/javascript" src="../../scripts/ext.js"></script>
<script type="text/javascript" src="scripts/wcontainer.js"></script>
<script type="text/javascript" src="../../scripts/spl-word.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if(window.sankore)
sankore.enableDropOnWidget(false);
});
</script>
</head>
<body>
<table class="body_table" cellpadding=0 cellspacing=0>
<tr style="height: 54px;">
<td class="b_top_left">&nbsp;</td>
<td class="b_top_center">
<div id="wgt_name"></div>
<div id="wgt_help"></div>
<div id="wgt_reload"></div>
<div id="wgt_display" class="selected"></div>
<div id="wgt_edit"></div>
</td>
<td class="b_top_right">&nbsp;</td>
</tr>
<tr>
<td class="b_center_left">&nbsp;</td>
<td>
<div id="help"></div>
<div id="ub-widget">
<div id="parameters">
<div class="inline">
<label>
<select id="style_select">
<option value="1"></option>
<option value="2"></option>
<option value="3"></option>
</select>
</label>
</div>
</div>
</div>
</td>
<td class="b_center_right">&nbsp;</td>
</tr>
<tr style="height: 54px;">
<td class="b_bottom_left">&nbsp;</td>
<td class="b_bottom_center">&nbsp;</td>
<td class="b_bottom_right">&nbsp;</td>
</tr>
</table>
</body>
</html>

@ -0,0 +1,203 @@
var sankoreLang = {
view: "Zobraziť",
edit: "Upraviť",
example: "naj*vý*raz*nej*ší",
wgt_name: "Slabiky",
reload: "Obnoviť",
slate: "bridlica",
pad: "tablet",
none: "žiadny",
help: "Pomoc",
help_content:
"<p><h2> Slabiky </h2></p>"+
"<p><h3> Delenie slov na slabiky</h3></p>"+
"<p>Cieľom aktivity je správne rozdeliť slovo. Ak sa to žiakom podarí, celé slovo sa zafarbí dozelena.</p>"+
"<p>Ak chcete slovo rozdeliť na slabiky alebo toto rozdelenie zrušiť, nastavte kurzor na koniec slabiky a kliknite myšou (resp. stylusom).</p>"+
"<p>Tlačidlom „Obnoviť“ vrátite cvičenie do pôvodného stavu. </p>"+
"<p>Po stlačení tlačidla „Upraviť“ môžete v&nbsp;režime úprav:</p>"+
"<ul><li> zmeniť farebný motív na tablet, bridlicu alebo na žiadny (predvolený je žiadny),</li>"+
"<li> zmeniť slovo (slovo napíšte do textového poľa a rozdeľte ho na slabiky pomocou *).</li></ul>"+
"<p>Tlačidlom „Zobraziť“ sa z režimu úprav vrátite na aktivitu.</p>",
theme:"Farebný motív"
};
// 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 )
{
// some protecred variables
var thisInstance = this;
this.editMode = false;
var data = {}; // see setData and getData
// widget size parameters
this.minHeight = 100;
this.minWidth = 400;
// links to the elements of the widget
this.elements = {};
/*
============
create
============
- creates html base, inits this.elements, assings events
*/
this.create = function( containerID )
{
var html =
'<div id="mp_content">' +
'<div class="viewmode">' +
'</div>' +
'<div class="editmode">' +
'</div>' +
'</div>';
var container = $( containerID );
container.append( html );
this.elements.edit = container.find( ".editmode" );
this.elements.view = container.find( ".viewmode" );
this.elements.container = container;
this.elements.containerView = container.find( "#mp_content .viewmode" );
this.elements.containerEdit = container.find( "#mp_content .editmode" );
$("#wgt_edit").live("click", function(){
thisInstance.modeEdit();
} );
$("#wgt_display").live("click", function(){
thisInstance.modeView();
} );
};
/*
===============
setViewContent
===============
- assigns custom html to the viewmode container
*/
this.setViewContent = function( html )
{
this.elements.container.find( "#mp_content .viewmode" ).html( html );
};
/*
===============
setEditContent
===============
- assigns custom html to the editmode container
*/
this.setEditContent = function( html )
{
this.elements.container.find( "#mp_content .editmode" ).html( html );
};
/*
=========================
modeEdit and modeView
=========================
- switch the widget betweed modes
* for customization extend onEditMode and onViewMode
*/
this.modeEdit = function()
{
this.onEditMode();
this.editMode = true;
this.elements.edit.removeClass( "hide" );
this.elements.view.addClass( "hide" );
//this.adjustSize();
};
this.modeView = function()
{
this.onViewMode();
this.editMode = false;
this.elements.edit.addClass( "hide" );
this.elements.view.removeClass( "hide" );
//this.adjustSize();
};
/*
======================
setData and getData
======================
- store some data inside
*/
this.setData = function( name, value ){
data[name] = value;
};
this.getData = function( name ){
if( typeof( data[name] ) == "undefined" ){
return null;
} else return data[name];
};
// redefinable methods
/*
==========================
onEditMode and onViewMode
==========================
- these are called when the mode is being changed
*/
this.onEditMode = function(){
//
};
this.onViewMode = function(){
//
};
/*
======================
viewSize and editSize
======================
- calculate container size for the adjustSize method
* they are likely to be redefined for each particular widget
*/
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()
};
};
/*
=====================
checkAnswer
=====================
- check if the exercise in the view mode was done right
* redefine it for each particular widget
*/
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;
}

@ -0,0 +1,16 @@
fr.njin.i18n.document.title = Počítanie
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zatvoriť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomocník
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.tableur.parameters.label.operator = Operácia
fr.njin.i18n.tableur.parameters.label.row = Počet riadkov
fr.njin.i18n.tableur.parameters.label.col = Počet stĺpcov
fr.njin.i18n.tableur.parameters.label.reste = Zobraziť zvyšok pri delení

@ -0,0 +1,15 @@
<h3>Počítanie</h3>
<h4>Počítanie spamäti</h4>
<p>V aktivite Počítanie môžete precvičovať všetky matematické úkony (sčítanie, odčítanie, násobenie a&nbsp;delenie).
Ak chcete zobraziť alebo skryť odpoveď, kliknite na príslušný štvorec v&nbsp;mriežke.</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul>
<li> farebný motív na tablet, bridlicu alebo na žiadny (predvolená je bridlica),</li>
<li> matematickú operáciu,</li>
<li> počet riadkov a stĺpcov (1 &ndash; 12).</li>
</ul>
<p>Šípka na doske označuje začiatok príkladu.</p>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>

@ -0,0 +1,14 @@
fr.njin.i18n.document.title = Matematické piškvorky
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zatvoriť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomocník
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.morpion.playerInfo = Hráč {0} ({1})
fr.njin.i18n.morpion.cell.submit = OK

@ -0,0 +1,21 @@
<h3>Piškvorky</h3>
<h3>variácia na počítanie spamäti</h3>
<p>
Dvaja hráči si na striedačku vyberajú príklady z matematiky, počítajú ich a&nbsp;kontrolujú si ich výsledky.
Na kontrolu výpočtu použite tlačidlo Skontrolovať (fajka). Interaktívna aktivita dokáže príklad skontrolovať sama.
</p>
<p>
Ak je odpoveď správna, pole bude označené krížikom (X) alebo kruhom (O) podľa toho, ktorý hráč je na rade.
Ak je odpoveď nesprávna, na rade je druhý hráč.
</p>
<p>Označenie hráča sa zobrazí v ľavom hornom rohu: Hráč č. 1 (X), Hráč č. 2 (O).</p>
<p>Hráč, ktorý ako prvý umiestni 3 svoje značky (X alebo O) v riadku za sebou (hore, dole alebo šikmo), je víťaz.</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav:</p>
<ul>
<li> zmeniť farebný motív na bridlicu, tablet alebo na žiadny (predvolená je bridlica),</li>
<li> zadať vlastné príklady, ktoré chcete použiť vo svojej aktivite.</li>
</ul>
<p>Interaktívna aktivita dokáže rozoznať matematický zápis &ndash; povolené znamienka: +, * (krát), -, / (delené) a zátvorky.</p>
<p>Tlačidlom Obnoviť znova spustíte hru.</p>

@ -0,0 +1,15 @@
fr.njin.i18n.document.title = Vlak
fr.njin.i18n.toolbar.edit = Upraviť
fr.njin.i18n.toolbar.view = Zobraziť
fr.njin.i18n.toolbar.reload = Obnoviť
fr.njin.i18n.toolbar.help = Pomoc
fr.njin.i18n.parameters.label.themes = Farebný motív
fr.njin.i18n.parameters.label.slate.themes = bridlica
fr.njin.i18n.parameters.label.pad.themes = tablet
fr.njin.i18n.parameters.label.none.themes = žiadny
fr.njin.i18n.train.parameters.label.count = Počet čísel
fr.njin.i18n.train.parameters.label.range = Veľkosť
fr.njin.i18n.train.parameters.label.operator = Poradie

@ -0,0 +1,16 @@
 <h3> Vlak </h3>
<h4>Menšie alebo väčšie čísla</h4>
<p>Cieľom hry je dať štítky s číslami na správne miesta.</p>
<p>Program úlohu neskontroluje.</p>
<p>Po stlačení tlačidla Obnoviť sa zobrazia nové čísla.</p>
<p>Po stlačení tlačidla Upraviť môžete v&nbsp;režime úprav zmeniť:</p>
<ul><li> farebný motív na tablet, bridlicu alebo na žiadny (predvolený je tablet),</li>
<li>počet čísel (2 &ndash; 6),</li>
<li>veľkosť čísel,</li>
<li>druh číselného radu (na stúpajúci alebo klesajúci).</li></ul>
<p>Tlačidlom Zobraziť sa z režimu úprav vrátite na aktivitu.</p>
Loading…
Cancel
Save