@ -9,7 +9,9 @@ var sankoreLang = {
reload : "Recharger" ,
slate : "ardoise" ,
pad : "tablette" ,
none : "aucun"
none : "aucun" ,
help : "aide" ,
help _content : "Ceci est un exemple de contenu de l'aide ..."
} ;
//main function
@ -19,6 +21,8 @@ function start(){
$ ( "#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 ) ;
@ -40,6 +44,21 @@ function start(){
}
}
$ ( "#wgt_help" ) . click ( function ( ) {
var tmp = $ ( this ) ;
if ( $ ( this ) . hasClass ( "open" ) ) {
$ ( "#help" ) . slideUp ( "100" , function ( ) {
tmp . removeClass ( "open" ) ;
$ ( "#data" ) . show ( ) ;
} ) ;
} else {
$ ( "#data" ) . hide ( ) ;
$ ( "#help" ) . slideDown ( "100" , function ( ) {
tmp . addClass ( "open" ) ;
} ) ;
}
} ) ;
$ ( "#wgt_reload" ) . click ( function ( ) {
if ( $ ( "#wgt_display" ) . hasClass ( "selected" ) ) {
$ ( "#wgt_edit" ) . trigger ( "click" ) ;
@ -210,7 +229,7 @@ function start(){
//export
function exportData ( ) {
var array _to _export = [ ] ;
if ( $ ( "#edit" ) . hasClass ( "selected" ) ) {
if ( $ ( "#wgt_ edit" ) . hasClass ( "selected" ) ) {
$ ( ".cont" ) . each ( function ( ) {
var cont _obj = new Object ( ) ;
cont _obj . style = $ ( ".style_select" ) . find ( "option:selected" ) . val ( ) ;
@ -226,7 +245,6 @@ function exportData(){
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 ) ;
@ -251,7 +269,6 @@ function exportData(){
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 ) ;
@ -263,7 +280,6 @@ function exportData(){
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 ) ;
@ -312,12 +328,9 @@ function importData(data){
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 ) ;
if ( data [ i ] . conts [ j ] . imgs [ k ] . ht >= data [ i ] . conts [ j ] . imgs [ k ] . wd )
img . attr ( "height" , "120" ) ;
else {
img . attr ( "width" , "120" ) ;
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 ) ;
}
@ -377,12 +390,9 @@ function importData(data){
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 ) ;
if ( data [ i ] . conts [ j ] . imgs [ k ] . ht >= data [ i ] . conts [ j ] . imgs [ k ] . wd )
img . attr ( "height" , "120" ) ;
else {
img . attr ( "width" , "120" ) ;
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 ) ;
}
@ -414,7 +424,10 @@ function importData(data){
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 src=\"../../" + data [ i ] . all _imgs [ j ] . link + "\" style=\"display: inline;\" height=\"" + data [ i ] . all _imgs [ j ] . ht + "\"/>" ) . 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 ) ;
}
@ -621,6 +634,7 @@ function changeStyle(val){
$ ( ".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_display" ) . removeClass ( "pad_color" ) . removeClass ( "pad_edit" ) ;
$ ( "#wgt_name" ) . removeClass ( "pad_color" ) ;
@ -637,6 +651,7 @@ function changeStyle(val){
$ ( ".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_display" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_name" ) . addClass ( "pad_color" ) ;
@ -652,6 +667,7 @@ function changeStyle(val){
$ ( ".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_display" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
@ -752,6 +768,8 @@ function onDropTarget(obj, event) {
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 ) ;
@ -762,6 +780,8 @@ function onDropTarget(obj, event) {
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" ) ;
}
}