From 2d60b8f329e1f843bd112682e9f6f26e5e2cb2af Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Aug 2011 19:09:02 +0300 Subject: [PATCH] updating web-browser, notes and calculator --- .../interactive/Calculator.wgt/index.html | 56 +- .../interactive/Calculator.wgt/js/ubw-main.js | 787 ++++++++++-------- .../interactive/Notes.wgt/js/ubw-main.js | 347 ++++---- .../interactive/WebBrowser.wgt/index.html | 397 +++++---- .../WebBrowser.wgt/scripts/jquery.oembed.js | 146 ---- 5 files changed, 855 insertions(+), 878 deletions(-) delete mode 100644 resources/library/interactive/WebBrowser.wgt/scripts/jquery.oembed.js diff --git a/resources/library/interactive/Calculator.wgt/index.html b/resources/library/interactive/Calculator.wgt/index.html index 624970b1..970e8b12 100644 --- a/resources/library/interactive/Calculator.wgt/index.html +++ b/resources/library/interactive/Calculator.wgt/index.html @@ -1,33 +1,33 @@ - - - ubwidget - - - - - - - - - - - - - - - - - - -
- - + + + ubwidget + + + + + + + + + + + + + + + + + + +
+ + \ No newline at end of file diff --git a/resources/library/interactive/Calculator.wgt/js/ubw-main.js b/resources/library/interactive/Calculator.wgt/js/ubw-main.js index 7e08d0dc..7bc45984 100644 --- a/resources/library/interactive/Calculator.wgt/js/ubw-main.js +++ b/resources/library/interactive/Calculator.wgt/js/ubw-main.js @@ -14,392 +14,513 @@ */ function init(){ - var h = 292; - var w = 160; - var wh = h+6; - var ww = w+6; - - var ubwidget = $("#ubwidget").ubwidget({ - width:w, - height:h - }); + var h = 292; + var w = 160; + var wh = h+6; + var ww = w+6; + var clickFlag = false; + + var ubwidget = $("#ubwidget").ubwidget({ + width:w, + height:h + }); - var historyTab = $("
") - .css({ - height:h, - marginRight:0, - width:20, - float:"left", - backgroundImage:"url(images/historytab.png)", - backgroundRepeat:"no-repeat" - }) - .toggle( - function(){ - resizeWidget(370, 294); - historyPanel.show(); - $(".ubw-container").css({ - backgroundImage:"url(images/back.png)", - width:328 - }); - if(window.sankore){ - window.sankore.setPreference('historyTab', "visible"); - }; - }, - function(){ - resizeWidget(200, 294); - historyPanel.hide(); - $(".ubw-container").css({ - backgroundImage:"url(images/back_small.png)", - width:160 - }); - if(window.sankore){ - window.sankore.setPreference('historyTab', "hidden"); - }; - } - ) - .hover( - function(){ - $(this).css({ - backgroundImage:"url(images/historytabOver.png)" - }); - }, - function(){ - $(this).css({ - backgroundImage:"url(images/historytab.png)" - }); - } - ) - .appendTo($("body")); + var historyTab = $("
") + .css({ + height:h, + marginRight:0, + width:20, + float:"left", + backgroundImage:"url(images/historytab.png)", + backgroundRepeat:"no-repeat" + }) + .toggle( + function(){ + resizeWidget(370, 294); + historyPanel.show(); + $(".ubw-container").css({ + backgroundImage:"url(images/back.png)", + width:328 + }); + if(window.sankore){ + window.sankore.setPreference('historyTab', "visible"); + }; + }, + function(){ + resizeWidget(200, 294); + historyPanel.hide(); + $(".ubw-container").css({ + backgroundImage:"url(images/back_small.png)", + width:160 + }); + if(window.sankore){ + window.sankore.setPreference('historyTab', "hidden"); + }; + } + ) + .hover( + function(){ + $(this).css({ + backgroundImage:"url(images/historytabOver.png)" + }); + }, + function(){ + $(this).css({ + backgroundImage:"url(images/historytab.png)" + }); + } + ) + .appendTo($("body")); - var space = $("
"); - space.css({width:5, height:1, float:"left"}); + var space = $("
"); + space.css({ + width:5, + height:1, + float:"left" + }); - var keysPanel = $("
").css({float:"left"}); - var mode = "standard"; - var calc = ""; - var displayTrunk = ""; - var historyTrunk = ""; - var lastHistory = ""; - var subtrunk = 0; - var itrunk = 0; - var trunkpos = 0; - var lastchar = {type:"NaN", value:"null"}; - var inparenthesis = false; - var erase = false; - var abtn; - var readyToCompute = false; - var lastResult = "0"; - var gDecimalSeparator = ""; - var gThousandsSeparator = ""; - var gDecimalCode = 0; - var gDecimalString = ""; - var gError = false; + var keysPanel = $("
").css({ + float:"left" + }); + var mode = "standard"; + var calc = ""; + var displayTrunk = ""; + var historyTrunk = ""; + var lastHistory = ""; + var subtrunk = 0; + var itrunk = 0; + var trunkpos = 0; + var lastchar = { + type:"NaN", + value:"null" + }; + var inparenthesis = false; + var erase = false; + var abtn; + var readyToCompute = false; + var lastResult = "0"; + var gDecimalSeparator = ""; + var gThousandsSeparator = ""; + var gDecimalCode = 0; + var gDecimalString = ""; + var gError = false; - var historyTxt = "0"; + var historyTxt = "0"; - var display = $("
0
") - .addClass("ubw-inputbox") - .css({ - padding:"12px", - marginLeft:"2px", - marginBottom:"9px", - marginTop:7, - backgroundImage:"url(images/display.png)", - fontSize:"22px", - fontFamily:"Arial, Helvetica, Sans-serif", - color:"#777788", - width:118, - height:28, - overflow:"hidden", - textAlign:"right", - }); + var display = $("
0
") + .addClass("ubw-inputbox") + .css({ + padding:"12px", + marginLeft:"2px", + marginBottom:"9px", + marginTop:7, + backgroundImage:"url(images/display.png)", + fontSize:"22px", + fontFamily:"Arial, Helvetica, Sans-serif", + color:"#777788", + width:118, + height:28, + overflow:"hidden", + textAlign:"right", + }); - var standardPanel = $("
").css({float:"left"}); + var standardPanel = $("
").css({ + float:"left" + }); - var cKeySize = {w:33, h:36}; + var cKeySize = { + w:33, + h:36 + }; - var btn7 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("7", 1)}); - var btn8 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("8", 1)}); - var btn9 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("9", 1)}); - var btnDiv = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("/", 0)}); - var btn4 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("4", 1)}); - var btn5 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("5", 1)}); - var btn6 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("6", 1)}); - var btnMul = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("*", 0)}); - var btn1 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("1", 1)}); - var btn2 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("2", 1)}); - var btn3 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("3", 1)}); - var btnSou = $("
").ubwbutton({w:68, h:34}) - .mousedown(function(){appendToDisplay("-", 0)}); - var btn0 = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("0", 1)}); - var btnDot = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay(".", 1)}); - var btnC = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){reset()}); - var btnAdd = $("
").ubwbutton({w:68, h:34}) - .mousedown(function(){appendToDisplay("+", 0)}); - var btnPaL = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay("(", 1)}); - var btnPaR = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){appendToDisplay(")", 1)}); - var btnEqu = $("
").ubwbutton({w:cKeySize.w, h:cKeySize.h}) - .mousedown(function(){compute()}); + var btn7 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("7", 1) + }); + var btn8 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("8", 1) + }); + var btn9 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("9", 1) + }); + var btnDiv = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("/", 0) + }); + var btn4 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("4", 1) + }); + var btn5 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("5", 1) + }); + var btn6 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("6", 1) + }); + var btnMul = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("*", 0) + }); + var btn1 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("1", 1) + }); + var btn2 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("2", 1) + }); + var btn3 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("3", 1) + }); + var btnSou = $("
").ubwbutton({ + w:68, + h:34 + }) + .mousedown(function(){ + appendToDisplay("-", 0) + }); + var btn0 = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("0", 1) + }); + var btnDot = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay(".", 1) + }); + var btnC = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + reset() + }); + var btnAdd = $("
").ubwbutton({ + w:68, + h:34 + }) + .mousedown(function(){ + appendToDisplay("+", 0) + }); + var btnPaL = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay("(", 1) + }); + var btnPaR = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + appendToDisplay(")", 1) + }); + var btnEqu = $("
").ubwbutton({ + w:cKeySize.w, + h:cKeySize.h + }) + .mousedown(function(){ + compute() + }); - var historyPanel = $("
") - .css({ - backgroundImage:"url(images/historyback.png)", - width:"auto", - height:"auto", - float:"left", - marginLeft:3, - marginRight:2, - marginTop:6 - }) - .hide(); + var historyPanel = $("
") + .css({ + backgroundImage:"url(images/historyback.png)", + width:"auto", + height:"auto", + float:"left", + marginLeft:3, + marginRight:2, + marginTop:6 + }) + .hide(); - var historyBox = $("") - .css({ - padding:10, - fontSize:"20px", - fontFamily:"Arial, Helvetica, Sans-serif", - width:143, - height:236, - backgroundColor:"transparent", - resize:"none", - border:"none", - overlay:"none", - color:"#eeeeee" - }) - .val("0"); + var historyBox = $("") + .css({ + padding:10, + fontSize:"20px", + fontFamily:"Arial, Helvetica, Sans-serif", + width:143, + height:236, + backgroundColor:"transparent", + resize:"none", + border:"none", + overlay:"none", + color:"#eeeeee" + }) + .val("0"); - historyPanel.append(historyBox); + historyPanel.append(historyBox); - var stop = $("
"); - var sleft = $("
"); - var sright = $("
"); + var stop = $("
"); + var sleft = $("
"); + var sright = $("
"); - stop.css({width:140}) - .append(btnAdd).append(btnSou) - .append(btn7).append(btn8).append(btn9).append(btnMul) - .append(btn4).append(btn5).append(btn6).append(btnDiv); + stop.css({ + width:140 + }) + .append(btnAdd).append(btnSou) + .append(btn7).append(btn8).append(btn9).append(btnMul) + .append(btn4).append(btn5).append(btn6).append(btnDiv); - sleft.css({width:105, float:"left"}) - .append(btn1).append(btn2).append(btn3) - .append(btn0).append(btnDot).append(btnC); + sleft.css({ + width:105, + float:"left" + }) + .append(btn1).append(btn2).append(btn3) + .append(btn0).append(btnDot).append(btnC); - sright.css({width:45, float:"left"}) - .append(btnEqu); + sright.css({ + width:45, + float:"left" + }) + .append(btnEqu); - standardPanel.css({width:150}) - .append(stop) - .append(sleft).append(sright); + standardPanel.css({ + width:150 + }) + .append(stop) + .append(sleft).append(sright); - keysPanel - .append(display) - .append(standardPanel); + keysPanel + .append(display) + .append(standardPanel); - ubwidget - .append(historyPanel) - .append(keysPanel); + ubwidget + .append(historyPanel) + .append(keysPanel); - if(window.sankore){ - historyTxt = window.sankore.preference('historyTxt', historyTxt); - var ht = window.sankore.preference('historyTab', "hidden"); - $("#historyBox").val(historyTxt); - if(ht === "visible"){ - historyTab.trigger("click"); - }; - } + if(window.sankore){ + historyTxt = window.sankore.preference('historyTxt', historyTxt); + var ht = window.sankore.preference('historyTab', "hidden"); + $("#historyBox").val(historyTxt); + if(ht === "visible"){ + historyTab.trigger("click"); + }; + } -function resizeWidget(w, h){ - window.sankore.resize(w+2, h+2); - $("#indicator").remove(); - var indicator = $("
") - .css({ - width:w, - height:h, - position:"absolute", - left:0, - top:0, - border:"1px solid #ff0000" - }); -} + function resizeWidget(w, h){ + window.sankore.resize(w+2, h+2); + } -function compute(){ - var result = eval(calc) + function compute(){ + var result = eval(calc) - $("#display").text(updateDisplay(result)); - lastResult = result; - lastchar.type = "Nan"; - lastchar.value = ""; - calc = ""; + $("#display").text(updateDisplay(result)); + lastResult = result; + lastchar.type = "Nan"; + lastchar.value = ""; + calc = ""; - $("#historyBox").val($("#historyBox").val()+historyTrunk+"\n= "+updateDisplay(result)+"\n\n"); - $("#historyBox").scrollTop(99999); + $("#historyBox").val($("#historyBox").val()+historyTrunk+"\n= "+updateDisplay(result)+"\n\n"); + $("#historyBox").scrollTop(99999); - displayTrunk = ""; - historyTrunk = ""; + displayTrunk = ""; + historyTrunk = ""; - if(window.sankore){ - window.sankore.setPreference('historyTxt', $("#historyBox").val()); - }; + if(window.sankore){ + window.sankore.setPreference('historyTxt', $("#historyBox").val()); + }; - lastHistory = $("#historyBox").val(); -} + lastHistory = $("#historyBox").val(); + } -function reset(){ - $("#display").text("0"); - calc=""; - displayTrunk=""; - historyTrunk=""; - $("#historyBox").val(lastHistory); - $("#historyBox").scrollTop(99999); -} + function reset(){ + $("#display").text("0"); + calc=""; + displayTrunk=""; + historyTrunk=""; + $("#historyBox").val(lastHistory); + $("#historyBox").scrollTop(99999); + } -function formatNumberWithDelimiters(number) { - var delimiter = gThousandsSeparator; - var numString = number.toString(); + function formatNumberWithDelimiters(number) { + var delimiter = gThousandsSeparator; + var numString = number.toString(); - if (!numString) - return "0"; + if (!numString) + return "0"; - var dot = numString.indexOf(gDecimalSeparator); - if (dot == -1) - dot = numString.length; + var dot = numString.indexOf(gDecimalSeparator); + if (dot == -1) + dot = numString.length; - var stop = numString.length-dot; - var characteristic = numString.substr(0, dot); - if (!parseInt(characteristic)) - return numString; + var stop = numString.length-dot; + var characteristic = numString.substr(0, dot); + if (!parseInt(characteristic)) + return numString; - // see if it's a negative number - var numIsNegative = (parseInt(characteristic) < 0) + // see if it's a negative number + var numIsNegative = (parseInt(characteristic) < 0) - var newNumber = ""; - var delimiterCount = Math.floor((characteristic.length-1) / 3); - var extras = characteristic.length % 3; - if (!extras && characteristic.length > 2) - extras = 3; + var newNumber = ""; + var delimiterCount = Math.floor((characteristic.length-1) / 3); + var extras = characteristic.length % 3; + if (!extras && characteristic.length > 2) + extras = 3; - if (extras) - newNumber = newNumber + characteristic.substr(0, extras); + if (extras) + newNumber = newNumber + characteristic.substr(0, extras); - for (var i=0;i< delimiterCount; i++) { + for (var i=0;i< delimiterCount; i++) { - if ( (0 == i) && numIsNegative && (extras == 1)) - newNumber = newNumber + characteristic.substr(extras + (i * 3), 3); - else - newNumber = newNumber + delimiter + characteristic.substr(extras + (i * 3), 3); - } + if ( (0 == i) && numIsNegative && (extras == 1)) + newNumber = newNumber + characteristic.substr(extras + (i * 3), 3); + else + newNumber = newNumber + delimiter + characteristic.substr(extras + (i * 3), 3); + } - return (dot ? (newNumber + numString.substr(dot, stop)) : newNumber); -} + return (dot ? (newNumber + numString.substr(dot, stop)) : newNumber); + } -function formatNumberWithScientificNotation(number) { - if (number == 0) - return number; + function formatNumberWithScientificNotation(number) { + if (number == 0) + return number; - var numString = number.toString(); - if (!numString) - return "0"; + var numString = number.toString(); + if (!numString) + return "0"; - var num = new Number(numString); - var sci = num.toExponential(5); - if (sci == "NaN") - sci = formatNumberWithDelimiters(numString); - if (!sci) - return "0"; + var num = new Number(numString); + var sci = num.toExponential(5); + if (sci == "NaN") + sci = formatNumberWithDelimiters(numString); + if (!sci) + return "0"; - return sci; -} + return sci; + } -function updateDisplay(number){ - if(String(number).length > 8){ - number = formatNumberWithScientificNotation(number); - } - else{ - number = number; - } + function updateDisplay(number){ + if(String(number).length > 8){ + number = formatNumberWithScientificNotation(number); + } + else{ + number = number; + } - return number; -} + return number; + } -function appendToDisplay(_char, v){ - var char = _char; + function appendToDisplay(_char, v){ + var char = _char; - // Display - if($("#historyBox").val() === "0"){ - $("#historyBox").val(""); - }; + // Display + if($("#historyBox").val() === "0"){ + $("#historyBox").val(""); + }; - if(char == "-" && lastchar.type == "NaN"){ - char = "m"; - }; + if(char == "-" && lastchar.type == "NaN"){ + char = "m"; + }; - // char is a number - if(char <= 0 || char > 0 || char == "." || char == "m" || char == "(" || char == ")"){ - if(char == "m"){ - char = "-"; - }; + // char is a number + if(char <= 0 || char > 0 || char == "." || char == "m" || char == "(" || char == ")"){ + if(char == "m"){ + char = "-"; + }; - if(lastchar.type == "NaN"){ - displayTrunk = ""; - }; + if(lastchar.type == "NaN"){ + displayTrunk = ""; + }; - if(lastchar.value == "." && char == "."){ - calc = calc.substr(0, calc.length-1); - displayTrunk = displayTrunk.substr(0, displayTrunk.length-1); - }; + if(lastchar.value == "." && char == "."){ + calc = calc.substr(0, calc.length-1); + displayTrunk = displayTrunk.substr(0, displayTrunk.length-1); + }; - calc += String(char); - displayTrunk += String(char); - historyTrunk += String(char); - lastchar.type = "Number"; - } - // char is an operator - else { - if(calc.length === 0){ - var endCalc = calc; - calc = lastResult + endCalc; - historyTrunk = updateDisplay(lastResult); - } + calc += String(char); + displayTrunk += String(char); + historyTrunk += String(char); + lastchar.type = "Number"; + } + // char is an operator + else { + if(calc.length === 0){ + var endCalc = calc; + calc = lastResult + endCalc; + historyTrunk = updateDisplay(lastResult); + } - if(lastchar.type == "NaN"){ - calc = calc.substr(0, calc.length-1); - calc += char; - $("#historyBox").val($("#historyBox").val().substr(0, $("#historyBox").val().length-1)); - } - else{ - try{ - calc = eval(calc) + String(char); - }catch(e){} - } + if(lastchar.type == "NaN"){ + calc = calc.substr(0, calc.length-1); + calc += char; + $("#historyBox").val($("#historyBox").val().substr(0, $("#historyBox").val().length-1)); + } + else{ + try{ + calc = eval(calc) + String(char); + }catch(e){} + } - lastchar.type = "NaN"; - try{ - displayTrunk = eval(calc.substr(0, calc.length-1)); - }catch(e){} - $("#historyBox").val($("#historyBox").val()+historyTrunk+char); - $("#historyBox").scrollTop(99999); - historyTrunk = ""; - } + lastchar.type = "NaN"; + try{ + displayTrunk = eval(calc.substr(0, calc.length-1)); + }catch(e){} + $("#historyBox").val($("#historyBox").val()+historyTrunk+char); + $("#historyBox").scrollTop(99999); + historyTrunk = ""; + } - lastchar.value = char; - $("#display").text(updateDisplay(displayTrunk)); -} - + lastchar.value = char; + $("#display").text(updateDisplay(displayTrunk)); + } + + $("#historyBox").click(function(){ + if(!clickFlag){ + $(this).select(); + clickFlag = true; + } + else{ + clickFlag = false; + $(this).blur(); + } + }); + $(document).disableTextSelect(); }; diff --git a/resources/library/interactive/Notes.wgt/js/ubw-main.js b/resources/library/interactive/Notes.wgt/js/ubw-main.js index 662a41ae..cea778fa 100644 --- a/resources/library/interactive/Notes.wgt/js/ubw-main.js +++ b/resources/library/interactive/Notes.wgt/js/ubw-main.js @@ -15,211 +15,218 @@ function init(){ - var ubwidget = $("#ubwidget").ubwidget({ - width:360, - height:240 - }); + var ubwidget = $("#ubwidget").ubwidget({ + width:360, + height:240 + }); - var checkMinimize = false; - var text = ""; - var winwidth; - var minimizedHeight; - var winheight; - var scroll = false; - var defaultFontSize = 35; - var currentFontSize = defaultFontSize; - var header = $(''); - var fontUp = $(''); - var fontDown = $(''); - var minimize = $(''); - var maximize = $(''); - var title = $(''); - var textField = $('
'); - var shadow = $("
 
") - .appendTo("body"); - var shadowleft = $("") - .appendTo($("#sl")); - var shadowright = $("") - .appendTo($("#sr")); - - $("#ubwidget") - .append(header) - .append(textField); + var checkMinimize = false; + var text = ""; + var winwidth; + var minimizedHeight; + var winheight; + var scroll = false; + var defaultFontSize = 35; + var currentFontSize = defaultFontSize; + var header = $(''); + var fontUp = $(''); + var fontDown = $(''); + var minimize = $(''); + var maximize = $(''); + var title = $(''); + var textField = $('
'); + var shadow = $("
 
") + .appendTo("body"); + var shadowleft = $("") + .appendTo($("#sl")); + var shadowright = $("") + .appendTo($("#sr")); - fontUp.addClass('menuElement'); - fontDown.addClass('menuElement'); - minimize.addClass('menuElement'); - maximize.addClass('menuElement') - .hide(); + $("#ubwidget") + .append(header) + .append(textField); + + fontUp.addClass('menuElement'); + fontDown.addClass('menuElement'); + minimize.addClass('menuElement'); + maximize.addClass('menuElement') + .hide(); - header.append(maximize) - .append(minimize) - .append(fontUp) - .append(fontDown); - var titletext = header.find('textarea'); + header.append(maximize) + .append(minimize) + .append(fontUp) + .append(fontDown); + var titletext = header.find('textarea'); - titletext.click( - function(){ - titletext.focus(); + titletext.click( + function(){ + titletext.focus(); - }); + }); - fontDown.click( - function(){ + fontDown.click( + function(){ - var newFontSize = parseInt(currentFontSize) - 3; + var newFontSize = parseInt(currentFontSize) - 3; - textField.css({ - fontSize : newFontSize - }) + textField.css({ + fontSize : newFontSize + }) - controlTextField(); + controlTextField(); - if(window.sankore){ - window.sankore.setPreference("fontSize", newFontSize); - }; + if(window.sankore){ + window.sankore.setPreference("fontSize", newFontSize); + }; - if(!checkMinimize) - textField.focus(); - }); + if(!checkMinimize) + textField.focus(); + }); - fontUp.click( - function(){ - var newFontSize = parseInt(currentFontSize) + 3; + fontUp.click( + function(){ + var newFontSize = parseInt(currentFontSize) + 3; - textField.css({ - fontSize : newFontSize - }) + textField.css({ + fontSize : newFontSize + }) - controlTextField(); + controlTextField(); - if(window.sankore){ - window.sankore.setPreference("fontSize", newFontSize); - }; + if(window.sankore){ + window.sankore.setPreference("fontSize", newFontSize); + }; - if(!checkMinimize) - textField.focus(); - }); + if(!checkMinimize) + textField.focus(); + }); - minimize.click( - function(){ - $('.ubw-container').animate({height:"26px"},500); - minimizedHeight = $('.ubw-container').height(); - minimize.hide(); - maximize.show(); - controlTextField(); - $('#headtitle').show(); - $('#headtitle').focus(); - //window.resizeTo($('.ubw-container').width(),0); - checkMinimize = true; + minimize.click( + function(){ + $('.ubw-container').animate({ + height:"26px" + },500); + minimizedHeight = $('.ubw-container').height(); + minimize.hide(); + maximize.show(); + controlTextField(); + $('#headtitle').show(); + $('#headtitle').focus(); + //window.resizeTo($('.ubw-container').width(),0); + checkMinimize = true; - }); + }); - maximize.click( - function(){ - var lastHeight = String(minimizedHeight)+'px'; - $('.ubw-container').animate({height: lastHeight},500); + maximize.click( + function(){ + var lastHeight = String(minimizedHeight)+'px'; + $('.ubw-container').animate({ + height: lastHeight + },500); - maximize.hide(); - minimize.show(); - $('#headtitle').hide(); - //textField.focus(); - //window.resizeTo($('.ubw-container').width()+15,minimizedHeight+20); - checkMinimize = false; + maximize.hide(); + minimize.show(); + $('#headtitle').hide(); + //textField.focus(); + //window.resizeTo($('.ubw-container').width()+15,minimizedHeight+20); + checkMinimize = false; - }); - - header - .append(title); - title - .addClass('menu'); - header - .addClass('head'); - textField - .addClass("textField") - .css("fontSize",currentFontSize) - .attr('contentEditable','true') - .keyup(function(){ - if(window.sankore){ - window.sankore.setPreference("noteText", textField.html()); - } - controlTextField(); - //$('#headtitle').hide(); - }); - if(textField.html().length === 0){ - textField.focus(); - } - titletext - .attr('rows','1'); + }); + + header + .append(title); + title + .addClass('menu'); + header + .addClass('head'); + textField + .addClass("textField") + .css("fontSize",currentFontSize) + .attr('contentEditable','true') + .keyup(function(){ + if(window.sankore){ + window.sankore.setPreference("noteText", textField.html()); + } + controlTextField(); + //$('#headtitle').hide(); + }); + if(textField.html().length === 0){ + textField.focus(); + } + titletext.attr('rows','1'); - function controlTextField(){ - if(textField.text().length < 25) - $('#headtitle').val(textField.text()); - else - $('#headtitle').val(textField.text().substr(0,25) + "..."); + function controlTextField(){ + if(textField.text().length < 25) + $('#headtitle').val(textField.text()); + else + $('#headtitle').val(textField.text().substr(0,25) + "..."); - textField.css({ - height : $('.ubw-container').height()-28, - }) + textField.css({ + height : $('.ubw-container').height()-28 + }) - if(textField.text().length == 0){ - textField.css({ - fontSize: defaultFontSize, - }); - } + if(textField.text().length == 0){ + textField.css({ + fontSize: defaultFontSize + }); + } - currentFontSize = textField.css('fontSize').replace('px',''); + currentFontSize = textField.css('fontSize').replace('px',''); - } + } - textField.bind('paste', function(e) { - controlTextField(); + textField.bind('paste', function(e) { + controlTextField(); }); - $('#headtitle').hide(); + $('#headtitle').hide(); - if(window.sankore){ - text = window.sankore.preference('noteText', text); - currentFontSize = window.sankore.preference('fontSize', defaultFontSize); - $('.ubw-container').css({ - width:window.innerWidth - 2, - height:window.innerHeight - 20 - }); + if(window.sankore){ + text = window.sankore.preference('noteText', text); + currentFontSize = window.sankore.preference('fontSize', defaultFontSize); + $('.ubw-container').css({ + width:window.innerWidth - 2, + height:window.innerHeight - 20 + }); - if(checkMinimize){ - minimize.trigger("click"); - }; + if(checkMinimize){ + minimize.trigger("click"); + }; - textField.css({ - fontSize : parseInt(currentFontSize) - }) - textField.html(text); - } + textField.css({ + fontSize : parseInt(currentFontSize) + }) + if(text) + textField.html(text); + else + textField.html("Enter your notes here ..."); + textField.focus(); + } - window.onresize = function(){ - winwidth = window.innerWidth; - winheight = window.innerHeight; + window.onresize = function(){ + winwidth = window.innerWidth; + winheight = window.innerHeight; - if(winwidth <= 290) - { - window.resizeTo(290,winheight); - } - if(winheight <= 100) - { - window.resizeTo(winwidth,100); - } - if(winheight > 600) - { - window.resizeTo(winwidth,600); - } + if(winwidth <= 290) + { + window.resizeTo(290,winheight); + } + if(winheight <= 100) + { + window.resizeTo(winwidth,100); + } + if(winheight > 600) + { + window.resizeTo(winwidth,600); + } - $('.ubw-container').width(winwidth-2); + $('.ubw-container').width(winwidth-2); - if(checkMinimize) - minimizedHeight = winheight-40; - else - $('.ubw-container').height(winheight-40); + if(checkMinimize) + minimizedHeight = winheight-40; + else + $('.ubw-container').height(winheight-40); - controlTextField(); - } + controlTextField(); + } } \ No newline at end of file diff --git a/resources/library/interactive/WebBrowser.wgt/index.html b/resources/library/interactive/WebBrowser.wgt/index.html index 49d1b680..f7983342 100644 --- a/resources/library/interactive/WebBrowser.wgt/index.html +++ b/resources/library/interactive/WebBrowser.wgt/index.html @@ -1,231 +1,226 @@ + "http://www.w3.org/TR/html4/loose.dtd"> - - - Video Picker - - - - - + + + Web Browser + + + + - - + }); + -
-
- -
-
Previous
-
Next
- -
Show
-
+
+
-
-
arrow-top
- -
-
- -
- - - - - - - -
 
-
- -
- +
+
Previous
+
Next
+ +
Show
+
+ +
+
arrow-top
+ +
+
+ +
+ + + + + + + +
 
+
+ +
+ \ No newline at end of file diff --git a/resources/library/interactive/WebBrowser.wgt/scripts/jquery.oembed.js b/resources/library/interactive/WebBrowser.wgt/scripts/jquery.oembed.js deleted file mode 100644 index 827bdb80..00000000 --- a/resources/library/interactive/WebBrowser.wgt/scripts/jquery.oembed.js +++ /dev/null @@ -1,146 +0,0 @@ -(function($) { - $.fn.oembed = function(url, options) { - - options = $.extend({}, $.fn.oembed.defaults, options); - - return this.each(function() { - - var container = $(this), - target = (url != null) ? url : container.attr("href"), - provider; - - if (target != null) { - - provider = getOEmbedProvider(target); - - if (provider != null) { - provider.maxWidth = options.maxWidth; - provider.maxHeight = options.maxHeight; - - provider.embedCode(target, function(code) { container.html(code); }); - } - } - }); - }; - - // Plugin defaults - $.fn.oembed.defaults = { - maxWidth: 500, - maxHeight: 400 - }; - - $.fn.oembed.getPhotoCode = function(url, data) { - var code = '
'; - if (data.html) - code += "
" + data.html + "
"; - return code; - }; - - $.fn.oembed.getVideoCode = function(url, data) { - var code = data.html; - return code; - }; - - $.fn.oembed.getRichCode = function(url, data) { - var code = data.html; - return code; - }; - - $.fn.oembed.getGenericCode = function(url, data) { - var title = (data.title != null) ? data.title : url, - code = '' + title + ''; - if (data.html) - code += "
" + data.html + "
"; - return code; - }; - - $.fn.oembed.isAvailable = function(url) { - var provider = getOEmbedProvider(url); - return (provider != null); - }; - - /* Private Methods */ - function getOEmbedProvider(url) { - for (var i = 0; i < providers.length; i++) { - if (providers[i].matches(url)) - return providers[i]; - } - return null; - } - - var providers = [ - new OEmbedProvider("fivemin", "5min.com"), - new OEmbedProvider("amazon", "amazon.com"), - new OEmbedProvider("flickr", "flickr", "http://flickr.com/services/oembed", "jsoncallback"), - new OEmbedProvider("googlevideo", "video.google."), - new OEmbedProvider("hulu", "hulu.com"), - new OEmbedProvider("imdb", "imdb.com"), - new OEmbedProvider("metacafe", "metacafe.com"), - new OEmbedProvider("qik", "qik.com"), - new OEmbedProvider("revision3", "slideshare"), - new OEmbedProvider("slideshare", "5min.com"), - new OEmbedProvider("twitpic", "twitpic.com"), - new OEmbedProvider("viddler", "viddler.com"), - new OEmbedProvider("vimeo", "vimeo.com", "http://vimeo.com/api/oembed.json"), - new OEmbedProvider("wikipedia", "wikipedia.org"), - new OEmbedProvider("wordpress", "wordpress.com"), - new OEmbedProvider("youtube", "youtube.com") - ]; - - function OEmbedProvider(name, urlPattern, oEmbedUrl, callbackparameter) { - this.name = name; - this.urlPattern = urlPattern; - this.oEmbedUrl = (oEmbedUrl != null) ? oEmbedUrl : "http://oohembed.com/oohembed/"; - this.callbackparameter = (callbackparameter != null) ? callbackparameter : "callback"; - this.maxWidth = 500; - this.maxHeight = 400; - - this.matches = function(externalUrl) { - // TODO: Convert to Regex - return externalUrl.indexOf(this.urlPattern) >= 0; - }; - - this.getRequestUrl = function(externalUrl) { - - var url = this.oEmbedUrl; - - if (url.indexOf("?") <= 0) - url = url + "?"; - - url += "maxwidth=" + this.maxWidth + - "&maxHeight=" + this.maxHeight + - "&format=json" + - "&url=" + escape(externalUrl) + - "&" + this.callbackparameter + "=?"; - return url; - } - - this.embedCode = function(externalUrl, embedCallback) { - - var request = this.getRequestUrl(externalUrl); - - $.getJSON(request, function(data) { - - var code, type = data.type; - - switch (type) { - case "photo": - code = $.fn.oembed.getPhotoCode(externalUrl, data); - break; - case "video": - code = $.fn.oembed.getVideoCode(externalUrl, data); - break; - case "rich": - code = $.fn.oembed.getRichCode(externalUrl, data); - break; - default: - code = $.fn.oembed.getGenericCode(externalUrl, data); - break; - } - - embedCallback(code); - }); - } - } -})(jQuery); -