Blame view

sources/apps/gallery/js/public.js 1.13 KB
6d9380f96   Cédric Dupont   Update sources OC...
1
  /* global OC */
d1bafeea1   Kload   [fix] Upgrade to ...
2
  $(document).ready(function () {
6d9380f96   Cédric Dupont   Update sources OC...
3
  	var button;
d1bafeea1   Kload   [fix] Upgrade to ...
4
5
6
  	if ($('#body-login').length > 0) {
  		return true; //deactivate on login page
  	}
6d9380f96   Cédric Dupont   Update sources OC...
7
8
9
10
11
12
  
  	function onFileListUpdated() {
  		var hasImages = !!$("#fileList").find("tr[data-mime^='image']:first").length;
  
  		button.toggleClass('hidden', !hasImages);
  	}
d1bafeea1   Kload   [fix] Upgrade to ...
13
  	if ($('#filesApp').val() && $('#isPublic').val()) {
d1bafeea1   Kload   [fix] Upgrade to ...
14

6d9380f96   Cédric Dupont   Update sources OC...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  		$('#fileList').on('updated', onFileListUpdated);
  
  		// toggle for opening shared file list as picture view
  		// TODO find a way to not need to use inline CSS
  		button = $('<div class="button hidden"'
  			+'style="position: absolute; right: 0; top: 0; font-weight: normal;">'
  				+'<img class="svg" src="' + OC.filePath('core', 'img/actions', 'toggle-pictures.svg') + '"'
  				+'alt="' + t('gallery', 'Picture view') + '"'
  				+'style="vertical-align: text-top; '
  				+'-ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50); '
  				+'filter: alpha(opacity=50); opacity: .5;" />'
  			+'</div>');
  
  		button.click( function (event) {
  			window.location.href = window.location.href.replace('service=files', 'service=gallery').replace('dir=', 'path=');
  		});
  
  		$('#controls').append(button);
d1bafeea1   Kload   [fix] Upgrade to ...
33
34
  	}
  });