@ -1,5 +1,5 @@
var sankoreLang = {
var sankoreLang = {
display : "Показа ть" ,
display : "Закры ть" ,
edit : "Изменить" ,
edit : "Изменить" ,
text _content : "Это - пример. Вместо этого текста вы можете ввести свой собственный контент." ,
text _content : "Это - пример. Вместо этого текста вы можете ввести свой собственный контент." ,
new _txt : "Новый текстовый блок." ,
new _txt : "Новый текстовый блок." ,
@ -9,7 +9,8 @@ var sankoreLang = {
pad : "Планшет" ,
pad : "Планшет" ,
none : "Нет" ,
none : "Нет" ,
help : "Помощь" ,
help : "Помощь" ,
help _content : "Пример текста помощи ..."
help _content : "Пример текста помощи ..." ,
theme : "Тема"
} ;
} ;
//some flags
//some flags
@ -31,9 +32,11 @@ function start(){
$ ( "#wgt_name" ) . text ( sankoreLang . wgt _name ) ;
$ ( "#wgt_name" ) . text ( sankoreLang . wgt _name ) ;
$ ( "#wgt_help" ) . text ( sankoreLang . help ) ;
$ ( "#wgt_help" ) . text ( sankoreLang . help ) ;
$ ( "#help" ) . html ( sankoreLang . help _content ) ;
$ ( "#help" ) . html ( sankoreLang . help _content ) ;
$ ( ".style_select option[value='1']" ) . text ( sankoreLang . slate ) ;
$ ( "#style_select option[value='1']" ) . text ( sankoreLang . slate ) ;
$ ( ".style_select option[value='2']" ) . text ( sankoreLang . pad ) ;
$ ( "#style_select option[value='2']" ) . text ( sankoreLang . pad ) ;
$ ( ".style_select option[value='3']" ) . text ( sankoreLang . none ) ;
$ ( "#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 ( window . sankore ) {
if ( sankore . preference ( "etudier" , "" ) ) {
if ( sankore . preference ( "etudier" , "" ) ) {
@ -44,7 +47,7 @@ function start(){
showExample ( ) ;
showExample ( ) ;
if ( sankore . preference ( "etudier_style" , "" ) ) {
if ( sankore . preference ( "etudier_style" , "" ) ) {
changeStyle ( sankore . preference ( "etudier_style" , "" ) ) ;
changeStyle ( sankore . preference ( "etudier_style" , "" ) ) ;
$ ( ". style_select" ) . val ( sankore . preference ( "etudier_style" , "" ) ) ;
$ ( "# style_select" ) . val ( sankore . preference ( "etudier_style" , "" ) ) ;
} else
} else
changeStyle ( "3" )
changeStyle ( "3" )
}
}
@ -56,7 +59,7 @@ function start(){
window . widget . onleave = function ( ) {
window . widget . onleave = function ( ) {
if ( ! $ ( "#wgt_help" ) . hasClass ( "open" ) ) {
if ( ! $ ( "#wgt_help" ) . hasClass ( "open" ) ) {
exportData ( ) ;
exportData ( ) ;
sankore . setPreference ( "etudier_style" , $ ( ". style_select" ) . find ( "option:selected" ) . val ( ) ) ;
sankore . setPreference ( "etudier_style" , $ ( "# style_select" ) . find ( "option:selected" ) . val ( ) ) ;
sankore . setPreference ( "etudier_cur_page" , $ ( "#slider" ) . getPage ( ) ) ;
sankore . setPreference ( "etudier_cur_page" , $ ( "#slider" ) . getPage ( ) ) ;
sankore . setPreference ( "etudier_left_nav" , $ ( "#prevBtn a" ) . css ( "display" ) ) ;
sankore . setPreference ( "etudier_left_nav" , $ ( "#prevBtn a" ) . css ( "display" ) ) ;
sankore . setPreference ( "etudier_right_nav" , $ ( "#nextBtn a" ) . css ( "display" ) ) ;
sankore . setPreference ( "etudier_right_nav" , $ ( "#nextBtn a" ) . css ( "display" ) ) ;
@ -64,19 +67,21 @@ function start(){
}
}
}
}
$ ( ". style_select" ) . change ( function ( event ) {
$ ( "# style_select" ) . change ( function ( event ) {
changeStyle ( $ ( this ) . find ( "option:selected" ) . val ( ) ) ;
changeStyle ( $ ( this ) . find ( "option:selected" ) . val ( ) ) ;
} )
} )
$ ( "#wgt_help" ) . click ( function ( ) {
$ ( "#wgt_help" ) . click ( function ( ) {
var tmp = $ ( this ) ;
var tmp = $ ( this ) ;
if ( $ ( this ) . hasClass ( "open" ) ) {
if ( $ ( this ) . hasClass ( "open" ) ) {
$ ( this ) . removeClass ( "help_pad" ) . removeClass ( "help_wood" )
$ ( "#help" ) . hide ( ) ;
$ ( "#help" ) . hide ( ) ;
tmp . removeClass ( "open" ) ;
tmp . removeClass ( "open" ) ;
$ ( "#slider" ) . show ( ) ;
$ ( "#slider" ) . show ( ) ;
} else {
} else {
( $ ( "#style_select" ) . val ( ) == 1 ) ? $ ( this ) . removeClass ( "help_pad" ) . addClass ( "help_wood" ) : $ ( this ) . removeClass ( "help_wood" ) . addClass ( "help_pad" ) ;
exportData ( ) ;
exportData ( ) ;
sankore . setPreference ( "etudier_style" , $ ( ". style_select" ) . find ( "option:selected" ) . val ( ) ) ;
sankore . setPreference ( "etudier_style" , $ ( "# style_select" ) . find ( "option:selected" ) . val ( ) ) ;
sankore . setPreference ( "etudier_cur_page" , $ ( "#slider" ) . getPage ( ) ) ;
sankore . setPreference ( "etudier_cur_page" , $ ( "#slider" ) . getPage ( ) ) ;
sankore . setPreference ( "etudier_left_nav" , $ ( "#prevBtn a" ) . css ( "display" ) ) ;
sankore . setPreference ( "etudier_left_nav" , $ ( "#prevBtn a" ) . css ( "display" ) ) ;
sankore . setPreference ( "etudier_right_nav" , $ ( "#nextBtn a" ) . css ( "display" ) ) ;
sankore . setPreference ( "etudier_right_nav" , $ ( "#nextBtn a" ) . css ( "display" ) ) ;
@ -93,7 +98,10 @@ function start(){
sankore . enableDropOnWidget ( false ) ;
sankore . enableDropOnWidget ( false ) ;
$ ( this ) . addClass ( "selected" ) ;
$ ( this ) . addClass ( "selected" ) ;
$ ( "#wgt_edit" ) . removeClass ( "selected" ) ;
$ ( "#wgt_edit" ) . removeClass ( "selected" ) ;
$ ( ".style_select" ) . css ( "display" , "none" ) ;
$ ( "#parameters" ) . css ( "display" , "none" ) ;
var tmpwh = $ ( window ) . height ( ) ;
var tmpww = $ ( window ) . width ( ) ;
window . resizeTo ( tmpww , tmpwh - 44 )
$ ( "#slider li>div" ) . each ( function ( ) {
$ ( "#slider li>div" ) . each ( function ( ) {
var container = $ ( this ) ;
var container = $ ( this ) ;
@ -109,7 +117,8 @@ function start(){
$ ( this ) . find ( ".size_up" ) . remove ( ) ;
$ ( this ) . find ( ".size_up" ) . remove ( ) ;
$ ( this ) . find ( ".size_down" ) . remove ( ) ;
$ ( this ) . find ( ".size_down" ) . remove ( ) ;
$ ( this ) . find ( ".resize_block" ) . remove ( ) ;
$ ( this ) . find ( ".resize_block" ) . remove ( ) ;
$ ( this ) . removeAttr ( "contenteditable" ) . removeClass ( "block_border" ) ;
$ ( this ) . find ( ".real_text" ) . removeAttr ( "contenteditable" ) ;
$ ( this ) . removeClass ( "block_border" ) ;
$ ( this ) . css ( "position" , "absolute" ) ;
$ ( this ) . css ( "position" , "absolute" ) ;
} ) ;
} ) ;
@ -142,7 +151,10 @@ function start(){
sankore . enableDropOnWidget ( true ) ;
sankore . enableDropOnWidget ( true ) ;
$ ( this ) . addClass ( "selected" ) ;
$ ( this ) . addClass ( "selected" ) ;
$ ( "#wgt_display" ) . removeClass ( "selected" ) ;
$ ( "#wgt_display" ) . removeClass ( "selected" ) ;
$ ( ".style_select" ) . css ( "display" , "block" ) ;
$ ( "#parameters" ) . css ( "display" , "block" ) ;
tmpwh = $ ( window ) . height ( ) ;
tmpww = $ ( window ) . width ( ) ;
window . resizeTo ( tmpww , tmpwh + 44 )
$ ( "#slider li>div" ) . each ( function ( ) {
$ ( "#slider li>div" ) . each ( function ( ) {
var container = $ ( this ) ;
var container = $ ( this ) ;
@ -158,7 +170,8 @@ function start(){
$ ( "<div class='size_up' contenteditable='false'>" ) . appendTo ( $ ( this ) ) ;
$ ( "<div class='size_up' contenteditable='false'>" ) . appendTo ( $ ( this ) ) ;
$ ( "<div class='size_down' contenteditable='false'>" ) . appendTo ( $ ( this ) ) ;
$ ( "<div class='size_down' contenteditable='false'>" ) . appendTo ( $ ( this ) ) ;
$ ( "<div class='resize_block' contenteditable='false'>" ) . appendTo ( $ ( this ) ) ;
$ ( "<div class='resize_block' contenteditable='false'>" ) . appendTo ( $ ( this ) ) ;
$ ( this ) . attr ( "contenteditable" , "true" ) . addClass ( "block_border" ) ;
$ ( this ) . find ( ".real_text" ) . attr ( "contenteditable" , "true" ) ;
$ ( this ) . addClass ( "block_border" ) ;
} ) ;
} ) ;
container . find ( ".img_block" ) . each ( function ( ) {
container . find ( ".img_block" ) . each ( function ( ) {
@ -292,7 +305,7 @@ function start(){
//var height = resize_obj.object.parent().height() - resize_obj.top + event.clientY;
//var height = resize_obj.object.parent().height() - resize_obj.top + event.clientY;
resize _obj . left = event . clientX ;
resize _obj . left = event . clientX ;
resize _obj . top = event . clientY ;
resize _obj . top = event . clientY ;
resize _obj . object . parent ( ) . width ( width ) . height ( "" ) ;
resize _obj . object . parent ( ) . width ( width ) ;
} else {
} else {
width = resize _obj . object . parent ( ) . width ( ) - resize _obj . left + event . clientX ;
width = resize _obj . object . parent ( ) . width ( ) - resize _obj . left + event . clientX ;
var height = resize _obj . object . parent ( ) . height ( ) - resize _obj . top + event . clientY ;
var height = resize _obj . object . parent ( ) . height ( ) - resize _obj . top + event . clientY ;
@ -367,13 +380,13 @@ function start(){
$ ( ".add_text" ) . live ( "click" , function ( ) {
$ ( ".add_text" ) . live ( "click" , function ( ) {
var container = $ ( this ) . parent ( ) ;
var container = $ ( this ) . parent ( ) ;
var text _block = $ ( "<div class='text_block'>" + sankoreLang . new _txt + " </div>") . appendTo ( container ) ;
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='move_block' contenteditable='false'>" ) . appendTo ( text _block ) ;
$ ( "<div class='close_img' 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_up' contenteditable='false'>" ) . appendTo ( text _block ) ;
$ ( "<div class='size_down' contenteditable='false'>" ) . appendTo ( text _block ) ;
$ ( "<div class='size_down' contenteditable='false'>" ) . appendTo ( text _block ) ;
$ ( "<div class='resize_block' contenteditable='false'>" ) . appendTo ( text _block ) ;
$ ( "<div class='resize_block' contenteditable='false'>" ) . appendTo ( text _block ) ;
text _block . attr ( "contenteditable" , "true" ) . a ddClass ( "block_border" ) ;
text _block . addClass ( "block_border" ) ;
} ) ;
} ) ;
}
}
@ -391,7 +404,7 @@ function exportData(){
txt _block . left = $ ( this ) . position ( ) . left ;
txt _block . left = $ ( this ) . position ( ) . left ;
txt _block . w = $ ( this ) . width ( ) ;
txt _block . w = $ ( this ) . width ( ) ;
txt _block . fz = $ ( this ) . css ( "font-size" ) ;
txt _block . fz = $ ( this ) . css ( "font-size" ) ;
txt _block . val = $ ( this ) . text ( ) ;
txt _block . val = $ ( this ) . find ( ".real_ text" ) . html ( ) ;
cont _obj . text . push ( txt _block ) ;
cont _obj . text . push ( txt _block ) ;
} ) ;
} ) ;
cont _obj . imgs = [ ] ;
cont _obj . imgs = [ ] ;
@ -433,7 +446,7 @@ function importData(data){
var div = $ ( "<div>" ) . appendTo ( li ) ;
var div = $ ( "<div>" ) . appendTo ( li ) ;
for ( var j in data [ i ] . text ) {
for ( var j in data [ i ] . text ) {
var text _div = $ ( "<div class='text_block'>" + data [ i ] . text [ j ] . val + " </div>") ;
var text _div = $ ( "<div class='text_block'><div class='real_text'>" + data [ i ] . text [ j ] . val + "</div> </div>") ;
text _div . draggable ( ) . css ( "position" , "absolute" )
text _div . draggable ( ) . css ( "position" , "absolute" )
. width ( data [ i ] . text [ j ] . w )
. width ( data [ i ] . text [ j ] . w )
. css ( "top" , data [ i ] . text [ j ] . top )
. css ( "top" , data [ i ] . text [ j ] . top )
@ -486,7 +499,7 @@ function showExample(){
var li1 = $ ( "<li>" ) ;
var li1 = $ ( "<li>" ) ;
var div1 = $ ( "<div>" ) . appendTo ( li1 ) ;
var div1 = $ ( "<div>" ) . appendTo ( li1 ) ;
$ ( "<div class='text_block'>" + sankoreLang . text _content + " </div>") . draggable ( ) . appendTo ( div1 )
$ ( "<div class='text_block'><div class='real_text'>" + sankoreLang . text _content + "</div> </div>") . draggable ( ) . appendTo ( div1 )
li1 . width ( $ ( "#slider" ) . width ( ) ) . height ( $ ( "#slider" ) . height ( ) ) ;
li1 . width ( $ ( "#slider" ) . width ( ) ) . height ( $ ( "#slider" ) . height ( ) ) ;
$ ( "#slider ul" ) . append ( li1 ) ;
$ ( "#slider ul" ) . append ( li1 ) ;
var li2 = $ ( "<li>" ) ;
var li2 = $ ( "<li>" ) ;
@ -507,7 +520,7 @@ function showExample(){
$ ( "#slider ul" ) . append ( li3 ) ;
$ ( "#slider ul" ) . append ( li3 ) ;
var li4 = $ ( "<li>" ) ;
var li4 = $ ( "<li>" ) ;
var div4 = $ ( "<div>" ) . appendTo ( li4 ) ;
var div4 = $ ( "<div>" ) . appendTo ( li4 ) ;
$ ( "<div class='text_block'>" + sankoreLang . text _content + " </div>") . draggable ( ) . appendTo ( div4 ) ;
$ ( "<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 ) ;
var img2 = $ ( "<div class='img_block' style='text-align: center;'></div>" ) . draggable ( ) . appendTo ( div4 ) ;
$ ( "<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>" ) . appendTo ( img2 ) ;
$ ( "<img src=\"../../objects/1.gif\" style=\"display: inline;\" height=\"120\"/>" ) . appendTo ( img2 ) ;
var audio _block2 = $ ( "<div class='audio_block'>" ) . draggable ( ) . appendTo ( div4 ) ;
var audio _block2 = $ ( "<div class='audio_block'>" ) . draggable ( ) . appendTo ( div4 ) ;
@ -555,10 +568,10 @@ function changeStyle(val){
$ ( ".b_bottom_center" ) . removeClass ( "bbc_pad" ) . removeClass ( "without_back" ) ;
$ ( ".b_bottom_center" ) . removeClass ( "bbc_pad" ) . removeClass ( "without_back" ) ;
$ ( "#wgt_help" ) . removeClass ( "pad_color" ) . removeClass ( "pad_help" ) ;
$ ( "#wgt_help" ) . removeClass ( "pad_color" ) . removeClass ( "pad_help" ) ;
$ ( "#wgt_edit" ) . removeClass ( "pad_color" ) . removeClass ( "pad_edit" ) ;
$ ( "#wgt_edit" ) . removeClass ( "pad_color" ) . removeClass ( "pad_edit" ) ;
$ ( "#wgt_display" ) . removeClass ( "pad_color" ) . removeClass ( "pad_edit" ) ;
$ ( "#wgt_name" ) . removeClass ( "pad_color" ) ;
$ ( "#wgt_name" ) . removeClass ( "pad_color" ) ;
$ ( ".style_select" ) . removeClass ( "pad_select" ) . removeClass ( "none_select" ) . val ( val ) ;
$ ( "#wgt_display" ) . addClass ( "display_wood" ) ;
$ ( "body, html" ) . removeClass ( "without_radius" ) ;
$ ( "#style_select" ) . val ( val ) ;
$ ( "body, html" ) . removeClass ( "without_radius" ) . addClass ( "radius_ft" ) ;
break ;
break ;
case "2" :
case "2" :
$ ( ".b_top_left" ) . addClass ( "btl_pad" ) . removeClass ( "without_back" ) ;
$ ( ".b_top_left" ) . addClass ( "btl_pad" ) . removeClass ( "without_back" ) ;
@ -571,10 +584,10 @@ function changeStyle(val){
$ ( ".b_bottom_center" ) . addClass ( "bbc_pad" ) . removeClass ( "without_back" ) ;
$ ( ".b_bottom_center" ) . addClass ( "bbc_pad" ) . removeClass ( "without_back" ) ;
$ ( "#wgt_help" ) . addClass ( "pad_color" ) . addClass ( "pad_help" ) ;
$ ( "#wgt_help" ) . addClass ( "pad_color" ) . addClass ( "pad_help" ) ;
$ ( "#wgt_edit" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_edit" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_display" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_name" ) . addClass ( "pad_color" ) ;
$ ( "#wgt_name" ) . addClass ( "pad_color" ) ;
$ ( ".style_select" ) . addClass ( "pad_select" ) . removeClass ( "none_select" ) . val ( val ) ;
$ ( "#wgt_display" ) . removeClass ( "display_wood" ) ;
$ ( "body, html" ) . removeClass ( "without_radius" ) ;
$ ( "#style_select" ) . val ( val ) ;
$ ( "body, html" ) . removeClass ( "without_radius" ) . removeClass ( "radius_ft" ) ;
break ;
break ;
case "3" :
case "3" :
$ ( ".b_top_left" ) . addClass ( "without_back" ) . removeClass ( "btl_pad" ) ;
$ ( ".b_top_left" ) . addClass ( "without_back" ) . removeClass ( "btl_pad" ) ;
@ -587,10 +600,10 @@ function changeStyle(val){
$ ( ".b_bottom_center" ) . addClass ( "without_back" ) . removeClass ( "bbc_pad" ) ;
$ ( ".b_bottom_center" ) . addClass ( "without_back" ) . removeClass ( "bbc_pad" ) ;
$ ( "#wgt_help" ) . addClass ( "pad_color" ) . addClass ( "pad_help" ) ;
$ ( "#wgt_help" ) . addClass ( "pad_color" ) . addClass ( "pad_help" ) ;
$ ( "#wgt_edit" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_edit" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_display" ) . addClass ( "pad_color" ) . addClass ( "pad_edit" ) ;
$ ( "#wgt_name" ) . addClass ( "pad_color" ) ;
$ ( "#wgt_name" ) . addClass ( "pad_color" ) ;
$ ( ".style_select" ) . addClass ( "none_select" ) . val ( val ) ;
$ ( "#wgt_display" ) . removeClass ( "display_wood" ) ;
$ ( "body, html" ) . addClass ( "without_radius" ) ;
$ ( "#style_select" ) . val ( val ) ;
$ ( "body, html" ) . addClass ( "without_radius" ) . removeClass ( "radius_ft" ) ;
break ;
break ;
}
}
}
}
@ -663,4 +676,4 @@ $(window).resize(function(){
$ ( this ) . width ( slider . width ( ) ) . height ( slider . height ( ) ) ;
$ ( this ) . width ( slider . width ( ) ) . height ( slider . height ( ) ) ;
} ) ;
} ) ;
slider . setSize ( slider . width ( ) , slider . height ( ) ) ;
slider . setSize ( slider . width ( ) , slider . height ( ) ) ;
} )
} )