From 333adf4afb5f790b1abdf7282e4d1289aa56a693 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Aug 2012 17:13:15 +0200 Subject: [PATCH] fixed Sankore-704 bug --- .../Contraste.wgt/css/basic.css | 20 +++-- .../Contraste.wgt/images/trgDown.png | Bin 0 -> 475 bytes .../Contraste.wgt/images/trgRight.png | Bin 0 -> 447 bytes .../locales/fr/scripts/blackYellow.js | 70 ++++++++++------ .../locales/ru/scripts/blackYellow.js | 70 ++++++++++------ .../Contraste.wgt/scripts/blackYellow.js | 75 ++++++++++++------ 6 files changed, 157 insertions(+), 78 deletions(-) create mode 100644 resources/library/interactivities/Contraste.wgt/images/trgDown.png create mode 100644 resources/library/interactivities/Contraste.wgt/images/trgRight.png diff --git a/resources/library/interactivities/Contraste.wgt/css/basic.css b/resources/library/interactivities/Contraste.wgt/css/basic.css index 6ca92f51..451e6ce0 100644 --- a/resources/library/interactivities/Contraste.wgt/css/basic.css +++ b/resources/library/interactivities/Contraste.wgt/css/basic.css @@ -60,6 +60,7 @@ body{ .shadowDiv{ width: 100%; + height: 100%; display: none; opacity: 0.7; background-color: black; @@ -67,7 +68,10 @@ body{ -webkit-border-radius: 3px; border-radius: 3px; border-radius: 3px; - z-index: 100; + z-index: 400; + position: absolute; + top: 0; + left: 0; } .popupBack{ @@ -126,8 +130,6 @@ body{ } .readyTask{ - margin: 2px; - padding: 2px; width: 100%; height: 100%; overflow: hidden; @@ -167,9 +169,11 @@ body{ height: 65%; cursor: e-resize; position: absolute; - background: none; + background-image: url(../images/trgRight.png); + background-position: center; + background-repeat: no-repeat; right: -10px; - top: 20%; + top: 18%; } .bottomResize{ @@ -177,9 +181,11 @@ body{ height: 10px; cursor: n-resize; position: absolute; - background: none; + background-image: url(../images/trgDown.png); + background-position: center; + background-repeat: no-repeat; bottom: -10px; - left: 20%; + left: 18%; } /*new design*/ diff --git a/resources/library/interactivities/Contraste.wgt/images/trgDown.png b/resources/library/interactivities/Contraste.wgt/images/trgDown.png new file mode 100644 index 0000000000000000000000000000000000000000..632be5fb5560dde4c9a5c76430e7878d817381b7 GIT binary patch literal 475 zcmV<10VMv3P)g(&fl=1oV=d#Yu&ZkvXRmDX`MZpSKSy>s_*w|1o z4-XH++qZ8ScJAEybnDiwrc4qN5|7*3+S1OPIm5ur%*?>T!UD%217L=L+LB44j;tU>bx41qB&)?AXEJ>gw9(?d`o2 zq=)hU|NkJG;memV+)hqT$F;Pybk)_>!D1jk@$&LA+`4s(;lzm(XMxVN;o{=@0g?mT z2m(MqeC_Y=Pd#?**iTSkaC37r02ML({ri_;`}XbMdwYA+V46@gf`GNP^~w17_y(Xt zu#@@t_!w5NUd;d$t1>e)JBO?m?o=26+Q8)H<+aDaz`zj{J=d>a-?4e~W>1hSPyk3H zI=*q^hO&l+#usgE?e}-@-j&CuhJ^tO00z$8l9G~qU{w58Qc`+|O$|VR0RRFkn+8)O RIpF{R002ovPDHLkV1k0cgTH8uZrbaeg|78dq={rZ&yn?k0aKYua^3kx%(rKK_6 zym_%3P7sHYk&yvp11l>l zgQcY_jrs=B)RU9cNLx?v^&eaz_Ur+PU7kOGeyX*#^+}ZQk(QQz>+kRXA4vbt&d#3l`SWLPtT6+0_$Q#RUjW_W phc^m?f`aBefBsySP@(_`FaZ5oAyt9V@9zKr002ovPDHLkV1jvi#&`e# literal 0 HcmV?d00001 diff --git a/resources/library/interactivities/Contraste.wgt/locales/fr/scripts/blackYellow.js b/resources/library/interactivities/Contraste.wgt/locales/fr/scripts/blackYellow.js index 7f0cfb19..7cfdea27 100644 --- a/resources/library/interactivities/Contraste.wgt/locales/fr/scripts/blackYellow.js +++ b/resources/library/interactivities/Contraste.wgt/locales/fr/scripts/blackYellow.js @@ -81,9 +81,9 @@ function init(){ .css("top",importArray[i].top) .css("left",importArray[i].left); tmpReadyTask.appendTo("#data"); - } - } - $(document).disableTextSelect(); + } + $(document).disableTextSelect(); + } } /* ------------- BUTTONS -------------*/ @@ -182,10 +182,16 @@ function init(){ }); $("#wgt_add").click(function(){ - shadowDiv.show("fast", function(){ - shadowOver = true; - popupBack.show("slow"); - }); + if($("#wgt_help").hasClass("open")){ + $("#help").slideUp("100", function(){ + $("#wgt_help").removeClass("open"); + $("#data").show(); + }); + } + shadowDiv.show() + shadowOver = true; + popupBack.show("slow"); + $(document).disableTextSelect(); }); @@ -203,7 +209,7 @@ function init(){ var rightDiv = $("
").appendTo("#data"); //divs for adding a new item - var shadowDiv = $("
").appendTo("#data"); + var shadowDiv = $("
").appendTo("html"); var popupBack = $("
").appendTo("#data"); //input fields and buttons for a popup window @@ -228,37 +234,39 @@ function init(){ }); cancelButton.click(function(){ - $(document).enableTextSelect(); popupBack.hide("slow", function(){ $("#resultText, #expresionText").val("") .css("background-color", "#ffc"); - shadowDiv.hide("fast"); + shadowDiv.hide(); shadowOver = false; + $(document).enableTextSelect(); }); + }); okButton.click(function(){ - $(document).enableTextSelect(); if(checkEmptyFields(expresionText) && checkEmptyFields(resultText)){ popupBack.hide("slow", function(){ - shadowDiv.hide("fast"); + shadowDiv.hide(); shadowOver = false; addTask(expresionText.val(), resultText.val()); exportToSankore(); $("#resultText, #expresionText").val("") .css("background-color", "#ffc"); + $(document).enableTextSelect(); }) } + }); /* -------------- THE END OF WORK WITH POPUP BUTTONS AND FIELDS ---------------*/ // a work with dragging possibility - $("input:text, .style_select").mouseover(function(){ + $("input:text").mouseover(function(){ $(document).enableTextSelect(); }); - $("input:text, .style_select").mouseout(function(){ + $("input:text").mouseout(function(){ $(document).disableTextSelect(); }); @@ -270,6 +278,8 @@ function init(){ resizeObj.width = $(this).width(); resizeObj.height = $(this).height(); } + if($("#wgt_display").hasClass("selected")) + $(document).disableTextSelect(); }); $(".rightResize").live("mousedown",function(event){ @@ -296,13 +306,25 @@ function init(){ }); $("body").mousemove(function(event){ - if(dragElement && !shadowOver){ - if(resizeObj.x) - dragElement.width(event.pageX - dragElement.position().left); - else if(resizeObj.y) - dragElement.height(event.pageY - dragElement.position().top); - else - dragElement.css("top",event.pageY - coords.top).css("left", event.pageX - coords.left); + if(dragElement && !shadowOver){ + var top = event.pageY - coords.top; + var left = event.pageX - coords.left; + var bottom = top + dragElement.height(); + var right = left + dragElement.width(); + if(resizeObj.x){ + if(right < ($(window).width() - 54)) + dragElement.width(event.pageX - dragElement.position().left); + } + else if(resizeObj.y){ + if(bottom < ($(window).height() - 54)) + dragElement.height(event.pageY - dragElement.position().top); + } + else { + if((top > 54) && (bottom < ($(window).height() - 54))) + dragElement.css("top",event.pageY - coords.top); + if((left >= 54) && (right < ($(window).width() - 54))) + dragElement.css("left", event.pageX - coords.left); + } } }); @@ -393,8 +415,8 @@ function checkEmptyFields(field){ //adding a new task to the page function addTask(expression, result){ var lastItem = $(".editContainer:last"), - lastItemPos = lastItem.length ? lastItem.position().top : 45, - lastItemHeight = lastItem.length ? lastItem.height() : 0; + lastItemPos = lastItem.length ? lastItem.position().top : 45, + lastItemHeight = lastItem.length ? lastItem.height() : 0; var editContent = $("
").width(240).height(70).css("top", lastItemPos + lastItemHeight + 15 + "px").appendTo("#data"); var closeItem = $("
").appendTo(editContent); var rightResize = $("
").appendTo(editContent); @@ -463,4 +485,6 @@ function changeStyle(val){ $("body, html").addClass("without_radius"); break; } + if($("#wgt_edit").hasClass("selected")) + $(document).enableTextSelect(); } \ No newline at end of file diff --git a/resources/library/interactivities/Contraste.wgt/locales/ru/scripts/blackYellow.js b/resources/library/interactivities/Contraste.wgt/locales/ru/scripts/blackYellow.js index d77e7108..ab7ad61a 100644 --- a/resources/library/interactivities/Contraste.wgt/locales/ru/scripts/blackYellow.js +++ b/resources/library/interactivities/Contraste.wgt/locales/ru/scripts/blackYellow.js @@ -23,9 +23,9 @@ var sankoreLang = { cancel: "Отмена", wgt_name: "Черный/желтый", reload: "Обновить", - slate: "Узор", - pad: "Планшет", - none: "Нет", + slate: "узор", + pad: "планшет", + none: "нет", help: "Помощь", help_content: "Пример текста помощи ..." }; @@ -182,10 +182,16 @@ function init(){ }); $("#wgt_add").click(function(){ - shadowDiv.show("fast", function(){ - shadowOver = true; - popupBack.show("slow"); - }); + if($("#wgt_help").hasClass("open")){ + $("#help").slideUp("100", function(){ + $("#wgt_help").removeClass("open"); + $("#data").show(); + }); + } + shadowDiv.show() + shadowOver = true; + popupBack.show("slow"); + $(document).disableTextSelect(); }); @@ -203,7 +209,7 @@ function init(){ var rightDiv = $("
").appendTo("#data"); //divs for adding a new item - var shadowDiv = $("
").appendTo("#data"); + var shadowDiv = $("
").appendTo("html"); var popupBack = $("
").appendTo("#data"); //input fields and buttons for a popup window @@ -228,37 +234,39 @@ function init(){ }); cancelButton.click(function(){ - $(document).enableTextSelect(); popupBack.hide("slow", function(){ $("#resultText, #expresionText").val("") .css("background-color", "#ffc"); - shadowDiv.hide("fast"); + shadowDiv.hide(); shadowOver = false; + $(document).enableTextSelect(); }); + }); okButton.click(function(){ - $(document).enableTextSelect(); if(checkEmptyFields(expresionText) && checkEmptyFields(resultText)){ popupBack.hide("slow", function(){ - shadowDiv.hide("fast"); + shadowDiv.hide(); shadowOver = false; addTask(expresionText.val(), resultText.val()); exportToSankore(); $("#resultText, #expresionText").val("") .css("background-color", "#ffc"); + $(document).enableTextSelect(); }) } + }); /* -------------- THE END OF WORK WITH POPUP BUTTONS AND FIELDS ---------------*/ // a work with dragging possibility - $("input:text, .style_select").mouseover(function(){ + $("input:text").mouseover(function(){ $(document).enableTextSelect(); }); - $("input:text, .style_select").mouseout(function(){ + $("input:text").mouseout(function(){ $(document).disableTextSelect(); }); @@ -270,6 +278,8 @@ function init(){ resizeObj.width = $(this).width(); resizeObj.height = $(this).height(); } + if($("#wgt_display").hasClass("selected")) + $(document).disableTextSelect(); }); $(".rightResize").live("mousedown",function(event){ @@ -296,13 +306,25 @@ function init(){ }); $("body").mousemove(function(event){ - if(dragElement && !shadowOver){ - if(resizeObj.x) - dragElement.width(event.pageX - dragElement.position().left); - else if(resizeObj.y) - dragElement.height(event.pageY - dragElement.position().top); - else - dragElement.css("top",event.pageY - coords.top).css("left", event.pageX - coords.left); + if(dragElement && !shadowOver){ + var top = event.pageY - coords.top; + var left = event.pageX - coords.left; + var bottom = top + dragElement.height(); + var right = left + dragElement.width(); + if(resizeObj.x){ + if(right < ($(window).width() - 54)) + dragElement.width(event.pageX - dragElement.position().left); + } + else if(resizeObj.y){ + if(bottom < ($(window).height() - 54)) + dragElement.height(event.pageY - dragElement.position().top); + } + else { + if((top > 54) && (bottom < ($(window).height() - 54))) + dragElement.css("top",event.pageY - coords.top); + if((left >= 54) && (right < ($(window).width() - 54))) + dragElement.css("left", event.pageX - coords.left); + } } }); @@ -393,8 +415,8 @@ function checkEmptyFields(field){ //adding a new task to the page function addTask(expression, result){ var lastItem = $(".editContainer:last"), - lastItemPos = lastItem.length ? lastItem.position().top : 45, - lastItemHeight = lastItem.length ? lastItem.height() : 0; + lastItemPos = lastItem.length ? lastItem.position().top : 45, + lastItemHeight = lastItem.length ? lastItem.height() : 0; var editContent = $("
").width(240).height(70).css("top", lastItemPos + lastItemHeight + 15 + "px").appendTo("#data"); var closeItem = $("
").appendTo(editContent); var rightResize = $("
").appendTo(editContent); @@ -463,4 +485,6 @@ function changeStyle(val){ $("body, html").addClass("without_radius"); break; } + if($("#wgt_edit").hasClass("selected")) + $(document).enableTextSelect(); } \ No newline at end of file diff --git a/resources/library/interactivities/Contraste.wgt/scripts/blackYellow.js b/resources/library/interactivities/Contraste.wgt/scripts/blackYellow.js index 85cdaab2..33687d4d 100644 --- a/resources/library/interactivities/Contraste.wgt/scripts/blackYellow.js +++ b/resources/library/interactivities/Contraste.wgt/scripts/blackYellow.js @@ -23,9 +23,9 @@ var sankoreLang = { cancel: "Cancel", wgt_name: "Contrast", reload: "Reload", - slate: "Wood", - pad: "Pad", - none: "None", + slate: "wood", + pad: "pad", + none: "none", help: "Help", help_content: "This is an example of help content ..." }; @@ -88,9 +88,12 @@ function init(){ /* ------------- BUTTONS -------------*/ - if(sankore.preference("by_style","")){ - changeStyle(sankore.preference("by_style","")); - $(".style_select").val(sankore.preference("by_style","")); + if(window.sankore){ + if(sankore.preference("by_style","")){ + changeStyle(sankore.preference("by_style","")); + $(".style_select").val(sankore.preference("by_style","")); + } else + changeStyle("3") } else changeStyle("3") @@ -182,10 +185,15 @@ function init(){ }); $("#wgt_add").click(function(){ - shadowDiv.show("fast", function(){ - shadowOver = true; - popupBack.show("slow"); - }); + if($("#wgt_help").hasClass("open")){ + $("#help").slideUp("100", function(){ + $("#wgt_help").removeClass("open"); + $("#data").show(); + }); + } + shadowDiv.show(); + shadowOver = true; + popupBack.show("slow"); $(document).disableTextSelect(); }); @@ -203,7 +211,7 @@ function init(){ var rightDiv = $("
").appendTo("#data"); //divs for adding a new item - var shadowDiv = $("
").appendTo("#data"); + var shadowDiv = $("
").appendTo("html"); var popupBack = $("
").appendTo("#data"); //input fields and buttons for a popup window @@ -228,25 +236,25 @@ function init(){ }); cancelButton.click(function(){ - $(document).enableTextSelect(); popupBack.hide("slow", function(){ $("#resultText, #expresionText").val("") .css("background-color", "#ffc"); - shadowDiv.hide("fast"); + shadowDiv.hide(); shadowOver = false; + $(document).enableTextSelect(); }); }); okButton.click(function(){ - $(document).enableTextSelect(); if(checkEmptyFields(expresionText) && checkEmptyFields(resultText)){ popupBack.hide("slow", function(){ - shadowDiv.hide("fast"); + shadowDiv.hide(); shadowOver = false; addTask(expresionText.val(), resultText.val()); exportToSankore(); $("#resultText, #expresionText").val("") .css("background-color", "#ffc"); + $(document).enableTextSelect(); }) } }); @@ -254,11 +262,11 @@ function init(){ /* -------------- THE END OF WORK WITH POPUP BUTTONS AND FIELDS ---------------*/ // a work with dragging possibility - $("input:text, .style_select").mouseover(function(){ + $("input:text").mouseover(function(){ $(document).enableTextSelect(); }); - $("input:text, .style_select").mouseout(function(){ + $("input:text").mouseout(function(){ $(document).disableTextSelect(); }); @@ -270,6 +278,8 @@ function init(){ resizeObj.width = $(this).width(); resizeObj.height = $(this).height(); } + if($("#wgt_display").hasClass("selected")) + $(document).disableTextSelect(); }); $(".rightResize").live("mousedown",function(event){ @@ -296,13 +306,25 @@ function init(){ }); $("body").mousemove(function(event){ - if(dragElement && !shadowOver){ - if(resizeObj.x) - dragElement.width(event.pageX - dragElement.position().left); - else if(resizeObj.y) - dragElement.height(event.pageY - dragElement.position().top); - else - dragElement.css("top",event.pageY - coords.top).css("left", event.pageX - coords.left); + if(dragElement && !shadowOver){ + var top = event.pageY - coords.top; + var left = event.pageX - coords.left; + var bottom = top + dragElement.height(); + var right = left + dragElement.width(); + if(resizeObj.x){ + if(right < ($(window).width() - 54)) + dragElement.width(event.pageX - dragElement.position().left); + } + else if(resizeObj.y){ + if(bottom < ($(window).height() - 54)) + dragElement.height(event.pageY - dragElement.position().top); + } + else { + if((top > 54) && (bottom < ($(window).height() - 54))) + dragElement.css("top",event.pageY - coords.top); + if((left >= 54) && (right < ($(window).width() - 54))) + dragElement.css("left", event.pageX - coords.left); + } } }); @@ -375,7 +397,8 @@ function init(){ }); } } - sankore.setPreference("blackYellowData", JSON.stringify(arrayToExport)); + if(window.sankore) + sankore.setPreference("blackYellowData", JSON.stringify(arrayToExport)); } } @@ -463,4 +486,6 @@ function changeStyle(val){ $("body, html").addClass("without_radius"); break; } + if($("#wgt_edit").hasClass("selected")) + $(document).enableTextSelect(); }