var Parser = { integrations: [ { type: "image", regex: /\.(jpeg|jpg|gif|png|svg)(\?.*)?$/i, fetch: function (url, done) { var img = new Image(); img.onload = function () { if (!img) return; var width = img.naturalWidth, height = img.naturalHeight; img = null; done({ url: url, type: "image", token: "", thumbnail: "", title: "", width: width, height: height, }); }; img.src = url; if (img.complete) { img.onload(); } }, tag: function (media) { return ''; }, }, { type: "video", regex: /\.(mp4|webm)(\?.*)?$/i, fetch: function (url, done) { var video = document.createElement("video"); var url_parts = url.replace(/\?.*$/, "").split("/"); var filename = url_parts[url_parts.length - 1]; video.addEventListener("loadedmetadata", function () { var width = video.videoWidth, height = video.videoHeight; video = null; done({ url: url, type: "video", token: url, thumbnail: "http://okfocus.s3.amazonaws.com/misc/okcms/video.png", title: filename, width: width, height: height, }); }); video.src = url; video.load(); }, tag: function (media) { return '