Last active
June 21, 2016 21:50
-
-
Save PCfromDC/830324288905c500f1d235418dd21b14 to your computer and use it in GitHub Desktop.
Download All Yammer Files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getDownloadLink(el, i) { | |
'use strict'; | |
var rlastForwardSlash = /.+\//, | |
fileId = (el.href) ? el.href.replace(rlastForwardSlash, '') : '', | |
downloadPath = 'https://www.yammer.com/api/v1/uploaded_files/' + fileId + '/download' | |
; | |
return downloadPath; | |
} | |
function downloadFile(dataUrl) { | |
'use strict'; | |
// Construct the a element | |
var link = document.createElement('a'); | |
link.download = 'filename'; | |
link.target = '_blank'; | |
// Construct the uri | |
link.href = dataUrl; | |
document.body.appendChild(link); | |
link.click(); | |
// Cleanup the DOM | |
document.body.removeChild(link); | |
} | |
var fileNodes = Array.from(document.querySelectorAll('.page-content .yj-tabular-data-name')); | |
fileNodes.map(getDownloadLink).forEach(downloadFile); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can download the .min from https://gist.github.com/PCfromDCSnippets/d2c58f7372cbb119dd2e25b80b863191