Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rockodi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CeRiAl
rockodi
Commits
54151a3d
Commit
54151a3d
authored
Mar 09, 2016
by
CeRiAl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Beautify JS-code even more
parent
cfe43c5b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
131 additions
and
119 deletions
+131
-119
pebble-js-app.js
src/js/pebble-js-app.js
+131
-119
No files found.
src/js/pebble-js-app.js
View file @
54151a3d
...
...
@@ -144,8 +144,9 @@ var MessageQueue = function () {
}
}
}();
// global variables
// global variables
var
storage_keys
=
{
"IP_ADDRESS"
:
0
,
"USERNAME"
:
1
,
...
...
@@ -229,6 +230,8 @@ function handleJsonRpcError(response) {
}
}
}
// player methods
function
getStatus
()
{
g_player_id
=
-
1
;
...
...
@@ -360,6 +363,8 @@ function stop() {
function
changeTransportCb
(
result
)
{
getStatus
();
}
// Remote methods
function
sendKey
(
input_key
)
{
switch
(
input_key
)
{
...
...
@@ -383,6 +388,8 @@ function sendKey(input_key) {
break
;
}
}
// Goto methods
function
gotoFullscreen
()
{
sendJsonRequest
(
new
JsonRpcRequest
(
"GUI.setFullScreen"
,
{
...
...
@@ -423,6 +430,8 @@ function gotoWeather() {
"window"
:
"weather"
}));
}
// Playlist methods
function
getMusicPlaylists
()
{
sendJsonRequest
(
new
JsonRpcRequest
(
"Files.GetDirectory"
,
{
...
...
@@ -469,6 +478,8 @@ function playMusicPlaylist(payload) {
}));
sendJsonRequest
(
requests
);
}
// Addon methods
function
getAddons
()
{
sendJsonRequest
(
new
JsonRpcRequest
(
"Addons.GetAddons"
,
{
...
...
@@ -499,6 +510,8 @@ function executeAddon(payload) {
"addonid"
:
addonid
}));
}
// Power methods
function
systemShutdown
()
{
sendJsonRequest
(
new
JsonRpcRequest
(
"System.Shutdown"
));
...
...
@@ -515,21 +528,22 @@ function systemHibernate() {
function
systemSuspend
()
{
sendJsonRequest
(
new
JsonRpcRequest
(
"System.Suspend"
));
}
// Event listeners
Pebble
.
addEventListener
(
"ready"
,
function
(
e
)
{
Pebble
.
addEventListener
(
"ready"
,
function
(
e
)
{
console
.
log
(
"Rockodi copyright (c) 2015, Douglas Otwell"
);
g_ip_address
=
localStorage
.
getItem
(
storage_keys
.
IP_ADDRESS
);
g_username
=
localStorage
.
getItem
(
storage_keys
.
USERNAME
);
g_password
=
localStorage
.
getItem
(
storage_keys
.
PASSWORD
);
}
);
});
Pebble
.
addEventListener
(
"showConfiguration"
,
function
(
e
)
{
var
query_string
=
encodeURI
(
"?ip_address="
+
g_ip_address
+
"&username="
+
g_username
+
"&password="
+
g_password
);
Pebble
.
openURL
(
"http://www.dkographicdetails.com/rockodi/config/config-page.html"
+
query_string
);
});
Pebble
.
addEventListener
(
"webviewclosed"
,
function
(
e
)
{
Pebble
.
addEventListener
(
"webviewclosed"
,
function
(
e
)
{
var
configuration
=
JSON
.
parse
(
decodeURIComponent
(
e
.
response
));
if
(
typeof
configuration
.
ip_address
!==
"undefined"
)
{
localStorage
.
setItem
(
storage_keys
.
IP_ADDRESS
,
configuration
.
ip_address
);
...
...
@@ -539,10 +553,9 @@ Pebble.addEventListener("webviewclosed",
g_username
=
localStorage
.
getItem
(
storage_keys
.
USERNAME
);
g_password
=
localStorage
.
getItem
(
storage_keys
.
PASSWORD
);
}
}
);
Pebble
.
addEventListener
(
"appmessage"
,
function
(
e
)
{
});
Pebble
.
addEventListener
(
"appmessage"
,
function
(
e
)
{
var
cmd
=
e
.
payload
.
MSG_KEY_CMD
;
switch
(
cmd
)
{
// Player messages
...
...
@@ -638,5 +651,4 @@ Pebble.addEventListener("appmessage",
default
:
console
.
log
(
"Command is not defined: "
+
cmd
+
"; payload: "
+
e
.
payload
);
}
}
);
});
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