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
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
Sebastian
erp5
Commits
bc27e73b
Commit
bc27e73b
authored
Dec 23, 2014
by
Sven Franck
Committed by
Xiaowu Zhang
Jan 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: update renderjs to latest version
parent
d73fdaf7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
225 additions
and
178 deletions
+225
-178
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
...s_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
+225
-178
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml
View file @
bc27e73b
...
...
@@ -101,16 +101,6 @@
<key>
<string>
text_content
</string>
</key>
<value>
<string
encoding=
"cdata"
>
<![CDATA[
// IE does not support have Document.prototype.contains.\n
if (typeof document.contains != \'function\') {\n
Document.prototype.contains = function(node) {\n
if (node === this || node.parentNode === this)\n
return true;\n
return this.documentElement.contains(node);\n
}\n
}\n
\n
\n
/*\n
* js_channel is a very lightweight abstraction on top of\n
* postMessage which defines message formats and semantics\n
...
...
@@ -770,9 +760,17 @@ if (typeof document.contains != \'function\') {\n
};\n
}(DOMParser));\n
\n
;//
IE
does
not
support
have
Document.prototype.contains.\n
if
(typeof
document.contains
!==
\'function\')
{\n
Document.prototype.contains =
function(node)
{\n
if
(
node =
==
this
||
node.parentNode =
==
this)\n
return
true;\n
return
this.documentElement.contains(node);\n
}\n
}\n
;/*!
RenderJs
*/\n
/*global
console*/\n
/*jslint
nomen:
true*/\n
\n
function
loopEventListener(target,
type,
useCapture,
callback)
{\n
"use
strict";\n
//////////////////////////\n
...
...
@@ -823,7 +821,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
*
http://www.renderjs.org/documentation\n
*/\n
(function
(document,
window,
RSVP,
DOMParser,
Channel,
MutationObserver,\n
Node
,
undefined
)
{\n
Node)
{\n
"use
strict";\n
\n
var
gadget_model_dict =
{},\n
...
...
@@ -837,6 +835,71 @@ function loopEventListener(target, type, useCapture, callback) {\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
}\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
}
else
{\n
if
(!dict.hasOwnProperty(kk))
{\n
dict[kk]
=
{};\n
}\n
dict =
dict[kk];\n
}\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
}\n
\n
if
(gadget.render
!==
undefined)
{\n
return
gadget.render(options);\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
}\n
\n
\n
function
removeHash(url)
{\n
var
index =
url.indexOf(\'#\');\n
if
(index
>
0) {\n
...
...
@@ -1168,22 +1231,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
"reportServiceError");\n
RenderJSGadget.declareAcquiredMethod("aq_pleasePublishMyState",\n
"pleasePublishMyState");\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
//
RenderJSGadget.allowPublicAcquisition\n
...
...
@@ -1203,6 +1250,22 @@ 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
...
...
@@ -1340,8 +1403,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
gadget_instance.__chan.bind("declareMethod",\n
function
(trans,
method_name)
{\n
gadget_instance[method_name]
=
function
()
{\n
var
argument_list =
arguments
;
\n
return
new
RSVP.Promise(function
(resolve,
reject)
{\n
var
argument_list =
arguments
,
\n
wait_promise =
new
RSVP.Promise(function
(resolve,
reject)
{\n
gadget_instance.__chan.call({\n
method:
"methodCall",\n
params:
[\n
...
...
@@ -1355,6 +1418,10 @@ function loopEventListener(target, type, useCapture, callback) {\n
}\n
});\n
});\n
return
new
RSVP.Queue()\n
.push(function
()
{\n
return
wait_promise;\n
});\n
};\n
return
"OK";\n
});\n
...
...
@@ -1742,6 +1809,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
if (document_element.nodeType === 9) {\n
settings.title = document_element.title;\n
\n
if (document_element.head !== null) {\n
for (i = 0; i
< document_element.head.children.length
;
i
+=
1)
{\n
element =
document_element.head.children[i];\n
if
(element.href
!==
null)
{\n
...
...
@@ -1757,13 +1825,15 @@ function loopEventListener(target, type, useCapture, callback) {\n
settings.required_js_list.push(\n
renderJS.getAbsoluteURL(element.getAttribute("src"),
url)\n
);\n
}
else
if
(
element.rel =
==
"http://www.renderjs.org/rel/interface")
{\n
}
else
if
(
element.rel =
==\n
"http://www.renderjs.org/rel/interface")
{\n
settings.interface_list.push(\n
renderJS.getAbsoluteURL(element.getAttribute("href"),
url)\n
);\n
}\n
}\n
}\n
}\n
}
else
{\n
throw
new
Error("The
first
parameter
should
be
an
HTMLDocument");\n
}\n
...
...
@@ -1825,6 +1895,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
notifyReady,\n
notifyDeclareMethod,\n
gadget_ready =
false,\n
iframe_top_gadget,\n
last_acquisition_gadget;\n
\n
//
Create
the
gadget
class
for
the
current
url\n
...
...
@@ -1832,7 +1903,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
throw
new
Error("bootstrap
should
not
be
called
twice");\n
}\n
loading_klass_promise =
new
RSVP.Promise(function
(resolve,
reject)
{\n
if
(
window.self =
==
window.top)
{\n
\n
last_acquisition_gadget =
new
RenderJSGadget();\n
last_acquisition_gadget.__acquired_method_dict =
{\n
...
...
@@ -1871,6 +1941,15 @@ function loopEventListener(target, type, useCapture, callback) {\n
);\n
};\n
\n
//we
need
to
determine
tmp_constructor\'s
value
before
exit
bootstrap\n
//because
of
function
:
renderJS\n
//but
since
the
channel
checking
is
async,\n
//we
can\'t
use
code
structure
like:\n
//
if
channel
communication
is
ok\n
//
tmp_constructor =
RenderJSGadget\n
//
else\n
//
tmp_constructor =
RenderJSEmbeddedGadget\n
if
(
window.self =
==
window.top)
{\n
//
XXX
Copy/Paste
from
declareGadgetKlass\n
tmp_constructor =
function
()
{\n
RenderJSGadget.call(this);\n
...
...
@@ -1892,6 +1971,10 @@ 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
...
...
@@ -1909,15 +1992,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
tmp_constructor.prototype.__path =
url;\n
root_gadget =
new
RenderJSEmbeddedGadget();\n
\n
//
Bind
calls
to
renderJS
method
on
the
instance\n
embedded_channel.bind("methodCall",
function
(trans,
v)
{\n
root_gadget[v[0]].apply(root_gadget,
v[1]).then(function
(g)
{\n
trans.complete(g);\n
}).fail(function
(e)
{\n
trans.error(e.toString());\n
});\n
trans.delayReturn(true);\n
});\n
\n
//
Notify
parent
about
gadget
instanciation\n
notifyReady =
function
()
{\n
...
...
@@ -1965,9 +2039,9 @@ function loopEventListener(target, type, useCapture, callback) {\n
tmp_constructor.allowPublicAcquisition =
\n
RenderJSGadget.allowPublicAcquisition;\n
\n
//
Define
__aq_parent
to
inform
parent
window\n
//
Default:
Define
__aq_parent
to
inform
parent
window\n
tmp_constructor.prototype.__aq_parent =
function
(method_name,\n
argument_list)
{\n
argument_list
,
time_out
)
{\n
return
new
RSVP.Promise(function
(resolve,
reject)
{\n
embedded_channel.call({\n
method:
"acquire",\n
...
...
@@ -1980,7 +2054,8 @@ function loopEventListener(target, type, useCapture, callback) {\n
},\n
error:
function
(e)
{\n
reject(e);\n
}\n
},\n
timeout:
time_out\n
});\n
});\n
};\n
...
...
@@ -2111,13 +2186,43 @@ function loopEventListener(target, type, useCapture, callback) {\n
}\n
\n
if
(window.top
!==
window.self)
{\n
tmp_constructor.ready(function
()
{\n
var
base =
document.createElement(\'base\');\n
return
root_gadget.__aq_parent(\'getTopURL\',
[])\n
//checking
channel
should
be
done
before
sub
gadget\'s
declaration\n
//__ready_list:\n
//0:
clearGadgetInternalParameters\n
//1:
loadSubGadgetDOMDeclaration\n
//.....\n
tmp_constructor.__ready_list.splice(1,
0,
function
()
{\n
return
root_gadget.__aq_parent(\'getTopURL\',
[],
100)\n
.then(function
(topURL)
{\n
var
base =
document.createElement(\'base\');\n
base.href =
topURL;\n
base.target =
"_top"
;\n
document.head.appendChild(base);\n
//the
channel
is
ok\n
//so
bind
calls
to
renderJS
method
on
the
instance\n
embedded_channel.bind("methodCall",
function
(trans,
v)
{\n
root_gadget[v[0]].apply(root_gadget,
v[1])\n
.then(function
(g)
{\n
trans.complete(g);\n
}).fail(function
(e)
{\n
trans.error(e.toString());\n
});\n
trans.delayReturn(true);\n
});\n
})\n
.fail(function
(error)
{\n
if
(
error =
==
"timeout_error")
{\n
//the
channel
fail\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
}\n
});\n
});\n
}\n
...
...
@@ -2137,68 +2242,6 @@ function loopEventListener(target, type, useCapture, callback) {\n
});\n
if
(
window.self =
==
window.top)
{\n
loading_gadget_promise\n
.then(function
()
{\n
\n
function
extractHashAndDispatch(evt)
{\n
var
hash =
evt.newURL.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
}\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
}
else
{\n
if
(!dict.hasOwnProperty(kk))
{\n
dict[kk]
=
{};\n
}\n
dict =
dict[kk];\n
}\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
}\n
\n
if
(root_gadget.render
!==
undefined)
{\n
return
root_gadget.render(options);\n
}\n
}\n
\n
//
XXX
Put
it
in
a
service\n
//
XXX
Manually
trigger
hashchange
event!\n
return
RSVP.all([\n
extractHashAndDispatch({newURL:
window.location.toString()}),\n
loopEventListener(window,
\'hashchange\',
false,\n
extractHashAndDispatch)\n
]);\n
})\n
.fail(function
(e)
{\n
letsCrash(e);\n
throw
e;\n
...
...
@@ -2211,7 +2254,12 @@ function loopEventListener(target, type, useCapture, callback) {\n
notifyReady();\n
})\n
.fail(function
(e)
{\n
//top
gadget
in
iframe\n
if
(iframe_top_gadget)
{\n
letsCrash(e);\n
}
else
{\n
embedded_channel.notify({method:
"failed",
params:
e.toString()});\n
}\n
throw
e;\n
});\n
}\n
...
...
@@ -2219,8 +2267,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
}\n
bootstrap();\n
\n
}(document,
window,
RSVP,
DOMParser,
Channel,
MutationObserver,
Node));\n
}(document,
window,
RSVP,
DOMParser,
Channel,
MutationObserver,
Node));
]]
></string>
</value>
</item>
...
...
@@ -2343,7 +2390,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
romai
n
</string>
</value>
<value>
<string>
super_sve
n
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -2357,7 +2404,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
93
7.39596.23974.43622
</string>
</value>
<value>
<string>
93
9.51246.32089.52411
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -2375,7 +2422,7 @@ function loopEventListener(target, type, useCapture, callback) {\n
</tuple>
<state>
<tuple>
<float>
141
0871234.37
</float>
<float>
141
9342867.69
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
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