Files
fnx_web/res/static/script/Toolbar.js

75 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-11-06 22:19:57 +01:00
/*
2017-11-10 12:39:55 +01:00
* Time for a more Java-like approach.
2018-11-06 22:19:57 +01:00
*
2017-11-10 12:39:55 +01:00
* Feel free to use this of course
2018-11-06 22:19:57 +01:00
*
2017-11-10 12:39:55 +01:00
* Made by Fornax
*/
/* global Sharebar, Viewer */
var Toolbar = {
visible: true,
toggle: function () {
if (this.visible) {
if (Sharebar.visible) {
Sharebar.toggle();
}
$("#toolbar").animate( {left: "-132"}, 400);
$("#filepreview").animate({left: "0"}, 400);
$("#info_popup").animate( {left: "20"}, 400);
2017-11-10 12:39:55 +01:00
$("#button-expand-toolbar").css("visibility", "visible");
this.visible = false;
} else {
$("#toolbar").animate( {left: "0"}, 400);
2017-11-10 12:39:55 +01:00
$("#filepreview").animate({left: "122"}, 400);
$("#info_popup").animate( {left: "142"}, 400);
2017-11-10 12:39:55 +01:00
2018-01-07 21:42:19 +01:00
setTimeout(function(){
if(this.visible){
$("#button-expand-toolbar").css("visibility", "hidden");
}
}, 1000)
2017-11-10 12:39:55 +01:00
this.visible = true;
}
},
download: function () {
2018-11-06 22:19:57 +01:00
$("#frmDownload").attr("src", "/api/file/" + Viewer.currentFile + "?download");
2017-11-10 12:39:55 +01:00
},
downloadList: function(){
if(!Viewer.isList){
return;
}
2018-11-06 22:19:57 +01:00
2017-11-10 12:39:55 +01:00
$("#frmDownload").attr("src", "/api/list/" + Viewer.listId + "/zip");
},
copyUrl: function () {
$("#copy-text").val(window.location.href);
$("#copy-text").select();
try {
var success = document.execCommand('copy');
console.log('Text copied');
$("#btnCopy>span").text("Copied!");
2018-01-07 21:42:19 +01:00
$("#btnCopy").addClass("button_highlight");
2017-11-10 12:39:55 +01:00
} catch (err) {
console.log('Copying not supported');
$("#btnCopy>span").text("Error!");
alert("Your browser does not support copying text.");
}
2018-11-06 22:19:57 +01:00
2017-11-10 12:39:55 +01:00
// Return to normal
2018-01-07 21:42:19 +01:00
setTimeout(function(){
$("#btnCopy>span").text("Copy");
$("#btnCopy").removeClass("button_highlight");
2019-02-17 22:44:37 +01:00
}, 60000);
2017-11-10 12:39:55 +01:00
},
setViews: function(amount){
2019-02-11 22:41:22 +01:00
$("#views").html("Views: "+amount);
2017-11-10 12:39:55 +01:00
}
};