Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
2d60b8f3
Commit
2d60b8f3
authored
Aug 09, 2011
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating web-browser, notes and calculator
parent
42a7fef6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
855 additions
and
878 deletions
+855
-878
index.html
resources/library/interactive/Calculator.wgt/index.html
+28
-28
ubw-main.js
resources/library/interactive/Calculator.wgt/js/ubw-main.js
+454
-333
ubw-main.js
resources/library/interactive/Notes.wgt/js/ubw-main.js
+177
-170
index.html
resources/library/interactive/WebBrowser.wgt/index.html
+196
-201
jquery.oembed.js
...brary/interactive/WebBrowser.wgt/scripts/jquery.oembed.js
+0
-146
No files found.
resources/library/interactive/Calculator.wgt/index.html
View file @
2d60b8f3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title>
ubwidget
</title>
<script
src=
"js/jquery-1.3.2.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery-ui-1.7.2.custom.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.disable.text.select.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.center.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.ubwidget.js"
type=
"text/javascript"
></script>
<script
src=
"js/DD_roundies_0.0.2a.js"
type=
"text/javascript"
></script>
<script
src=
"js/ubw-main.js"
type=
"text/javascript"
></script>
<script
src=
"js/calculate.js"
type=
"text/javascript"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/ubwidget.css"
/>
</head>
<body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
init
();
});
</script>
<div
id=
"ubwidget"
></div>
</body>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<title>
ubwidget
</title>
<script
src=
"js/jquery-1.3.2.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery-ui-1.7.2.custom.min.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.disable.text.select.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.center.js"
type=
"text/javascript"
></script>
<script
src=
"js/jquery.ubwidget.js"
type=
"text/javascript"
></script>
<script
src=
"js/DD_roundies_0.0.2a.js"
type=
"text/javascript"
></script>
<script
src=
"js/ubw-main.js"
type=
"text/javascript"
></script>
<script
src=
"js/calculate.js"
type=
"text/javascript"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/ubwidget.css"
/>
</head>
<body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
init
();
});
</script>
<div
id=
"ubwidget"
></div>
</body>
</html>
\ No newline at end of file
resources/library/interactive/Calculator.wgt/js/ubw-main.js
View file @
2d60b8f3
...
...
@@ -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
=
$
(
"<div></div>"
)
.
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
=
$
(
"<div></div>"
)
.
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
=
$
(
"<div></div>"
);
space
.
css
({
width
:
5
,
height
:
1
,
float
:
"left"
});
var
space
=
$
(
"<div></div>"
);
space
.
css
({
width
:
5
,
height
:
1
,
float
:
"left"
});
var
keysPanel
=
$
(
"<div id='keysPanel'></div>"
).
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
=
$
(
"<div id='keysPanel'></div>"
).
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
=
$
(
"<div id='display'>0</div>"
)
.
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
=
$
(
"<div id='display'>0</div>"
)
.
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
=
$
(
"<div></div>"
).
css
({
float
:
"left"
});
var
standardPanel
=
$
(
"<div></div>"
).
css
({
float
:
"left"
});
var
cKeySize
=
{
w
:
33
,
h
:
36
};
var
cKeySize
=
{
w
:
33
,
h
:
36
};
var
btn7
=
$
(
"<div><img src='images/touche7.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"7"
,
1
)});
var
btn8
=
$
(
"<div><img src='images/touche8.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"8"
,
1
)});
var
btn9
=
$
(
"<div><img src='images/touche9.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"9"
,
1
)});
var
btnDiv
=
$
(
"<div><img src='images/touchediv.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"/"
,
0
)});
var
btn4
=
$
(
"<div><img src='images/touche4.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"4"
,
1
)});
var
btn5
=
$
(
"<div><img src='images/touche5.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"5"
,
1
)});
var
btn6
=
$
(
"<div><img src='images/touche6.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"6"
,
1
)});
var
btnMul
=
$
(
"<div><img src='images/touchef.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"*"
,
0
)});
var
btn1
=
$
(
"<div><img src='images/touche1.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"1"
,
1
)});
var
btn2
=
$
(
"<div><img src='images/touche2.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"2"
,
1
)});
var
btn3
=
$
(
"<div><img src='images/touche3.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"3"
,
1
)});
var
btnSou
=
$
(
"<div><img src='images/touchem.png'/></div>"
).
ubwbutton
({
w
:
68
,
h
:
34
})
.
mousedown
(
function
(){
appendToDisplay
(
"-"
,
0
)});
var
btn0
=
$
(
"<div><img src='images/touche0.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"0"
,
1
)});
var
btnDot
=
$
(
"<div><img src='images/touchedot.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"."
,
1
)});
var
btnC
=
$
(
"<div><img src='images/touchec.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
reset
()});
var
btnAdd
=
$
(
"<div><img src='images/touchep.png'/></div>"
).
ubwbutton
({
w
:
68
,
h
:
34
})
.
mousedown
(
function
(){
appendToDisplay
(
"+"
,
0
)});
var
btnPaL
=
$
(
"<div><img src='images/touchepg.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"("
,
1
)});
var
btnPaR
=
$
(
"<div><img src='images/touchepd.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
")"
,
1
)});
var
btnEqu
=
$
(
"<div><img src='images/toucheeq.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
compute
()});
var
btn7
=
$
(
"<div><img src='images/touche7.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"7"
,
1
)
});
var
btn8
=
$
(
"<div><img src='images/touche8.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"8"
,
1
)
});
var
btn9
=
$
(
"<div><img src='images/touche9.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"9"
,
1
)
});
var
btnDiv
=
$
(
"<div><img src='images/touchediv.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"/"
,
0
)
});
var
btn4
=
$
(
"<div><img src='images/touche4.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"4"
,
1
)
});
var
btn5
=
$
(
"<div><img src='images/touche5.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"5"
,
1
)
});
var
btn6
=
$
(
"<div><img src='images/touche6.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"6"
,
1
)
});
var
btnMul
=
$
(
"<div><img src='images/touchef.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"*"
,
0
)
});
var
btn1
=
$
(
"<div><img src='images/touche1.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"1"
,
1
)
});
var
btn2
=
$
(
"<div><img src='images/touche2.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"2"
,
1
)
});
var
btn3
=
$
(
"<div><img src='images/touche3.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"3"
,
1
)
});
var
btnSou
=
$
(
"<div><img src='images/touchem.png'/></div>"
).
ubwbutton
({
w
:
68
,
h
:
34
})
.
mousedown
(
function
(){
appendToDisplay
(
"-"
,
0
)
});
var
btn0
=
$
(
"<div><img src='images/touche0.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"0"
,
1
)
});
var
btnDot
=
$
(
"<div><img src='images/touchedot.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"."
,
1
)
});
var
btnC
=
$
(
"<div><img src='images/touchec.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
reset
()
});
var
btnAdd
=
$
(
"<div><img src='images/touchep.png'/></div>"
).
ubwbutton
({
w
:
68
,
h
:
34
})
.
mousedown
(
function
(){
appendToDisplay
(
"+"
,
0
)
});
var
btnPaL
=
$
(
"<div><img src='images/touchepg.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
"("
,
1
)
});
var
btnPaR
=
$
(
"<div><img src='images/touchepd.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
appendToDisplay
(
")"
,
1
)
});
var
btnEqu
=
$
(
"<div><img src='images/toucheeq.png'/></div>"
).
ubwbutton
({
w
:
cKeySize
.
w
,
h
:
cKeySize
.
h
})
.
mousedown
(
function
(){
compute
()
});
var
historyPanel
=
$
(
"<div id='historyPanel'></div>"
)
.
css
({
backgroundImage
:
"url(images/historyback.png)"
,
width
:
"auto"
,
height
:
"auto"
,
float
:
"left"
,
marginLeft
:
3
,
marginRight
:
2
,
marginTop
:
6
})
.
hide
();
var
historyPanel
=
$
(
"<div id='historyPanel'></div>"
)
.
css
({
backgroundImage
:
"url(images/historyback.png)"
,
width
:
"auto"
,
height
:
"auto"
,
float
:
"left"
,
marginLeft
:
3
,
marginRight
:
2
,
marginTop
:
6
})
.
hide
();
var
historyBox
=
$
(
"<textarea id='historyBox'></textarea>"
)
.
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
=
$
(
"<textarea id='historyBox'></textarea>"
)
.
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
=
$
(
"<div></div>"
);
var
sleft
=
$
(
"<div></div>"
);
var
sright
=
$
(
"<div></div>"
);
var
stop
=
$
(
"<div></div>"
);
var
sleft
=
$
(
"<div></div>"
);
var
sright
=
$
(
"<div></div>"
);
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
=
$
(
"<div id='indicator'></div>"
)
.
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
();
};
resources/library/interactive/Notes.wgt/js/ubw-main.js
View file @
2d60b8f3
...
...
@@ -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
=
$
(
'<div id="head"><input id="headtitle" class="stickytitle" readonly="readonly"/></div>'
);
var
fontUp
=
$
(
'<img src="images/stick-but-aplus.png"/>'
);
var
fontDown
=
$
(
'<img src="images/stick-but-aminus.png"/>'
);
var
minimize
=
$
(
'<img src="images/stick-but-minimize.png"/>'
);
var
maximize
=
$
(
'<img src="images/stick-but-maximize.png"/>'
);
var
title
=
$
(
'<div id="menu"></div>'
);
var
textField
=
$
(
'<div id="txt"></div>'
);
var
shadow
=
$
(
"<table width='100%' height='18' border='0' cellspacing='0' cellpadding='0'><tr><td id='sl' width='139'></td><td id='sc' style='background-image:url(images/shadowcenter.png)'> </td><td id='sr' width='139'></td></tr></table>"
)
.
appendTo
(
"body"
);
var
shadowleft
=
$
(
"<img src='images/shadowleft.png'/>"
)
.
appendTo
(
$
(
"#sl"
));
var
shadowright
=
$
(
"<img src='images/shadowright.png'/>"
)
.
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
=
$
(
'<div id="head"><input id="headtitle" class="stickytitle" readonly="readonly"/></div>'
);
var
fontUp
=
$
(
'<img src="images/stick-but-aplus.png"/>'
);
var
fontDown
=
$
(
'<img src="images/stick-but-aminus.png"/>'
);
var
minimize
=
$
(
'<img src="images/stick-but-minimize.png"/>'
);
var
maximize
=
$
(
'<img src="images/stick-but-maximize.png"/>'
);
var
title
=
$
(
'<div id="menu"></div>'
);
var
textField
=
$
(
'<div id="txt"></div>'
);
var
shadow
=
$
(
"<table width='100%' height='18' border='0' cellspacing='0' cellpadding='0'><tr><td id='sl' width='139'></td><td id='sc' style='background-image:url(images/shadowcenter.png)'> </td><td id='sr' width='139'></td></tr></table>"
)
.
appendTo
(
"body"
);
var
shadowleft
=
$
(
"<img src='images/shadowleft.png'/>"
)
.
appendTo
(
$
(
"#sl"
));
var
shadowright
=
$
(
"<img src='images/shadowright.png'/>"
)
.
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
resources/library/interactive/WebBrowser.wgt/index.html
View file @
2d60b8f3
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
<title>
Video Picker
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/main.css"
>
<script
src=
"scripts/jquery-1.3.2.min.js"
type=
"text/javascript"
></script>
<script
src=
"scripts/jquery.oembed.js"
type=
"text/javascript"
></script>
<!--DEFAULT FR-->
</head>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
<title>
Web Browser
</title>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/main.css"
>
<script
src=
"scripts/jquery-1.3.2.min.js"
type=
"text/javascript"
></script>
<!--DEFAULT FR-->
</head>
<body>
<script
type=
"text/javascript"
>
<body>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
(){
//var resizer; // Timer
//var resizerIndex;
var
currentHistory
=
0
;
var
references
=
new
Array
();
var
globalWidth
=
850
;
var
globalHeight
=
700
;
var
language
;
var
url
=
""
;
var
margins
=
{
top
:
cssToInt
(
$
(
"body"
).
css
(
"margin-top"
)),
right
:
cssToInt
(
$
(
"body"
).
css
(
"margin-right"
)),
bottom
:
cssToInt
(
$
(
"body"
).
css
(
"margin-bottom"
)),
left
:
cssToInt
(
$
(
"body"
).
css
(
"margin-left"
))
};
var
loadingState
=
false
;
function
changeLoadingState
(){
loadingState
=
true
;
}
$
(
document
).
ready
(
function
(){
//var resizer; // Timer
//var resizerIndex;
var
currentHistory
=
0
;
var
references
=
new
Array
();
var
globalWidth
=
850
;
var
globalHeight
=
700
;
var
language
;
var
url
=
""
;
var
margins
=
{
top
:
cssToInt
(
$
(
"body"
).
css
(
"margin-top"
)),
right
:
cssToInt
(
$
(
"body"
).
css
(
"margin-right"
)),
bottom
:
cssToInt
(
$
(
"body"
).
css
(
"margin-bottom"
)),
left
:
cssToInt
(
$
(
"body"
).
css
(
"margin-left"
))
};
//resizerIndex = 0;
var
resizer
;
// Timer
var
resizerIndex
;
resizerIndex
=
0
;
if
(
window
.
sankore
){
url
=
window
.
sankore
.
preference
(
"url"
,
""
);
}
else
{
url
=
""
;
};
if
(
window
.
sankore
){
url
=
window
.
sankore
.
preference
(
"url"
,
""
);
}
else
{
url
=
""
;
};
language
=
navigator
.
userAgent
.
split
(
";"
);
language
=
language
[
3
].
replace
(
/
\s
/g
,
""
).
substr
(
0
,
2
);
language
=
navigator
.
userAgent
.
split
(
";"
);
language
=
language
[
3
].
replace
(
/
\s
/g
,
""
).
substr
(
0
,
2
);
$
(
"#back-button"
)
.
click
(
function
(){
if
((
currentHistory
-
1
)
>
0
){
$
(
"#textbox"
).
val
(
references
[
--
currentHistory
-
1
]);
frames
[
'web-content'
].
location
.
href
=
references
[
currentHistory
-
1
];
}
});
$
(
"#back-button"
)
.
click
(
function
(){
loadingState
=
false
;
if
((
currentHistory
-
1
)
>
0
){
$
(
"#textbox"
).
val
(
references
[
--
currentHistory
-
1
]);
$
(
"#search-button"
).
trigger
(
"click"
);
}
});
$
(
"#forward-button"
)
.
click
(
function
(){
if
(
currentHistory
<
references
.
length
)
{
$
(
"#textbox"
).
val
(
references
[
currentHistory
++
]);
frames
[
'web-content'
].
location
.
href
=
$
(
"#textbox"
).
val
();
}
});
$
(
"#forward-button"
)
.
click
(
function
(){
loadingState
=
false
;
if
(
currentHistory
<
references
.
length
)
{
$
(
"#textbox"
).
val
(
references
[
currentHistory
++
]);
$
(
"#search-button"
).
trigger
(
"click"
);
}
});
$
(
"#textbox"
).
keypress
(
function
(
e
)
{
if
(
e
.
keyCode
==
13
)
{
$
(
"#search-button"
).
trigger
(
"click"
);
}
});
$
(
"#textbox"
).
keypress
(
function
(
e
)
{
if
(
e
.
keyCode
==
13
)
{
$
(
"#search-button"
).
trigger
(
"click"
);
}
});
$
(
"#search-button"
)
.
click
(
function
(
){
if
(
$
(
"#textbox"
).
val
().
length
>
0
){
var
url
=
$
(
"#textbox"
).
val
();
var
urlStart
=
url
.
split
(
"://"
);
$
(
"#search-button"
).
click
(
function
(){
if
(
$
(
"#textbox"
).
val
().
length
>
0
){
loadingState
=
false
;
var
url
=
$
(
"#textbox"
).
val
();
var
urlStart
=
url
.
split
(
"://"
);
if
(
urlStart
[
0
]
!=
"http"
){
url
=
"http://"
+
url
;
};
if
(
urlStart
[
0
]
!=
"http"
){
url
=
"http://"
+
url
;
};
if
(
checkURLs
(
references
,
url
)){
if
(
currentHistory
==
references
.
length
)
references
[
currentHistory
++
]
=
url
;
else
references
=
insertInto
(
references
,
currentHistory
++
,
url
);
}
window
.
resizeTo
(
globalWidth
,
globalHeight
);
if
(
checkURLs
(
references
,
url
)){
if
(
currentHistory
==
references
.
length
)
references
[
currentHistory
++
]
=
url
;
else
references
=
insertInto
(
references
,
currentHistory
++
,
url
);
}
window
.
resizeTo
(
globalWidth
,
globalHeight
);
$
(
"#container"
)
.
removeClass
(
"welcome"
)
.
removeClass
(
"change"
)
.
removeClass
(
"error"
)
.
addClass
(
"load"
);
$
(
"#container-shadow"
).
hide
();
$
(
"#arrow"
).
hide
();
$
(
"#embeded-content"
).
hide
();
$
(
"#web-content"
).
show
();
frames
[
'web-content'
].
location
.
href
=
url
;
$
(
"#container"
).
removeClass
(
"welcome"
).
removeClass
(
"change"
)
.
removeClass
(
"error"
).
addClass
(
"load"
);
$
(
"#container-shadow"
).
hide
();
$
(
"#arrow"
).
hide
();
$
(
"#embeded-content"
).
hide
();
$
(
"#web-content"
).
show
();
$
(
'#web-content'
).
attr
(
'src'
,
url
);
checkcontent
();
}
else
{
$
(
"#embeded-content"
).
load
(
"locales/"
+
"en"
+
"/howto.html"
);
// Welcome screen with some explanations
$
(
"#container"
)
.
addClass
(
"welcome"
)
.
addClass
(
"change"
)
.
addClass
(
"error"
)
.
removeClass
(
"load"
);
$
(
"#container-shadow"
).
show
();
$
(
"#arrow"
).
show
();
$
(
"#embeded-content"
).
show
();
$
(
"#web-content"
).
hide
();
window
.
resizeTo
(
550
,
280
);
}
})
.
mouseenter
(
function
(){
$
(
this
)
.
addClass
(
"over"
);
})
.
mouseleave
(
function
(){
$
(
this
)
.
removeClass
(
"over"
);
});
if
(
url
.
length
>
0
){
$
(
"#textbox"
).
val
(
url
);
$
(
"#search-button"
).
trigger
(
"click"
);
}
else
{
$
(
"#embeded-content"
).
load
(
"locales/"
+
"en"
+
"/howto.html"
);
// Welcome screen with some explanations
};
/*$("#show-inputfield-button")
.click(
function(){
$("#show-area").hide();
$("#inputfield").show();
$("#shadow").show();
$("#container")
.removeClass("show")
.addClass("change");
adaptWidgetSize(18, 82);
})
.mouseenter(function(){
$(this)
.addClass("over");
})
.mouseleave(function(){
$(this)
.removeClass("over");
});*/
checkcontent
();
checkLoading
();
}
else
{
$
(
"#embeded-content"
).
load
(
"locales/"
+
"en"
+
"/howto.html"
);
// Welcome screen with some explanations
$
(
"#container"
)
.
addClass
(
"welcome"
)
.
addClass
(
"change"
)
.
addClass
(
"error"
)
.
removeClass
(
"load"
);
$
(
"#container-shadow"
).
show
();
$
(
"#arrow"
).
show
();
$
(
"#embeded-content"
).
show
();
$
(
"#web-content"
).
hide
();
window
.
resizeTo
(
550
,
280
);
}
})
.
mouseenter
(
function
(){
$
(
this
)
.
addClass
(
"over"
);
})
.
mouseleave
(
function
(){
$
(
this
)
.
removeClass
(
"over"
);
});
$
(
window
).
resize
(
function
(){
globalWidth
=
$
(
window
).
width
();
globalHeight
=
$
(
window
).
height
();
$
(
"#web-content"
)
.
attr
(
"width"
,
globalWidth
-
25
)
.
attr
(
"height"
,
globalHeight
-
90
);
});
if
(
url
.
length
>
0
){
$
(
"#textbox"
).
val
(
url
);
$
(
"#search-button"
).
trigger
(
"click"
);
}
else
{
$
(
"#embeded-content"
).
load
(
"locales/"
+
"en"
+
"/howto.html"
);
// Welcome screen with some explanations
};
$
(
window
).
resize
(
function
(){
globalWidth
=
$
(
window
).
width
();
globalHeight
=
$
(
window
).
height
();
$
(
"#web-content"
)
.
attr
(
"width"
,
globalWidth
-
25
)
.
attr
(
"height"
,
globalHeight
-
90
);
});
function
checkcontent
(){
//clearTimeout(resizer);
//resizerIndex = 0;
function
checkcontent
(){
if
(
window
.
sankore
){
window
.
sankore
.
setPreference
(
"url"
,
$
(
"#textbox"
).
val
());
};
if
(
window
.
sankore
){
window
.
sankore
.
setPreference
(
"url"
,
$
(
"#textbox"
).
val
());
};
$
(
"#embeded-content"
).
hide
();
$
(
"#container"
).
removeClass
(
"load"
).
addClass
(
"show"
);
};
$
(
"#embeded-content"
).
hide
();
$
(
"#container"
).
removeClass
(
"load"
).
addClass
(
"show"
);
};
/*function adaptWidgetSize(adjustmentX, adjustmentY){
var widgetWidth = $("#container").width() + margins.right + margins.left + adjustmentX;
var widgetHeight = $("#container").position().top + $("#container").height() + margins.bottom + adjustmentY;
window.resizeTo(widgetWidth, $(window).height());
window.resizeTo($(window).width(), widgetHeight);
};*/
function
checkLoading
(){
if
(
loadingState
){
clearTimeout
(
resizer
);
resizerIndex
=
0
;
return
false
;
};
if
(
resizerIndex
>
70
){
resizerIndex
=
0
;
$
(
"#textbox"
).
val
(
"http://www.google.com/search?q="
+
$
(
"#textbox"
).
val
().
replace
(
"http://"
,
""
));
$
(
"#search-button"
).
trigger
(
"click"
);
}
else
{
resizer
=
setTimeout
(
function
(){
checkLoading
()},
100
);
resizerIndex
++
;
};
};
function
cssToInt
(
cssvalue
){
return
(
parseInt
(
cssvalue
.
replace
(
"px"
,
""
)));
}
function
cssToInt
(
cssvalue
){
return
(
parseInt
(
cssvalue
.
replace
(
"px"
,
""
)));
}
function
checkURLs
(
arr
,
value
){
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
if
(
arr
[
i
]
==
value
)
return
false
;
return
true
;
}
function
checkURLs
(
arr
,
value
){
for
(
var
i
=
0
;
i
<
arr
.
length
;
i
++
)
if
(
arr
[
i
]
==
value
)
return
false
;
return
true
;
}
function
insertInto
(
arr
,
index
,
url
){
var
newArr
=
new
Array
();
for
(
var
i
=
0
,
j
=
0
;
i
<
arr
.
length
;
i
++
,
j
++
)
if
(
i
==
index
-
1
){
newArr
[
j
]
=
arr
[
i
];
newArr
[
++
j
]
=
url
;
}
else
newArr
[
j
]
=
arr
[
i
];
return
newArr
;
}
function
insertInto
(
arr
,
index
,
url
){
var
newArr
=
new
Array
();
for
(
var
i
=
0
,
j
=
0
;
i
<
arr
.
length
;
i
++
,
j
++
)
if
(
i
==
index
-
1
){
newArr
[
j
]
=
arr
[
i
];
newArr
[
++
j
]
=
url
;
}
else
newArr
[
j
]
=
arr
[
i
];
return
newArr
;
}
});
</script>
});
</script>
<div
id=
"ubwidget"
>
<div
id=
"shadow"
></div>
<div
id=
"inputfield"
>
<div
id=
"back-button"
class=
"button"
>
Previous
</div>
<div
id=
"forward-button"
class=
"button"
>
Next
</div>
<input
id=
"textbox"
type=
"text"
>
<div
id=
"search-button"
class=
"button"
>
Show
</div>
</div>
<div
id=
"ubwidget"
>
<div
id=
"shadow"
></div>
<div
id=
"container"
class=
"welcome"
>
<div
id=
"arrow"
><img
src=
"imgs/arrow.png"
alt=
"arrow-top"
></div>
<div
id=
"show-container"
>
<div
id=
"embeded-content"
></div>
<iframe
id=
"web-content"
name=
"web-content"
src=
""
scrolling=
auto
frameborder=
1
></iframe>
</div>
<table
cellspacing=
"0"
cellpadding=
"0"
id=
"container-shadow"
>
<tr>
<td
id=
"shadow-left"
></td>
<td
id=
"shadow-center"
>
</td>
<td
id=
"shadow-right"
></td>
</tr>
</table>
</div>
</div>
</body>
<div
id=
"inputfield"
>
<div
id=
"back-button"
class=
"button"
>
Previous
</div>
<div
id=
"forward-button"
class=
"button"
>
Next
</div>
<input
id=
"textbox"
type=
"text"
>
<div
id=
"search-button"
class=
"button"
>
Show
</div>
</div>
<div
id=
"container"
class=
"welcome"
>
<div
id=
"arrow"
><img
src=
"imgs/arrow.png"
alt=
"arrow-top"
></div>
<div
id=
"show-container"
>
<div
id=
"embeded-content"
></div>
<iframe
id=
"web-content"
name=
"web-content"
src=
""
scrolling=
auto
frameborder=
1
onload=
"changeLoadingState()"
></iframe>
</div>
<table
cellspacing=
"0"
cellpadding=
"0"
id=
"container-shadow"
>
<tr>
<td
id=
"shadow-left"
></td>
<td
id=
"shadow-center"
>
</td>
<td
id=
"shadow-right"
></td>
</tr>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
resources/library/interactive/WebBrowser.wgt/scripts/jquery.oembed.js
deleted
100644 → 0
View file @
42a7fef6
(
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
=
'<div><a href="'
+
url
+
'" target="_blank"><img src="'
+
data
.
url
+
'"/></a></div>'
;
if
(
data
.
html
)
code
+=
"<div>"
+
data
.
html
+
"</div>"
;
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
=
'<a href="'
+
url
+
'">'
+
title
+
'</a>'
;
if
(
data
.
html
)
code
+=
"<div>"
+
data
.
html
+
"</div>"
;
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
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment