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
dd5b7008
Commit
dd5b7008
authored
Jun 05, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add display noDisplay methods for optimization
parent
b354cac2
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
125 additions
and
31 deletions
+125
-31
src/audioplayer/audioplayer.js
src/audioplayer/audioplayer.js
+25
-0
src/audioplayer/error.html
src/audioplayer/error.html
+17
-0
src/audioplayer/error.js
src/audioplayer/error.js
+17
-0
src/audioplayer/index.html
src/audioplayer/index.html
+5
-0
src/audioplayer/interface.js
src/audioplayer/interface.js
+25
-28
src/audioplayer_animation/animation.js
src/audioplayer_animation/animation.js
+8
-0
src/audioplayer_io/io.js
src/audioplayer_io/io.js
+9
-3
src/audioplayer_progress/progress.js
src/audioplayer_progress/progress.js
+6
-0
src/audioplayer_title/title.js
src/audioplayer_title/title.js
+6
-0
src/audioplayer_volume/volume.js
src/audioplayer_volume/volume.js
+7
-0
No files found.
src/audioplayer/audioplayer.js
View file @
dd5b7008
...
...
@@ -104,6 +104,7 @@
volume
=
all_param
[
3
];
title
=
all_param
[
4
];
io
=
all_param
[
5
];
that
.
display
();
window
.
setInterval
(
function
()
{
control
.
getCurrentTime
()
.
then
(
function
(
e
)
{
...
...
@@ -139,6 +140,30 @@
});
rJS
(
window
)
.
declareMethod
(
"
display
"
,
function
(
options
)
{
io
.
noDisplay
();
title
.
display
();
time
.
display
();
volume
.
display
();
animation
.
display
();
next_context
.
style
.
display
=
""
;
play_context
.
style
.
display
=
""
;
stop_context
.
style
.
display
=
""
;
addMusic_context
.
style
.
display
=
""
;
})
.
declareMethod
(
"
noDisplay
"
,
function
(
options
)
{
if
(
options
===
"
addPage
"
)
{
io
.
display
();
}
title
.
noDisplay
();
time
.
noDisplay
();
volume
.
noDisplay
();
animation
.
noDisplay
();
next_context
.
style
.
display
=
"
none
"
;
play_context
.
style
.
display
=
"
none
"
;
stop_context
.
style
.
display
=
"
none
"
;
addMusic_context
.
style
.
display
=
"
none
"
;
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
id
=
nextId
(),
name
=
playlist
[
id
];
...
...
src/audioplayer/error.html
0 → 100644
View file @
dd5b7008
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<title>
errorPage
</title>
<!-- renderjs -->
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
<script
src=
"../<%= copy.renderjs.relative_dest %>"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"./error.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
>
</div>
</body>
</html>
src/audioplayer/error.js
0 → 100644
View file @
dd5b7008
/*global rJS, window*/
/*jslint nomen: true*/
(
function
(
window
,
rJS
)
{
"
use strict
"
;
var
h2_context
;
rJS
(
window
)
.
ready
(
function
(
g
)
{
h2_context
=
g
.
__element
.
getElementsByTagName
(
'
div
'
)[
0
];
})
.
declareMethod
(
"
display
"
,
function
(
options
)
{
h2_context
.
innerHTML
=
"
<h2>ERROR:Music not found</h2>
"
;
})
.
declareMethod
(
"
noDisplay
"
,
function
(
options
)
{
h2_context
.
innerHTML
=
""
;
});
}(
window
,
rJS
));
src/audioplayer/index.html
View file @
dd5b7008
...
...
@@ -13,5 +13,10 @@
<script
src=
"./interface.js"
type=
"text/javascript"
></script>
</head>
<body>
<div
class =
"audioplayer"
data-gadget-url=
"./audioplayer.html"
data-gadget-scope=
"audioplayer"
>
</div>
<div
class =
"error"
data-gadget-url=
"./error.html"
data-gadget-scope=
"error"
>
</div>
</body>
</html>
src/audioplayer/interface.js
View file @
dd5b7008
/*global
console, jQuery, rJS, RSVP, alert
*/
/*global
window, rJS, RSVP
*/
/*jslint nomen: true*/
(
function
(
window
,
rJS
,
$
)
{
(
function
(
window
,
rJS
)
{
"
use strict
"
;
var
gadget
,
top
,
innerHTML
;
error
;
rJS
(
window
)
.
allowPublicAcquisition
(
"
ErrorPage
"
,
function
()
{
top
.
__element
.
innerHTML
=
"
ERROR:music does't exist
"
;
top
.
dropGadget
(
"
audioplayer
"
);
error
.
display
()
;
gadget
.
noDisplay
(
);
top
.
newPage
=
true
;
})
.
allowPublicAcquisition
(
"
addPage
"
,
function
()
{
innerHTML
=
top
.
__element
.
innerHTML
;
top
.
__element
.
innerHTML
=
"
"
;
top
.
declareGadget
(
"
../audioplayer_io/index.html
"
,
{
element
:
top
.
__element
,
scope
:
"
io
"
}
);
gadget
.
noDisplay
(
"
addPage
"
);
top
.
newPage
=
true
;
top
.
addPage
=
true
;
})
.
allowPublicAcquisition
(
"
showPage
"
,
function
(
param_list
)
{
return
this
.
aq_pleasePublishMyState
({
page
:
param_list
[
0
]});
...
...
@@ -29,25 +22,29 @@
top
=
g
;
top
.
newPage
=
false
;
top
.
addPage
=
false
;
top
.
declareGadget
(
"
./audioplayer.html
"
,
{
element
:
top
.
__element
}
)
.
then
(
function
(
result
)
{
gadget
=
result
;
RSVP
.
all
([
g
.
getDeclaredGadget
(
"
audioplayer
"
),
g
.
getDeclaredGadget
(
"
error
"
)
])
.
then
(
function
(
all_param
)
{
gadget
=
all_param
[
0
];
error
=
all_param
[
1
];
error
.
noDisplay
();
});
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
if
(
top
.
newPage
===
true
)
{
if
(
top
.
addPage
===
true
)
{
top
.
addPage
=
false
;
top
.
dropGadget
(
"
io
"
);
}
top
.
__element
.
innerHTML
=
innerHTML
;
top
.
newPage
=
false
;
}
else
{
if
(
gadget
!==
undefined
)
{
gadget
.
render
(
options
);
}
error
.
noDisplay
();
gadget
.
display
();
return
;
}
if
(
gadget
!==
undefined
)
{
gadget
.
render
(
options
);
}
});
}(
window
,
rJS
,
jQuery
));
}(
window
,
rJS
));
src/audioplayer_animation/animation.js
View file @
dd5b7008
...
...
@@ -59,6 +59,14 @@
window
.
cancelAnimationFrame
(
this
.
animationPlayId
);
//stop the previous animation
})
.
declareMethod
(
"
display
"
,
function
(
options
)
{
this
.
canvas
.
style
.
display
=
""
;
this
.
mirror
.
style
.
display
=
""
;
})
.
declareMethod
(
"
noDisplay
"
,
function
(
options
)
{
this
.
canvas
.
style
.
display
=
"
none
"
;
this
.
mirror
.
style
.
display
=
"
none
"
;
});
gk
.
ready
(
function
(
g
)
{
...
...
src/audioplayer_io/io.js
View file @
dd5b7008
...
...
@@ -3,7 +3,8 @@
(
function
(
window
,
jIO
,
rJS
)
{
"
use strict
"
;
var
gk
=
rJS
(
window
);
var
gk
=
rJS
(
window
),
input_context
;
gk
.
declareMethod
(
'
createIO
'
,
function
(
description
,
key
)
{
// indexedDB.deleteDatabase("jio:test");
...
...
@@ -31,6 +32,12 @@
return
"
jio getIO error :
"
+
response
.
target
.
result
;
});
})
.
declareMethod
(
'
display
'
,
function
(
attachment
)
{
input_context
.
style
.
display
=
""
;
})
.
declareMethod
(
'
noDisplay
'
,
function
(
attachment
)
{
input_context
.
style
.
display
=
"
none
"
;
})
.
declareMethod
(
'
setIO
'
,
function
(
attachment
,
file
)
{
var
gadget
=
this
;
return
gadget
.
jio
.
putAttachment
({
...
...
@@ -55,7 +62,7 @@
})
.
declareAcquiredMethod
(
"
sendPlaylist
"
,
"
sendPlaylist
"
);
gk
.
ready
(
function
(
g
)
{
var
input_context
=
g
.
__element
.
getElementsByTagName
(
'
input
'
)[
0
];
input_context
=
g
.
__element
.
getElementsByTagName
(
'
input
'
)[
0
];
g
.
playlist
=
[];
g
.
createIO
({
"
type
"
:
"
indexeddb
"
,
"
database
"
:
"
test
"
},
...
...
@@ -70,7 +77,6 @@
g
.
sendPlaylist
(
g
.
playlist
);
});
});
input_context
.
onchange
=
function
()
{
var
tmp
,
index
,
...
...
src/audioplayer_progress/progress.js
View file @
dd5b7008
...
...
@@ -18,6 +18,12 @@
.
declareMethod
(
'
getMax
'
,
function
()
{
return
this
.
bar
.
max
;
})
.
declareMethod
(
'
display
'
,
function
(
attachment
)
{
this
.
bar
.
style
.
display
=
""
;
})
.
declareMethod
(
'
noDisplay
'
,
function
(
attachment
)
{
this
.
bar
.
style
.
display
=
"
none
"
;
})
.
declareAcquiredMethod
(
"
setCurrentTime
"
,
"
setCurrentTime
"
);
gk
.
ready
(
function
(
g
)
{
g
.
bar
=
g
.
__element
.
getElementsByTagName
(
'
progress
'
)[
0
];
...
...
src/audioplayer_title/title.js
View file @
dd5b7008
...
...
@@ -34,6 +34,12 @@
})
.
declareMethod
(
'
getSize
'
,
function
(
size
)
{
return
this
.
input
.
size
;
})
.
declareMethod
(
'
display
'
,
function
(
attachment
)
{
this
.
input
.
style
.
display
=
""
;
})
.
declareMethod
(
'
noDisplay
'
,
function
(
attachment
)
{
this
.
input
.
style
.
display
=
"
none
"
;
});
gk
.
ready
(
function
(
g
)
{
g
.
scroll
=
new
BannerObject
();
...
...
src/audioplayer_volume/volume.js
View file @
dd5b7008
...
...
@@ -17,11 +17,18 @@
.
declareMethod
(
'
getMax
'
,
function
()
{
return
this
.
bar
.
max
;
})
.
declareMethod
(
'
display
'
,
function
(
attachment
)
{
this
.
bar
.
style
.
display
=
""
;
})
.
declareMethod
(
'
noDisplay
'
,
function
(
attachment
)
{
this
.
bar
.
style
.
display
=
"
none
"
;
})
.
declareAcquiredMethod
(
"
setVolume
"
,
"
setVolume
"
)
.
declareAcquiredMethod
(
"
getVolume
"
,
"
getVolume
"
);
//xxxx
gk
.
ready
(
function
(
g
)
{
g
.
bar
=
g
.
__element
.
getElementsByTagName
(
'
progress
'
)[
0
];
g
.
bar
.
max
=
1000
;
//g.bar.style.display = "none";
g
.
bar
.
onclick
=
function
(
e
)
{
var
posX
=
e
.
clientX
,
targetLeft
=
$
(
g
.
bar
).
offset
().
left
;
...
...
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