spee.ch/public/assets/js/publishFileFunctions.js

46 lines
2.1 KiB
JavaScript
Raw Normal View History

var stagedFiles = null;
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-03 21:37:23 +01:00
return null;
2017-11-02 01:14:38 +01:00
},
// Validate the publish submission and then trigger upload
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>');
},
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){
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>');
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
}