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 @@
...
@@ -104,6 +104,7 @@
volume
=
all_param
[
3
];
volume
=
all_param
[
3
];
title
=
all_param
[
4
];
title
=
all_param
[
4
];
io
=
all_param
[
5
];
io
=
all_param
[
5
];
that
.
display
();
window
.
setInterval
(
function
()
{
window
.
setInterval
(
function
()
{
control
.
getCurrentTime
()
control
.
getCurrentTime
()
.
then
(
function
(
e
)
{
.
then
(
function
(
e
)
{
...
@@ -139,6 +140,30 @@
...
@@ -139,6 +140,30 @@
});
});
rJS
(
window
)
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
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
id
=
nextId
(),
var
id
=
nextId
(),
name
=
playlist
[
id
];
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 @@
...
@@ -13,5 +13,10 @@
<script
src=
"./interface.js"
type=
"text/javascript"
></script>
<script
src=
"./interface.js"
type=
"text/javascript"
></script>
</head>
</head>
<body>
<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>
</body>
</html>
</html>
src/audioplayer/interface.js
View file @
dd5b7008
/*global
console, jQuery, rJS, RSVP, alert
*/
/*global
window, rJS, RSVP
*/
/*jslint nomen: true*/
/*jslint nomen: true*/
(
function
(
window
,
rJS
,
$
)
{
(
function
(
window
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
var
gadget
,
var
gadget
,
top
,
top
,
innerHTML
;
error
;
rJS
(
window
)
rJS
(
window
)
.
allowPublicAcquisition
(
"
ErrorPage
"
,
function
()
{
.
allowPublicAcquisition
(
"
ErrorPage
"
,
function
()
{
top
.
__element
.
innerHTML
=
"
ERROR:music does't exist
"
;
error
.
display
()
;
top
.
dropGadget
(
"
audioplayer
"
);
gadget
.
noDisplay
(
);
top
.
newPage
=
true
;
top
.
newPage
=
true
;
})
})
.
allowPublicAcquisition
(
"
addPage
"
,
function
()
{
.
allowPublicAcquisition
(
"
addPage
"
,
function
()
{
innerHTML
=
top
.
__element
.
innerHTML
;
gadget
.
noDisplay
(
"
addPage
"
);
top
.
__element
.
innerHTML
=
"
"
;
top
.
declareGadget
(
"
../audioplayer_io/index.html
"
,
{
element
:
top
.
__element
,
scope
:
"
io
"
}
);
top
.
newPage
=
true
;
top
.
newPage
=
true
;
top
.
addPage
=
true
;
})
})
.
allowPublicAcquisition
(
"
showPage
"
,
function
(
param_list
)
{
.
allowPublicAcquisition
(
"
showPage
"
,
function
(
param_list
)
{
return
this
.
aq_pleasePublishMyState
({
page
:
param_list
[
0
]});
return
this
.
aq_pleasePublishMyState
({
page
:
param_list
[
0
]});
...
@@ -29,25 +22,29 @@
...
@@ -29,25 +22,29 @@
top
=
g
;
top
=
g
;
top
.
newPage
=
false
;
top
.
newPage
=
false
;
top
.
addPage
=
false
;
top
.
addPage
=
false
;
top
.
declareGadget
(
"
./audioplayer.html
"
,
RSVP
.
all
([
{
element
:
top
.
__element
}
g
.
getDeclaredGadget
(
)
"
audioplayer
"
.
then
(
function
(
result
)
{
),
gadget
=
result
;
g
.
getDeclaredGadget
(
"
error
"
)
])
.
then
(
function
(
all_param
)
{
gadget
=
all_param
[
0
];
error
=
all_param
[
1
];
error
.
noDisplay
();
});
});
})
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
if
(
top
.
newPage
===
true
)
{
if
(
top
.
newPage
===
true
)
{
if
(
top
.
addPage
===
true
)
{
top
.
addPage
=
false
;
top
.
dropGadget
(
"
io
"
);
}
top
.
__element
.
innerHTML
=
innerHTML
;
top
.
newPage
=
false
;
top
.
newPage
=
false
;
}
else
{
error
.
noDisplay
();
if
(
gadget
!==
undefined
)
{
gadget
.
display
();
gadget
.
render
(
options
);
return
;
}
}
if
(
gadget
!==
undefined
)
{
gadget
.
render
(
options
);
}
}
});
});
}(
window
,
rJS
,
jQuery
));
}(
window
,
rJS
));
src/audioplayer_animation/animation.js
View file @
dd5b7008
...
@@ -59,6 +59,14 @@
...
@@ -59,6 +59,14 @@
window
.
cancelAnimationFrame
(
window
.
cancelAnimationFrame
(
this
.
animationPlayId
this
.
animationPlayId
);
//stop the previous animation
);
//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
)
{
gk
.
ready
(
function
(
g
)
{
...
...
src/audioplayer_io/io.js
View file @
dd5b7008
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
(
function
(
window
,
jIO
,
rJS
)
{
(
function
(
window
,
jIO
,
rJS
)
{
"
use strict
"
;
"
use strict
"
;
var
gk
=
rJS
(
window
);
var
gk
=
rJS
(
window
),
input_context
;
gk
.
declareMethod
(
'
createIO
'
,
function
(
description
,
key
)
{
gk
.
declareMethod
(
'
createIO
'
,
function
(
description
,
key
)
{
// indexedDB.deleteDatabase("jio:test");
// indexedDB.deleteDatabase("jio:test");
...
@@ -31,6 +32,12 @@
...
@@ -31,6 +32,12 @@
return
"
jio getIO error :
"
+
response
.
target
.
result
;
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
)
{
.
declareMethod
(
'
setIO
'
,
function
(
attachment
,
file
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
gadget
.
jio
.
putAttachment
({
return
gadget
.
jio
.
putAttachment
({
...
@@ -55,7 +62,7 @@
...
@@ -55,7 +62,7 @@
})
})
.
declareAcquiredMethod
(
"
sendPlaylist
"
,
"
sendPlaylist
"
);
.
declareAcquiredMethod
(
"
sendPlaylist
"
,
"
sendPlaylist
"
);
gk
.
ready
(
function
(
g
)
{
gk
.
ready
(
function
(
g
)
{
var
input_context
=
g
.
__element
.
getElementsByTagName
(
'
input
'
)[
0
];
input_context
=
g
.
__element
.
getElementsByTagName
(
'
input
'
)[
0
];
g
.
playlist
=
[];
g
.
playlist
=
[];
g
.
createIO
({
"
type
"
:
"
indexeddb
"
,
g
.
createIO
({
"
type
"
:
"
indexeddb
"
,
"
database
"
:
"
test
"
},
"
database
"
:
"
test
"
},
...
@@ -70,7 +77,6 @@
...
@@ -70,7 +77,6 @@
g
.
sendPlaylist
(
g
.
playlist
);
g
.
sendPlaylist
(
g
.
playlist
);
});
});
});
});
input_context
.
onchange
=
function
()
{
input_context
.
onchange
=
function
()
{
var
tmp
,
var
tmp
,
index
,
index
,
...
...
src/audioplayer_progress/progress.js
View file @
dd5b7008
...
@@ -18,6 +18,12 @@
...
@@ -18,6 +18,12 @@
.
declareMethod
(
'
getMax
'
,
function
()
{
.
declareMethod
(
'
getMax
'
,
function
()
{
return
this
.
bar
.
max
;
return
this
.
bar
.
max
;
})
})
.
declareMethod
(
'
display
'
,
function
(
attachment
)
{
this
.
bar
.
style
.
display
=
""
;
})
.
declareMethod
(
'
noDisplay
'
,
function
(
attachment
)
{
this
.
bar
.
style
.
display
=
"
none
"
;
})
.
declareAcquiredMethod
(
"
setCurrentTime
"
,
"
setCurrentTime
"
);
.
declareAcquiredMethod
(
"
setCurrentTime
"
,
"
setCurrentTime
"
);
gk
.
ready
(
function
(
g
)
{
gk
.
ready
(
function
(
g
)
{
g
.
bar
=
g
.
__element
.
getElementsByTagName
(
'
progress
'
)[
0
];
g
.
bar
=
g
.
__element
.
getElementsByTagName
(
'
progress
'
)[
0
];
...
...
src/audioplayer_title/title.js
View file @
dd5b7008
...
@@ -34,6 +34,12 @@
...
@@ -34,6 +34,12 @@
})
})
.
declareMethod
(
'
getSize
'
,
function
(
size
)
{
.
declareMethod
(
'
getSize
'
,
function
(
size
)
{
return
this
.
input
.
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
)
{
gk
.
ready
(
function
(
g
)
{
g
.
scroll
=
new
BannerObject
();
g
.
scroll
=
new
BannerObject
();
...
...
src/audioplayer_volume/volume.js
View file @
dd5b7008
...
@@ -17,11 +17,18 @@
...
@@ -17,11 +17,18 @@
.
declareMethod
(
'
getMax
'
,
function
()
{
.
declareMethod
(
'
getMax
'
,
function
()
{
return
this
.
bar
.
max
;
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
(
"
setVolume
"
,
"
setVolume
"
)
.
declareAcquiredMethod
(
"
getVolume
"
,
"
getVolume
"
);
//xxxx
.
declareAcquiredMethod
(
"
getVolume
"
,
"
getVolume
"
);
//xxxx
gk
.
ready
(
function
(
g
)
{
gk
.
ready
(
function
(
g
)
{
g
.
bar
=
g
.
__element
.
getElementsByTagName
(
'
progress
'
)[
0
];
g
.
bar
=
g
.
__element
.
getElementsByTagName
(
'
progress
'
)[
0
];
g
.
bar
.
max
=
1000
;
g
.
bar
.
max
=
1000
;
//g.bar.style.display = "none";
g
.
bar
.
onclick
=
function
(
e
)
{
g
.
bar
.
onclick
=
function
(
e
)
{
var
posX
=
e
.
clientX
,
var
posX
=
e
.
clientX
,
targetLeft
=
$
(
g
.
bar
).
offset
().
left
;
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