@ -35,12 +35,21 @@ function start(){
//events
if ( window . widget ) {
window . widget . onleave = function ( ) {
//exportData();
exportData ( ) ;
}
}
$ ( "#wgt_reload" ) . click ( function ( ) {
window . location . reload ( ) ;
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 ) {
@ -205,6 +214,10 @@ function exportData(){
array _to _export . push ( cont _obj ) ;
}
sankore . setPreference ( "odr_des_imgs" , JSON . stringify ( array _to _export ) ) ;
if ( $ ( "#wgt_display" ) . hasClass ( "selected" ) )
sankore . setPreference ( "odr_des_imgs_state" , "display" ) ;
else
sankore . setPreference ( "odr_des_imgs_state" , "edit" ) ;
}
//import
@ -240,13 +253,19 @@ function importData(data){
img _block . append ( hidden _input ) . append ( img ) ;
tmp _array . push ( img _block ) ;
}
tmp _array = shuffle ( tmp _array ) ;
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 ( {
update : checkResult
} ) ;
imgs _container . sortable ( ) . bind ( 'sortupdate' , function ( event , ui ) {
checkResult ( event ) ;
} ) ;
container . appendTo ( "#data" ) ;
imgs _container . trigger ( "sortupdate" )
}
}
}
@ -286,9 +305,9 @@ function showExample(){
tmp _array = shuffle ( tmp _array ) ;
for ( var i = 0 ; i < tmp _array . length ; i ++ )
tmp _array [ i ] . appendTo ( imgs _container ) ;
imgs _container . sortable ( {
update : checkResult
} ) ;
imgs _container . sortable ( ) . bind ( 'sortupdate' , function ( event , ui ) {
checkResult ( event ) ;
} ) ;
container . appendTo ( "#data" ) ;
}
@ -467,4 +486,3 @@ function onDropTarget(obj, event) {
}
return false ;
}