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
e7f8a34d
Commit
e7f8a34d
authored
Jul 05, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add indexeddbstorage&httpstorage switch
parent
8284d44e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
15 deletions
+73
-15
src/audioplayer/audioplayer.js
src/audioplayer/audioplayer.js
+39
-12
src/audioplayer/index.html
src/audioplayer/index.html
+4
-1
src/audioplayer_control/control.js
src/audioplayer_control/control.js
+3
-1
src/audioplayer_playlist/index.html
src/audioplayer_playlist/index.html
+11
-0
src/audioplayer_playlist/playlist.js
src/audioplayer_playlist/playlist.js
+16
-1
No files found.
src/audioplayer/audioplayer.js
View file @
e7f8a34d
...
...
@@ -6,6 +6,18 @@
$
.
mobile
.
linkBindingEnabled
=
false
;
$
.
mobile
.
hashListeningEnabled
=
false
;
$
.
mobile
.
pushStateEnabled
=
false
;
var
gadget_list
=
{
"
upload
"
:
{
"
0
"
:
"
../audioplayer_upload/index.html
"
,
"
1
"
:
"
../audioplayer_playlist/index.html
"
},
"
playlist
"
:
{
"
0
"
:
"
../audioplayer_playlist/index.html
"
,
"
1
"
:
"
../audioplayer_playlist/index.html
"
},
"
control
"
:
{
"
0
"
:
"
../audioplayer_control/index.html
"
,
"
1
"
:
"
../audioplayer_control/index.html
"
}
},
allStorageType
=
[
"
indexeddbStorage
"
,
"
httpStorage
"
];
function
storageType
(
type
)
{
return
allStorageType
[
type
];
}
function
disablePage
(
g
)
{
var
overlay
=
document
.
createElement
(
'
div
'
),
loader
=
document
.
createElement
(
'
div
'
),
...
...
@@ -51,31 +63,31 @@
return
this
.
save
[
param_list
[
0
]];
})
.
allowPublicAcquisition
(
"
allDocs
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
"
jio
"
)
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)
)
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
allDocs
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_post
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
"
jio
"
)
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)
)
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
post
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_putAttachment
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
"
jio
"
)
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)
)
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
putAttachment
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_getAttachment
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
"
jio
"
)
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)
)
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
getAttachment
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_get
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
"
jio
"
)
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
)
)
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
get
.
apply
(
jio_gadget
,
param_list
);
});
...
...
@@ -87,13 +99,20 @@
rJS
(
window
)
.
ready
(
function
(
g
)
{
var
jio_gadget
;
return
g
.
getDeclaredGadget
(
"
jio
"
)
return
g
.
getDeclaredGadget
(
"
httpStorage
"
)
.
push
(
function
(
gadget
)
{
return
gadget
.
createJio
(
{
"
type
"
:
"
http
"
,
//indexeddb
"
database
"
:
"
http://localhost:8080/
"
}
//test
);
})
.
push
(
function
()
{
return
g
.
getDeclaredGadget
(
"
indexeddbStorage
"
);
})
.
push
(
function
(
gadget
)
{
jio_gadget
=
gadget
;
return
jio_gadget
.
createJio
(
{
"
type
"
:
"
http
"
,
"
database
"
:
"
http://192.168.242.63:8080/
"
}
return
gadget
.
createJio
(
{
"
type
"
:
"
indexeddb
"
,
"
database
"
:
"
test
"
}
);
});
})
...
...
@@ -109,8 +128,16 @@
return
gadget
.
aq_pleasePublishMyState
({
page
:
"
playlist
"
})
.
push
(
gadget
.
pleaseRedirectMyHash
.
bind
(
gadget
));
}
gadget
.
storageType
=
gadget
.
storageType
||
0
;
if
(
options
.
page
===
"
playlist
"
)
{
if
(
options
.
id
===
"
indexeddbStorage
"
)
{
gadget
.
storageType
=
0
;
}
else
if
(
options
.
id
===
"
httpStorage
"
)
{
gadget
.
storageType
=
1
;
}
}
return
gadget
.
declareGadget
(
"
../audioplayer_
"
+
options
.
page
+
"
/index.html
"
gadget_list
[
options
.
page
][
gadget
.
storageType
]
).
push
(
function
(
g
)
{
disablePage
(
gadget
);
page_gadget
=
g
;
...
...
src/audioplayer/index.html
View file @
e7f8a34d
...
...
@@ -24,7 +24,10 @@
</div>
<div
class=
"jio"
data-gadget-url=
"../audioplayer_bridge/index.html"
data-gadget-scope=
"jio"
>
<div
class=
"indexeddbStorage"
data-gadget-url=
"../audioplayer_bridge/index.html"
data-gadget-scope=
"indexeddbStorage"
>
</div>
<div
class=
"httpStorage"
data-gadget-url=
"../audioplayer_bridge/index.html"
data-gadget-scope=
"httpStorage"
>
</div>
<article
class=
"gadget_container"
></article>
...
...
src/audioplayer_control/control.js
View file @
e7f8a34d
...
...
@@ -6,7 +6,9 @@
(
function
(
window
,
rJS
,
RSVP
,
loopEventListener
,
$
,
promiseEventListener
)
{
"
use strict
"
;
var
gk
=
rJS
(
window
),
audioCtx
=
new
window
.
AudioContext
(),
AudioContext
=
window
.
AudioContext
||
window
.
webkitAudioContext
||
window
.
mozAudiocontext
||
window
.
msAudioContext
,
audioCtx
=
new
AudioContext
(),
myLoopEventListener
=
function
(
target
,
type
,
callback
,
allowDefault
)
{
//////////////////////////
...
...
src/audioplayer_playlist/index.html
View file @
e7f8a34d
...
...
@@ -29,5 +29,16 @@
<ul
data-role=
"listview"
data-split-theme=
"d"
>
</ul>
</div>
<div
data-role=
"footer"
data-position=
"fixed"
data-theme=
"b"
>
<div
data-role=
"navbar"
>
<ul>
<li><a
data-role=
"button"
class=
"indexeddbStorage"
data-icon=
"arrow-l"
>
indexeddbStorage
</a></li>
<li><a
data-role=
"button"
class=
"httpStorage"
data-icon=
"arrow-r"
>
httpStorage
</a></li>
</ul>
</div>
<!-- /navbar -->
</div>
<!-- /footer -->
</body>
</html>
src/audioplayer_playlist/playlist.js
View file @
e7f8a34d
...
...
@@ -21,6 +21,20 @@
.
push
(
function
()
{
return
gadget
.
displayThisTitle
(
"
playlist
"
);
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
displayThisPage
({
page
:
"
playlist
"
,
id
:
"
indexeddbStorage
"
}),
gadget
.
displayThisPage
({
page
:
"
playlist
"
,
id
:
"
httpStorage
"
})
]);
})
.
push
(
function
(
param_list
)
{
gadget
.
__element
.
getElementsByClassName
(
'
indexeddbStorage
'
)[
0
]
.
href
=
param_list
[
0
];
gadget
.
__element
.
getElementsByClassName
(
'
httpStorage
'
)[
0
]
.
href
=
param_list
[
1
];
})
.
push
(
function
()
{
return
gadget
.
allDocs
({
"
include_docs
"
:
true
});
})
...
...
@@ -29,7 +43,8 @@
i
,
j
,
exp
;
if
(
options
.
id
!==
undefined
)
{
if
(
options
.
id
!==
undefined
&&
options
.
id
!==
"
indexeddbStorage
"
&&
options
.
id
!==
"
httpStorage
"
)
{
for
(
i
=
0
,
j
=
0
;
i
<
e
.
data
.
rows
.
length
;
i
+=
1
)
{
exp
=
new
RegExp
(
options
.
id
,
"
i
"
);
if
(
e
.
data
.
rows
[
i
].
doc
.
title
.
search
(
exp
)
!==
-
1
)
{
...
...
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