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
41d31151
Commit
41d31151
authored
Jun 26, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_no_style: it starts being interesting
parent
0cba02fd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
42 deletions
+23
-42
bt5/erp5_no_style/SkinTemplateItem/portal_skins/erp5_no_style/nostyle.js.js
...SkinTemplateItem/portal_skins/erp5_no_style/nostyle.js.js
+23
-42
No files found.
bt5/erp5_no_style/SkinTemplateItem/portal_skins/erp5_no_style/nostyle.js.js
View file @
41d31151
...
...
@@ -47,36 +47,23 @@
function
listenURLChange
()
{
var
gadget
=
this
;
function
renderPage
()
{
return
new
RSVP
.
Queue
(
ajax
(
window
.
location
.
href
))
.
push
(
function
(
xhr
)
{
console
.
log
(
xhr
);
var
doc
=
(
new
DOMParser
()).
parseFromString
(
xhr
.
responseText
,
'
text/html
'
);
return
gadget
.
getDeclaredGadget
(
'
renderer
'
)
.
push
(
function
(
style_gadget
)
{
console
.
log
(
doc
.
documentElement
.
outerHTML
);
console
.
log
(
doc
.
body
);
return
style_gadget
.
render
(
doc
.
body
.
querySelector
(
'
main
'
).
innerHTML
);
});
// console.log('reload page ' + window.location.href);
// window.location.reload();
function
renderPage
(
page_url
)
{
return
new
RSVP
.
Queue
(
RSVP
.
hash
({
xhr
:
ajax
(
page_url
),
style_gadget
:
gadget
.
getDeclaredGadget
(
'
renderer
'
)
}))
.
push
(
function
(
result_dict
)
{
var
dom_parser
=
(
new
DOMParser
()).
parseFromString
(
result_dict
.
xhr
.
responseText
,
'
text/html
'
);
return
result_dict
.
style_gadget
.
render
(
dom_parser
.
body
.
querySelector
(
'
main
'
).
innerHTML
);
})
.
push
(
function
()
{
window
.
scrollTo
(
0
,
0
);
});
}
function
handlePopState
()
{
// console.log(evt);
// alert('couscous');
/*
return new RSVP.Queue()
.push(function () {
return extractHashAndDispatch(evt);
});
*/
console
.
log
(
'
pop state reload
'
);
return
renderPage
();
return
renderPage
(
window
.
location
.
href
);
}
function
handleClick
(
evt
)
{
...
...
@@ -104,27 +91,21 @@
}
evt
.
preventDefault
();
window
.
history
.
pushState
(
null
,
null
,
target_element
.
href
);
console
.
log
(
'
push state reload
'
);
return
renderPage
();
return
renderPage
(
target_element
.
href
)
.
push
(
function
()
{
window
.
history
.
pushState
(
null
,
null
,
target_element
.
href
);
},
function
()
{
// Implement support for managed error
// (like URL is not an HTML document parsable)
// and redirect in such case
window
.
location
=
target_element
.
href
;
});
}
var
result
=
RSVP
.
all
([
return
RSVP
.
all
([
loopEventListener
(
window
,
'
popstate
'
,
false
,
handlePopState
,
false
),
loopEventListener
(
document
.
documentElement
,
'
click
'
,
false
,
handleClick
,
false
),
]);
/*
window.history.onpushstate(function () {
alert('nutnut');
});
*/
/*
event = document.createEvent("Event");
event.initEvent('hashchange', true, true);
event.newURL = window.location.toString();
window.dispatchEvent(event);
*/
return
result
;
}
rJS
(
window
)
...
...
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