Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
renderjs
Commits
e6d89778
Commit
e6d89778
authored
Jun 07, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switched to using addGadget() in filecontent.js
parent
5e269eda
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
61 deletions
+21
-61
gadget/filebrowser_and_preview.js
gadget/filebrowser_and_preview.js
+0
-11
gadget/filecontent.js
gadget/filecontent.js
+8
-29
gadget/preview.js
gadget/preview.js
+0
-7
renderjs.js
renderjs.js
+13
-14
No files found.
gadget/filebrowser_and_preview.js
View file @
e6d89778
...
...
@@ -88,17 +88,6 @@
});
}
});
// var frames = document.getElementsByTagName("iframe"), frame, i;
// for (i = 0; i < frames.length; i += 1) {
// frame = frames[i];
// if (myIndexOf(
// event.source.location.pathname,
// frame.getAttribute("src").split("?")[0]
// ) < 0) {
// frame.contentWindow.postMessage(event.data, "*");
// }
// }
}
};
...
...
gadget/filecontent.js
View file @
e6d89778
...
...
@@ -8,19 +8,6 @@
sessionStorage
.
setItem
(
"
cous
"
,
"
cous
"
);
sessionStorage
.
setItem
(
"
schnick
"
,
"
schnack
"
);
var
generateUuid
=
function
()
{
var
S4
=
function
()
{
var
i
,
string
=
Math
.
floor
(
Math
.
random
()
*
0x10000
).
toString
(
16
);
for
(
i
=
string
.
length
;
i
<
4
;
i
+=
1
)
{
string
=
"
0
"
+
string
;
}
return
string
;
};
return
S4
()
+
S4
();
};
var
setup
=
function
()
{
// this will have to run automatically should renderJs have an easy API
var
instance1
=
"
data://application/hal+json;base64,
"
+
...
...
@@ -42,23 +29,15 @@
call
:
{
href
:
''
}
}}));
$
(
"
body
"
).
append
(
'
<iframe src="
'
+
// XXX Hardcoded gadget to load
'
filebrowser_and_preview.html
'
+
"
?file=
"
+
instance1
+
'
" id="
'
+
generateUuid
()
+
'
">
'
+
'
<p>Your browser does not support iframes.</p>
'
+
'
</iframe">
'
);
$
(
"
body
"
).
addGadget
({
"
src
"
:
"
filebrowser_and_preview.html?file=
"
+
instance1
,
"
iframe
"
:
"
true
"
});
$
(
"
body
"
).
append
(
'
<iframe src="
'
+
// XXX Hardcoded gadget to load
'
filebrowser_and_preview.html
'
+
"
?file=
"
+
instance2
+
'
" id="
'
+
generateUuid
()
+
'
">
'
+
'
<p>Your browser does not support iframes.</p>
'
+
'
</iframe">
'
);
$
(
"
body
"
).
addGadget
({
"
src
"
:
"
filebrowser_and_preview.html?file=
"
+
instance2
,
"
iframe
"
:
"
true
"
});
};
$
(
document
).
ready
(
function
()
{
...
...
gadget/preview.js
View file @
e6d89778
// > grab URL with parameters of file to open
// > call addGadget with those parameters?
// > display a file from some storage (local/session)
// > storage type will also be a parameter in the url?
// return "browser://localstorage/foo"
// file=browser%3A%2F%2Flocalstorage%2Ffoo
/*global document, jQuery */
"
use strict
"
;
(
function
(
document
,
$
)
{
...
...
renderjs.js
View file @
e6d89778
...
...
@@ -914,15 +914,13 @@
// find recursive services
$
(
newParentElement
).
findService
();
}
else
{
//
IFRAME handler
//
=============== IFRAME ==================
newHTML
=
document
.
createElement
(
"
iframe
"
);
newHTML
.
setAttribute
(
"
src
"
,
options
.
src
+
"
?base=
"
+
priv
.
encodeURI
(
options
.
directory
.
root
)
);
newHTML
.
setAttribute
(
"
src
"
,
options
.
src
);
newHTML
.
setAttribute
(
"
frameborder
"
,
0
);
newHTML
.
setAttribute
(
"
seamless
"
,
"
seamless
"
);
newHTML
.
setAttribute
(
"
id
"
,
options
.
id
);
newHTML
.
innerHTML
=
'
<p>Your browser does not support iframes.</p>
'
// append or replace
if
(
options
.
wrapper
)
{
...
...
@@ -988,15 +986,15 @@
// => publish a service to this instance (and root instance)
that
.
addService
=
$
.
fn
.
addService
=
function
(
options
)
{
var
adressArray
=
window
.
location
.
href
.
split
(
"
?
"
),
targetUrl
;
options
.
src
=
options
.
src
||
adressArray
[
0
];
var
ad
d
ressArray
=
window
.
location
.
href
.
split
(
"
?
"
),
targetUrl
;
options
.
src
=
options
.
src
||
ad
d
ressArray
[
0
];
// posts to URL passed (need for CORS?)
// otherwise window.top.location.href) would also work
if
(
adressArray
.
length
===
1
)
{
targetUrl
=
priv
.
decodeURI
(
adressArray
[
0
]);
if
(
ad
d
ressArray
.
length
===
1
)
{
targetUrl
=
priv
.
decodeURI
(
ad
d
ressArray
[
0
]);
}
else
{
targetUrl
=
priv
.
decodeURI
(
adressArray
[
1
].
split
(
"
=
"
)[
1
]);
targetUrl
=
priv
.
decodeURI
(
ad
d
ressArray
[
1
].
split
(
"
=
"
)[
1
]);
}
window
.
top
.
postMessage
(
options
,
targetUrl
);
};
...
...
@@ -1029,10 +1027,11 @@
// => load gadget
that
.
addGadget
=
$
.
fn
.
addGadget
=
function
(
options
)
{
var
adressArray
=
window
.
location
.
href
.
split
(
"
?
"
);
var
addressArray
=
window
.
location
.
href
.
split
(
"
?
"
),
element
=
this
[
0
];
// set parent
if
(
this
[
0
]
===
document
||
this
[
0
]
===
window
)
{
if
(
element
===
document
||
element
===
window
||
element
===
document
.
body
)
{
options
.
parent
=
document
.
body
;
options
.
replaceParent
=
false
;
}
else
{
...
...
@@ -1046,9 +1045,9 @@
// set directory (root)
// if no ?-param is available, we can only set to href
if
(
options
.
directory
===
undefined
)
{
if
(
adressArray
.
length
>
1
)
{
if
(
ad
d
ressArray
.
length
>
1
)
{
options
.
directory
=
{
"
root
"
:
priv
.
decodeURI
(
adressArray
[
1
].
split
(
"
=
"
)[
1
])
"
root
"
:
priv
.
decodeURI
(
ad
d
ressArray
[
1
].
split
(
"
=
"
)[
1
])
};
}
else
{
options
.
directory
=
{
...
...
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