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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
f0c19999
Commit
f0c19999
authored
Aug 24, 2015
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: update to renderjs 0.7.5
parent
ab9e6e69
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
109 additions
and
254 deletions
+109
-254
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
...s_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
+109
-254
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
View file @
f0c19999
...
...
@@ -769,137 +769,81 @@ if (typeof document.contains !== \'function\') {\n
}\n
}\n
;/*!
RenderJs
*/\n
/*global
console*/\n
/*jslint
nomen:
true*/\n
function
loopEventListener(target,
type,
useCapture,
callback)
{\n
"use
strict";\n
//////////////////////////\n
//
Infinite
event
listener
(promise
is
never
resolved)\n
//
eventListener
is
removed
when
promise
is
cancelled/rejected\n
//////////////////////////\n
var
handle_event_callback,\n
callback_promise;\n
\n
function
cancelResolver()
{\n
if
((callback_promise
!==
undefined)
&&\n
(typeof
callback_promise.cancel =
==
"function"))
{\n
callback_promise.cancel();\n
}\n
}\n
\n
function
canceller()
{\n
if
(handle_event_callback
!==
undefined)
{\n
target.removeEventListener(type,
handle_event_callback,
useCapture);\n
}\n
cancelResolver();\n
}\n
function
itsANonResolvableTrap(resolve,
reject)
{\n
\n
handle_event_callback =
function
(evt)
{\n
evt.stopPropagation();\n
evt.preventDefault();\n
cancelResolver();\n
callback_promise =
new
RSVP.Queue()\n
.push(function
()
{\n
return
callback(evt);\n
})\n
.push(undefined,
function
(error)
{\n
if
(!(error
instanceof
RSVP.CancellationError))
{\n
canceller();\n
reject(error);\n
}\n
});\n
};\n
\n
target.addEventListener(type,
handle_event_callback,
useCapture);\n
}\n
return
new
RSVP.Promise(itsANonResolvableTrap,
canceller);\n
}\n
\n
/*\n
*
renderJs
-
Generic
Gadget
library
renderer.\n
*
http://www.renderjs.org/documentation\n
*/\n
(function
(document,
window,
RSVP,
DOMParser,
Channel,
MutationObserver,\n
Node)
{\n
Node
,
FileReader,
Blob
)
{\n
"use
strict";\n
\n
var
gadget_model_dict =
{},\n
javascript_registration_dict =
{},\n
stylesheet_registration_dict =
{},\n
gadget_loading_klass,\n
loading_klass_promise,\n
renderJS,\n
Monitor;\n
\n
/////////////////////////////////////////////////////////////////\n
//
Helper
functions\n
/////////////////////////////////////////////////////////////////\n
function
listenHashChange(gadget)
{\n
\n
function
extractHashAndDispatch(evt)
{\n
var
hash =
(evt.newURL
||
window.location.toString()).split(\'#\')[1],\n
subhashes,\n
subhash,\n
keyvalue,\n
index,\n
options =
{};\n
if
(
hash =
==
undefined)
{\n
hash =
""
;\n
}
else
{\n
hash =
hash.split(\'?\')[0];\n
function
readBlobAsDataURL(blob)
{\n
var
fr =
new
FileReader();\n
return
new
RSVP.Promise(function
(resolve,
reject)
{\n
fr.addEventListener("load",
function
(evt)
{\n
resolve(evt.target.result);\n
});\n
fr.addEventListener("error",
reject);\n
fr.readAsDataURL(blob);\n
},
function
()
{\n
fr.abort();\n
});\n
}\n
\n
function
optionalize(key,
value,
dict)
{\n
var
key_list =
key.split("."),\n
kk,\n
i;\n
for
(
i =
0;
i
<
key_list.length;
i
+=
1)
{\n
kk =
key_list[i];\n
if
(
i =
==
key_list.length
-
1)
{\n
dict[kk]
=
value;\n
function
ajax(url)
{\n
var
xhr;\n
function
resolver(resolve,
reject)
{\n
function
handler()
{\n
try
{\n
if
(
xhr.readyState =
==
0)
{\n
//
UNSENT\n
reject(xhr);\n
}
else
if
(
xhr.readyState =
==
4)
{\n
//
DONE\n
if
((xhr.status
<
200)
||
(xhr.status
>
= 300) ||\n
(!/^text\\/html[;]?/.test(\n
xhr.getResponseHeader("Content-Type") || ""\n
))) {\n
reject(xhr);\n
} else {\n
if
(!dict.hasOwnProperty(kk))
{\n
dict[kk]
=
{};\n
resolve(xhr);\n
}\n
dict =
dict[kk];\n
}\n
} catch (e) {\n
reject(e);\n
}\n
}\n
\n
subhashes =
hash.split(\'&\');\n
for
(index
in
subhashes)
{\n
if
(subhashes.hasOwnProperty(index))
{\n
subhash =
subhashes[index];\n
if
(subhash
!==
\'\')
{\n
keyvalue =
subhash.split(\'=\');\n
if
(
keyvalue.length =
==
2)
{\n
\n
optionalize(decodeURIComponent(keyvalue[0]),\n
decodeURIComponent(keyvalue[1]),\n
options);\n
\n
}\n
}\n
}\n
xhr = new XMLHttpRequest();\n
xhr.open("GET", url);\n
xhr.onreadystatechange = handler;\n
xhr.setRequestHeader(\'Accept\', \'text/html\');\n
xhr.withCredentials = true;\n
xhr.send();\n
}\n
\n
if
(gadget.render
!==
undefined)
{\n
return
gadget.render(options);\n
function canceller() {\n
if ((xhr !== undefined)
&&
(xhr.readyState !== xhr.DONE)) {\n
xhr.abort();\n
}\n
}\n
\n
var
result =
loopEventListener(window,
\'hashchange\',
false,\n
extractHashAndDispatch),\n
event =
document.createEvent("Event");\n
\n
event.initEvent(\'hashchange\',
true,
true);\n
event.newURL =
window.location.toString();\n
window.dispatchEvent(event);\n
return
result;\n
return new RSVP.Promise(resolver, canceller);\n
}\n
\n
var gadget_model_dict = {},\n
javascript_registration_dict = {},\n
stylesheet_registration_dict = {},\n
gadget_loading_klass,\n
loading_klass_promise,\n
renderJS,\n
Monitor,\n
isAbsoluteOrDataURL = new RegExp(\'^(?:[a-z]+:)?//|data:\', \'i\');\n
\n
/////////////////////////////////////////////////////////////////\n
// Helper functions\n
/////////////////////////////////////////////////////////////////\n
function removeHash(url) {\n
var index = url.indexOf(\'#\');\n
if (index > 0) {\n
...
...
@@ -1229,8 +1173,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
};\n
RenderJSGadget.declareAcquiredMethod("aq_reportServiceError",\n
"reportServiceError");\n
RenderJSGadget.declareAcquiredMethod("aq_pleasePublishMyState",\n
"pleasePublishMyState");\n
\n
/////////////////////////////////////////////////////////////////\n
//
RenderJSGadget.allowPublicAcquisition\n
...
...
@@ -1250,22 +1192,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
argument_list]);\n
};\n
}\n
\n
function
pleasePublishMyState(param_list,
child_gadget_scope)
{\n
var
new_param =
{},\n
key;\n
for
(key
in
this.state_parameter_dict)
{\n
if
(this.state_parameter_dict.hasOwnProperty(key))
{\n
new_param[key]
=
this.state_parameter_dict[key];\n
}\n
}\n
if
(
child_gadget_scope =
==
undefined)
{\n
throw
new
Error("gadget
scope
is
mandatory");\n
}\n
new_param[child_gadget_scope]
=
param_list[0];\n
param_list =
[new_param];\n
return
this.aq_pleasePublishMyState.apply(this,
param_list);\n
}\n
\n
/////////////////////////////////////////////////////////////////\n
//
RenderJSEmbeddedGadget\n
...
...
@@ -1452,6 +1378,33 @@ function loopEventListener(target, type, useCapture, callback) {\n
RSVP.timeout(5000)\n
]);\n
}\n
\n
/////////////////////////////////////////////////////////////////\n
//
privateDeclareDataUrlGadget\n
/////////////////////////////////////////////////////////////////\n
function
privateDeclareDataUrlGadget(url,
options,
parent_gadget)
{\n
\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
ajax(url);\n
})\n
.push(function
(xhr)
{\n
//
Insert
a
"base"
element,
in
order
to
resolve
all
relative
links\n
//
which
could
get
broken
with
a
data
url\n
var
doc =
(new
DOMParser()).parseFromString(xhr.responseText,\n
\'text/html\'),\n
base =
doc.createElement(\'base\'),\n
blob;\n
base.href =
url;\n
doc.head.insertBefore(base,
doc.head.firstChild);\n
blob =
new
Blob([doc.documentElement.outerHTML],\n
{type:
"text/html;
charset=
UTF-8"});\n
return
readBlobAsDataURL(blob);\n
})\n
.push(function
(data_url)
{\n
return
privateDeclareIframeGadget(data_url,
options,
parent_gadget);\n
});\n
}\n
\n
/////////////////////////////////////////////////////////////////\n
//
RenderJSGadget.declareGadget\n
...
...
@@ -1488,6 +1441,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
method =
privateDeclarePublicGadget;\n
}
else
if
(
options.sandbox =
==
"iframe")
{\n
method =
privateDeclareIframeGadget;\n
}
else
if
(
options.sandbox =
==
"dataurl")
{\n
method =
privateDeclareDataUrlGadget;\n
}
else
{\n
throw
new
Error("Unsupported
sandbox
options
\'"
+\n
options.sandbox
+
"\'");\n
...
...
@@ -1600,8 +1555,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
/////////////////////////////////////////////////////////////////\n
renderJS.getAbsoluteURL =
function
(url,
base_url)
{\n
var
doc,
base,
link,\n
html =
"<!doctype><html><head></head></html>"
,\n
isAbsoluteOrDataURL =
new
RegExp(\'^(?:[a-z]+:)?//|data:\',
\'i\');\n
html =
"<!doctype><html><head></head></html>"
;\n
\n
if
(url
&&
base_url
&&
!isAbsoluteOrDataURL.test(url))
{\n
doc =
(new
DOMParser()).parseFromString(html,
\'text/html\');\n
...
...
@@ -1679,10 +1633,9 @@ function loopEventListener(target, type, useCapture, callback) {\n
//
renderJS.declareGadgetKlass\n
/////////////////////////////////////////////////////////////////\n
renderJS.declareGadgetKlass =
function
(url)
{\n
var
result,\n
xhr;\n
var
result;\n
\n
function
parse()
{\n
function
parse(
xhr
)
{\n
var
tmp_constructor,\n
key,\n
parsed_html;\n
...
...
@@ -1707,8 +1660,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
tmp_constructor.prototype.constructor =
tmp_constructor;\n
tmp_constructor.prototype.__path =
url;\n
tmp_constructor.prototype.__acquired_method_dict =
{};\n
tmp_constructor.allowPublicAcquisition("pleasePublishMyState",\n
pleasePublishMyState);\n
//
https://developer.mozilla.org/en-US/docs/HTML_in_XMLHttpRequest\n
//
https://developer.mozilla.org/en-US/docs/Web/API/DOMParser\n
//
https://developer.mozilla.org/en-US/docs/Code_snippets/HTML_to_DOM\n
...
...
@@ -1729,51 +1680,19 @@ function loopEventListener(target, type, useCapture, callback) {\n
\n
return
gadget_model_dict[url];\n
}\n
\n
function
resolver(resolve,
reject)
{\n
function
handler()
{\n
var
tmp_result;\n
try
{\n
if
(
xhr.readyState =
==
0)
{\n
//
UNSENT\n
reject(xhr);\n
}
else
if
(
xhr.readyState =
==
4)
{\n
//
DONE\n
if
((xhr.status
<
200)
||
(xhr.status
>
= 300) ||\n
(!/^text\\/html[;]?/.test(\n
xhr.getResponseHeader("Content-Type") || ""\n
))) {\n
reject(xhr);\n
} else {\n
tmp_result = parse();\n
resolve(tmp_result);\n
}\n
}\n
} catch (e) {\n
reject(e);\n
}\n
}\n
\n
xhr = new XMLHttpRequest();\n
xhr.open("GET", url);\n
xhr.onreadystatechange = handler;\n
xhr.setRequestHeader(\'Accept\', \'text/html\');\n
xhr.withCredentials = true;\n
xhr.send();\n
}\n
\n
function canceller() {\n
if ((xhr !== undefined)
&&
(xhr.readyState !== xhr.DONE)) {\n
xhr.abort();\n
}\n
}\n
\n
if
(gadget_model_dict.hasOwnProperty(url))
{\n
//
Return
klass
object
if
it
already
exists\n
result =
RSVP.resolve(gadget_model_dict[url]);\n
}
else
{\n
//
Fetch
the
HTML
page
and
parse
it\n
result = new RSVP.Promise(resolver, canceller);\n
result =
new
RSVP.Queue()\n
.push(function
()
{\n
return
ajax(url);\n
})\n
.push(function
(xhr)
{\n
return
parse(xhr);\n
});\n
}\n
return
result;\n
};\n
...
...
@@ -1799,10 +1718,9 @@ function loopEventListener(target, type, useCapture, callback) {\n
required_js_list:
[]\n
},\n
i,\n
element,\n
isAbsoluteURL = new RegExp(\'^(?:[a-z]+:)?//\', \'i\');\n
element;\n
\n
if (!url || !isAbsoluteURL.test(url)) {\n
if
(!url
||
!isAbsolute
OrData
URL.test(url))
{\n
throw
new
Error("The
url
should
be
absolute:
"
+
url);\n
}\n
\n
...
...
@@ -1851,39 +1769,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
///////////////////////////////////////////////////\n
//
Bootstrap
process.
Register
the
self
gadget.\n
///////////////////////////////////////////////////\n
\n
function
mergeSubDict(dict)
{\n
var
subkey,\n
subkey2,\n
subresult2,\n
value,\n
result =
{};\n
for
(subkey
in
dict)
{\n
if
(dict.hasOwnProperty(subkey))
{\n
value =
dict[subkey];\n
if
(value
instanceof
Object)
{\n
subresult2 =
mergeSubDict(value);\n
for
(subkey2
in
subresult2)
{\n
if
(subresult2.hasOwnProperty(subkey2))
{\n
//
XXX
key
should
not
have
an
.
inside\n
if
(result.hasOwnProperty(subkey
+
"."
+
subkey2))
{\n
throw
new
Error("Key
"
+
subkey
+
"."
+\n
subkey2
+
"
already
present");\n
}\n
result[subkey
+
"."
+
subkey2]
=
subresult2[subkey2];\n
}\n
}\n
}
else
{\n
if
(result.hasOwnProperty(subkey))
{\n
throw
new
Error("Key
"
+
subkey
+
"
already
present");\n
}\n
result[subkey]
=
value;\n
}\n
}\n
}\n
return
result;\n
\n
}\n
\n
function
bootstrap()
{\n
var
url =
removeHash(window.location.href),\n
...
...
@@ -1911,26 +1796,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
},\n
reportServiceError:
function
(param_list)
{\n
letsCrash(param_list[0]);\n
},\n
pleaseRedirectMyHash:
function
(param_list)
{\n
window.location.replace(param_list[0]);\n
},\n
pleasePublishMyState:
function
(param_list)
{\n
var
key,\n
first =
true,\n
hash =
"#"
;\n
param_list[0]
=
mergeSubDict(param_list[0]);\n
for
(key
in
param_list[0])
{\n
if
(param_list[0].hasOwnProperty(key))
{\n
if
(!first)
{\n
hash
+=
"&";\n
}\n
hash
+=
encodeURIComponent(key)
+
"="
+\n
encodeURIComponent(param_list[0][key]);\n
first =
false;\n
}\n
}\n
return
hash;\n
}\n
};\n
//
Stop
acquisition
on
the
last
acquisition
gadget\n
...
...
@@ -1971,10 +1836,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
\n
//
Create
the
root
gadget
instance
and
put
it
in
the
loading
stack\n
root_gadget =
new
gadget_model_dict[url]();\n
\n
tmp_constructor.declareService(function
()
{\n
return
listenHashChange(this);\n
});\n
\n
setAqParent(root_gadget,
last_acquisition_gadget);\n
\n
...
...
@@ -2062,8 +1923,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
}\n
\n
tmp_constructor.prototype.__acquired_method_dict =
{};\n
tmp_constructor.allowPublicAcquisition("pleasePublishMyState",\n
pleasePublishMyState);\n
gadget_loading_klass =
tmp_constructor;\n
\n
function
init()
{\n
...
...
@@ -2216,9 +2075,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
//we
consider
current
gadget
is
parent
gadget\n
//redifine
last
acquisition
gadget\n
iframe_top_gadget =
true;\n
tmp_constructor.declareService(function
()
{\n
return
listenHashChange(this);\n
});\n
setAqParent(root_gadget,
last_acquisition_gadget);\n
}
else
{\n
throw
error;\n
...
...
@@ -2267,7 +2123,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
}\n
bootstrap();\n
\n
}(document,
window,
RSVP,
DOMParser,
Channel,
MutationObserver,
Node));
}(document,
window,
RSVP,
DOMParser,
Channel,
MutationObserver,
Node,\n
FileReader,
Blob));
]]
></string>
</value>
</item>
...
...
@@ -2337,7 +2194,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
roma
in
</string>
</value>
<value>
<string>
cedric.le.niniv
in
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -2359,8 +2216,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
</tuple>
<state>
<tuple>
<float>
14
06898405.75
</float>
<string>
GMT
</string>
<float>
14
40175545.67
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
@@ -2390,7 +2247,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
super_sve
n
</string>
</value>
<value>
<string>
cedric.le.ninivi
n
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -2404,7 +2261,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
39.51246.32089.5241
1
</string>
</value>
<value>
<string>
9
45.18151.43412.1983
1
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -2422,8 +2279,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
</tuple>
<state>
<tuple>
<float>
14
19342867.69
</float>
<string>
GMT
</string>
<float>
14
40428114.52
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
@@ -2445,13 +2302,11 @@ function loopEventListener(target, type, useCapture, callback) {\n
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<none/>
</value>
<value>
<string>
detect_converted_file
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
roma
in
</string>
</value>
<value>
<string>
cedric.le.niniv
in
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -2463,7 +2318,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</item>
<item>
<key>
<string>
external_processing_state
</string>
</key>
<value>
<string>
empty
</string>
</value>
<value>
<string>
converted
</string>
</value>
</item>
<item>
<key>
<string>
serial
</string>
</key>
...
...
@@ -2481,8 +2336,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
</tuple>
<state>
<tuple>
<float>
14
04995958.41
</float>
<string>
GMT
</string>
<float>
14
40175328.89
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
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