From 82ddaaa13178450db32c8ab5f4d65ff6b1da60c7 Mon Sep 17 00:00:00 2001 From: Marco Dickert Date: Wed, 5 Jul 2017 21:34:44 +0200 Subject: [PATCH] add self-detection of api url --- src/ifm.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ifm.js b/src/ifm.js index dc90995..e51460e 100644 --- a/src/ifm.js +++ b/src/ifm.js @@ -5,15 +5,8 @@ function IFM( params ) { var self = this; // reference to ourself, because "this" does not work within callbacks // set the backend for the application - if( ! params.api ) { - throw new Error( "IFM: no backend configured" ); - } else { - self.api = params.api; - } + self.api = params.api || window.location.pathname; - - - this.isDocroot = ; this.editor = null; // global ace editor this.fileChanged = false; // flag for check if file was changed already this.currentDir = ""; // this is the global variable for the current directory; it is used for AJAX requests @@ -93,7 +86,7 @@ function IFM( params ) { newRow += '>"'; @@ -796,9 +789,10 @@ function IFM( params ) { */ this.showMessage = function(m, t) { var msgType = (t == "e")?"danger":(t == "s")?"success":"info"; + var element = ( self.config.inline ) ? self.rootElement : "body"; $.notify( { message: m }, - { type: msgType, delay: 5000, mouse_over: 'pause', offset: { x: 15, y: 65 } } + { type: msgType, delay: 5000, mouse_over: 'pause', offset: { x: 15, y: 65 }, element: element } ); }; @@ -1192,5 +1186,5 @@ function IFM( params ) { }; } -var ifm = new IFM({ api: "ifm.php" }); +var ifm = new IFM({}); ifm.init( "ifm" );