rdd
Version:
Preview your Markdown locally as it would appear on GitHub, with live updating
1 lines • 2.88 kB
JavaScript
!function n(e,t,o){function r(a,c){if(!t[a]){if(!e[a]){var u="function"==typeof require&&require;if(!c&&u)return u(a,!0);if(i)return i(a,!0);var d=new Error("Cannot find module '"+a+"'");throw d.code="MODULE_NOT_FOUND",d}var s=t[a]={exports:{}};e[a][0].call(s.exports,(function(n){return r(e[a][1][n]||n)}),s,s.exports,n,e,t,o)}return t[a].exports}for(var i="function"==typeof require&&require,a=0;a<o.length;a++)r(o[a]);return r}({1:[function(n,e,t){e.exports=function(n,e){if(n.indexOf)return n.indexOf(e);for(var t=0;t<n.length;++t)if(n[t]===e)return t;return-1}},{}],2:[function(n,e,t){e.exports=n("./lib/detect-dom-ready")},{"./lib/detect-dom-ready":3}],3:[function(n,e,t){"use strict";e.exports=function(n){if(document.addEventListener)document.addEventListener("DOMContentLoaded",(function(){n()}),!1);else if(document.attachEvent&&(document.attachEvent("onreadystatechange",(function(){"complete"!==document.readyState||n()})),document.documentElement.doScroll&&window===window.top)){try{document.documentElement.doScroll("left")}catch(e){return void n()}return void n()}}},{}],4:[function(n,e,t){var o=n("each"),r=n("indexof"),i=function(n){return(n=n||window.location.href).replace(/^[^#]*#?(.*)$/,"$1")},a=function(){var n=this;return this.onChangeCallbacks=[],window.addEventListener("hashchange",(function(e){n.hashChanged(i(e.newURL))}),!1),this};a.prototype={update:function(n){if(n)return this.onChangeCallbacks.push(n),this;this.hashChanged(i())},unbind:function(n){var e=r(this.onChangeCallbacks,n);return-1!==e&&this.onChangeCallbacks.splice(e-1,1),this},updateHash:function(n){this.currentHash=n,window.location.href=window.location.href.replace(/#.*/,"")+"#"+n},hashChanged:function(n){return this.onChangeCallbacks.length&&o(this.onChangeCallbacks,(function(e){return e(n),!0})),this}},hashChange=new a,e.exports=hashChange},{each:5,indexof:1}],5:[function(n,e,t){var o=Object.prototype.hasOwnProperty,r=Object.prototype.toString;e.exports=function(n,e,t){if("[object Function]"!==r.call(e))throw new TypeError("iterator must be a function");var i=n.length;if(i===+i)for(var a=0;a<i;a++)e.call(t,n[a],a,n);else for(var c in n)o.call(n,c)&&e.call(t,n[c],c,n)}},{}],6:[function(n,e,t){e.exports=function(n){o.update((function(e){var t=n||"user-content-";if(0===e.indexOf(t))o.updateHash(e.replace(t,""));else{var r=document.getElementById(t+e);r&&window.scrollTo(window.scrollX,r.getBoundingClientRect().top+window.scrollY)}})),r((function(){o.update()}))};var o=n("hashchange"),r=n("detect-dom-ready")},{"detect-dom-ready":2,hashchange:4}],7:[function(n,e,t){n("marky-deep-links")();const o=new window.WebSocket(`ws://0.0.0.0:${window.__rddWebSocketPort}/`),r=window.location.pathname.substring(1);o.onopen=function(){o.send(r)};const i=document.querySelector(".markdown-body");o.onmessage=function(n){i.innerHTML=n.data}},{"marky-deep-links":6}]},{},[7]);