UNPKG

vue-files-preview-inno

Version:

A tool for previewing files such as doc, excel, pdf, image, markdown, txt, audio, and video and so on.

51 lines (50 loc) 1.9 kB
import { qs as f } from "./core.mjs"; import l from "./url.mjs"; function v(r, i) { var t, e, a = i.url, u = a.indexOf("://") > -1; r && (e = f(r, "head"), t = f(e, "base"), t || (t = r.createElement("base"), e.insertBefore(t, e.firstChild)), !u && window && window.location && (a = window.location.origin + a), t.setAttribute("href", a)); } function m(r, i) { var t, e, a = i.canonical; r && (t = f(r, "head"), e = f(t, "link[rel='canonical']"), e ? e.setAttribute("href", a) : (e = r.createElement("link"), e.setAttribute("rel", "canonical"), e.setAttribute("href", a), t.appendChild(e))); } function A(r, i) { var t, e, a = i.idref; r && (t = f(r, "head"), e = f(t, "link[property='dc.identifier']"), e ? e.setAttribute("content", a) : (e = r.createElement("meta"), e.setAttribute("name", "dc.identifier"), e.setAttribute("content", a), t.appendChild(e))); } function g(r, i) { var t = r.querySelectorAll("a[href]"); if (t.length) for (var e = f(r.ownerDocument, "base"), a = e ? e.getAttribute("href") : void 0, u = (function(c) { var o = c.getAttribute("href"); if (o.indexOf("mailto:") !== 0) { var h = o.indexOf("://") > -1; if (h) c.setAttribute("target", "_blank"); else { var n; try { n = new l(o, a); } catch { } c.onclick = function() { return n && n.hash ? i(n.Path.path + n.hash) : i(n ? n.Path.path : o), !1; }; } } }).bind(this), s = 0; s < t.length; s++) u(t[s]); } function w(r, i, t) { return i.forEach(function(e, a) { e && t[a] && (e = e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), r = r.replace(new RegExp(e, "g"), t[a])); }), r; } export { v as replaceBase, m as replaceCanonical, g as replaceLinks, A as replaceMeta, w as substitute }; //# sourceMappingURL=replacements.mjs.map