]> source.dussan.org Git - nextcloud-server.git/commitdiff
add js versions of basename and dirname
authorRobin Appelman <icewind@owncloud.com>
Sat, 8 Sep 2012 21:56:37 +0000 (23:56 +0200)
committerRobin Appelman <icewind@owncloud.com>
Sat, 8 Sep 2012 21:59:02 +0000 (23:59 +0200)
core/js/js.js

index 1bd650bb6b87e92e928fb597eb050dddad07d3b4..21466a809b2f9e45b428edc01b17517946a41bb7 100644 (file)
@@ -154,6 +154,12 @@ OC={
                        $('head').append(style);
                }
        },
+       basename: function(path) {
+               return path.replace(/\\/g,'/').replace( /.*\//, '' );
+       },
+       dirname: function(path) {
+               return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');;
+       }
        /**
         * do a search query and display the results
         * @param query the search query