Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
61a07f31
Commit
61a07f31
authored
Jun 22, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix the asynchrone load
parent
f9cec3d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
23 deletions
+22
-23
UNGProject/js/editor.js
UNGProject/js/editor.js
+3
-2
UNGProject/js/theme.js
UNGProject/js/theme.js
+9
-6
UNGProject/js/tools.js
UNGProject/js/tools.js
+8
-13
UNGProject/theme.html
UNGProject/theme.html
+2
-2
No files found.
UNGProject/js/editor.js
View file @
61a07f31
...
@@ -11,10 +11,11 @@ var Xinha = function() {
...
@@ -11,10 +11,11 @@ var Xinha = function() {
xinha_init
();
xinha_init
();
}
}
this
.
saveEdition
=
function
()
{
this
.
saveEdition
=
function
()
{
getCurrentDocument
().
saveEdition
(
$
(
"
#input_area
"
).
attr
(
"
value
"
));
getCurrentDocument
().
saveEdition
(
xinha_editors
.
input_area
.
getEditorContent
(
));
}
}
this
.
loadContentFromDocument
=
function
(
doc
)
{
this
.
loadContentFromDocument
=
function
(
doc
)
{
$
(
"
#input_area
"
).
attr
(
"
value
"
,
doc
.
getContent
());
var
setText
=
function
()
{
xinha_editors
.
input_area
.
setEditorContent
(
doc
.
getContent
());}
waitBeforeSucceed
(
function
()
{
return
xinha_editors
.
input_area
;},
setText
);
}
}
this
.
load
();
this
.
load
();
}
}
...
...
UNGProject/js/theme.js
View file @
61a07f31
...
@@ -32,6 +32,7 @@ Page.prototype = {
...
@@ -32,6 +32,7 @@ Page.prototype = {
getContent
:
function
()
{
return
$
(
this
.
getXML
()).
find
(
"
content
"
).
html
();},
getContent
:
function
()
{
return
$
(
this
.
getXML
()).
find
(
"
content
"
).
html
();},
getDependencies
:
function
()
{
return
$
(
this
.
getXML
()).
find
(
"
dependencies
"
);},
getDependencies
:
function
()
{
return
$
(
this
.
getXML
()).
find
(
"
dependencies
"
);},
getEditor
:
function
()
{
return
this
.
editor
;},
getEditor
:
function
()
{
return
this
.
editor
;},
setEditor
:
function
(
editor
)
{
this
.
editor
=
editor
;},
//loaders
//loaders
/* load the xml document which contains the web page information */
/* load the xml document which contains the web page information */
...
@@ -40,7 +41,7 @@ Page.prototype = {
...
@@ -40,7 +41,7 @@ Page.prototype = {
type
:
"
GET
"
,
type
:
"
GET
"
,
url
:
source
,
url
:
source
,
dataType
:
"
html
"
,
dataType
:
"
html
"
,
async
:
fals
e
,
async
:
tru
e
,
success
:
function
(
data
)
{
success
:
function
(
data
)
{
getCurrentPage
().
setXML
(
data
);
getCurrentPage
().
setXML
(
data
);
}
}
...
@@ -56,21 +57,23 @@ Page.prototype = {
...
@@ -56,21 +57,23 @@ Page.prototype = {
$
(
dependencies
).
find
(
"
scriptfile
"
).
each
(
function
()
{
currentPage
.
include
(
$
(
this
).
text
(),
"
script
"
);});
//includes js
$
(
dependencies
).
find
(
"
scriptfile
"
).
each
(
function
()
{
currentPage
.
include
(
$
(
this
).
text
(),
"
script
"
);});
//includes js
var
doc
=
null
;
var
doc
=
null
;
var
editor
=
null
;
switch
(
this
.
name
)
{
switch
(
this
.
name
)
{
case
"
editor
"
:
case
"
editor
"
:
this
.
editor
=
new
Xinha
();
editor
=
new
Xinha
();
if
(
!
doc
)
{
doc
=
new
JSONTextDocument
();}
if
(
!
doc
)
{
doc
=
new
JSONTextDocument
();}
break
;
break
;
case
"
table
"
:
case
"
table
"
:
this
.
editor
=
new
SheetEditor
();
editor
=
new
SheetEditor
();
if
(
!
doc
)
{
doc
=
new
JSONSheetDocument
();}
if
(
!
doc
)
{
doc
=
new
JSONSheetDocument
();}
break
;
break
;
case
"
illustration
"
:
case
"
illustration
"
:
this
.
editor
=
new
SVGEditor
();
editor
=
new
SVGEditor
();
if
(
!
doc
)
{
doc
=
new
JSONIllustrationDocument
();}
if
(
!
doc
)
{
doc
=
new
JSONIllustrationDocument
();}
break
;
break
;
}
}
doc
.
setCurrentDocument
();
setCurrentDocument
(
doc
);
this
.
setEditor
(
editor
);
},
},
/* include a javascript or a css file */
/* include a javascript or a css file */
...
@@ -275,7 +278,7 @@ editDocumentSettings = function() {
...
@@ -275,7 +278,7 @@ editDocumentSettings = function() {
saveCurrentDocument
=
function
()
{
saveCurrentDocument
=
function
()
{
getCurrentPage
().
getEditor
().
saveEdition
();
getCurrentPage
().
getEditor
().
saveEdition
();
saveXHR
(
address
);
saveXHR
(
address
OfTestDocument
);
//saveJIO(); : JIO function
//saveJIO(); : JIO function
}
}
...
...
UNGProject/js/tools.js
View file @
61a07f31
...
@@ -106,21 +106,16 @@ loadXHR = function(address) {
...
@@ -106,21 +106,16 @@ loadXHR = function(address) {
/*
/*
* wait an event before execute an action
* wait an event before execute an action
*/
*/
tryUntilSucceed
=
function
(
func
)
{
waitBeforeSucceed
=
function
(
required
,
func
)
{
var
nb
=
2
;
//avoid to test too much times
var
nb
=
2
;
//avoid to test too much times
var
retry
=
function
()
{
var
execute
=
function
()
{
try
{
return
func
.
call
();}
//if(test()) {tryUntilSucceed(func);}
catch
(
e
)
{
if
(
nb
<
100
)
{
setTimeout
(
retry
,
nb
*
100
);
alert
(
e
);}}
try
{
if
(
!
required
.
call
())
{
throw
0
;}
func
.
call
();}
catch
(
e
)
{
if
(
nb
<
100
)
{
setTimeout
(
execute
,
nb
*
100
);}}
nb
*=
nb
;
nb
*=
nb
;
}
}
retry
();
execute
();
}
requireBeforeSucceed
=
function
(
required
,
func
)
{
var
test
=
function
()
{
try
{
return
required
.
call
();}
catch
(
e
)
{
return
null
;}
}
if
(
test
())
{
tryUntilSucceed
(
func
);}
else
{
setTimeout
(
test
,
100
);};
}
}
UNGProject/theme.html
View file @
61a07f31
...
@@ -50,8 +50,8 @@
...
@@ -50,8 +50,8 @@
var
init
=
function
()
{
var
init
=
function
()
{
initPage
();
initPage
();
require
BeforeSucceed
(
function
()
{
return
getCurrentPage
().
getXML
();},
initUser
);
wait
BeforeSucceed
(
function
()
{
return
getCurrentPage
().
getXML
();},
initUser
);
require
BeforeSucceed
(
function
()
{
return
getCurrentPage
().
getEditor
();},
initDocument
);
wait
BeforeSucceed
(
function
()
{
return
getCurrentPage
().
getEditor
();},
initDocument
);
}
}
$
(
document
).
ready
(
init
);
$
(
document
).
ready
(
init
);
</script>
</script>
...
...
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