11$ ( document ) . ready ( function ( ) {
22 OCA . Files . fileActions . registerAction ( {
33 name : 'copy-sharing-path' ,
4- displayName : [ 'zh-CN' , 'zh-HK' , 'zh-TW' , 'ja' , 'ko' ] . includes ( OC . getLanguage ( ) ) ? ( t ( 'files' , 'Copy' ) + t ( 'files_sharing' , 'Sharing' ) + t ( 'files' , 'Path' ) ) : ( t ( 'files' , 'Copy' ) + ' ' + t ( 'files_sharing' , 'Sharing' ) + ' ' + t ( 'files' , 'Path' ) ) ,
4+ displayName : [ 'zh-CN' , 'zh-HK' , 'zh-TW' , 'ja' , 'ko' ] . includes ( OC . getLanguage ( ) ) ?
5+ ( t ( 'files' , 'Copy' ) + t ( 'files_sharing' , 'Sharing' ) + t ( 'files' , 'Path' ) ) :
6+ ( t ( 'files' , 'Copy' ) + ' ' + t ( 'files_sharing' , 'Sharing' ) + ' ' + t ( 'files' , 'Path' ) ) ,
57 mime : 'file' ,
68 permissions : OC . PERMISSION_READ ,
79 iconClass : 'icon-public' ,
810 actionHandler : function ( filename , context ) {
9- if ( context . $file . data ( 'shareTypes' ) !== OC . Share . SHARE_TYPE_LINK ) {
10- OC . dialogs . info ( t ( 'files_sharing' , 'No shared links' ) , t ( 'gallery' , 'Warning' ) ) ;
11- return ;
12- }
11+ // Do not check file or parent folder is shared
12+ // if (context.fileInfoModel.attributes.shareTypes.indexOf(OC.Share.SHARE_TYPE_LINK) < 0) {
13+ // OC.dialogs.info(t('files_sharing', 'No shared links'), t('gallery', 'Warning'));
14+ // return;
15+ // }
1316
14- var path = OC . getProtocol ( ) + '://' + OC . getHost ( ) + OC . generateUrl ( '/apps/sharingpath/' + OC . getCurrentUser ( ) . uid + ( context . dir === '/' ? '' : context . dir ) + '/' + filename ) ;
17+ let path = OC . getProtocol ( ) + '://' + OC . getHost ( ) + OC . generateUrl ( '/apps/sharingpath/' +
18+ OC . getCurrentUser ( ) . uid + ( context . dir === '/' ? '' : context . dir ) + '/' + filename ) ;
1519
16- var dummyPath = document . createElement ( 'textarea' ) ;
20+ let dummyPath = document . createElement ( 'textarea' ) ;
1721 dummyPath . value = path ;
1822 dummyPath . setAttribute ( 'readonly' , '' ) ;
1923 dummyPath . style . position = 'absolute' ;
2024 dummyPath . style . left = '-9999px' ;
2125 document . body . appendChild ( dummyPath ) ;
2226 const selected =
23- document . getSelection ( ) . rangeCount > 0 // Check if there is any content selected previously
24- ? document . getSelection ( ) . getRangeAt ( 0 ) // Store selection if found
25- : false ;
27+ document . getSelection ( ) . rangeCount > 0 // Check if there is any content selected previously
28+ ? document . getSelection ( ) . getRangeAt ( 0 ) // Store selection if found
29+ : false ;
2630
2731 dummyPath . select ( ) ;
2832 document . execCommand ( "copy" ) ;
@@ -33,5 +37,4 @@ $(document).ready(function () {
3337 }
3438 }
3539 } ) ;
36-
3740} ) ;
0 commit comments