?
Path : /home/admin/public_html/old/media/editors/codemirror/addon/display/ |
Current File : /home/admin/public_html/old/media/editors/codemirror/addon/display/rulers.min.js |
!function(a){"object"==typeof exports&&"object"==typeof module?a(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],a):a(CodeMirror)}(function(a){"use strict";function b(a){for(var b=a.display.lineSpace.childNodes.length-1;b>=0;b--){var c=a.display.lineSpace.childNodes[b];/(^|\s)CodeMirror-ruler($|\s)/.test(c.className)&&c.parentNode.removeChild(c)}}function c(b){for(var c=b.getOption("rulers"),d=b.defaultCharWidth(),e=b.charCoords(a.Pos(b.firstLine(),0),"div").left,f=b.display.scroller.offsetHeight+30,g=0;g<c.length;g++){var h=document.createElement("div");h.className="CodeMirror-ruler";var i,j=c[g];"number"==typeof j?i=j:(i=j.column,j.className&&(h.className+=" "+j.className),j.color&&(h.style.borderColor=j.color),j.lineStyle&&(h.style.borderLeftStyle=j.lineStyle),j.width&&(h.style.borderLeftWidth=j.width)),h.style.left=e+i*d+"px",h.style.top="-50px",h.style.bottom="-20px",h.style.minHeight=f+"px",b.display.lineSpace.insertBefore(h,b.display.cursorDiv)}}function d(a){b(a),c(a)}a.defineOption("rulers",!1,function(e,f,g){g&&g!=a.Init&&(b(e),e.off("refresh",d)),f&&f.length&&(c(e),e.on("refresh",d))})});