You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
567 lines
23 KiB
567 lines
23 KiB
13 years ago
|
var sankoreLang = {
|
||
12 years ago
|
display: "Display",
|
||
13 years ago
|
edit: "Edit",
|
||
|
short_desc: "Listen to the sound and make the correct word.",
|
||
|
add: "Add new block",
|
||
|
enter: "Enter your instruction here ...",
|
||
|
example: "example",
|
||
12 years ago
|
wgt_name: "Order letters",
|
||
13 years ago
|
reload: "Reload",
|
||
12 years ago
|
slate: "slate",
|
||
|
pad: "pad",
|
||
|
none: "none",
|
||
13 years ago
|
help: "Help",
|
||
12 years ago
|
help_content:
|
||
|
"<p> <h2> Order letters </ h2> </p>" +
|
||
|
"<p> <h3>Drag and drop labels in the correct order</h3> </p>" +
|
||
|
"<p> Listen to the audio file and drag and drop labels in the correct order. If the result is correct, the area turns in green. </p> "+
|
||
|
|
||
|
"<p> You can also use this activity with numbers.</p>" +
|
||
|
|
||
|
"<p>“Reload” button resets the exercises. </p>" +
|
||
|
|
||
|
"<p> Enter the “Edit” mode to : </p>" +
|
||
12 years ago
|
"<ul> <li> choose the theme of the App : pad, slate, or none (by default : none), </li>" +
|
||
12 years ago
|
"<li> modify an exercise or to create a new one.</li> </ul>" +
|
||
|
"<p>To create a new exercise : </p>" +
|
||
|
"<ul> <li> click on “New block”,</li>" +
|
||
|
"<li>insert an instruction the field dragging an audio file from your library, </li>" +
|
||
|
"<li>edit the text field “Enter your instruction here...”,</li>" +
|
||
|
"<li>Write the desired word instead of “example”,</li>" +
|
||
|
"<li>set the correct image of your activity clicking on the submit button “v” on the frame. </li> </ul>" +
|
||
|
"<p> To replace an audio file, drag a new one from your library. </p>" +
|
||
|
"<p> To delete a whole block, click on the cross on the left.</p>" +
|
||
|
"<p>“Display” button comes back to the activity.</p>",
|
||
12 years ago
|
theme: "Theme"
|
||
13 years ago
|
};
|
||
|
|
||
|
//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);
|
||
13 years ago
|
$("#wgt_help").text(sankoreLang.help);
|
||
|
$("#help").html(sankoreLang.help_content);
|
||
12 years ago
|
$("#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)
|
||
13 years ago
|
|
||
|
if(window.sankore){
|
||
12 years ago
|
if(sankore.preference("ord_let","")){
|
||
|
var data = jQuery.parseJSON(sankore.preference("ord_let",""));
|
||
13 years ago
|
importData(data);
|
||
|
}
|
||
|
else
|
||
|
showExample();
|
||
|
if(sankore.preference("ord_let_style","")){
|
||
|
changeStyle(sankore.preference("ord_let_style",""));
|
||
12 years ago
|
$("#style_select").val(sankore.preference("ord_let_style",""));
|
||
13 years ago
|
} else
|
||
13 years ago
|
changeStyle("3")
|
||
13 years ago
|
}
|
||
|
else
|
||
|
showExample();
|
||
|
//events
|
||
|
if (window.widget) {
|
||
|
window.widget.onleave = function(){
|
||
|
exportData();
|
||
12 years ago
|
sankore.setPreference("ord_let_style", $("#style_select").find("option:selected").val());
|
||
13 years ago
|
}
|
||
|
}
|
||
|
|
||
13 years ago
|
$("#wgt_help").click(function(){
|
||
|
var tmp = $(this);
|
||
|
if($(this).hasClass("open")){
|
||
12 years ago
|
$(this).removeClass("help_pad").removeClass("help_wood")
|
||
13 years ago
|
$("#help").slideUp("100", function(){
|
||
|
tmp.removeClass("open");
|
||
|
$("#data").show();
|
||
|
});
|
||
12 years ago
|
} else {
|
||
|
($("#style_select").val() == 1)?$(this).removeClass("help_pad").addClass("help_wood"):$(this).removeClass("help_wood").addClass("help_pad");
|
||
13 years ago
|
$("#data").hide();
|
||
|
$("#help").slideDown("100", function(){
|
||
|
tmp.addClass("open");
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
13 years ago
|
$("#wgt_reload").click(function(){
|
||
|
if($("#wgt_display").hasClass("selected")){
|
||
12 years ago
|
setTimeout('$("#wgt_display").trigger("click")', 10)
|
||
|
$("#wgt_edit").trigger("click");
|
||
13 years ago
|
} else {
|
||
|
$("#wgt_display").trigger("click");
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$("#wgt_reload, #wgt_display, #wgt_edit").mouseover(function(){
|
||
|
exportData();
|
||
|
});
|
||
|
|
||
12 years ago
|
$("#style_select").change(function (event){
|
||
13 years ago
|
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");
|
||
12 years ago
|
$("#parameters").css("display","none");
|
||
13 years ago
|
$(".add_block").remove();
|
||
|
$(".cont").each(function(){
|
||
|
var container = $(this);
|
||
|
var tmp_array = [];
|
||
12 years ago
|
var ans_container = container.find(".audio_answer");
|
||
13 years ago
|
|
||
|
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();
|
||
12 years ago
|
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"));
|
||
13 years ago
|
for(var j in answer){
|
||
12 years ago
|
var tmp_letter = $("<li class='ui-state-default'>" + answer[j] + "</li>");
|
||
13 years ago
|
tmp_array.push(tmp_letter);
|
||
|
}
|
||
|
tmp_array = shuffle(tmp_array);
|
||
|
for(var i = 0; i<tmp_array.length;i++)
|
||
12 years ago
|
tmp_array[i].appendTo(ul_cont);
|
||
|
ul_cont.sortable({revert: true, placeholder: "highlight", update: checkResult});
|
||
13 years ago
|
});
|
||
|
$(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");
|
||
12 years ago
|
$("#parameters").css("display","block");
|
||
13 years ago
|
$(".cont").each(function(){
|
||
|
var container = $(this);
|
||
|
$("<div class='close_cont'>").appendTo(container);
|
||
12 years ago
|
container.find("#sortable").removeClass("imgs_answers_red")
|
||
13 years ago
|
.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;")
|
||
12 years ago
|
.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();
|
||
13 years ago
|
});
|
||
|
$("<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");
|
||
12 years ago
|
cont_obj.answer = $(this).find("ul").next().val();
|
||
|
cont_obj.cur_answer = getAnswer($(this).find("ul"));
|
||
13 years ago
|
array_to_export.push(cont_obj);
|
||
|
});
|
||
|
}
|
||
12 years ago
|
if(window.sankore){
|
||
|
sankore.setPreference("ord_let", JSON.stringify(array_to_export));
|
||
|
sankore.setPreference("ord_let_locale", "en");
|
||
|
}
|
||
13 years ago
|
if($("#wgt_display").hasClass("selected")){
|
||
|
if(window.sankore)
|
||
12 years ago
|
sankore.setPreference("ord_let_state", "display");
|
||
13 years ago
|
}
|
||
|
else{
|
||
|
if(window.sankore)
|
||
12 years ago
|
sankore.setPreference("ord_let_state", "edit");
|
||
13 years ago
|
}
|
||
13 years ago
|
}
|
||
|
|
||
|
//import
|
||
|
function importData(data){
|
||
|
|
||
|
var tmp = 0;
|
||
|
for(var i in data){
|
||
|
var tmp_array = [];
|
||
|
var container = $("<div class='cont'>").appendTo("#data");
|
||
|
var sub_container = $("<div class='sub_cont'>").appendTo(container);
|
||
12 years ago
|
var imgs_container = $("<ul id='sortable' class='imgs_answers_gray'>").appendTo(container);
|
||
13 years ago
|
|
||
|
$("<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);
|
||
12 years ago
|
$("<input type='hidden' value='" + data[i].answer + "'/>").appendTo(container);
|
||
13 years ago
|
|
||
|
if(data[i].cur_answer)
|
||
|
for(var j in data[i].cur_answer){
|
||
12 years ago
|
var tmp_letter = $("<li class='ui-state-default'>" + data[i].cur_answer[j] + "</li>");
|
||
13 years ago
|
tmp_array.push(tmp_letter);
|
||
|
}
|
||
|
else
|
||
|
for(j in data[i].answer){
|
||
12 years ago
|
tmp_letter = $("<li class='ui-state-default'>" + data[i].answer[j] + "</li>");
|
||
13 years ago
|
tmp_array.push(tmp_letter);
|
||
|
}
|
||
|
|
||
12 years ago
|
if(sankore.preference("ord_let_state","")){
|
||
|
if(sankore.preference("ord_let_state","") == "edit")
|
||
13 years ago
|
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);
|
||
|
|
||
12 years ago
|
imgs_container.sortable({revert: true, placeholder: "highlight"}).bind('sortupdate', function(event, ui) {
|
||
13 years ago
|
checkResult(event);
|
||
|
});
|
||
|
if(data[i].cur_answer)
|
||
|
imgs_container.trigger("sortupdate")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//example
|
||
|
function showExample(){
|
||
|
|
||
12 years ago
|
var tmp_array = [];
|
||
13 years ago
|
var container = $("<div class='cont'>").appendTo("#data");
|
||
|
var sub_container = $("<div class='sub_cont'>").appendTo(container);
|
||
12 years ago
|
var imgs_container = $("<ul id='sortable' class='imgs_answers_gray'>").appendTo(container);
|
||
13 years ago
|
|
||
|
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);
|
||
13 years ago
|
var source = $("<source/>").attr("src", "objects/beep.mp3");
|
||
13 years ago
|
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);
|
||
|
|
||
12 years ago
|
$("<input type='hidden' value='" + sankoreLang.example + "'/>").appendTo(container);
|
||
13 years ago
|
|
||
|
for(var j in sankoreLang.example){
|
||
12 years ago
|
var tmp_letter = $("<li class='ui-state-default'>" + sankoreLang.example[j] + "</li>");
|
||
13 years ago
|
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);
|
||
12 years ago
|
imgs_container.sortable({revert: true, placeholder: "highlight"}).bind('sortupdate', function(event, ui) {
|
||
13 years ago
|
checkResult(event);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
//add new container
|
||
|
function addContainer(){
|
||
|
var container = $("<div class='cont'>");
|
||
|
var sub_container = $("<div class='sub_cont'>").appendTo(container);
|
||
12 years ago
|
|
||
|
$("<div class='number_cont'>"+ ($(".cont").size() + 1) +"</div>").appendTo(sub_container);
|
||
12 years ago
|
var text = $("<div class='text_cont'>").appendTo(sub_container);
|
||
13 years ago
|
var audio_block = $("<div class='audio_block'>").appendTo(text);
|
||
12 years ago
|
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);");
|
||
13 years ago
|
$("<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);
|
||
12 years ago
|
$("<div class='audio_desc' contenteditable>" + sankoreLang.enter + "</div>").appendTo(text);
|
||
13 years ago
|
|
||
12 years ago
|
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);
|
||
13 years ago
|
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 = "";
|
||
12 years ago
|
var right_str = $(event.target).next().val();
|
||
|
$(event.target).find("li.ui-state-default").each(function(){
|
||
13 years ago
|
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")
|
||
13 years ago
|
.removeClass("imgs_answers_green");
|
||
13 years ago
|
}
|
||
|
|
||
|
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){
|
||
13 years ago
|
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");
|
||
13 years ago
|
$("#wgt_help").removeClass("pad_color").removeClass("pad_help");
|
||
13 years ago
|
$("#wgt_edit").removeClass("pad_color").removeClass("pad_edit");
|
||
|
$("#wgt_name").removeClass("pad_color");
|
||
12 years ago
|
$("#wgt_display").addClass("display_wood");
|
||
|
$("#style_select").val(val);
|
||
|
$("body, html").removeClass("without_radius").addClass("radius_ft");
|
||
13 years ago
|
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");
|
||
13 years ago
|
$("#wgt_help").addClass("pad_color").addClass("pad_help");
|
||
13 years ago
|
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
|
||
|
$("#wgt_name").addClass("pad_color");
|
||
12 years ago
|
$("#wgt_display").removeClass("display_wood");
|
||
|
$("#style_select").val(val);
|
||
|
$("body, html").removeClass("without_radius").removeClass("radius_ft");
|
||
13 years ago
|
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");
|
||
13 years ago
|
$("#wgt_help").addClass("pad_color").addClass("pad_help");
|
||
13 years ago
|
$("#wgt_reload").addClass("pad_color").addClass("pad_reload");
|
||
|
$("#wgt_edit").addClass("pad_color").addClass("pad_edit");
|
||
|
$("#wgt_name").addClass("pad_color");
|
||
12 years ago
|
$("#wgt_display").removeClass("display_wood");
|
||
|
$("#style_select").val(val);
|
||
|
$("body, html").addClass("without_radius").removeClass("radius_ft");
|
||
13 years ago
|
break;
|
||
13 years ago
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
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();
|
||
12 years ago
|
$(obj).find(":first-child").removeClass("stop").addClass("play");
|
||
13 years ago
|
var source = $("<source/>").attr("src", tmp);
|
||
12 years ago
|
var audio = $("<audio>").appendTo($(obj));
|
||
|
audio.append(source);
|
||
13 years ago
|
}
|
||
|
}
|
||
|
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 = "";
|
||
12 years ago
|
obj.find("li.ui-state-default").each(function(){
|
||
13 years ago
|
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");
|
||
|
});
|
||
|
}
|
||
|
}
|