]> git.immae.eu Git - perso/Immae/Projets/Nodejs/Surfer.git/blobdiff - frontend/js/app.js
Add button to real path
[perso/Immae/Projets/Nodejs/Surfer.git] / frontend / js / app.js
index 05cbe9ca331fb878b1974274e35a9b89b354367c..61f1b46979221ea1bc77fad32444c71b042566bc 100644 (file)
@@ -135,7 +135,7 @@ function loadDirectory(filePath) {
     });
 }
 
-function open(row, event, column) {
+function open(row, column, event) {
     // ignore item open on row clicks if we are renaming this entry
     if (row.rename) return;
 
@@ -146,7 +146,19 @@ function open(row, event, column) {
         return;
     }
 
-    window.open(encode(path));
+    app.activeEntry = row;
+    app.activeEntry.fullPath = encode(sanitize(app.path + '/' + row.filePath));
+    app.previewDrawerVisible = true
+
+    // need to wait for DOM element to exist
+    setTimeout(function () {
+        $('iframe').on('load', function (e) {
+            if (!e.target.contentWindow.document.body) return;
+
+            e.target.contentWindow.document.body.style.display = 'flex'
+            e.target.contentWindow.document.body.style.justifyContent = 'center'
+        });
+    }, 0);
 }
 
 function uploadFiles(files) {
@@ -280,6 +292,8 @@ var app = new Vue({
             password: '',
             busy: false
         },
+        previewDrawerVisible: false,
+        activeEntry: {},
         entries: [],
         accessTokens: [],
         accessTokensDialogVisible: false
@@ -486,7 +500,8 @@ var app = new Vue({
         },
         open: open,
         drop: drop,
-        dragOver: dragOver
+        dragOver: dragOver,
+        sanitize: sanitize
     }
 });