Edit in JSFiddle

function run() {
    var c1 = document.getElementById('area').value;
    var d1 = document.getElementById('result');
    d1.innerHTML = getPostLink(c1);
}

/**
 * getPostLink
 * 
 * https://jsfiddle.net/
 * 
 * Get a direct link to your facebook posts by parsing "embed post" code.
 */

function getPostLink(textBlock) {
  this.textBlock = textBlock;
  var substring1 = textBlock.split("?");
  var substring2 = substring1[1].split("&");
	var substring3 = substring2[0].replace("href=", "");
  var substring4 = substring3.replace(/%3A/g, ":");
  var substring5 = substring4.replace(/%2F/g, "/");
	

  return substring5;
}
<!DOCTYPE html>
<body>
    <form id="form">
        <div>
            <textarea id="area" cols="50" rows="5"></textarea>
            <input type="button" value="Get Link" onclick="run()" />
            <br />
            <p id="result">Result</p>
        </div>
    </form>
</body>