Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
Desktop Client
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SpinShare
Desktop Client
Commits
098fb047
Commit
098fb047
authored
Apr 02, 2020
by
Andreas Heimann
Committed by
GitHub
Apr 02, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2 from jy1263/master
Drag and drop install implemented
parents
69fcd2b8
878d6712
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
13 deletions
+36
-13
src/assets/js/section.library.js
src/assets/js/section.library.js
+34
-12
src/assets/js/section.startup.js
src/assets/js/section.startup.js
+2
-1
No files found.
src/assets/js/section.library.js
View file @
098fb047
const
DOMLibrarySongsList
=
document
.
querySelector
(
"
.song-row-library .song-list
"
);
//The Extraction Process
function
ExtractionProcess
(
filePath
){
//Basic .zip detection so the console doesnt throw a flurry of errors complaining it can't unzip.
if
(
filePath
.
endsWith
(
'
.zip
'
)){
let
fileName
=
path
.
basename
(
filePath
)
srxdControl
.
extractBackup
(
filePath
,
fileName
).
then
(
function
(
extractResults
)
{
if
(
extractResults
)
{
installBackup
(
extractResults
);
setTimeout
(
function
()
{
RefreshLibrary
();
},
200
);
}
else
{
console
.
error
(
"
Backup could not be loaded!
"
);
}
});
}
else
{
console
.
error
(
'
Not a zip!
'
);}
}
//Upload Manually
function
InstallBackupManually
()
{
dialog
.
showOpenDialog
({
title
:
"
Open Backup
"
,
properties
:
[
'
openFile
'
],
filters
:
[{
"
name
"
:
"
Backup Archive
"
,
"
extensions
"
:
[
"
zip
"
]}]
}).
then
(
result
=>
{
if
(
!
result
.
canceled
)
{
let
filePath
=
result
.
filePaths
[
0
];
let
fileName
=
path
.
basename
(
filePath
);
srxdControl
.
extractBackup
(
filePath
,
fileName
).
then
(
function
(
extractResults
)
{
if
(
extractResults
)
{
installBackup
(
extractResults
);
setTimeout
(
function
()
{
RefreshLibrary
();
},
200
);
}
else
{
console
.
error
(
"
Backup could not be loaded!
"
);
}
});
ExtractionProcess
(
filePath
);
}
});
}
//Drag and Drop
document
.
ondragover
=
document
.
ondrop
=
(
dragndrop
)
=>
{
dragndrop
.
preventDefault
();
}
document
.
body
.
ondrop
=
(
ev
)
=>
{
let
filePath
=
(
ev
.
dataTransfer
.
files
[
0
].
path
)
ev
.
preventDefault
()
ExtractionProcess
(
filePath
);
}
function
RefreshLibrary
()
{
// Clear current songs
let
installElement
=
DOMLibrarySongsList
.
firstElementChild
;
...
...
src/assets/js/section.startup.js
View file @
098fb047
...
...
@@ -163,4 +163,5 @@ function BuildSongDOM(songItem) {
});
return
songContainer
;
}
\ No newline at end of file
}
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