2017-11-02 23:12:26 +01:00
var stagedFiles = null ;
2017-11-01 21:07:13 +01:00
2017-11-13 21:21:26 +01:00
const publishFileFunctions = {
2017-11-02 01:14:38 +01:00
returnNullOrChannel : function ( ) {
2017-11-03 21:37:23 +01:00
const channelRadio = document . getElementById ( 'channel-radio' ) ;
if ( channelRadio . checked ) {
const channelInput = document . getElementById ( 'channel-name-select' ) ;
return channelInput . value . trim ( ) ;
2017-11-01 21:07:13 +01:00
}
2017-11-03 21:37:23 +01:00
return null ;
2017-11-02 01:14:38 +01:00
} ,
// Validate the publish submission and then trigger upload
2017-11-02 23:12:26 +01:00
showUploadStartedMessage : function ( ) {
console . log ( 'starting upload' ) ;
// hide the publish tool
this . hidePublishTools ( ) ;
// show the progress status and animation
this . showPublishStatus ( ) ;
this . showPublishProgressBar ( ) ;
} ,
showUploadProgressMessage : function ( percentage ) {
this . updatePublishStatus ( '<p>File is loading to server</p>' ) ;
2017-11-07 00:18:45 +01:00
this . updateUploadPercent ( '<p class="blue">' + percentage + '% </p>' ) ;
2017-11-02 23:12:26 +01:00
} ,
showFilePublishUpdate : function ( msg ) {
this . updatePublishStatus ( '<p>' + msg + '</p>' ) ;
this . updateUploadPercent ( '<p>Curious what magic is happening here? <a class="link--primary" target="blank" href="https://lbry.io/faq/what-is-lbry">Learn more.</a></p>' ) ;
} ,
showFilePublishFailure : function ( msg ) {
2017-11-13 21:12:16 +01:00
this . updatePublishStatus ( '<p>Something went wrong...</p><p><strong>' + msg + '</strong></p><p>For help, post the above error text in the #speech channel on the <a class="link--primary" href="https://discord.gg/YjYbwhS" target="_blank">lbry discord</a>' ) ;
2017-11-02 23:12:26 +01:00
this . hidePublishProgressBar ( ) ;
this . hideUploadPercent ( ) ;
} ,
showFilePublishComplete : function ( msg ) {
console . log ( 'Publish complete!' ) ;
const showUrl = msg . lbryTx . claim _id + "/" + msg . name ;
// update status
this . updatePublishStatus ( '<p>Your publish is complete! You are being redirected to it now.</p>' ) ;
this . updateUploadPercent ( '<p><a class="link--primary" target="_blank" href="' + showUrl + '">If you do not get redirected, click here.</a></p>' )
// redirect the user
window . location . href = showUrl ;
} ,
2017-11-02 01:14:38 +01:00
}
2017-11-01 21:07:13 +01:00