Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
961b9922
Commit
961b9922
authored
Jan 30, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_xhtml_style: 0.22
parent
8bb6f285
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
2 deletions
+31
-2
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js
...TemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js
+31
-2
No files found.
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js
View file @
961b9922
...
@@ -2103,7 +2103,8 @@ if (typeof document.contains !== 'function') {
...
@@ -2103,7 +2103,8 @@ if (typeof document.contains !== 'function') {
(
new
DOMParser
()).
parseFromString
(
xhr
.
responseText
,
"
text/html
"
);
(
new
DOMParser
()).
parseFromString
(
xhr
.
responseText
,
"
text/html
"
);
parsed_html
=
renderJS
.
parseGadgetHTMLDocument
(
parsed_html
=
renderJS
.
parseGadgetHTMLDocument
(
tmp_constructor
.
__template_element
,
tmp_constructor
.
__template_element
,
url
url
,
true
);
);
for
(
key
in
parsed_html
)
{
for
(
key
in
parsed_html
)
{
if
(
parsed_html
.
hasOwnProperty
(
key
))
{
if
(
parsed_html
.
hasOwnProperty
(
key
))
{
...
@@ -2208,7 +2209,8 @@ if (typeof document.contains !== 'function') {
...
@@ -2208,7 +2209,8 @@ if (typeof document.contains !== 'function') {
// renderJS.parseGadgetHTMLDocument
// renderJS.parseGadgetHTMLDocument
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
renderJS
.
parseGadgetHTMLDocument
=
renderJS
.
parseGadgetHTMLDocument
=
function
parseGadgetHTMLDocument
(
document_element
,
url
)
{
function
parseGadgetHTMLDocument
(
document_element
,
url
,
update_relative_url
)
{
var
settings
=
{
var
settings
=
{
title
:
""
,
title
:
""
,
interface_list
:
[],
interface_list
:
[],
...
@@ -2218,12 +2220,20 @@ if (typeof document.contains !== 'function') {
...
@@ -2218,12 +2220,20 @@ if (typeof document.contains !== 'function') {
},
},
i
,
i
,
element
,
element
,
element_list
,
j
,
url_attribute_list
=
[
'
src
'
,
'
href
'
,
'
srcset
'
],
url_attribute
,
base_found
=
false
;
base_found
=
false
;
if
(
!
url
||
!
isAbsoluteOrDataURL
.
test
(
url
))
{
if
(
!
url
||
!
isAbsoluteOrDataURL
.
test
(
url
))
{
throw
new
Error
(
"
The url should be absolute:
"
+
url
);
throw
new
Error
(
"
The url should be absolute:
"
+
url
);
}
}
if
(
update_relative_url
===
undefined
)
{
update_relative_url
=
false
;
}
if
(
document_element
.
nodeType
===
9
)
{
if
(
document_element
.
nodeType
===
9
)
{
settings
.
title
=
document_element
.
title
;
settings
.
title
=
document_element
.
title
;
...
@@ -2264,6 +2274,25 @@ if (typeof document.contains !== 'function') {
...
@@ -2264,6 +2274,25 @@ if (typeof document.contains !== 'function') {
}
}
}
}
}
}
if
(
update_relative_url
&&
(
document_element
.
body
!==
null
))
{
// Resolve all relativeurl configure in the dom as absolute from
// the gadget url
for
(
j
=
0
;
j
<
url_attribute_list
.
length
;
j
+=
1
)
{
url_attribute
=
url_attribute_list
[
j
];
element_list
=
document_element
.
body
.
querySelectorAll
(
'
[
'
+
url_attribute
+
'
]
'
);
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
element
=
element_list
[
i
];
element
.
setAttribute
(
url_attribute
,
renderJS
.
getAbsoluteURL
(
element
.
getAttribute
(
url_attribute
),
settings
.
path
));
}
}
}
}
else
{
}
else
{
throw
new
Error
(
"
The first parameter should be an HTMLDocument
"
);
throw
new
Error
(
"
The first parameter should be an HTMLDocument
"
);
}
}
...
...
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