Failed to execute template. Cause: [Access denied when checking [script] access to [xwiki:Collaboratory.UX.HbpSkin.WebHome] for user [xwiki:XWiki.Admin]]. Click on this message for details.

DriveParentCollab - HBP Wiki

IAM21 instance, do not create collab nor modify a team, your changes will be lost


Changes for page DriveParentCollab

Last modified by bougault on 2022/01/07 11:03

From version 1.1
edited by bougault
on 2022/01/05 15:25
Change comment: There is no comment for this version
To version 5.1
edited by bougault
on 2022/01/05 15:28
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,7 +1,7 @@
1 1  {{html clean="false"}}
2 2  
3 -<label for="driveUrl">Drive document url</label>
4 -<input type="text" id="driveUrl" placeholder="Put drive document url here" />
3 +<label for="driveURL">Drive document url</label>
4 +<input type="text" id="driveURL" placeholder="Put drive document url here" />
5 5  <button id="opencollab">Open Collab</button>
6 6  <script>
7 7  (function() {
... ... @@ -10,8 +10,8 @@
10 10   openCollabButton.addEventListener("click", findCollab);
11 11   });
12 12   function findCollab() {
13 - const driveUrl = document.getElementById("driveUrl");
14 - const driveId = getDriveId(driveURL);
13 + const driveURL = document.getElementById("driveURL");
14 + const driveId = getDriveId(driveURL.value);
15 15   if(driveId) {
16 16   console.log('Perform request with id:', driveId);
17 17   }
... ... @@ -18,8 +18,8 @@
18 18   }
19 19   function getDriveId(driveURL) {
20 20   const url = new URL(driveURL);
21 - const re = /\/library\/([^/]*)\/.*/;
22 - const id = re.exec(url.pathname)[1];
21 + const re = /\/(library|lib)\/([^/]*)\/.*/;
22 + const id = re.exec(url.pathname)[2];
23 23   return id;
24 24   }
25 25  })();