Simple SharePoint Function

Job ID: 34010455

Budget: $10 – $30 AUD

I need a simple Javascript function which will take in the standard URL for an office file and return the Embed URL (which contains the "sourcedoc" ID of the file).

For example, input URL is:
/ProcessProcedureSystem/Approved%20Documents/Filename.vsdx

Returned URL is:
/ProcessProcedureSystem/_layouts/15/Doc.aspx?sourcedoc={bd415499-9cfa-4e56-8681-d9bfa1e5cc3c}&action=embedview

The function will always be run within the SharePoint site.
Related categories: JavaScript Sharepoint HTML