X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/b0d77fd4dd2b177e77e2bb038a5864567adfd9df..36f6233fd79390ad5af8a1532eac60a0ae57c825:/platforma/static/js/lib/codemirror/codemirror.js diff --git a/platforma/static/js/lib/codemirror/codemirror.js b/platforma/static/js/lib/codemirror/codemirror.js index 4eb5fb73..8c62dab9 100644 --- a/platforma/static/js/lib/codemirror/codemirror.js +++ b/platforma/static/js/lib/codemirror/codemirror.js @@ -79,22 +79,8 @@ var CodeMirror = (function(){ var win = frame.contentWindow, doc = win.document, nums = frame.nextSibling, scroller = nums.firstChild; - var nextNum = 1, barWidth = null; - function sizeBar() { - if (!frame.offsetWidth || !win.Editor) { - for (var cur = frame; cur.parentNode; cur = cur.parentNode) { - if (cur != document) { - clearInterval(sizeInterval); - return; - } - } - } + var nextNum = 1; - if (nums.offsetWidth != barWidth) { - barWidth = nums.offsetWidth; - nums.style.left = "-" + (frame.parentNode.style.marginLeft = barWidth + "px"); - } - } function update() { var diff = 20 + Math.max(doc.body.offsetHeight, frame.offsetHeight) - scroller.offsetHeight; for (var n = Math.ceil(diff / 10); n > 0; n--) { @@ -104,11 +90,10 @@ var CodeMirror = (function(){ } nums.scrollTop = doc.body.scrollTop || doc.documentElement.scrollTop || 0; } - sizeBar(); + update(); win.addEventHandler(win, "scroll", update); win.addEventHandler(win, "resize", update); - var sizeInterval = setInterval(sizeBar, 500); } function CodeMirror(place, options) {