Blame view

sources/apps/files_svgedit/js/ocsvg.js 1.26 KB
42e4f8d60   Kload   add all apps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
  $(document).ready(function() {
  	if(typeof FileActions!=='undefined'){
  		FileActions.register('image/svg+xml','Edit','',function(filename){
              window.location = OC.filePath('files_svgedit', '', 'index.php')
                              + "?file=" + $('#dir').val() + "/" + filename;
  		});
  		FileActions.setDefault('image/svg+xml','Edit');
  	}
      if(location.href.match(/\/files\/index\.php/)) {
          getMimeIcon('image/svg+xml', function(icon) {
              $('<li><p>' + t('files_svgedit', 'Graphic') + '</p></li>')
                  .attr('id', 'newSvgLi')
                  .appendTo('div#new>ul')
                  .css('background-image', 'url(' + icon + ')')
                  .data('type', 'svg')
                  .children('p')
                  .click(function() {
                      $(this).hide();
                      $('<input>').appendTo('#newSvgLi').focus().change(function() {
                          window.location = OC.filePath('files_svgedit', '', 'index.php')
                              + "?file=" + $('#dir').val() + "/" + $(this).val().replace(/(\..{3})?$/, '.svg');
                      }).blur(function() {
                          $(this).remove();
                          $('#newSvgLi>p').show();
                      });
                  });
          });
      }
  });