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
f1cdd9f5
Commit
f1cdd9f5
authored
Jul 16, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable ip taken while net connects
parent
f4b86584
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
69 deletions
+87
-69
src/audioplayer/audioplayer.js
src/audioplayer/audioplayer.js
+3
-0
src/audioplayer/index.html
src/audioplayer/index.html
+1
-1
src/audioplayer_control/control.less
src/audioplayer_control/control.less
+1
-1
src/audioplayer_control/index.html
src/audioplayer_control/index.html
+1
-1
src/audioplayer_playlist_online/playlist.js
src/audioplayer_playlist_online/playlist.js
+81
-66
No files found.
src/audioplayer/audioplayer.js
View file @
f1cdd9f5
...
...
@@ -27,6 +27,9 @@
controlPanel
=
g
.
__element
.
getElementsByClassName
(
"
page
"
)[
0
],
i
=
0
,
circle
;
if
(
controlPanel
.
firstChild
)
{
return
;
}
overlay
.
className
=
'
overlay
'
;
loader
.
className
=
'
loader
'
;
while
(
i
<
5
)
{
...
...
src/audioplayer/index.html
View file @
f1cdd9f5
<!DOCTYPE html>
<
html
manifest=
"audioPlayer.appcache"
>
<
!--html manifest="audioPlayer.appcache"--
>
<head>
<!-- renderjs -->
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
...
...
src/audioplayer_control/control.less
View file @
f1cdd9f5
button.loop {
width :
6
em;
width :
10
em;
}
#visualizer {
text-align: center;
...
...
src/audioplayer_control/index.html
View file @
f1cdd9f5
...
...
@@ -29,7 +29,7 @@
<button
type=
"button"
class=
"loop"
></button>
<button
type=
"button"
data-icon=
"refresh"
class=
"loop"
></button>
<div
id=
"visualizer"
>
...
...
src/audioplayer_playlist_online/playlist.js
View file @
f1cdd9f5
/*global window, rJS, RSVP, console, jQuery, $, JSON, Handlebars,
loopEventListener, RegExp, alert */
loopEventListener, RegExp, alert
, promiseEventListener
*/
/*jslint maxlen:180, nomen: true */
...
...
@@ -19,6 +19,51 @@
return
true
;
}
function
check
(
value
)
{
var
g
=
this
,
info
=
g
.
__element
.
getElementsByClassName
(
'
info
'
)[
0
],
http
,
port
,
portEnd
,
ipValue
=
value
;
g
.
__element
.
getElementsByTagName
(
'
ul
'
)[
0
].
innerHTML
=
"
"
;
if
(
ipValue
.
indexOf
(
"
/
"
,
ipValue
.
length
-
1
)
===
-
1
)
{
info
.
innerHTML
=
"
not end with /
"
;
return
;
}
http
=
ipValue
.
indexOf
(
"
http://
"
);
ipValue
=
ipValue
.
substring
(
ipValue
.
indexOf
(
"
//
"
)
+
2
);
port
=
ipValue
.
indexOf
(
"
:
"
);
portEnd
=
ipValue
.
indexOf
(
"
:/
"
);
if
(
port
!==
-
1
)
{
ipValue
=
ipValue
.
substring
(
0
,
port
);
}
if
(
http
===
-
1
)
{
info
.
innerHTML
=
"
please start ip with http://
"
;
return
;
}
if
(
port
===
-
1
||
portEnd
!==
-
1
)
{
info
.
innerHTML
=
"
input port number
"
;
return
;
}
if
(
checkIp
(
ipValue
)
===
false
)
{
info
.
innerHTML
=
"
invalide ip: ip should like xxx.xxx.xxx.xxx(xxx is between 0 ~ 255)
"
;
return
;
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
g
.
plSave
({
"
ip
"
:
value
});
})
.
push
(
function
()
{
return
g
.
displayThisPage
({
page
:
"
playlist
"
,
action
:
value
});
})
.
push
(
function
(
url
)
{
window
.
location
=
url
;
});
}
gk
.
declareAcquiredMethod
(
"
allDocs
"
,
"
allDocs
"
)
.
declareAcquiredMethod
(
"
plSave
"
,
"
plSave
"
)
.
declareAcquiredMethod
(
"
plGive
"
,
"
plGive
"
)
...
...
@@ -30,6 +75,8 @@
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
gadget
=
this
,
ipValue
,
ip_context
=
gadget
.
__element
.
getElementsByClassName
(
'
inputIp
'
)[
0
],
list
=
gadget
.
__element
.
getElementsByTagName
(
'
ul
'
)[
0
];
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
...
...
@@ -47,38 +94,49 @@
.
href
=
param_list
[
1
];
})
.
push
(
function
()
{
if
(
options
.
action
)
{
return
options
.
action
;
}
return
gadget
.
plGive
(
"
ip
"
);
})
.
push
(
function
(
value
)
{
if
(
value
!==
undefined
)
{
ipValue
=
value
;
gadget
.
__element
.
getElementsByClassName
(
'
inputIp
'
)[
0
]
.
value
=
value
;
ip_context
.
value
=
value
;
return
gadget
.
plCreateHttpStorage
(
value
)
;
}
return
gadget
.
allDocs
({
"
include_docs
"
:
true
});
})
.
push
(
function
()
{
return
RSVP
.
any
([
gadget
.
allDocs
({
"
include_docs
"
:
true
}),
promiseEventListener
(
ip_context
,
"
change
"
,
false
)
]);
})
.
push
(
function
(
e
)
{
var
tmp
=
e
.
data
.
rows
,
i
,
j
,
exp
;
if
(
options
.
id
!==
undefined
&&
options
.
id
!==
"
online
"
)
{
tmp
=
[];
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
)
{
tmp
[
j
]
=
e
.
data
.
rows
[
i
];
j
+=
1
;
if
(
e
.
data
)
{
var
tmp
=
e
.
data
.
rows
,
i
,
j
,
exp
;
if
(
options
.
id
!==
undefined
&&
options
.
id
!==
"
online
"
)
{
tmp
=
[];
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
)
{
tmp
[
j
]
=
e
.
data
.
rows
[
i
];
j
+=
1
;
}
}
gadget
.
id
=
options
.
id
;
}
gadget
.
id
=
options
.
id
;
list
.
innerHTML
=
network
({
"
rows
"
:
tmp
});
$
(
list
).
listview
(
"
refresh
"
);
return
gadget
.
displayThisTitle
(
"
online playlist:
"
+
tmp
.
length
+
"
music
"
);
}
list
.
innerHTML
=
network
({
"
rows
"
:
tmp
});
$
(
list
).
listview
(
"
refresh
"
);
return
gadget
.
displayThisTitle
(
"
online playlist:
"
+
tmp
.
length
+
"
music
"
);
return
check
.
call
(
gadget
,
ip_context
.
value
);
})
.
fail
(
function
(
error
)
{
if
(
ipValue
)
{
...
...
@@ -113,50 +171,7 @@
});
}),
loopEventListener
(
ip
,
"
change
"
,
false
,
function
()
{
var
info
=
g
.
__element
.
getElementsByClassName
(
'
info
'
)[
0
],
http
,
port
,
portEnd
,
ipValue
=
ip
.
value
;
g
.
__element
.
getElementsByTagName
(
'
ul
'
)[
0
].
innerHTML
=
"
"
;
if
(
ipValue
.
indexOf
(
"
/
"
,
ipValue
.
length
-
1
)
===
-
1
)
{
info
.
innerHTML
=
"
not end with /
"
;
return
;
}
http
=
ipValue
.
indexOf
(
"
http://
"
);
ipValue
=
ipValue
.
substring
(
ipValue
.
indexOf
(
"
//
"
)
+
2
);
port
=
ipValue
.
indexOf
(
"
:
"
);
portEnd
=
ipValue
.
indexOf
(
"
:/
"
);
if
(
port
!==
-
1
)
{
ipValue
=
ipValue
.
substring
(
0
,
port
);
}
if
(
http
===
-
1
)
{
info
.
innerHTML
=
"
please start ip with http://
"
;
return
;
}
if
(
port
===
-
1
||
portEnd
!==
-
1
)
{
info
.
innerHTML
=
"
input port number
"
;
return
;
}
if
(
checkIp
(
ipValue
)
===
false
)
{
info
.
innerHTML
=
"
invalide ip: ip should like xxx.xxx.xxx.xxx(xxx is between 0 ~ 255)
"
;
return
;
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
g
.
plCreateHttpStorage
(
ip
.
value
);
})
.
push
(
function
()
{
return
g
.
plSave
({
"
ip
"
:
ip
.
value
});
})
.
push
(
function
()
{
return
g
.
displayThisPage
({
page
:
"
playlist
"
,
action
:
ip
.
value
});
})
.
push
(
function
(
url
)
{
window
.
location
=
url
;
});
return
check
.
call
(
g
,
ip
.
value
);
})
]);
//any
});
//rsvp
...
...
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