@ -31,8 +31,8 @@ function start(){
$ ( "div.inline label" ) . html ( sankoreLang . theme + tmpl )
if ( window . sankore ) {
if ( sankore . preference ( "associer_sound " , "" ) ) {
var data = jQuery . parseJSON ( sankore . preference ( "associer_sound " , "" ) ) ;
if ( sankore . preference ( "ord_let " , "" ) ) {
var data = jQuery . parseJSON ( sankore . preference ( "ord_let " , "" ) ) ;
importData ( data ) ;
}
else
@ -252,7 +252,7 @@ function exportData(){
$ ( ".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 . audio = $ ( this ) . find ( "source" ) . attr ( "src" ) ;
cont _obj . answer = $ ( this ) . find ( ".audio_answer" ) . text ( ) ;
cont _obj . cur _answer = "" ;
array _to _export . push ( cont _obj ) ;
@ -261,22 +261,23 @@ function exportData(){
$ ( ".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 . 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 ( "associer_sound" , JSON . stringify ( array _to _export ) ) ;
sankore . setPreference ( "ord_let" , JSON . stringify ( array _to _export ) ) ;
sankore . setPreference ( "ord_let_locale" , sankore . locale ( ) . substr ( 0 , 2 ) ) ;
if ( $ ( "#wgt_display" ) . hasClass ( "selected" ) )
sankore . setPreference ( "associer_sound _state" , "display" ) ;
sankore . setPreference ( "ord_let _state" , "display" ) ;
else
sankore . setPreference ( "associer_sound _state" , "edit" ) ;
sankore . setPreference ( "ord_let _state" , "edit" ) ;
}
//import
function importData ( data ) {
var tmp _loc = sankore . preference ( "ord_let_locale" , "" )
var tmp = 0 ;
for ( var i in data ) {
var tmp _array = [ ] ;
@ -289,7 +290,7 @@ function importData(data){
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 source = $ ( "<source/>" ) . attr ( "src" , ( ( tmp _loc != "en" ) ? "" : "../../" ) + data [ i ] . audio ) ;
var audio = $ ( "<audio>" ) . appendTo ( audio _block ) ;
audio . append ( source ) ;
$ ( "<input type='hidden'/>" ) . appendTo ( audio _block ) ;
@ -306,8 +307,8 @@ function importData(data){
tmp _array . push ( tmp _letter ) ;
}
if ( sankore . preference ( "associer_sound _state" , "" ) ) {
if ( sankore . preference ( "associer_sound _state" , "" ) == "edit" )
if ( sankore . preference ( "ord_let _state" , "" ) ) {
if ( sankore . preference ( "ord_let _state" , "" ) == "edit" )
tmp _array = shuffle ( tmp _array ) ;
} else
tmp _array = shuffle ( tmp _array ) ;
@ -339,7 +340,7 @@ function showExample(){
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/exe mple.mp3" ) ;
var source = $ ( "<source/>" ) . attr ( "src" , "objects/exa mple.mp3" ) ;
var audio = $ ( "<audio>" ) . appendTo ( audio _block ) ;
audio . append ( source ) ;
$ ( "<input type='hidden'/>" ) . appendTo ( audio _block ) ;
@ -370,11 +371,11 @@ function addContainer(){
$ ( "<div class='number_cont'>" + ( $ ( ".cont" ) . size ( ) + 1 ) + "</div>" ) . appendTo ( sub _container ) ;
var text = $ ( "<div class='text_cont'>" ) . appendTo ( sub _container ) ;
text . attr ( "ondragenter" , "return false;" )
. attr ( "ondragleave" , "$(this).removeClass('gray'); return false;" )
. attr ( "ondragover" , "$(this).addClass('gray'); return false;" )
. attr ( "ondrop" , "$(this).removeClass('gray'); return onDropAudio(this,event);" ) ;
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" , "" ) ;
@ -507,13 +508,12 @@ function onDropAudio(obj, event) {
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 ) . find ( ".audio_block" ) ;
if ( tmp _type . substr ( 0 , 5 ) == "audio" ) {
$ ( obj ) . find ( "audio" ) . remove ( ) ;
audio _block . find ( ":first-child" ) . removeClass ( "stop" ) . addClass ( "play" ) ;
$ ( obj ) . find ( ":first-child" ) . removeClass ( "stop" ) . addClass ( "play" ) ;
var source = $ ( "<source/>" ) . attr ( "src" , "../../" + tmp ) ;
var audio = $ ( "<audio>" ) . appendTo ( audio _block ) ;
audio . append ( source ) ;
var audio = $ ( "<audio>" ) . appendTo ( $ ( obj ) ) ;
audio . append ( source ) ;
}
}
else {