(function() {
window.addEventListener("DOMContentLoaded", function() {
const openCollabButton = document.getElementById("opencollab");
openCollabButton.addEventListener("click", findCollab);
});
function findCollab() {
const driveURL = document.getElementById("driveURL");
const driveId = getDriveId(driveURL.value);
if(driveId) {
console.log('Perform request with id:', driveId);
}
}
function getDriveId(driveURL) {
const url = new URL(driveURL);
const re = /\/library\/([^/]*)\/.*/;
const id = re.exec(url.pathname)[1];
return id;
}
})();