Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ardublockly
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ardublockly
Commits
4b550b9d
Commit
4b550b9d
authored
Apr 30, 2015
by
Neil Fraser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch from iframe to overlay in resize demo.
parent
f454f779
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
111 additions
and
62 deletions
+111
-62
demos/iframe/frame.html
demos/iframe/frame.html
+0
-41
demos/index.html
demos/index.html
+3
-3
demos/resizable/icon.png
demos/resizable/icon.png
+0
-0
demos/resizable/index.html
demos/resizable/index.html
+17
-18
demos/resizable/overlay.html
demos/resizable/overlay.html
+91
-0
No files found.
demos/iframe/frame.html
deleted
100644 → 0
View file @
f454f779
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<script
src=
"../../blockly_compressed.js"
></script>
<script
src=
"../../blocks_compressed.js"
></script>
<script
src=
"../../msg/js/en.js"
></script>
<style>
html
,
body
{
background-color
:
#fff
;
margin
:
0
;
padding
:
0
;
overflow
:
hidden
;
height
:
100%
;
}
.blocklySvg
{
height
:
100%
;
width
:
100%
;
}
</style>
<script>
function
init
()
{
Blockly
.
inject
(
document
.
body
,
{
toolbox
:
document
.
getElementById
(
'
toolbox
'
)});
// Let the top-level application know that Blockly is ready.
window
.
parent
.
blocklyLoaded
(
Blockly
);
}
</script>
</head>
<body
onload=
"init()"
>
<xml
id=
"toolbox"
style=
"display: none"
>
<block
type=
"controls_if"
></block>
<block
type=
"logic_compare"
></block>
<block
type=
"controls_repeat_ext"
></block>
<block
type=
"math_number"
></block>
<block
type=
"math_arithmetic"
></block>
<block
type=
"text"
></block>
<block
type=
"text_print"
></block>
</xml>
</body>
</html>
demos/index.html
View file @
4b550b9d
...
...
@@ -42,12 +42,12 @@
<tr>
<td>
<a
href=
"
ifram
e/index.html"
>
<img
src=
"
ifram
e/icon.png"
height=
80
width=
100
>
<a
href=
"
resizabl
e/index.html"
>
<img
src=
"
resizabl
e/icon.png"
height=
80
width=
100
>
</a>
</td>
<td>
<div><a
href=
"
ifram
e/index.html"
>
Resizable Blockly
</a></div>
<div><a
href=
"
resizabl
e/index.html"
>
Resizable Blockly
</a></div>
<div>
Inject Blockly into a page as a resizable element.
</div>
</td>
</tr>
...
...
demos/
ifram
e/icon.png
→
demos/
resizabl
e/icon.png
View file @
4b550b9d
File moved
demos/
ifram
e/index.html
→
demos/
resizabl
e/index.html
View file @
4b550b9d
...
...
@@ -2,52 +2,51 @@
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Blockly Demo:
Iframe Blockly
</title>
<title>
Blockly Demo:
Resizable Blockly (Part 1)
</title>
<style>
html
,
body
{
height
:
100%
;
margin
:
0
;
}
body
{
background-color
:
#fff
;
font-family
:
sans-serif
;
margin-top
:
0
;
margin-bottom
:
0
;
overflow
:
hidden
;
}
h1
{
font-weight
:
normal
;
font-size
:
140%
;
}
iframe
{
width
:
100%
;
table
{
height
:
100%
;
border
:
none
;
width
:
100%
;
}
#blocklyArea
{
height
:
99%
;
background
:
#fc9
;
text-align
:
center
;
}
</style>
</head>
<body>
<table
width=
"100%"
height=
"99%"
>
<table>
<tr>
<td>
<h1><a
href=
"https://developers.google.com/blockly/"
>
Blockly
</a>
>
<a
href=
"../index.html"
>
Demos
</a>
>
Iframe Blockly
</h1>
<a
href=
"../index.html"
>
Demos
</a>
>
Resizable Blockly (Part 1)
</h1>
<p>
This is a simple demo of injecting Blockly into a resizable 'iframe' element.
</p>
<p>
The first step in creating a resizable Blockly workspace is to use
CSS or tables to create an area for it.
Next,
<a
href=
"overlay.html"
>
inject Blockly
</a>
over that area.
</p>
<p>
→
More info on
<a
href=
"https://developers.google.com/blockly/installation/injecting-resizable"
>
injecting resizable Blockly
</a>
...
</p>
</td>
</tr>
<tr>
<td
height=
"99%"
>
<script>
function
blocklyLoaded
(
blockly
)
{
// Called once Blockly is fully loaded.
window
.
Blockly
=
blockly
;
}
</script>
<iframe
src=
"frame.html"
></iframe>
<td
id=
"blocklyArea"
>
Blockly will be positioned here.
</td>
</tr>
</table>
</body>
</html>
demos/resizable/overlay.html
0 → 100644
View file @
4b550b9d
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
>
<title>
Blockly Demo: Resizable Blockly (Part 2)
</title>
<script
src=
"../../blockly_compressed.js"
></script>
<script
src=
"../../blocks_compressed.js"
></script>
<script
src=
"../../msg/js/en.js"
></script>
<style>
html
,
body
{
height
:
100%
;
margin
:
0
;
}
body
{
background-color
:
#fff
;
font-family
:
sans-serif
;
overflow
:
hidden
;
}
h1
{
font-weight
:
normal
;
font-size
:
140%
;
}
table
{
height
:
100%
;
width
:
100%
;
}
#blocklyArea
{
height
:
99%
;
}
</style>
</head>
<body>
<table>
<tr>
<td>
<h1><a
href=
"https://developers.google.com/blockly/"
>
Blockly
</a>
>
<a
href=
"../index.html"
>
Demos
</a>
>
Resizable Blockly (Part 2)
</h1>
<p>
Once an
<a
href=
"index.html"
>
area is defined
</a>
, Blockly can be
injected and positioned over the area.
A resize handler keeps it in position as the page changes.
</p>
<p>
→
More info on
<a
href=
"https://developers.google.com/blockly/installation/injecting-resizable"
>
injecting resizable Blockly
</a>
...
</p>
</td>
</tr>
<tr>
<td
id=
"blocklyArea"
>
</td>
</tr>
</table>
<div
id=
"blocklyDiv"
style=
"position: absolute"
></div>
<xml
id=
"toolbox"
style=
"display: none"
>
<block
type=
"controls_if"
></block>
<block
type=
"logic_compare"
></block>
<block
type=
"controls_repeat_ext"
></block>
<block
type=
"math_number"
></block>
<block
type=
"math_arithmetic"
></block>
<block
type=
"text"
></block>
<block
type=
"text_print"
></block>
</xml>
<script>
var
blocklyArea
=
document
.
getElementById
(
'
blocklyArea
'
);
var
blocklyDiv
=
document
.
getElementById
(
'
blocklyDiv
'
);
var
workspace
=
Blockly
.
inject
(
blocklyDiv
,
{
toolbox
:
document
.
getElementById
(
'
toolbox
'
)});
var
onresize
=
function
(
e
)
{
// Compute the absolute coordinates and dimensions of blocklyArea.
var
element
=
blocklyArea
;
var
x
=
0
;
var
y
=
0
;
do
{
x
+=
element
.
offsetLeft
;
y
+=
element
.
offsetTop
;
element
=
element
.
offsetParent
;
}
while
(
element
);
// Position blocklyDiv over blocklyArea.
blocklyDiv
.
style
.
left
=
x
+
'
px
'
;
blocklyDiv
.
style
.
top
=
y
+
'
px
'
;
blocklyDiv
.
style
.
width
=
blocklyArea
.
offsetWidth
+
'
px
'
;
blocklyDiv
.
style
.
height
=
blocklyArea
.
offsetHeight
+
'
px
'
;
};
window
.
addEventListener
(
'
resize
'
,
onresize
,
false
);
onresize
();
</script>
</body>
</html>
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