| .historical .chart { | ||
| height: 200px; | ||
| } | ||
| .CodeMirror { | ||
| height: auto; | ||
| } | ||
| .CodeMirror-scroll { | ||
| overflow-x: hidden; | ||
| overflow-y: hidden; | ||
| } | ||
| .CodeMirror-lines { | ||
| cursor:default; | ||
| } | ||
| .plato-mark { | ||
| background-color:rgb(212, 250, 236); | ||
| border: 1px dashed red; | ||
| border-width:1px 0 1px 0; | ||
| cursor:pointer; | ||
| } | ||
| .plato-mark.focus { | ||
| background-color: rgb(235, 250, 166); | ||
| } | ||
| .plato-mark.active { | ||
| background-color: rgb(158, 180, 255); | ||
| } | ||
| .plato-mark-start { | ||
| border-left-width:1px; | ||
| padding-left:1px; | ||
| } | ||
| .plato-mark-end { | ||
| border-right-width:1px; | ||
| padding-right:1px; | ||
| } | ||
| .plato-gutter { | ||
| } | ||
| .plato-gutter-icon { | ||
| font-size:16px; | ||
| cursor:pointer; | ||
| color: #800000; | ||
| text-align:center; | ||
| } | ||
| .plato-gutter-jshint, .plato-gutter-complexity { | ||
| width:14px; | ||
| } | ||
| .charts { | ||
| margin-top:1em; | ||
| } | ||
| .charts .header { | ||
| font-weight:normal; | ||
| text-align:center; | ||
| } | ||
| .chart-header { | ||
| font-weight:normal; | ||
| text-align:center; | ||
| } | ||
| .CodeMirror-linewidget { | ||
| background-color: hsl(240, 20%, 96%); | ||
| font-size:12px; | ||
| box-shadow:inset 10px 10px 10px -12px hsl(240, 20%, 17%); | ||
| margin-top:10px; | ||
| padding-top:5px; | ||
| padding-left:5px; | ||
| padding-bottom:2px; | ||
| } | ||
| .CodeMirror-linewidget ~ .CodeMirror-linewidget{ | ||
| box-shadow:inset 10px 0px 10px -12px hsl(240, 20%, 17%); | ||
| margin-top:0px; | ||
| padding-top:0px; | ||
| } | ||
| .plato-line-widget { | ||
| } |
| .chart { | ||
| margin: 0 auto; | ||
| height: 200px; | ||
| } | ||
| .overview .chart { | ||
| height: 250px; | ||
| } | ||
| .historical .chart { | ||
| height:200px; | ||
| } | ||
| .chart rect { | ||
| cursor:pointer; | ||
| } | ||
| .file-list li { | ||
| border-bottom:1px solid #ccc; | ||
| padding-bottom:10px; | ||
| padding-top:10px; | ||
| } | ||
| .file-list li:nth-child(odd) { | ||
| background-color: hsl(0, 0%, 98%); | ||
| } | ||
| .fade-left { | ||
| background: -moz-linear-gradient(left, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */ | ||
| background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */ | ||
| background: -webkit-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */ | ||
| background: -o-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */ | ||
| background: -ms-linear-gradient(left, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */ | ||
| background: linear-gradient(to right, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C */ | ||
| filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */ | ||
| } | ||
| .file-list li:nth-child(odd) .fade-left { | ||
| background: -moz-linear-gradient(left, rgba(249,249,249,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6+ */ | ||
| background: -webkit-gradient(linear, left top, right top, color-stop(0%,rgba(249,249,249,1)), color-stop(100%,rgba(255,255,255,0))); /* Chrome,Safari4+ */ | ||
| background: -webkit-linear-gradient(left, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10+,Safari5.1+ */ | ||
| background: -o-linear-gradient(left, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* Opera 11.10+ */ | ||
| background: -ms-linear-gradient(left, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* IE10+ */ | ||
| background: linear-gradient(to right, rgba(249,249,249,1) 0%,rgba(255,255,255,0) 100%); /* W3C */ | ||
| filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f9f9f9', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 */ | ||
| } | ||
| .fadeout { | ||
| position: absolute; | ||
| height: 50px; | ||
| z-index: 10; | ||
| float: left; | ||
| width:70px | ||
| } | ||
| .file { | ||
| white-space: nowrap; | ||
| } | ||
| .file-link { | ||
| text-align: right; | ||
| direction: rtl; | ||
| overflow: hidden; | ||
| height:40px; | ||
| font-size:20px; | ||
| color: #334B6D; | ||
| display:block; | ||
| padding:12px 12px 12px 0; | ||
| text-decoration: underline; | ||
| } | ||
| .file-link:hover { | ||
| color: #3B71B1; | ||
| } | ||
| .file-chart label { | ||
| width: 75px; | ||
| text-align: right; | ||
| margin-right: 10px; | ||
| } | ||
| .file-chart .chart-value { | ||
| margin-left: 3px; | ||
| font-size:11px; | ||
| } | ||
| .horizontal-bar { | ||
| display:inline-block; | ||
| height:8px; | ||
| border-radius: 0 4px 4px 0; | ||
| } | ||
| .threshold-0 .horizontal-bar { | ||
| background-color: #01939A; | ||
| } | ||
| .threshold-1 .horizontal-bar { | ||
| background-color: #FFAB00; | ||
| } | ||
| .threshold-2 .horizontal-bar { | ||
| background-color: #FF0700; | ||
| } | ||
| @media (max-width: 767px) { | ||
| .file-link { | ||
| text-align: center; | ||
| } | ||
| } | ||
| body { | ||
| } | ||
| .navbar { | ||
| margin-bottom:0; | ||
| padding: 0 20px; | ||
| background-color: #f2f2f2; | ||
| background-image: none; | ||
| border: 1px solid #d4d4d4; | ||
| border-radius: 4px; | ||
| -webkit-box-shadow: none; | ||
| box-shadow: none; | ||
| line-height:10px; | ||
| } | ||
| a:visited { | ||
| fill:inherit; | ||
| } | ||
| .jumbotron { | ||
| background: rgb(255,255,255); /* Old browsers */ | ||
| background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(229,229,229,1) 100%); /* FF3.6+ */ | ||
| background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(100%,rgba(229,229,229,1))); /* Chrome,Safari4+ */ | ||
| background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* Chrome10+,Safari5.1+ */ | ||
| background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* Opera 11.10+ */ | ||
| background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* IE10+ */ | ||
| background: linear-gradient(to bottom, rgba(255,255,255,1) 0%,rgba(229,229,229,1) 100%); /* W3C */ | ||
| filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); /* IE6-9 */ | ||
| color:#333; | ||
| box-shadow: 5px 5px 15px -6px black; | ||
| } | ||
| li { | ||
| line-height: 10px; | ||
| } | ||
| /* Landscape phone to portrait tablet */ | ||
| @media (max-width: 767px) { | ||
| .jumbotron h1 { | ||
| font-size: 40px; | ||
| } | ||
| } | ||
| .aggregate-stats { | ||
| } | ||
| .aggregate-stats .header { | ||
| text-align: center; | ||
| color: #5a5a5a; | ||
| font-weight:lighter; | ||
| } | ||
| .aggregate-stats .stat { | ||
| text-align: center; | ||
| color: #5a5a5a; | ||
| font-size:55px; | ||
| line-height:70px; | ||
| } | ||
| i.icon[rel=popover] { | ||
| font-size:23px; | ||
| color: #0088cc; | ||
| } |
Sorry, the diff of this file is too big to display
| /* BASICS */ | ||
| .CodeMirror { | ||
| /* Set height, width, borders, and global font properties here */ | ||
| font-family: monospace; | ||
| height: 300px; | ||
| } | ||
| .CodeMirror-scroll { | ||
| /* Set scrolling behaviour here */ | ||
| overflow: auto; | ||
| } | ||
| /* PADDING */ | ||
| .CodeMirror-lines { | ||
| padding: 4px 0; /* Vertical padding around content */ | ||
| } | ||
| .CodeMirror pre { | ||
| padding: 0 4px; /* Horizontal padding of content */ | ||
| } | ||
| .CodeMirror-scrollbar-filler { | ||
| background-color: white; /* The little square between H and V scrollbars */ | ||
| } | ||
| /* GUTTER */ | ||
| .CodeMirror-gutters { | ||
| border-right: 1px solid #ddd; | ||
| background-color: #f7f7f7; | ||
| } | ||
| .CodeMirror-linenumbers {} | ||
| .CodeMirror-linenumber { | ||
| padding: 0 3px 0 5px; | ||
| min-width: 20px; | ||
| text-align: right; | ||
| color: #999; | ||
| } | ||
| /* CURSOR */ | ||
| .CodeMirror pre.CodeMirror-cursor { | ||
| border-left: 1px solid black; | ||
| } | ||
| /* Shown when moving in bi-directional text */ | ||
| .CodeMirror pre.CodeMirror-secondarycursor { | ||
| border-left: 1px solid silver; | ||
| } | ||
| .cm-keymap-fat-cursor pre.CodeMirror-cursor { | ||
| width: auto; | ||
| border: 0; | ||
| background: transparent; | ||
| background: rgba(0, 200, 0, .4); | ||
| filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800); | ||
| } | ||
| /* Kludge to turn off filter in ie9+, which also accepts rgba */ | ||
| .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) { | ||
| filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); | ||
| } | ||
| /* Can style cursor different in overwrite (non-insert) mode */ | ||
| .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {} | ||
| /* DEFAULT THEME */ | ||
| .cm-s-default .cm-keyword {color: #708;} | ||
| .cm-s-default .cm-atom {color: #219;} | ||
| .cm-s-default .cm-number {color: #164;} | ||
| .cm-s-default .cm-def {color: #00f;} | ||
| .cm-s-default .cm-variable {color: black;} | ||
| .cm-s-default .cm-variable-2 {color: #05a;} | ||
| .cm-s-default .cm-variable-3 {color: #085;} | ||
| .cm-s-default .cm-property {color: black;} | ||
| .cm-s-default .cm-operator {color: black;} | ||
| .cm-s-default .cm-comment {color: #a50;} | ||
| .cm-s-default .cm-string {color: #a11;} | ||
| .cm-s-default .cm-string-2 {color: #f50;} | ||
| .cm-s-default .cm-meta {color: #555;} | ||
| .cm-s-default .cm-error {color: #f00;} | ||
| .cm-s-default .cm-qualifier {color: #555;} | ||
| .cm-s-default .cm-builtin {color: #30a;} | ||
| .cm-s-default .cm-bracket {color: #997;} | ||
| .cm-s-default .cm-tag {color: #170;} | ||
| .cm-s-default .cm-attribute {color: #00c;} | ||
| .cm-s-default .cm-header {color: blue;} | ||
| .cm-s-default .cm-quote {color: #090;} | ||
| .cm-s-default .cm-hr {color: #999;} | ||
| .cm-s-default .cm-link {color: #00c;} | ||
| .cm-negative {color: #d44;} | ||
| .cm-positive {color: #292;} | ||
| .cm-header, .cm-strong {font-weight: bold;} | ||
| .cm-em {font-style: italic;} | ||
| .cm-emstrong {font-style: italic; font-weight: bold;} | ||
| .cm-link {text-decoration: underline;} | ||
| .cm-invalidchar {color: #f00;} | ||
| div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} | ||
| div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} | ||
| /* STOP */ | ||
| /* The rest of this file contains styles related to the mechanics of | ||
| the editor. You probably shouldn't touch them. */ | ||
| .CodeMirror { | ||
| line-height: 1; | ||
| position: relative; | ||
| overflow: hidden; | ||
| } | ||
| .CodeMirror-scroll { | ||
| /* 30px is the magic margin used to hide the element's real scrollbars */ | ||
| /* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */ | ||
| margin-bottom: -30px; margin-right: -30px; | ||
| padding-bottom: 30px; padding-right: 30px; | ||
| height: 100%; | ||
| outline: none; /* Prevent dragging from highlighting the element */ | ||
| position: relative; | ||
| } | ||
| .CodeMirror-sizer { | ||
| position: relative; | ||
| } | ||
| /* The fake, visible scrollbars. Used to force redraw during scrolling | ||
| before actuall scrolling happens, thus preventing shaking and | ||
| flickering artifacts. */ | ||
| .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler { | ||
| position: absolute; | ||
| z-index: 6; | ||
| display: none; | ||
| } | ||
| .CodeMirror-vscrollbar { | ||
| right: 0; top: 0; | ||
| overflow-x: hidden; | ||
| overflow-y: scroll; | ||
| } | ||
| .CodeMirror-hscrollbar { | ||
| bottom: 0; left: 0; | ||
| overflow-y: hidden; | ||
| overflow-x: scroll; | ||
| } | ||
| .CodeMirror-scrollbar-filler { | ||
| right: 0; bottom: 0; | ||
| z-index: 6; | ||
| } | ||
| .CodeMirror-gutters { | ||
| position: absolute; left: 0; top: 0; | ||
| height: 100%; | ||
| z-index: 3; | ||
| } | ||
| .CodeMirror-gutter { | ||
| height: 100%; | ||
| display: inline-block; | ||
| /* Hack to make IE7 behave */ | ||
| *zoom:1; | ||
| *display:inline; | ||
| } | ||
| .CodeMirror-gutter-elt { | ||
| position: absolute; | ||
| cursor: default; | ||
| z-index: 4; | ||
| } | ||
| .CodeMirror-lines { | ||
| cursor: text; | ||
| } | ||
| .CodeMirror pre { | ||
| /* Reset some styles that the rest of the page might have set */ | ||
| -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0; | ||
| border-width: 0; | ||
| background: transparent; | ||
| font-family: inherit; | ||
| font-size: inherit; | ||
| margin: 0; | ||
| white-space: pre; | ||
| word-wrap: normal; | ||
| line-height: inherit; | ||
| color: inherit; | ||
| z-index: 2; | ||
| position: relative; | ||
| overflow: visible; | ||
| } | ||
| .CodeMirror-wrap pre { | ||
| word-wrap: break-word; | ||
| white-space: pre-wrap; | ||
| word-break: normal; | ||
| } | ||
| .CodeMirror-linebackground { | ||
| position: absolute; | ||
| left: 0; right: 0; top: 0; bottom: 0; | ||
| z-index: 0; | ||
| } | ||
| .CodeMirror-linewidget { | ||
| position: relative; | ||
| z-index: 2; | ||
| } | ||
| .CodeMirror-wrap .CodeMirror-scroll { | ||
| overflow-x: hidden; | ||
| } | ||
| .CodeMirror-measure { | ||
| position: absolute; | ||
| width: 100%; height: 0px; | ||
| overflow: hidden; | ||
| visibility: hidden; | ||
| } | ||
| .CodeMirror-measure pre { position: static; } | ||
| .CodeMirror pre.CodeMirror-cursor { | ||
| position: absolute; | ||
| visibility: hidden; | ||
| border-right: none; | ||
| width: 0; | ||
| } | ||
| .CodeMirror-focused pre.CodeMirror-cursor { | ||
| visibility: visible; | ||
| } | ||
| .CodeMirror-selected { background: #d9d9d9; } | ||
| .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } | ||
| .CodeMirror-searching { | ||
| background: #ffa; | ||
| background: rgba(255, 255, 0, .4); | ||
| } | ||
| /* IE7 hack to prevent it from returning funny offsetTops on the spans */ | ||
| .CodeMirror span { *vertical-align: text-bottom; } | ||
| @media print { | ||
| /* Hide the cursor when printing */ | ||
| .CodeMirror pre.CodeMirror-cursor { | ||
| visibility: hidden; | ||
| } | ||
| } |
| [class^="icon-"], | ||
| [class*=" icon-"] { | ||
| font-family: FontAwesome; | ||
| font-style: normal; | ||
| font-weight: normal; | ||
| } | ||
| .btn.dropdown-toggle [class^="icon-"], | ||
| .btn.dropdown-toggle [class*=" icon-"] { | ||
| /* keeps button heights with and without icons the same */ | ||
| line-height: 1.4em; | ||
| } | ||
| .icon-large { | ||
| font-size: 1.3333em; | ||
| } | ||
| .icon-glass { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-music { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-search { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-envelope { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-heart { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-star { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-star-empty { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-user { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-film { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-th-large { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-th { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-th-list { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-ok { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-remove { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-zoom-in { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-zoom-out { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-off { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-signal { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-cog { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-trash { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-home { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-file { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-time { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-road { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-download-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-download { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-upload { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-inbox { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-play-circle { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-repeat { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-refresh { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-list-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-lock { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-flag { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-headphones { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-volume-off { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-volume-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-volume-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-qrcode { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-barcode { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-tag { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-tags { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-book { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bookmark { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-print { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-camera { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-font { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bold { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-italic { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-text-height { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-text-width { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-align-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-align-center { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-align-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-align-justify { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-list { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-indent-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-indent-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-facetime-video { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-picture { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-pencil { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-map-marker { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-adjust { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-tint { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-edit { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-share { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-check { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-move { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-step-backward { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-fast-backward { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-backward { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-play { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-pause { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-stop { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-forward { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-fast-forward { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-step-forward { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-eject { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-chevron-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-chevron-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-plus-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-minus-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-remove-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-ok-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-question-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-info-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-screenshot { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-remove-circle { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-ok-circle { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-ban-circle { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-arrow-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-arrow-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-arrow-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-arrow-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-share-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-resize-full { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-resize-small { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-plus { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-minus { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-asterisk { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-exclamation-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-gift { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-leaf { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-fire { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-eye-open { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-eye-close { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-warning-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-plane { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-calendar { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-random { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-comment { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-magnet { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-chevron-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-chevron-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-retweet { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-shopping-cart { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-folder-close { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-folder-open { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-resize-vertical { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-resize-horizontal { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bar-chart { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-twitter-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-facebook-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-camera-retro { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-key { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-cogs { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-comments { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-thumbs-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-thumbs-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-star-half { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-heart-empty { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-signout { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-linkedin-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-pushpin { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-external-link { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-signin { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-trophy { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-github-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-upload-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-lemon { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-phone { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-check-empty { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bookmark-empty { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-phone-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-twitter { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-facebook { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-github { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-unlock { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-credit-card { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-rss { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-hdd { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bullhorn { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bell { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-certificate { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-hand-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-hand-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-hand-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-hand-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-circle-arrow-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-circle-arrow-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-circle-arrow-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-circle-arrow-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-globe { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-wrench { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-tasks { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-filter { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-briefcase { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-fullscreen { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-group { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-link { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-cloud { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-beaker { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-cut { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-copy { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-paper-clip { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-save { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-sign-blank { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-reorder { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-list-ul { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-list-ol { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-strikethrough { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-underline { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-table { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-magic { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-truck { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-pinterest { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-pinterest-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-google-plus-sign { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-google-plus { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-money { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-caret-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-caret-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-caret-left { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-caret-right { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-columns { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-sort { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-sort-down { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-sort-up { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-envelope-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-linkedin { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-undo { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-legal { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-dashboard { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-comment-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-comments-alt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-bolt { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-sitemap { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-umbrella { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-paste { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } | ||
| .icon-user-md { | ||
| *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = ' '); | ||
| } |
| /* Font Awesome | ||
| the iconic font designed for use with Twitter Bootstrap | ||
| ------------------------------------------------------- | ||
| The full suite of pictographic icons, examples, and documentation | ||
| can be found at: http://fortawesome.github.com/Font-Awesome/ | ||
| License | ||
| ------------------------------------------------------- | ||
| The Font Awesome webfont, CSS, and LESS files are licensed under CC BY 3.0: | ||
| http://creativecommons.org/licenses/by/3.0/ A mention of | ||
| 'Font Awesome - http://fortawesome.github.com/Font-Awesome' in human-readable | ||
| source code is considered acceptable attribution (most common on the web). | ||
| If human readable source code is not available to the end user, a mention in | ||
| an 'About' or 'Credits' screen is considered acceptable (most common in desktop | ||
| or mobile software). | ||
| Contact | ||
| ------------------------------------------------------- | ||
| Email: dave@davegandy.com | ||
| Twitter: http://twitter.com/fortaweso_me | ||
| Work: http://lemonwi.se co-founder | ||
| */ | ||
| @font-face { | ||
| font-family: "FontAwesome"; | ||
| src: url('../../font/fontawesome-webfont.eot'); | ||
| src: url('../../font/fontawesome-webfont.eot?#iefix') format('eot'), url('../../font/fontawesome-webfont.woff') format('woff'), url('../../font/fontawesome-webfont.ttf') format('truetype'), url('../../font/fontawesome-webfont.svg#FontAwesome') format('svg'); | ||
| font-weight: normal; | ||
| font-style: normal; | ||
| } | ||
| /* Font Awesome styles | ||
| ------------------------------------------------------- */ | ||
| [class^="icon-"]:before, [class*=" icon-"]:before { | ||
| font-family: FontAwesome; | ||
| font-weight: normal; | ||
| font-style: normal; | ||
| display: inline-block; | ||
| text-decoration: inherit; | ||
| } | ||
| a [class^="icon-"], a [class*=" icon-"] { | ||
| display: inline-block; | ||
| text-decoration: inherit; | ||
| } | ||
| /* makes the font 33% larger relative to the icon container */ | ||
| .icon-large:before { | ||
| vertical-align: top; | ||
| font-size: 1.3333333333333333em; | ||
| } | ||
| .btn [class^="icon-"], .btn [class*=" icon-"] { | ||
| /* keeps button heights with and without icons the same */ | ||
| line-height: .9em; | ||
| } | ||
| li [class^="icon-"], li [class*=" icon-"] { | ||
| display: inline-block; | ||
| width: 1.25em; | ||
| text-align: center; | ||
| } | ||
| li .icon-large[class^="icon-"], li .icon-large[class*=" icon-"] { | ||
| /* 1.5 increased font size for icon-large * 1.25 width */ | ||
| width: 1.875em; | ||
| } | ||
| li[class^="icon-"], li[class*=" icon-"] { | ||
| margin-left: 0; | ||
| list-style-type: none; | ||
| } | ||
| li[class^="icon-"]:before, li[class*=" icon-"]:before { | ||
| text-indent: -2em; | ||
| text-align: center; | ||
| } | ||
| li[class^="icon-"].icon-large:before, li[class*=" icon-"].icon-large:before { | ||
| text-indent: -1.3333333333333333em; | ||
| } | ||
| /* Font Awesome uses the Unicode Private Use Area (PUA) to ensure screen | ||
| readers do not read off random characters that represent icons */ | ||
| .icon-glass:before { content: "\f000"; } | ||
| .icon-music:before { content: "\f001"; } | ||
| .icon-search:before { content: "\f002"; } | ||
| .icon-envelope:before { content: "\f003"; } | ||
| .icon-heart:before { content: "\f004"; } | ||
| .icon-star:before { content: "\f005"; } | ||
| .icon-star-empty:before { content: "\f006"; } | ||
| .icon-user:before { content: "\f007"; } | ||
| .icon-film:before { content: "\f008"; } | ||
| .icon-th-large:before { content: "\f009"; } | ||
| .icon-th:before { content: "\f00a"; } | ||
| .icon-th-list:before { content: "\f00b"; } | ||
| .icon-ok:before { content: "\f00c"; } | ||
| .icon-remove:before { content: "\f00d"; } | ||
| .icon-zoom-in:before { content: "\f00e"; } | ||
| .icon-zoom-out:before { content: "\f010"; } | ||
| .icon-off:before { content: "\f011"; } | ||
| .icon-signal:before { content: "\f012"; } | ||
| .icon-cog:before { content: "\f013"; } | ||
| .icon-trash:before { content: "\f014"; } | ||
| .icon-home:before { content: "\f015"; } | ||
| .icon-file:before { content: "\f016"; } | ||
| .icon-time:before { content: "\f017"; } | ||
| .icon-road:before { content: "\f018"; } | ||
| .icon-download-alt:before { content: "\f019"; } | ||
| .icon-download:before { content: "\f01a"; } | ||
| .icon-upload:before { content: "\f01b"; } | ||
| .icon-inbox:before { content: "\f01c"; } | ||
| .icon-play-circle:before { content: "\f01d"; } | ||
| .icon-repeat:before { content: "\f01e"; } | ||
| /* \f020 doesn't work in Safari. all shifted one down */ | ||
| .icon-refresh:before { content: "\f021"; } | ||
| .icon-list-alt:before { content: "\f022"; } | ||
| .icon-lock:before { content: "\f023"; } | ||
| .icon-flag:before { content: "\f024"; } | ||
| .icon-headphones:before { content: "\f025"; } | ||
| .icon-volume-off:before { content: "\f026"; } | ||
| .icon-volume-down:before { content: "\f027"; } | ||
| .icon-volume-up:before { content: "\f028"; } | ||
| .icon-qrcode:before { content: "\f029"; } | ||
| .icon-barcode:before { content: "\f02a"; } | ||
| .icon-tag:before { content: "\f02b"; } | ||
| .icon-tags:before { content: "\f02c"; } | ||
| .icon-book:before { content: "\f02d"; } | ||
| .icon-bookmark:before { content: "\f02e"; } | ||
| .icon-print:before { content: "\f02f"; } | ||
| .icon-camera:before { content: "\f030"; } | ||
| .icon-font:before { content: "\f031"; } | ||
| .icon-bold:before { content: "\f032"; } | ||
| .icon-italic:before { content: "\f033"; } | ||
| .icon-text-height:before { content: "\f034"; } | ||
| .icon-text-width:before { content: "\f035"; } | ||
| .icon-align-left:before { content: "\f036"; } | ||
| .icon-align-center:before { content: "\f037"; } | ||
| .icon-align-right:before { content: "\f038"; } | ||
| .icon-align-justify:before { content: "\f039"; } | ||
| .icon-list:before { content: "\f03a"; } | ||
| .icon-indent-left:before { content: "\f03b"; } | ||
| .icon-indent-right:before { content: "\f03c"; } | ||
| .icon-facetime-video:before { content: "\f03d"; } | ||
| .icon-picture:before { content: "\f03e"; } | ||
| .icon-pencil:before { content: "\f040"; } | ||
| .icon-map-marker:before { content: "\f041"; } | ||
| .icon-adjust:before { content: "\f042"; } | ||
| .icon-tint:before { content: "\f043"; } | ||
| .icon-edit:before { content: "\f044"; } | ||
| .icon-share:before { content: "\f045"; } | ||
| .icon-check:before { content: "\f046"; } | ||
| .icon-move:before { content: "\f047"; } | ||
| .icon-step-backward:before { content: "\f048"; } | ||
| .icon-fast-backward:before { content: "\f049"; } | ||
| .icon-backward:before { content: "\f04a"; } | ||
| .icon-play:before { content: "\f04b"; } | ||
| .icon-pause:before { content: "\f04c"; } | ||
| .icon-stop:before { content: "\f04d"; } | ||
| .icon-forward:before { content: "\f04e"; } | ||
| .icon-fast-forward:before { content: "\f050"; } | ||
| .icon-step-forward:before { content: "\f051"; } | ||
| .icon-eject:before { content: "\f052"; } | ||
| .icon-chevron-left:before { content: "\f053"; } | ||
| .icon-chevron-right:before { content: "\f054"; } | ||
| .icon-plus-sign:before { content: "\f055"; } | ||
| .icon-minus-sign:before { content: "\f056"; } | ||
| .icon-remove-sign:before { content: "\f057"; } | ||
| .icon-ok-sign:before { content: "\f058"; } | ||
| .icon-question-sign:before { content: "\f059"; } | ||
| .icon-info-sign:before { content: "\f05a"; } | ||
| .icon-screenshot:before { content: "\f05b"; } | ||
| .icon-remove-circle:before { content: "\f05c"; } | ||
| .icon-ok-circle:before { content: "\f05d"; } | ||
| .icon-ban-circle:before { content: "\f05e"; } | ||
| .icon-arrow-left:before { content: "\f060"; } | ||
| .icon-arrow-right:before { content: "\f061"; } | ||
| .icon-arrow-up:before { content: "\f062"; } | ||
| .icon-arrow-down:before { content: "\f063"; } | ||
| .icon-share-alt:before { content: "\f064"; } | ||
| .icon-resize-full:before { content: "\f065"; } | ||
| .icon-resize-small:before { content: "\f066"; } | ||
| .icon-plus:before { content: "\f067"; } | ||
| .icon-minus:before { content: "\f068"; } | ||
| .icon-asterisk:before { content: "\f069"; } | ||
| .icon-exclamation-sign:before { content: "\f06a"; } | ||
| .icon-gift:before { content: "\f06b"; } | ||
| .icon-leaf:before { content: "\f06c"; } | ||
| .icon-fire:before { content: "\f06d"; } | ||
| .icon-eye-open:before { content: "\f06e"; } | ||
| .icon-eye-close:before { content: "\f070"; } | ||
| .icon-warning-sign:before { content: "\f071"; } | ||
| .icon-plane:before { content: "\f072"; } | ||
| .icon-calendar:before { content: "\f073"; } | ||
| .icon-random:before { content: "\f074"; } | ||
| .icon-comment:before { content: "\f075"; } | ||
| .icon-magnet:before { content: "\f076"; } | ||
| .icon-chevron-up:before { content: "\f077"; } | ||
| .icon-chevron-down:before { content: "\f078"; } | ||
| .icon-retweet:before { content: "\f079"; } | ||
| .icon-shopping-cart:before { content: "\f07a"; } | ||
| .icon-folder-close:before { content: "\f07b"; } | ||
| .icon-folder-open:before { content: "\f07c"; } | ||
| .icon-resize-vertical:before { content: "\f07d"; } | ||
| .icon-resize-horizontal:before { content: "\f07e"; } | ||
| .icon-bar-chart:before { content: "\f080"; } | ||
| .icon-twitter-sign:before { content: "\f081"; } | ||
| .icon-facebook-sign:before { content: "\f082"; } | ||
| .icon-camera-retro:before { content: "\f083"; } | ||
| .icon-key:before { content: "\f084"; } | ||
| .icon-cogs:before { content: "\f085"; } | ||
| .icon-comments:before { content: "\f086"; } | ||
| .icon-thumbs-up:before { content: "\f087"; } | ||
| .icon-thumbs-down:before { content: "\f088"; } | ||
| .icon-star-half:before { content: "\f089"; } | ||
| .icon-heart-empty:before { content: "\f08a"; } | ||
| .icon-signout:before { content: "\f08b"; } | ||
| .icon-linkedin-sign:before { content: "\f08c"; } | ||
| .icon-pushpin:before { content: "\f08d"; } | ||
| .icon-external-link:before { content: "\f08e"; } | ||
| .icon-signin:before { content: "\f090"; } | ||
| .icon-trophy:before { content: "\f091"; } | ||
| .icon-github-sign:before { content: "\f092"; } | ||
| .icon-upload-alt:before { content: "\f093"; } | ||
| .icon-lemon:before { content: "\f094"; } | ||
| .icon-phone:before { content: "\f095"; } | ||
| .icon-check-empty:before { content: "\f096"; } | ||
| .icon-bookmark-empty:before { content: "\f097"; } | ||
| .icon-phone-sign:before { content: "\f098"; } | ||
| .icon-twitter:before { content: "\f099"; } | ||
| .icon-facebook:before { content: "\f09a"; } | ||
| .icon-github:before { content: "\f09b"; } | ||
| .icon-unlock:before { content: "\f09c"; } | ||
| .icon-credit-card:before { content: "\f09d"; } | ||
| .icon-rss:before { content: "\f09e"; } | ||
| .icon-hdd:before { content: "\f0a0"; } | ||
| .icon-bullhorn:before { content: "\f0a1"; } | ||
| .icon-bell:before { content: "\f0a2"; } | ||
| .icon-certificate:before { content: "\f0a3"; } | ||
| .icon-hand-right:before { content: "\f0a4"; } | ||
| .icon-hand-left:before { content: "\f0a5"; } | ||
| .icon-hand-up:before { content: "\f0a6"; } | ||
| .icon-hand-down:before { content: "\f0a7"; } | ||
| .icon-circle-arrow-left:before { content: "\f0a8"; } | ||
| .icon-circle-arrow-right:before { content: "\f0a9"; } | ||
| .icon-circle-arrow-up:before { content: "\f0aa"; } | ||
| .icon-circle-arrow-down:before { content: "\f0ab"; } | ||
| .icon-globe:before { content: "\f0ac"; } | ||
| .icon-wrench:before { content: "\f0ad"; } | ||
| .icon-tasks:before { content: "\f0ae"; } | ||
| .icon-filter:before { content: "\f0b0"; } | ||
| .icon-briefcase:before { content: "\f0b1"; } | ||
| .icon-fullscreen:before { content: "\f0b2"; } | ||
| .icon-group:before { content: "\f0c0"; } | ||
| .icon-link:before { content: "\f0c1"; } | ||
| .icon-cloud:before { content: "\f0c2"; } | ||
| .icon-beaker:before { content: "\f0c3"; } | ||
| .icon-cut:before { content: "\f0c4"; } | ||
| .icon-copy:before { content: "\f0c5"; } | ||
| .icon-paper-clip:before { content: "\f0c6"; } | ||
| .icon-save:before { content: "\f0c7"; } | ||
| .icon-sign-blank:before { content: "\f0c8"; } | ||
| .icon-reorder:before { content: "\f0c9"; } | ||
| .icon-list-ul:before { content: "\f0ca"; } | ||
| .icon-list-ol:before { content: "\f0cb"; } | ||
| .icon-strikethrough:before { content: "\f0cc"; } | ||
| .icon-underline:before { content: "\f0cd"; } | ||
| .icon-table:before { content: "\f0ce"; } | ||
| .icon-magic:before { content: "\f0d0"; } | ||
| .icon-truck:before { content: "\f0d1"; } | ||
| .icon-pinterest:before { content: "\f0d2"; } | ||
| .icon-pinterest-sign:before { content: "\f0d3"; } | ||
| .icon-google-plus-sign:before { content: "\f0d4"; } | ||
| .icon-google-plus:before { content: "\f0d5"; } | ||
| .icon-money:before { content: "\f0d6"; } | ||
| .icon-caret-down:before { content: "\f0d7"; } | ||
| .icon-caret-up:before { content: "\f0d8"; } | ||
| .icon-caret-left:before { content: "\f0d9"; } | ||
| .icon-caret-right:before { content: "\f0da"; } | ||
| .icon-columns:before { content: "\f0db"; } | ||
| .icon-sort:before { content: "\f0dc"; } | ||
| .icon-sort-down:before { content: "\f0dd"; } | ||
| .icon-sort-up:before { content: "\f0de"; } | ||
| .icon-envelope-alt:before { content: "\f0e0"; } | ||
| .icon-linkedin:before { content: "\f0e1"; } | ||
| .icon-undo:before { content: "\f0e2"; } | ||
| .icon-legal:before { content: "\f0e3"; } | ||
| .icon-dashboard:before { content: "\f0e4"; } | ||
| .icon-comment-alt:before { content: "\f0e5"; } | ||
| .icon-comments-alt:before { content: "\f0e6"; } | ||
| .icon-bolt:before { content: "\f0e7"; } | ||
| .icon-sitemap:before { content: "\f0e8"; } | ||
| .icon-umbrella:before { content: "\f0e9"; } | ||
| .icon-paste:before { content: "\f0ea"; } | ||
| .icon-user-md:before { content: "\f200"; } |
| .morris-hover{position:absolute;z-index:1000;}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255, 255, 255, 0.8);border:solid 2px rgba(230, 230, 230, 0.8);font-family:sans-serif;font-size:12px;text-align:center;}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0;} | ||
| .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0;} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
| /*global CodeMirror:false, $:false*/ | ||
| (function(){ | ||
| "use strict"; | ||
| function makeid(num){ | ||
| num = num || 5; | ||
| var text = ""; | ||
| var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; | ||
| for( var i=0; i < num; i++ ) | ||
| text += possible.charAt(Math.floor(Math.random() * possible.length)); | ||
| return text; | ||
| } | ||
| CodeMirror.prototype.markPopoverText = function(lineObj, regex, className, gutter, message){ | ||
| var re = new RegExp('(' + regex + ')', 'g'); | ||
| var cursor = this.getSearchCursor(re, lineObj); | ||
| var match, internalClass = 'plato-mark-' + makeid(10); | ||
| while (match = cursor.findNext()) { | ||
| if (cursor.to().line !== lineObj.line) break; | ||
| this.markText( | ||
| { line : lineObj.line, ch : cursor.from().ch }, | ||
| { line : lineObj.line, ch : cursor.to().ch }, | ||
| { | ||
| className : 'plato-mark ' + internalClass + ' ' + (className || ''), | ||
| startStyle : 'plato-mark-start', | ||
| endStyle : 'plato-mark-end' | ||
| } | ||
| ); | ||
| } | ||
| if (gutter) { | ||
| this.setGutterMarker(lineObj.line, gutter.gutterId, gutter.el); | ||
| } | ||
| // return a function to bind hover events, to be run after | ||
| // the codemirror operations are executed | ||
| return function(){ | ||
| var markStart = $('.plato-mark-start.' + internalClass); | ||
| var markSpans = $('.' + internalClass); | ||
| if (message.type === 'popover') { | ||
| var triggered = false; | ||
| markSpans.add(gutter.el) | ||
| .on('mouseenter touchstart',function(e){ | ||
| e.preventDefault(); | ||
| triggered = true; | ||
| markSpans.addClass('active'); | ||
| markStart.popover('show'); | ||
| }) | ||
| .on('mouseleave touchend',function(e){ | ||
| e.preventDefault(); | ||
| markSpans.removeClass('active'); | ||
| triggered = false; | ||
| setTimeout(function(){ | ||
| if (!triggered) markStart.popover('hide'); | ||
| },200); | ||
| }); | ||
| markStart.popover({ | ||
| trigger : 'manual', | ||
| content : message.content, | ||
| html : true, | ||
| title : message.title, | ||
| placement : 'top' | ||
| }); | ||
| } else if (message.type === 'block') { | ||
| this.addLineWidget(lineObj.line, $(message.content)[0]); | ||
| } | ||
| }; | ||
| }; | ||
| })(); |
| /*global $:false, _:false, Morris:false, CodeMirror:false, __report:false, __history:false */ | ||
| /*jshint browser:true*/ | ||
| $(function(){ | ||
| "use strict"; | ||
| // bootstrap popover | ||
| $('[rel=popover]').popover(); | ||
| _.templateSettings = { | ||
| interpolate : /\{\{(.+?)\}\}/g | ||
| }; | ||
| function focusFragment() { | ||
| $('.plato-mark').removeClass('focus'); | ||
| var markId = window.location.hash.substr(1); | ||
| if (markId) $('.' + markId).addClass('focus'); | ||
| return focusFragment; | ||
| } | ||
| window.onhashchange = focusFragment(); | ||
| var srcEl = document.getElementById('file-source'); | ||
| var options = { | ||
| lineNumbers : true, | ||
| gutters : ['plato-gutter-jshint','plato-gutter-complexity'], | ||
| readOnly : 'nocursor' | ||
| }; | ||
| var cm = CodeMirror.fromTextArea(srcEl, options); | ||
| var byComplexity = [], bySloc = []; | ||
| var popoverTemplate = _.template($('#complexity-popover-template').text()); | ||
| var gutterIcon = $('<a><i class="plato-gutter-icon icon-cog"></i></a>'); | ||
| var popovers = cm.operation(function(){ | ||
| var queuedPopovers = []; | ||
| __report.complexity.functions.forEach(function(fn,i){ | ||
| byComplexity.push({ | ||
| label : fn.name, | ||
| value : fn.complexity.cyclomatic | ||
| }); | ||
| bySloc.push({ | ||
| label : fn.name, | ||
| value : fn.complexity.sloc.physical, | ||
| formatter: function (x) { return x + " lines"; } | ||
| }); | ||
| var name = fn.name === '<anonymous>' ? 'function\\s*\\([^)]*\\)' : fn.name; | ||
| var line = fn.line - 1; | ||
| var className = 'plato-mark-fn-' + i; | ||
| var gutter = { | ||
| gutterId : 'plato-gutter-complexity', | ||
| el : gutterIcon.clone().attr('name',className)[0] | ||
| }; | ||
| var popover = { | ||
| type : 'popover', | ||
| title : fn.name === '<anonymous>' ? '<anonymous>' : 'function ' + fn.name + '', | ||
| content : popoverTemplate(fn) | ||
| }; | ||
| queuedPopovers.push(cm.markPopoverText({line : line, ch:0}, name, className, gutter, popover)); | ||
| }); | ||
| return queuedPopovers; | ||
| }); | ||
| popovers.forEach(function(fn){fn();}); | ||
| var scrollToLine = function(i) { | ||
| var origScroll = [window.pageXOffset,window.pageYOffset]; | ||
| window.location.hash = '#plato-mark-fn-' + i; | ||
| window.scrollTo(origScroll[0],origScroll[1]); | ||
| var line = __report.complexity.functions[i].line; | ||
| var coords = cm.charCoords({line : line, ch : 0}); | ||
| $('body,html').animate({scrollTop : coords.top -50},250); | ||
| }; | ||
| // yield to the browser | ||
| setTimeout(function(){ | ||
| drawFunctionCharts([ | ||
| { element: 'fn-by-complexity', data: byComplexity }, | ||
| { element: 'fn-by-sloc', data: bySloc } | ||
| ]); | ||
| drawHistoricalCharts(__history); | ||
| },0); | ||
| cm.operation(function(){ | ||
| addLintMessages(__report); | ||
| }); | ||
| function drawFunctionCharts(charts) { | ||
| charts.forEach(function(chart){ | ||
| Morris.Donut(chart).on('click',scrollToLine); | ||
| }); | ||
| } | ||
| function drawHistoricalCharts(history) { | ||
| $('.historical.chart').empty(); | ||
| var data = _.map(history,function(record){ | ||
| var date = new Date(record.date); | ||
| return { | ||
| date : date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(), | ||
| maintainability : parseFloat(record.maintainability).toFixed(2), | ||
| sloc : record.sloc | ||
| }; | ||
| }).slice(-20); | ||
| Morris.Line({ | ||
| element: 'chart_historical_sloc', | ||
| data: data, | ||
| xkey: 'date', | ||
| ykeys: ['sloc'], | ||
| labels: ['Lines of Code'], | ||
| parseTime : false | ||
| }); | ||
| Morris.Line({ | ||
| element: 'chart_historical_maint', | ||
| data: data, | ||
| xkey: 'date', | ||
| ykeys: ['maintainability'], | ||
| labels: ['Maintainability'], | ||
| ymax: 100, | ||
| parseTime : false | ||
| }); | ||
| } | ||
| function addLintMessages(report) { | ||
| var lines = {}; | ||
| report.jshint.messages.forEach(function (message) { | ||
| var text = 'Column: ' + message.column + ' "' + message.message + '"'; | ||
| if (_.isArray(message.line)) { | ||
| message.line.forEach(function(line){ | ||
| if (!lines[line]) lines[line] = ''; | ||
| lines[line] += '<div class="plato-jshint-message text-'+message.severity+'">' + text + '</div>'; | ||
| }); | ||
| } else { | ||
| if (!lines[message.line]) lines[message.line] = ''; | ||
| lines[message.line] += '<div class="plato-jshint-message text-'+message.severity+'">' + text + '</div>'; | ||
| } | ||
| }); | ||
| var marker = document.createElement('a'); | ||
| marker.innerHTML = '<i class="plato-gutter-icon icon-eye-open"></i>'; | ||
| Object.keys(lines).forEach(function(line){ | ||
| var lineWidget = document.createElement('div'); | ||
| lineWidget.innerHTML = lines[line]; | ||
| cm.setGutterMarker(line - 1, 'plato-gutter-jshint', marker.cloneNode(true)); | ||
| cm.addLineWidget(line - 1, lineWidget); | ||
| }); | ||
| } | ||
| }); | ||
| /*global $:false, _:false, Morris:false, __report:false, __history:false, __options: false */ | ||
| /*jshint browser:true*/ | ||
| $(function(){ | ||
| "use strict"; | ||
| // bootstrap popover | ||
| $('[rel=popover]').popover(); | ||
| // @todo put client side templates into a JST | ||
| var fileGraphTemplate = _.template( | ||
| '<div class="threshold-<%= threshold %>">' + | ||
| '<label><%= label %></label>' + | ||
| '<span class="horizontal-bar" style="width:<%= width %>px"></span>' + | ||
| '<span class="chart-value"><%= value %></span>' + | ||
| '</div>' | ||
| ); | ||
| var horizontalBar = function(orig, width, label, thresholds){ | ||
| var threshold = 0; | ||
| for (var i = thresholds.length - 1; i > -1; i--) { | ||
| if (orig > thresholds[i]) { | ||
| threshold = i + 1; | ||
| break; | ||
| } | ||
| } | ||
| return fileGraphTemplate({ | ||
| width : width, | ||
| label : label, | ||
| threshold : threshold, | ||
| value : orig | ||
| }); | ||
| }; | ||
| function drawFileCharts() { | ||
| // @todo make a jQuery plugin to accomodate the horizontalBar function | ||
| $('.js-file-chart').each(function(){ | ||
| var el = $(this), | ||
| width = el.width() - 130; // @todo establish max width of graph in plugin | ||
| el.empty(); | ||
| var value = el.data('complexity'); | ||
| el.append(horizontalBar(value, Math.min(value * 2, width),'complexity', [5,10])); | ||
| value = el.data('sloc'); | ||
| el.append(horizontalBar(value, Math.min(value, width), 'sloc', [400,600])); | ||
| value = el.data('bugs'); | ||
| el.append(horizontalBar(value, value * 5, 'est errors', [1,5])); | ||
| value = el.data('lint'); | ||
| el.append(horizontalBar(value, value * 5, 'lint errors', [1,10])); | ||
| }); | ||
| } | ||
| function drawOverviewCharts(reports) { | ||
| var maintainability = { | ||
| element: 'chart_maintainability', | ||
| data: [], | ||
| xkey: 'label', | ||
| ykeys: ['value'], | ||
| ymax : 100, | ||
| ymin : 0, | ||
| labels: ['Maintainability'], | ||
| barColors : ['#ff9b40'] | ||
| }; | ||
| var sloc = { | ||
| element: 'chart_sloc', | ||
| data: [], | ||
| xkey: 'label', | ||
| ykeys: ['value'], | ||
| ymax : 400, | ||
| labels: ['Lines'], | ||
| barColors : ['#1f6b75'] | ||
| }; | ||
| var bugs = { | ||
| element: 'chart_bugs', | ||
| data: [], | ||
| xkey: 'label', | ||
| ykeys: ['value'], | ||
| labels: ['Errors'], | ||
| ymax: 20, | ||
| barColors : ['#ff9b40'] | ||
| }; | ||
| var lint = { | ||
| element: 'chart_lint', | ||
| data: [], | ||
| xkey: 'label', | ||
| ykeys: ['value'], | ||
| labels: ['Errors'], | ||
| ymax: 20, | ||
| barColors : ['#1f6b75'] | ||
| }; | ||
| reports.forEach(function(report){ | ||
| // @todo shouldn't need this, 'auto [num]' doesn't seem to work : https://github.com/oesmith/morris.js/issues/201 | ||
| sloc.ymax = Math.max(sloc.ymax, report.complexity.aggregate.complexity.sloc.physical); | ||
| bugs.ymax = Math.max(bugs.ymax, report.complexity.aggregate.complexity.halstead.bugs.toFixed(2)); | ||
| sloc.data.push({ | ||
| value : report.complexity.aggregate.complexity.sloc.physical, | ||
| label : report.info.fileShort | ||
| }); | ||
| bugs.data.push({ | ||
| value : report.complexity.aggregate.complexity.halstead.bugs.toFixed(2), | ||
| label : report.info.fileShort | ||
| }); | ||
| maintainability.data.push({ | ||
| value : report.complexity.maintainability ? report.complexity.maintainability.toFixed(2) : 0, | ||
| label : report.info.fileShort | ||
| }); | ||
| lint.data.push({ | ||
| value : report.jshint && report.jshint.messages, | ||
| label : report.info.fileShort | ||
| }); | ||
| }); | ||
| function onGraphClick(i){ | ||
| document.location = __report.reports[i].info.link; | ||
| } | ||
| var charts = [ | ||
| Morris.Bar(bugs), | ||
| Morris.Bar(sloc), | ||
| Morris.Bar(maintainability) | ||
| ]; | ||
| if (__options.flags.jshint) charts.push(Morris.Bar(lint)); | ||
| charts.forEach(function(chart){ | ||
| chart.on('click', onGraphClick); | ||
| }); | ||
| return charts; | ||
| } | ||
| function drawHistoricalChart(history) { | ||
| var data = _.map(history,function(record){ | ||
| var date = new Date(record.date); | ||
| return { | ||
| date : date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(), | ||
| average_maintainability : parseFloat(record.average.maintainability), | ||
| average_sloc : record.average.sloc | ||
| }; | ||
| }).slice(-20); | ||
| Morris.Line({ | ||
| element: 'chart_historical_sloc', | ||
| data: data, | ||
| xkey: 'date', | ||
| ykeys: ['average_sloc'], | ||
| labels: ['Average Lines'], | ||
| parseTime : false | ||
| }); | ||
| Morris.Line({ | ||
| element: 'chart_historical_maint', | ||
| data: data, | ||
| xkey: 'date', | ||
| ykeys: ['average_maintainability'], | ||
| labels: ['Maintainability'], | ||
| ymax: 100, | ||
| parseTime : false | ||
| }); | ||
| } | ||
| function drawCharts() { | ||
| $('.js-chart').empty(); | ||
| drawHistoricalChart(__history); | ||
| drawOverviewCharts(__report.reports); | ||
| drawFileCharts(__report.reports); | ||
| } | ||
| drawCharts(); | ||
| $(window).on('resize', _.debounce(drawCharts,200)); | ||
| }); | ||
| /* =========================================================== | ||
| * bootstrap-popover.js v3.0.0 | ||
| * http://twitter.github.com/bootstrap/javascript.html#popovers | ||
| * =========================================================== | ||
| * Copyright 2012 Twitter, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * =========================================================== */ | ||
| !function ($) { | ||
| "use strict"; // jshint ;_; | ||
| /* POPOVER PUBLIC CLASS DEFINITION | ||
| * =============================== */ | ||
| var Popover = function (element, options) { | ||
| this.init('popover', element, options) | ||
| } | ||
| /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js | ||
| ========================================== */ | ||
| Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { | ||
| constructor: Popover | ||
| , setContent: function () { | ||
| var $tip = this.tip() | ||
| , title = this.getTitle() | ||
| , content = this.getContent() | ||
| $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) | ||
| $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) | ||
| $tip.removeClass('fade top bottom left right in') | ||
| } | ||
| , hasContent: function () { | ||
| return this.getTitle() || this.getContent() | ||
| } | ||
| , getContent: function () { | ||
| var content | ||
| , $e = this.$element | ||
| , o = this.options | ||
| content = $e.attr('data-content') | ||
| || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) | ||
| return content | ||
| } | ||
| , tip: function () { | ||
| if (!this.$tip) { | ||
| this.$tip = $(this.options.template) | ||
| } | ||
| return this.$tip | ||
| } | ||
| , destroy: function () { | ||
| this.hide().$element.off('.' + this.type).removeData(this.type) | ||
| } | ||
| }) | ||
| /* POPOVER PLUGIN DEFINITION | ||
| * ======================= */ | ||
| var old = $.fn.popover | ||
| $.fn.popover = function (option) { | ||
| return this.each(function () { | ||
| var $this = $(this) | ||
| , data = $this.data('popover') | ||
| , options = typeof option == 'object' && option | ||
| if (!data) $this.data('popover', (data = new Popover(this, options))) | ||
| if (typeof option == 'string') data[option]() | ||
| }) | ||
| } | ||
| $.fn.popover.Constructor = Popover | ||
| $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { | ||
| placement: 'right' | ||
| , trigger: 'click' | ||
| , content: '' | ||
| , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>' | ||
| }) | ||
| /* POPOVER NO CONFLICT | ||
| * =================== */ | ||
| $.fn.popover.noConflict = function () { | ||
| $.fn.popover = old | ||
| return this | ||
| } | ||
| }(window.jQuery); |
| /* =========================================================== | ||
| * bootstrap-tooltip.js v3.0.0 | ||
| * http://twitter.github.com/bootstrap/javascript.html#tooltips | ||
| * Inspired by the original jQuery.tipsy by Jason Frame | ||
| * =========================================================== | ||
| * Copyright 2012 Twitter, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * ========================================================== */ | ||
| !function ($) { | ||
| "use strict"; // jshint ;_; | ||
| /* TOOLTIP PUBLIC CLASS DEFINITION | ||
| * =============================== */ | ||
| var Tooltip = function (element, options) { | ||
| this.init('tooltip', element, options) | ||
| } | ||
| Tooltip.prototype = { | ||
| constructor: Tooltip | ||
| , init: function (type, element, options) { | ||
| var eventIn | ||
| , eventOut | ||
| this.type = type | ||
| this.$element = $(element) | ||
| this.options = this.getOptions(options) | ||
| this.enabled = true | ||
| if (this.options.trigger == 'click') { | ||
| this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) | ||
| } else if (this.options.trigger != 'manual') { | ||
| eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus' | ||
| eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur' | ||
| this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) | ||
| this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) | ||
| } | ||
| this.options.selector ? | ||
| (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : | ||
| this.fixTitle() | ||
| } | ||
| , getOptions: function (options) { | ||
| options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) | ||
| if (options.delay && typeof options.delay == 'number') { | ||
| options.delay = { | ||
| show: options.delay | ||
| , hide: options.delay | ||
| } | ||
| } | ||
| return options | ||
| } | ||
| , enter: function (e) { | ||
| var self = $(e.currentTarget)[this.type](this._options).data(this.type) | ||
| if (!self.options.delay || !self.options.delay.show) return self.show() | ||
| clearTimeout(this.timeout) | ||
| self.hoverState = 'in' | ||
| this.timeout = setTimeout(function() { | ||
| if (self.hoverState == 'in') self.show() | ||
| }, self.options.delay.show) | ||
| } | ||
| , leave: function (e) { | ||
| var self = $(e.currentTarget)[this.type](this._options).data(this.type) | ||
| if (this.timeout) clearTimeout(this.timeout) | ||
| if (!self.options.delay || !self.options.delay.hide) return self.hide() | ||
| self.hoverState = 'out' | ||
| this.timeout = setTimeout(function() { | ||
| if (self.hoverState == 'out') self.hide() | ||
| }, self.options.delay.hide) | ||
| } | ||
| , show: function () { | ||
| var $tip | ||
| , pos | ||
| , actualWidth | ||
| , actualHeight | ||
| , placement | ||
| , tp | ||
| if (this.hasContent() && this.enabled) { | ||
| $tip = this.tip() | ||
| if ($tip.is(':visible')) return this; | ||
| this.setContent() | ||
| if (this.options.animation) { | ||
| $tip.addClass('fade') | ||
| } | ||
| placement = typeof this.options.placement == 'function' ? | ||
| this.options.placement.call(this, $tip[0], this.$element[0]) : | ||
| this.options.placement | ||
| $tip | ||
| .detach() | ||
| .css({ top: 0, left: 0, display: 'block' }); | ||
| document.body.appendChild($tip[0]); | ||
| pos = this.getPosition() | ||
| actualWidth = $tip[0].offsetWidth | ||
| actualHeight = $tip[0].offsetHeight | ||
| switch (placement) { | ||
| case 'bottom': | ||
| tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} | ||
| break | ||
| case 'top': | ||
| tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} | ||
| break | ||
| case 'left': | ||
| tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} | ||
| break | ||
| case 'right': | ||
| tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} | ||
| break | ||
| } | ||
| $tip | ||
| .offset(tp) | ||
| .addClass(placement) | ||
| .addClass('in') | ||
| } | ||
| } | ||
| , setContent: function () { | ||
| var $tip = this.tip() | ||
| , title = this.getTitle() | ||
| $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) | ||
| $tip.removeClass('fade in top bottom left right') | ||
| } | ||
| , hide: function () { | ||
| var that = this | ||
| , $tip = this.tip() | ||
| $tip.removeClass('in') | ||
| function removeWithAnimation() { | ||
| var timeout = setTimeout(function () { | ||
| $tip.off($.support.transition.end).detach() | ||
| }, 500) | ||
| $tip.one($.support.transition.end, function () { | ||
| clearTimeout(timeout) | ||
| $tip.detach() | ||
| }) | ||
| } | ||
| $.support.transition && this.$tip.hasClass('fade') ? | ||
| removeWithAnimation() : | ||
| $tip.detach() | ||
| return this | ||
| } | ||
| , fixTitle: function () { | ||
| var $e = this.$element | ||
| if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { | ||
| $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') | ||
| } | ||
| } | ||
| , hasContent: function () { | ||
| return this.getTitle() | ||
| } | ||
| , getPosition: function () { | ||
| var el = this.$element[0] | ||
| return $.extend({}, el.getBoundingClientRect ? el.getBoundingClientRect() : { | ||
| width: el.offsetWidth | ||
| , height: el.offsetHeight | ||
| }, this.$element.offset()) | ||
| } | ||
| , getTitle: function () { | ||
| var title | ||
| , $e = this.$element | ||
| , o = this.options | ||
| title = $e.attr('data-original-title') | ||
| || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) | ||
| return title | ||
| } | ||
| , tip: function () { | ||
| return this.$tip = this.$tip || $(this.options.template) | ||
| } | ||
| , validate: function () { | ||
| if (!this.$element[0].parentNode) { | ||
| this.hide() | ||
| this.$element = null | ||
| this.options = null | ||
| } | ||
| } | ||
| , enable: function () { | ||
| this.enabled = true | ||
| } | ||
| , disable: function () { | ||
| this.enabled = false | ||
| } | ||
| , toggleEnabled: function () { | ||
| this.enabled = !this.enabled | ||
| } | ||
| , toggle: function (e) { | ||
| var self = $(e.currentTarget)[this.type](this._options).data(this.type) | ||
| self[self.tip().hasClass('in') ? 'hide' : 'show']() | ||
| } | ||
| , destroy: function () { | ||
| this.hide().$element.off('.' + this.type).removeData(this.type) | ||
| } | ||
| } | ||
| /* TOOLTIP PLUGIN DEFINITION | ||
| * ========================= */ | ||
| var old = $.fn.tooltip | ||
| $.fn.tooltip = function ( option ) { | ||
| return this.each(function () { | ||
| var $this = $(this) | ||
| , data = $this.data('tooltip') | ||
| , options = typeof option == 'object' && option | ||
| if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) | ||
| if (typeof option == 'string') data[option]() | ||
| }) | ||
| } | ||
| $.fn.tooltip.Constructor = Tooltip | ||
| $.fn.tooltip.defaults = { | ||
| animation: true | ||
| , placement: 'top' | ||
| , selector: false | ||
| , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' | ||
| , trigger: 'hover' | ||
| , title: '' | ||
| , delay: 0 | ||
| , html: false | ||
| } | ||
| /* TOOLTIP NO CONFLICT | ||
| * =================== */ | ||
| $.fn.tooltip.noConflict = function () { | ||
| $.fn.tooltip = old | ||
| return this | ||
| } | ||
| }(window.jQuery); |
Sorry, the diff of this file is too big to display
| // TODO actually recognize syntax of TypeScript constructs | ||
| CodeMirror.defineMode("javascript", function(config, parserConfig) { | ||
| var indentUnit = config.indentUnit; | ||
| var jsonMode = parserConfig.json; | ||
| var isTS = parserConfig.typescript; | ||
| // Tokenizer | ||
| var keywords = function(){ | ||
| function kw(type) {return {type: type, style: "keyword"};} | ||
| var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"); | ||
| var operator = kw("operator"), atom = {type: "atom", style: "atom"}; | ||
| var jsKeywords = { | ||
| "if": A, "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B, | ||
| "return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C, | ||
| "var": kw("var"), "const": kw("var"), "let": kw("var"), | ||
| "function": kw("function"), "catch": kw("catch"), | ||
| "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"), | ||
| "in": operator, "typeof": operator, "instanceof": operator, | ||
| "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom | ||
| }; | ||
| // Extend the 'normal' keywords with the TypeScript language extensions | ||
| if (isTS) { | ||
| var type = {type: "variable", style: "variable-3"}; | ||
| var tsKeywords = { | ||
| // object-like things | ||
| "interface": kw("interface"), | ||
| "class": kw("class"), | ||
| "extends": kw("extends"), | ||
| "constructor": kw("constructor"), | ||
| // scope modifiers | ||
| "public": kw("public"), | ||
| "private": kw("private"), | ||
| "protected": kw("protected"), | ||
| "static": kw("static"), | ||
| "super": kw("super"), | ||
| // types | ||
| "string": type, "number": type, "bool": type, "any": type | ||
| }; | ||
| for (var attr in tsKeywords) { | ||
| jsKeywords[attr] = tsKeywords[attr]; | ||
| } | ||
| } | ||
| return jsKeywords; | ||
| }(); | ||
| var isOperatorChar = /[+\-*&%=<>!?|]/; | ||
| function chain(stream, state, f) { | ||
| state.tokenize = f; | ||
| return f(stream, state); | ||
| } | ||
| function nextUntilUnescaped(stream, end) { | ||
| var escaped = false, next; | ||
| while ((next = stream.next()) != null) { | ||
| if (next == end && !escaped) | ||
| return false; | ||
| escaped = !escaped && next == "\\"; | ||
| } | ||
| return escaped; | ||
| } | ||
| // Used as scratch variables to communicate multiple values without | ||
| // consing up tons of objects. | ||
| var type, content; | ||
| function ret(tp, style, cont) { | ||
| type = tp; content = cont; | ||
| return style; | ||
| } | ||
| function jsTokenBase(stream, state) { | ||
| var ch = stream.next(); | ||
| if (ch == '"' || ch == "'") | ||
| return chain(stream, state, jsTokenString(ch)); | ||
| else if (/[\[\]{}\(\),;\:\.]/.test(ch)) | ||
| return ret(ch); | ||
| else if (ch == "0" && stream.eat(/x/i)) { | ||
| stream.eatWhile(/[\da-f]/i); | ||
| return ret("number", "number"); | ||
| } | ||
| else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) { | ||
| stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/); | ||
| return ret("number", "number"); | ||
| } | ||
| else if (ch == "/") { | ||
| if (stream.eat("*")) { | ||
| return chain(stream, state, jsTokenComment); | ||
| } | ||
| else if (stream.eat("/")) { | ||
| stream.skipToEnd(); | ||
| return ret("comment", "comment"); | ||
| } | ||
| else if (state.lastType == "operator" || state.lastType == "keyword c" || | ||
| /^[\[{}\(,;:]$/.test(state.lastType)) { | ||
| nextUntilUnescaped(stream, "/"); | ||
| stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla | ||
| return ret("regexp", "string-2"); | ||
| } | ||
| else { | ||
| stream.eatWhile(isOperatorChar); | ||
| return ret("operator", null, stream.current()); | ||
| } | ||
| } | ||
| else if (ch == "#") { | ||
| stream.skipToEnd(); | ||
| return ret("error", "error"); | ||
| } | ||
| else if (isOperatorChar.test(ch)) { | ||
| stream.eatWhile(isOperatorChar); | ||
| return ret("operator", null, stream.current()); | ||
| } | ||
| else { | ||
| stream.eatWhile(/[\w\$_]/); | ||
| var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word]; | ||
| return (known && state.lastType != ".") ? ret(known.type, known.style, word) : | ||
| ret("variable", "variable", word); | ||
| } | ||
| } | ||
| function jsTokenString(quote) { | ||
| return function(stream, state) { | ||
| if (!nextUntilUnescaped(stream, quote)) | ||
| state.tokenize = jsTokenBase; | ||
| return ret("string", "string"); | ||
| }; | ||
| } | ||
| function jsTokenComment(stream, state) { | ||
| var maybeEnd = false, ch; | ||
| while (ch = stream.next()) { | ||
| if (ch == "/" && maybeEnd) { | ||
| state.tokenize = jsTokenBase; | ||
| break; | ||
| } | ||
| maybeEnd = (ch == "*"); | ||
| } | ||
| return ret("comment", "comment"); | ||
| } | ||
| // Parser | ||
| var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true}; | ||
| function JSLexical(indented, column, type, align, prev, info) { | ||
| this.indented = indented; | ||
| this.column = column; | ||
| this.type = type; | ||
| this.prev = prev; | ||
| this.info = info; | ||
| if (align != null) this.align = align; | ||
| } | ||
| function inScope(state, varname) { | ||
| for (var v = state.localVars; v; v = v.next) | ||
| if (v.name == varname) return true; | ||
| } | ||
| function parseJS(state, style, type, content, stream) { | ||
| var cc = state.cc; | ||
| // Communicate our context to the combinators. | ||
| // (Less wasteful than consing up a hundred closures on every call.) | ||
| cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; | ||
| if (!state.lexical.hasOwnProperty("align")) | ||
| state.lexical.align = true; | ||
| while(true) { | ||
| var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement; | ||
| if (combinator(type, content)) { | ||
| while(cc.length && cc[cc.length - 1].lex) | ||
| cc.pop()(); | ||
| if (cx.marked) return cx.marked; | ||
| if (type == "variable" && inScope(state, content)) return "variable-2"; | ||
| return style; | ||
| } | ||
| } | ||
| } | ||
| // Combinator utils | ||
| var cx = {state: null, column: null, marked: null, cc: null}; | ||
| function pass() { | ||
| for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]); | ||
| } | ||
| function cont() { | ||
| pass.apply(null, arguments); | ||
| return true; | ||
| } | ||
| function register(varname) { | ||
| var state = cx.state; | ||
| if (state.context) { | ||
| cx.marked = "def"; | ||
| for (var v = state.localVars; v; v = v.next) | ||
| if (v.name == varname) return; | ||
| state.localVars = {name: varname, next: state.localVars}; | ||
| } | ||
| } | ||
| // Combinators | ||
| var defaultVars = {name: "this", next: {name: "arguments"}}; | ||
| function pushcontext() { | ||
| cx.state.context = {prev: cx.state.context, vars: cx.state.localVars}; | ||
| cx.state.localVars = defaultVars; | ||
| } | ||
| function popcontext() { | ||
| cx.state.localVars = cx.state.context.vars; | ||
| cx.state.context = cx.state.context.prev; | ||
| } | ||
| function pushlex(type, info) { | ||
| var result = function() { | ||
| var state = cx.state; | ||
| state.lexical = new JSLexical(state.indented, cx.stream.column(), type, null, state.lexical, info); | ||
| }; | ||
| result.lex = true; | ||
| return result; | ||
| } | ||
| function poplex() { | ||
| var state = cx.state; | ||
| if (state.lexical.prev) { | ||
| if (state.lexical.type == ")") | ||
| state.indented = state.lexical.indented; | ||
| state.lexical = state.lexical.prev; | ||
| } | ||
| } | ||
| poplex.lex = true; | ||
| function expect(wanted) { | ||
| return function expecting(type) { | ||
| if (type == wanted) return cont(); | ||
| else if (wanted == ";") return pass(); | ||
| else return cont(arguments.callee); | ||
| }; | ||
| } | ||
| function statement(type) { | ||
| if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex); | ||
| if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex); | ||
| if (type == "keyword b") return cont(pushlex("form"), statement, poplex); | ||
| if (type == "{") return cont(pushlex("}"), block, poplex); | ||
| if (type == ";") return cont(); | ||
| if (type == "function") return cont(functiondef); | ||
| if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"), | ||
| poplex, statement, poplex); | ||
| if (type == "variable") return cont(pushlex("stat"), maybelabel); | ||
| if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"), | ||
| block, poplex, poplex); | ||
| if (type == "case") return cont(expression, expect(":")); | ||
| if (type == "default") return cont(expect(":")); | ||
| if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"), | ||
| statement, poplex, popcontext); | ||
| return pass(pushlex("stat"), expression, expect(";"), poplex); | ||
| } | ||
| function expression(type) { | ||
| if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator); | ||
| if (type == "function") return cont(functiondef); | ||
| if (type == "keyword c") return cont(maybeexpression); | ||
| if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator); | ||
| if (type == "operator") return cont(expression); | ||
| if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator); | ||
| if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator); | ||
| return cont(); | ||
| } | ||
| function maybeexpression(type) { | ||
| if (type.match(/[;\}\)\],]/)) return pass(); | ||
| return pass(expression); | ||
| } | ||
| function maybeoperator(type, value) { | ||
| if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator); | ||
| if (type == "operator" && value == "?") return cont(expression, expect(":"), expression); | ||
| if (type == ";") return; | ||
| if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator); | ||
| if (type == ".") return cont(property, maybeoperator); | ||
| if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator); | ||
| } | ||
| function maybelabel(type) { | ||
| if (type == ":") return cont(poplex, statement); | ||
| return pass(maybeoperator, expect(";"), poplex); | ||
| } | ||
| function property(type) { | ||
| if (type == "variable") {cx.marked = "property"; return cont();} | ||
| } | ||
| function objprop(type) { | ||
| if (type == "variable") cx.marked = "property"; | ||
| if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression); | ||
| } | ||
| function commasep(what, end) { | ||
| function proceed(type) { | ||
| if (type == ",") return cont(what, proceed); | ||
| if (type == end) return cont(); | ||
| return cont(expect(end)); | ||
| } | ||
| return function commaSeparated(type) { | ||
| if (type == end) return cont(); | ||
| else return pass(what, proceed); | ||
| }; | ||
| } | ||
| function block(type) { | ||
| if (type == "}") return cont(); | ||
| return pass(statement, block); | ||
| } | ||
| function maybetype(type) { | ||
| if (type == ":") return cont(typedef); | ||
| return pass(); | ||
| } | ||
| function typedef(type) { | ||
| if (type == "variable"){cx.marked = "variable-3"; return cont();} | ||
| return pass(); | ||
| } | ||
| function vardef1(type, value) { | ||
| if (type == "variable") { | ||
| register(value); | ||
| return isTS ? cont(maybetype, vardef2) : cont(vardef2); | ||
| } | ||
| return pass(); | ||
| } | ||
| function vardef2(type, value) { | ||
| if (value == "=") return cont(expression, vardef2); | ||
| if (type == ",") return cont(vardef1); | ||
| } | ||
| function forspec1(type) { | ||
| if (type == "var") return cont(vardef1, expect(";"), forspec2); | ||
| if (type == ";") return cont(forspec2); | ||
| if (type == "variable") return cont(formaybein); | ||
| return cont(forspec2); | ||
| } | ||
| function formaybein(_type, value) { | ||
| if (value == "in") return cont(expression); | ||
| return cont(maybeoperator, forspec2); | ||
| } | ||
| function forspec2(type, value) { | ||
| if (type == ";") return cont(forspec3); | ||
| if (value == "in") return cont(expression); | ||
| return cont(expression, expect(";"), forspec3); | ||
| } | ||
| function forspec3(type) { | ||
| if (type != ")") cont(expression); | ||
| } | ||
| function functiondef(type, value) { | ||
| if (type == "variable") {register(value); return cont(functiondef);} | ||
| if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, statement, popcontext); | ||
| } | ||
| function funarg(type, value) { | ||
| if (type == "variable") {register(value); return isTS ? cont(maybetype) : cont();} | ||
| } | ||
| // Interface | ||
| return { | ||
| startState: function(basecolumn) { | ||
| return { | ||
| tokenize: jsTokenBase, | ||
| lastType: null, | ||
| cc: [], | ||
| lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false), | ||
| localVars: parserConfig.localVars, | ||
| context: parserConfig.localVars && {vars: parserConfig.localVars}, | ||
| indented: 0 | ||
| }; | ||
| }, | ||
| token: function(stream, state) { | ||
| if (stream.sol()) { | ||
| if (!state.lexical.hasOwnProperty("align")) | ||
| state.lexical.align = false; | ||
| state.indented = stream.indentation(); | ||
| } | ||
| if (stream.eatSpace()) return null; | ||
| var style = state.tokenize(stream, state); | ||
| if (type == "comment") return style; | ||
| state.lastType = type; | ||
| return parseJS(state, style, type, content, stream); | ||
| }, | ||
| indent: function(state, textAfter) { | ||
| if (state.tokenize == jsTokenComment) return CodeMirror.Pass; | ||
| if (state.tokenize != jsTokenBase) return 0; | ||
| var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical; | ||
| if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev; | ||
| var type = lexical.type, closing = firstChar == type; | ||
| if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? 4 : 0); | ||
| else if (type == "form" && firstChar == "{") return lexical.indented; | ||
| else if (type == "form") return lexical.indented + indentUnit; | ||
| else if (type == "stat") | ||
| return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? indentUnit : 0); | ||
| else if (lexical.info == "switch" && !closing) | ||
| return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit); | ||
| else if (lexical.align) return lexical.column + (closing ? 0 : 1); | ||
| else return lexical.indented + (closing ? 0 : indentUnit); | ||
| }, | ||
| electricChars: ":{}", | ||
| jsonMode: jsonMode | ||
| }; | ||
| }); | ||
| CodeMirror.defineMIME("text/javascript", "javascript"); | ||
| CodeMirror.defineMIME("application/json", {name: "javascript", json: true}); | ||
| CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true }); | ||
| CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true }); |
| /** | ||
| * Tag-closer extension for CodeMirror. | ||
| * | ||
| * This extension adds an "autoCloseTags" option that can be set to | ||
| * either true to get the default behavior, or an object to further | ||
| * configure its behavior. | ||
| * | ||
| * These are supported options: | ||
| * | ||
| * `whenClosing` (default true) | ||
| * Whether to autoclose when the '/' of a closing tag is typed. | ||
| * `whenOpening` (default true) | ||
| * Whether to autoclose the tag when the final '>' of an opening | ||
| * tag is typed. | ||
| * `dontCloseTags` (default is empty tags for HTML, none for XML) | ||
| * An array of tag names that should not be autoclosed. | ||
| * `indentTags` (default is block tags for HTML, none for XML) | ||
| * An array of tag names that should, when opened, cause a | ||
| * blank line to be added inside the tag, and the blank line and | ||
| * closing line to be indented. | ||
| * | ||
| * See demos/closetag.html for a usage example. | ||
| */ | ||
| (function() { | ||
| CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) { | ||
| if (val && (old == CodeMirror.Init || !old)) { | ||
| var map = {name: "autoCloseTags"}; | ||
| if (typeof val != "object" || val.whenClosing) | ||
| map["'/'"] = function(cm) { autoCloseTag(cm, '/'); }; | ||
| if (typeof val != "object" || val.whenOpening) | ||
| map["'>'"] = function(cm) { autoCloseTag(cm, '>'); }; | ||
| cm.addKeyMap(map); | ||
| } else if (!val && (old != CodeMirror.Init && old)) { | ||
| cm.removeKeyMap("autoCloseTags"); | ||
| } | ||
| }); | ||
| var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", | ||
| "source", "track", "wbr"]; | ||
| var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4", | ||
| "h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"]; | ||
| function autoCloseTag(cm, ch) { | ||
| var pos = cm.getCursor(), tok = cm.getTokenAt(pos); | ||
| var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state; | ||
| if (inner.mode.name != "xml") throw CodeMirror.Pass; | ||
| var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html"; | ||
| var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose); | ||
| var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent); | ||
| if (ch == ">" && state.tagName) { | ||
| var tagName = state.tagName; | ||
| if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch); | ||
| var lowerTagName = tagName.toLowerCase(); | ||
| // Don't process the '>' at the end of an end-tag or self-closing tag | ||
| if (tok.type == "tag" && state.type == "closeTag" || | ||
| /\/\s*$/.test(tok.string) || | ||
| dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1) | ||
| throw CodeMirror.Pass; | ||
| var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1; | ||
| cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">", | ||
| doIndent ? {line: pos.line + 1, ch: 0} : {line: pos.line, ch: pos.ch + 1}); | ||
| if (doIndent) { | ||
| cm.indentLine(pos.line + 1); | ||
| cm.indentLine(pos.line + 2); | ||
| } | ||
| return; | ||
| } else if (ch == "/" && tok.type == "tag" && tok.string == "<") { | ||
| var tagName = state.context && state.context.tagName; | ||
| if (tagName) cm.replaceSelection("/" + tagName + ">", "end"); | ||
| return; | ||
| } | ||
| throw CodeMirror.Pass; | ||
| } | ||
| function indexOf(collection, elt) { | ||
| if (collection.indexOf) return collection.indexOf(elt); | ||
| for (var i = 0, e = collection.length; i < e; ++i) | ||
| if (collection[i] == elt) return i; | ||
| return -1; | ||
| } | ||
| })(); |
| CodeMirror.colorize = (function() { | ||
| var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/; | ||
| function textContent(node, out) { | ||
| if (node.nodeType == 3) return out.push(node.nodeValue); | ||
| for (var ch = node.firstChild; ch; ch = ch.nextSibling) { | ||
| textContent(ch, out); | ||
| if (isBlock.test(node.nodeType)) out.push("\n"); | ||
| } | ||
| } | ||
| return function(collection, defaultMode) { | ||
| if (!collection) collection = document.body.getElementsByTagName("pre"); | ||
| for (var i = 0; i < collection.length; ++i) { | ||
| var node = collection[i]; | ||
| var mode = node.getAttribute("data-lang") || defaultMode; | ||
| if (!mode) continue; | ||
| var text = []; | ||
| textContent(node, text); | ||
| node.innerHTML = ""; | ||
| CodeMirror.runMode(text.join(""), mode, node); | ||
| node.className += " cm-s-default"; | ||
| } | ||
| }; | ||
| })(); |
| (function() { | ||
| var modes = ["clike", "css", "javascript"]; | ||
| for (var i = 0; i < modes.length; ++i) | ||
| CodeMirror.extendMode(modes[i], {blockCommentStart: "/*", | ||
| blockCommentEnd: "*/", | ||
| blockCommentContinue: " * "}); | ||
| CodeMirror.commands.newlineAndIndentContinueComment = function(cm) { | ||
| var pos = cm.getCursor(), token = cm.getTokenAt(pos); | ||
| var mode = CodeMirror.innerMode(cm.getMode(), token.state).mode; | ||
| var space; | ||
| if (token.type == "comment" && mode.blockCommentStart) { | ||
| var end = token.string.indexOf(mode.blockCommentEnd); | ||
| var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end}), found; | ||
| if (end != -1 && end == token.string.length - mode.blockCommentEnd.length) { | ||
| // Comment ended, don't continue it | ||
| } else if (token.string.indexOf(mode.blockCommentStart) == 0) { | ||
| space = full.slice(0, token.start); | ||
| if (!/^\s*$/.test(space)) { | ||
| space = ""; | ||
| for (var i = 0; i < token.start; ++i) space += " "; | ||
| } | ||
| } else if ((found = full.indexOf(mode.blockCommentContinue)) != -1 && | ||
| found + mode.blockCommentContinue.length > token.start && | ||
| /^\s*$/.test(full.slice(0, found))) { | ||
| space = full.slice(0, found); | ||
| } | ||
| } | ||
| if (space != null) | ||
| cm.replaceSelection("\n" + space + mode.blockCommentContinue, "end"); | ||
| else | ||
| cm.execCommand("newlineAndIndent"); | ||
| }; | ||
| })(); |
| (function() { | ||
| CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) { | ||
| var pos = cm.getCursor(), token = cm.getTokenAt(pos); | ||
| var space; | ||
| if (token.className == "string") { | ||
| var full = cm.getRange({line: pos.line, ch: 0}, {line: pos.line, ch: token.end}); | ||
| var listStart = /\*|\d+\./, listContinue; | ||
| if (token.string.search(listStart) == 0) { | ||
| var reg = /^[\W]*(\d+)\./g; | ||
| var matches = reg.exec(full); | ||
| if(matches) | ||
| listContinue = (parseInt(matches[1]) + 1) + ". "; | ||
| else | ||
| listContinue = "* "; | ||
| space = full.slice(0, token.start); | ||
| if (!/^\s*$/.test(space)) { | ||
| space = ""; | ||
| for (var i = 0; i < token.start; ++i) space += " "; | ||
| } | ||
| } | ||
| } | ||
| if (space != null) | ||
| cm.replaceSelection("\n" + space + listContinue, "end"); | ||
| else | ||
| cm.execCommand("newlineAndIndent"); | ||
| }; | ||
| })(); |
| .CodeMirror-dialog { | ||
| position: absolute; | ||
| left: 0; right: 0; | ||
| background: white; | ||
| z-index: 15; | ||
| padding: .1em .8em; | ||
| overflow: hidden; | ||
| color: #333; | ||
| } | ||
| .CodeMirror-dialog-top { | ||
| border-bottom: 1px solid #eee; | ||
| top: 0; | ||
| } | ||
| .CodeMirror-dialog-bottom { | ||
| border-top: 1px solid #eee; | ||
| bottom: 0; | ||
| } | ||
| .CodeMirror-dialog input { | ||
| border: none; | ||
| outline: none; | ||
| background: transparent; | ||
| width: 20em; | ||
| color: inherit; | ||
| font-family: monospace; | ||
| } | ||
| .CodeMirror-dialog button { | ||
| font-size: 70%; | ||
| } |
| // Open simple dialogs on top of an editor. Relies on dialog.css. | ||
| (function() { | ||
| function dialogDiv(cm, template, bottom) { | ||
| var wrap = cm.getWrapperElement(); | ||
| var dialog; | ||
| dialog = wrap.appendChild(document.createElement("div")); | ||
| if (bottom) { | ||
| dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom"; | ||
| } else { | ||
| dialog.className = "CodeMirror-dialog CodeMirror-dialog-top"; | ||
| } | ||
| dialog.innerHTML = template; | ||
| return dialog; | ||
| } | ||
| CodeMirror.defineExtension("openDialog", function(template, callback, options) { | ||
| var dialog = dialogDiv(this, template, options && options.bottom); | ||
| var closed = false, me = this; | ||
| function close() { | ||
| if (closed) return; | ||
| closed = true; | ||
| dialog.parentNode.removeChild(dialog); | ||
| } | ||
| var inp = dialog.getElementsByTagName("input")[0], button; | ||
| if (inp) { | ||
| CodeMirror.on(inp, "keydown", function(e) { | ||
| if (e.keyCode == 13 || e.keyCode == 27) { | ||
| CodeMirror.e_stop(e); | ||
| close(); | ||
| me.focus(); | ||
| if (e.keyCode == 13) callback(inp.value); | ||
| } | ||
| }); | ||
| inp.focus(); | ||
| CodeMirror.on(inp, "blur", close); | ||
| } else if (button = dialog.getElementsByTagName("button")[0]) { | ||
| CodeMirror.on(button, "click", function() { | ||
| close(); | ||
| me.focus(); | ||
| }); | ||
| button.focus(); | ||
| CodeMirror.on(button, "blur", close); | ||
| } | ||
| return close; | ||
| }); | ||
| CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) { | ||
| var dialog = dialogDiv(this, template, options && options.bottom); | ||
| var buttons = dialog.getElementsByTagName("button"); | ||
| var closed = false, me = this, blurring = 1; | ||
| function close() { | ||
| if (closed) return; | ||
| closed = true; | ||
| dialog.parentNode.removeChild(dialog); | ||
| me.focus(); | ||
| } | ||
| buttons[0].focus(); | ||
| for (var i = 0; i < buttons.length; ++i) { | ||
| var b = buttons[i]; | ||
| (function(callback) { | ||
| CodeMirror.on(b, "click", function(e) { | ||
| CodeMirror.e_preventDefault(e); | ||
| close(); | ||
| if (callback) callback(me); | ||
| }); | ||
| })(callbacks[i]); | ||
| CodeMirror.on(b, "blur", function() { | ||
| --blurring; | ||
| setTimeout(function() { if (blurring <= 0) close(); }, 200); | ||
| }); | ||
| CodeMirror.on(b, "focus", function() { ++blurring; }); | ||
| } | ||
| }); | ||
| })(); |
| // the tagRangeFinder function is | ||
| // Copyright (C) 2011 by Daniel Glazman <daniel@glazman.org> | ||
| // released under the MIT license (../../LICENSE) like the rest of CodeMirror | ||
| CodeMirror.tagRangeFinder = function(cm, start) { | ||
| var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; | ||
| var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; | ||
| var xmlNAMERegExp = new RegExp("^[" + nameStartChar + "][" + nameChar + "]*"); | ||
| var lineText = cm.getLine(start.line); | ||
| var found = false; | ||
| var tag = null; | ||
| var pos = start.ch; | ||
| while (!found) { | ||
| pos = lineText.indexOf("<", pos); | ||
| if (-1 == pos) // no tag on line | ||
| return; | ||
| if (pos + 1 < lineText.length && lineText[pos + 1] == "/") { // closing tag | ||
| pos++; | ||
| continue; | ||
| } | ||
| // ok we seem to have a start tag | ||
| if (!lineText.substr(pos + 1).match(xmlNAMERegExp)) { // not a tag name... | ||
| pos++; | ||
| continue; | ||
| } | ||
| var gtPos = lineText.indexOf(">", pos + 1); | ||
| if (-1 == gtPos) { // end of start tag not in line | ||
| var l = start.line + 1; | ||
| var foundGt = false; | ||
| var lastLine = cm.lineCount(); | ||
| while (l < lastLine && !foundGt) { | ||
| var lt = cm.getLine(l); | ||
| gtPos = lt.indexOf(">"); | ||
| if (-1 != gtPos) { // found a > | ||
| foundGt = true; | ||
| var slash = lt.lastIndexOf("/", gtPos); | ||
| if (-1 != slash && slash < gtPos) { | ||
| var str = lineText.substr(slash, gtPos - slash + 1); | ||
| if (!str.match( /\/\s*\>/ )) // yep, that's the end of empty tag | ||
| return; | ||
| } | ||
| } | ||
| l++; | ||
| } | ||
| found = true; | ||
| } | ||
| else { | ||
| var slashPos = lineText.lastIndexOf("/", gtPos); | ||
| if (-1 == slashPos) { // cannot be empty tag | ||
| found = true; | ||
| // don't continue | ||
| } | ||
| else { // empty tag? | ||
| // check if really empty tag | ||
| var str = lineText.substr(slashPos, gtPos - slashPos + 1); | ||
| if (!str.match( /\/\s*\>/ )) { // finally not empty | ||
| found = true; | ||
| // don't continue | ||
| } | ||
| } | ||
| } | ||
| if (found) { | ||
| var subLine = lineText.substr(pos + 1); | ||
| tag = subLine.match(xmlNAMERegExp); | ||
| if (tag) { | ||
| // we have an element name, wooohooo ! | ||
| tag = tag[0]; | ||
| // do we have the close tag on same line ??? | ||
| if (-1 != lineText.indexOf("</" + tag + ">", pos)) // yep | ||
| { | ||
| found = false; | ||
| } | ||
| // we don't, so we have a candidate... | ||
| } | ||
| else | ||
| found = false; | ||
| } | ||
| if (!found) | ||
| pos++; | ||
| } | ||
| if (found) { | ||
| var startTag = "(\\<\\/" + tag + "\\>)|(\\<" + tag + "\\>)|(\\<" + tag + "\\s)|(\\<" + tag + "$)"; | ||
| var startTagRegExp = new RegExp(startTag); | ||
| var endTag = "</" + tag + ">"; | ||
| var depth = 1; | ||
| var l = start.line + 1; | ||
| var lastLine = cm.lineCount(); | ||
| while (l < lastLine) { | ||
| lineText = cm.getLine(l); | ||
| var match = lineText.match(startTagRegExp); | ||
| if (match) { | ||
| for (var i = 0; i < match.length; i++) { | ||
| if (match[i] == endTag) | ||
| depth--; | ||
| else | ||
| depth++; | ||
| if (!depth) return {from: {line: start.line, ch: gtPos + 1}, | ||
| to: {line: l, ch: match.index}}; | ||
| } | ||
| } | ||
| l++; | ||
| } | ||
| return; | ||
| } | ||
| }; | ||
| CodeMirror.braceRangeFinder = function(cm, start) { | ||
| var line = start.line, lineText = cm.getLine(line); | ||
| var at = lineText.length, startChar, tokenType; | ||
| for (;;) { | ||
| var found = lineText.lastIndexOf("{", at); | ||
| if (found < start.ch) break; | ||
| tokenType = cm.getTokenAt({line: line, ch: found}).type; | ||
| if (!/^(comment|string)/.test(tokenType)) { startChar = found; break; } | ||
| at = found - 1; | ||
| } | ||
| if (startChar == null || lineText.lastIndexOf("}") > startChar) return; | ||
| var count = 1, lastLine = cm.lineCount(), end, endCh; | ||
| outer: for (var i = line + 1; i < lastLine; ++i) { | ||
| var text = cm.getLine(i), pos = 0; | ||
| for (;;) { | ||
| var nextOpen = text.indexOf("{", pos), nextClose = text.indexOf("}", pos); | ||
| if (nextOpen < 0) nextOpen = text.length; | ||
| if (nextClose < 0) nextClose = text.length; | ||
| pos = Math.min(nextOpen, nextClose); | ||
| if (pos == text.length) break; | ||
| if (cm.getTokenAt({line: i, ch: pos + 1}).type == tokenType) { | ||
| if (pos == nextOpen) ++count; | ||
| else if (!--count) { end = i; endCh = pos; break outer; } | ||
| } | ||
| ++pos; | ||
| } | ||
| } | ||
| if (end == null || end == line + 1) return; | ||
| return {from: {line: line, ch: startChar + 1}, | ||
| to: {line: end, ch: endCh}}; | ||
| }; | ||
| CodeMirror.indentRangeFinder = function(cm, start) { | ||
| var tabSize = cm.getOption("tabSize"), firstLine = cm.getLine(start.line); | ||
| var myIndent = CodeMirror.countColumn(firstLine, null, tabSize); | ||
| for (var i = start.line + 1, end = cm.lineCount(); i < end; ++i) { | ||
| var curLine = cm.getLine(i); | ||
| if (CodeMirror.countColumn(curLine, null, tabSize) < myIndent) | ||
| return {from: {line: start.line, ch: firstLine.length}, | ||
| to: {line: i, ch: curLine.length}}; | ||
| } | ||
| }; | ||
| CodeMirror.newFoldFunction = function(rangeFinder, widget) { | ||
| if (widget == null) widget = "\u2194"; | ||
| if (typeof widget == "string") { | ||
| var text = document.createTextNode(widget); | ||
| widget = document.createElement("span"); | ||
| widget.appendChild(text); | ||
| widget.className = "CodeMirror-foldmarker"; | ||
| } | ||
| return function(cm, pos) { | ||
| if (typeof pos == "number") pos = {line: pos, ch: 0}; | ||
| var range = rangeFinder(cm, pos); | ||
| if (!range) return; | ||
| var present = cm.findMarksAt(range.from), cleared = 0; | ||
| for (var i = 0; i < present.length; ++i) { | ||
| if (present[i].__isFold) { | ||
| ++cleared; | ||
| present[i].clear(); | ||
| } | ||
| } | ||
| if (cleared) return; | ||
| var myWidget = widget.cloneNode(true); | ||
| CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();}); | ||
| var myRange = cm.markText(range.from, range.to, { | ||
| replacedWith: myWidget, | ||
| clearOnEnter: true, | ||
| __isFold: true | ||
| }); | ||
| }; | ||
| }; |
| (function() { | ||
| CodeMirror.extendMode("css", { | ||
| commentStart: "/*", | ||
| commentEnd: "*/", | ||
| newlineAfterToken: function(_type, content) { | ||
| return /^[;{}]$/.test(content); | ||
| } | ||
| }); | ||
| CodeMirror.extendMode("javascript", { | ||
| commentStart: "/*", | ||
| commentEnd: "*/", | ||
| // FIXME semicolons inside of for | ||
| newlineAfterToken: function(_type, content, textAfter, state) { | ||
| if (this.jsonMode) { | ||
| return /^[\[,{]$/.test(content) || /^}/.test(textAfter); | ||
| } else { | ||
| if (content == ";" && state.lexical && state.lexical.type == ")") return false; | ||
| return /^[;{}]$/.test(content) && !/^;/.test(textAfter); | ||
| } | ||
| } | ||
| }); | ||
| CodeMirror.extendMode("xml", { | ||
| commentStart: "<!--", | ||
| commentEnd: "-->", | ||
| newlineAfterToken: function(type, content, textAfter) { | ||
| return type == "tag" && />$/.test(content) || /^</.test(textAfter); | ||
| } | ||
| }); | ||
| // Comment/uncomment the specified range | ||
| CodeMirror.defineExtension("commentRange", function (isComment, from, to) { | ||
| var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode; | ||
| cm.operation(function() { | ||
| if (isComment) { // Comment range | ||
| cm.replaceRange(curMode.commentEnd, to); | ||
| cm.replaceRange(curMode.commentStart, from); | ||
| if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside | ||
| cm.setCursor(from.line, from.ch + curMode.commentStart.length); | ||
| } else { // Uncomment range | ||
| var selText = cm.getRange(from, to); | ||
| var startIndex = selText.indexOf(curMode.commentStart); | ||
| var endIndex = selText.lastIndexOf(curMode.commentEnd); | ||
| if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) { | ||
| // Take string till comment start | ||
| selText = selText.substr(0, startIndex) | ||
| // From comment start till comment end | ||
| + selText.substring(startIndex + curMode.commentStart.length, endIndex) | ||
| // From comment end till string end | ||
| + selText.substr(endIndex + curMode.commentEnd.length); | ||
| } | ||
| cm.replaceRange(selText, from, to); | ||
| } | ||
| }); | ||
| }); | ||
| // Applies automatic mode-aware indentation to the specified range | ||
| CodeMirror.defineExtension("autoIndentRange", function (from, to) { | ||
| var cmInstance = this; | ||
| this.operation(function () { | ||
| for (var i = from.line; i <= to.line; i++) { | ||
| cmInstance.indentLine(i, "smart"); | ||
| } | ||
| }); | ||
| }); | ||
| // Applies automatic formatting to the specified range | ||
| CodeMirror.defineExtension("autoFormatRange", function (from, to) { | ||
| var cm = this; | ||
| var outer = cm.getMode(), text = cm.getRange(from, to).split("\n"); | ||
| var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state); | ||
| var tabSize = cm.getOption("tabSize"); | ||
| var out = "", lines = 0, atSol = from.ch == 0; | ||
| function newline() { | ||
| out += "\n"; | ||
| atSol = true; | ||
| ++lines; | ||
| } | ||
| for (var i = 0; i < text.length; ++i) { | ||
| var stream = new CodeMirror.StringStream(text[i], tabSize); | ||
| while (!stream.eol()) { | ||
| var inner = CodeMirror.innerMode(outer, state); | ||
| var style = outer.token(stream, state), cur = stream.current(); | ||
| stream.start = stream.pos; | ||
| if (!atSol || /\S/.test(cur)) { | ||
| out += cur; | ||
| atSol = false; | ||
| } | ||
| if (!atSol && inner.mode.newlineAfterToken && | ||
| inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state)) | ||
| newline(); | ||
| } | ||
| if (!stream.pos && outer.blankLine) outer.blankLine(state); | ||
| if (!atSol) newline(); | ||
| } | ||
| cm.operation(function () { | ||
| cm.replaceRange(out, from, to); | ||
| for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur) | ||
| cm.indentLine(cur, "smart"); | ||
| cm.setSelection(from, cm.getCursor(false)); | ||
| }); | ||
| }); | ||
| })(); |
| (function () { | ||
| function forEach(arr, f) { | ||
| for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); | ||
| } | ||
| function arrayContains(arr, item) { | ||
| if (!Array.prototype.indexOf) { | ||
| var i = arr.length; | ||
| while (i--) { | ||
| if (arr[i] === item) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| return arr.indexOf(item) != -1; | ||
| } | ||
| function scriptHint(editor, keywords, getToken, options) { | ||
| // Find the token at the cursor | ||
| var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; | ||
| // If it's not a 'word-style' token, ignore the token. | ||
| if (!/^[\w$_]*$/.test(token.string)) { | ||
| token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state, | ||
| type: token.string == "." ? "property" : null}; | ||
| } | ||
| // If it is a property, find out what it is a property of. | ||
| while (tprop.type == "property") { | ||
| tprop = getToken(editor, {line: cur.line, ch: tprop.start}); | ||
| if (tprop.string != ".") return; | ||
| tprop = getToken(editor, {line: cur.line, ch: tprop.start}); | ||
| if (tprop.string == ')') { | ||
| var level = 1; | ||
| do { | ||
| tprop = getToken(editor, {line: cur.line, ch: tprop.start}); | ||
| switch (tprop.string) { | ||
| case ')': level++; break; | ||
| case '(': level--; break; | ||
| default: break; | ||
| } | ||
| } while (level > 0); | ||
| tprop = getToken(editor, {line: cur.line, ch: tprop.start}); | ||
| if (tprop.type == 'variable') | ||
| tprop.type = 'function'; | ||
| else return; // no clue | ||
| } | ||
| if (!context) var context = []; | ||
| context.push(tprop); | ||
| } | ||
| return {list: getCompletions(token, context, keywords, options), | ||
| from: {line: cur.line, ch: token.start}, | ||
| to: {line: cur.line, ch: token.end}}; | ||
| } | ||
| CodeMirror.javascriptHint = function(editor, options) { | ||
| return scriptHint(editor, javascriptKeywords, | ||
| function (e, cur) {return e.getTokenAt(cur);}, | ||
| options); | ||
| }; | ||
| function getCoffeeScriptToken(editor, cur) { | ||
| // This getToken, it is for coffeescript, imitates the behavior of | ||
| // getTokenAt method in javascript.js, that is, returning "property" | ||
| // type and treat "." as indepenent token. | ||
| var token = editor.getTokenAt(cur); | ||
| if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') { | ||
| token.end = token.start; | ||
| token.string = '.'; | ||
| token.type = "property"; | ||
| } | ||
| else if (/^\.[\w$_]*$/.test(token.string)) { | ||
| token.type = "property"; | ||
| token.start++; | ||
| token.string = token.string.replace(/\./, ''); | ||
| } | ||
| return token; | ||
| } | ||
| CodeMirror.coffeescriptHint = function(editor, options) { | ||
| return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options); | ||
| }; | ||
| var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " + | ||
| "toUpperCase toLowerCase split concat match replace search").split(" "); | ||
| var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " + | ||
| "lastIndexOf every some filter forEach map reduce reduceRight ").split(" "); | ||
| var funcProps = "prototype apply call bind".split(" "); | ||
| var javascriptKeywords = ("break case catch continue debugger default delete do else false finally for function " + | ||
| "if in instanceof new null return switch throw true try typeof var void while with").split(" "); | ||
| var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " + | ||
| "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" "); | ||
| function getCompletions(token, context, keywords, options) { | ||
| var found = [], start = token.string; | ||
| function maybeAdd(str) { | ||
| if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str); | ||
| } | ||
| function gatherCompletions(obj) { | ||
| if (typeof obj == "string") forEach(stringProps, maybeAdd); | ||
| else if (obj instanceof Array) forEach(arrayProps, maybeAdd); | ||
| else if (obj instanceof Function) forEach(funcProps, maybeAdd); | ||
| for (var name in obj) maybeAdd(name); | ||
| } | ||
| if (context) { | ||
| // If this is a property, see if it belongs to some object we can | ||
| // find in the current environment. | ||
| var obj = context.pop(), base; | ||
| if (obj.type == "variable") { | ||
| if (options && options.additionalContext) | ||
| base = options.additionalContext[obj.string]; | ||
| base = base || window[obj.string]; | ||
| } else if (obj.type == "string") { | ||
| base = ""; | ||
| } else if (obj.type == "atom") { | ||
| base = 1; | ||
| } else if (obj.type == "function") { | ||
| if (window.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') && | ||
| (typeof window.jQuery == 'function')) | ||
| base = window.jQuery(); | ||
| else if (window._ != null && (obj.string == '_') && (typeof window._ == 'function')) | ||
| base = window._(); | ||
| } | ||
| while (base != null && context.length) | ||
| base = base[context.pop().string]; | ||
| if (base != null) gatherCompletions(base); | ||
| } | ||
| else { | ||
| // If not, just look in the window object and any local scope | ||
| // (reading into JS mode internals to get at the local variables) | ||
| for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name); | ||
| gatherCompletions(window); | ||
| forEach(keywords, maybeAdd); | ||
| } | ||
| return found; | ||
| } | ||
| })(); |
| (function() { | ||
| if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js"; | ||
| var loading = {}; | ||
| function splitCallback(cont, n) { | ||
| var countDown = n; | ||
| return function() { if (--countDown == 0) cont(); }; | ||
| } | ||
| function ensureDeps(mode, cont) { | ||
| var deps = CodeMirror.modes[mode].dependencies; | ||
| if (!deps) return cont(); | ||
| var missing = []; | ||
| for (var i = 0; i < deps.length; ++i) { | ||
| if (!CodeMirror.modes.hasOwnProperty(deps[i])) | ||
| missing.push(deps[i]); | ||
| } | ||
| if (!missing.length) return cont(); | ||
| var split = splitCallback(cont, missing.length); | ||
| for (var i = 0; i < missing.length; ++i) | ||
| CodeMirror.requireMode(missing[i], split); | ||
| } | ||
| CodeMirror.requireMode = function(mode, cont) { | ||
| if (typeof mode != "string") mode = mode.name; | ||
| if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont); | ||
| if (loading.hasOwnProperty(mode)) return loading[mode].push(cont); | ||
| var script = document.createElement("script"); | ||
| script.src = CodeMirror.modeURL.replace(/%N/g, mode); | ||
| var others = document.getElementsByTagName("script")[0]; | ||
| others.parentNode.insertBefore(script, others); | ||
| var list = loading[mode] = [cont]; | ||
| var count = 0, poll = setInterval(function() { | ||
| if (++count > 100) return clearInterval(poll); | ||
| if (CodeMirror.modes.hasOwnProperty(mode)) { | ||
| clearInterval(poll); | ||
| loading[mode] = null; | ||
| ensureDeps(mode, function() { | ||
| for (var i = 0; i < list.length; ++i) list[i](); | ||
| }); | ||
| } | ||
| }, 200); | ||
| }; | ||
| CodeMirror.autoLoadMode = function(instance, mode) { | ||
| if (!CodeMirror.modes.hasOwnProperty(mode)) | ||
| CodeMirror.requireMode(mode, function() { | ||
| instance.setOption("mode", instance.getOption("mode")); | ||
| }); | ||
| }; | ||
| }()); |
| // Define match-highlighter commands. Depends on searchcursor.js | ||
| // Use by attaching the following function call to the cursorActivity event: | ||
| //myCodeMirror.matchHighlight(minChars); | ||
| // And including a special span.CodeMirror-matchhighlight css class (also optionally a separate one for .CodeMirror-focused -- see demo matchhighlighter.html) | ||
| (function() { | ||
| var DEFAULT_MIN_CHARS = 2; | ||
| function MatchHighlightState() { | ||
| this.marked = []; | ||
| } | ||
| function getMatchHighlightState(cm) { | ||
| return cm._matchHighlightState || (cm._matchHighlightState = new MatchHighlightState()); | ||
| } | ||
| function clearMarks(cm) { | ||
| var state = getMatchHighlightState(cm); | ||
| for (var i = 0; i < state.marked.length; ++i) | ||
| state.marked[i].clear(); | ||
| state.marked = []; | ||
| } | ||
| function markDocument(cm, className, minChars) { | ||
| clearMarks(cm); | ||
| minChars = (typeof minChars !== 'undefined' ? minChars : DEFAULT_MIN_CHARS); | ||
| if (cm.somethingSelected() && cm.getSelection().replace(/^\s+|\s+$/g, "").length >= minChars) { | ||
| var state = getMatchHighlightState(cm); | ||
| var query = cm.getSelection(); | ||
| cm.operation(function() { | ||
| if (cm.lineCount() < 2000) { // This is too expensive on big documents. | ||
| for (var cursor = cm.getSearchCursor(query); cursor.findNext();) { | ||
| //Only apply matchhighlight to the matches other than the one actually selected | ||
| if (cursor.from().line !== cm.getCursor(true).line || | ||
| cursor.from().ch !== cm.getCursor(true).ch) | ||
| state.marked.push(cm.markText(cursor.from(), cursor.to(), | ||
| {className: className})); | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| CodeMirror.defineExtension("matchHighlight", function(className, minChars) { | ||
| markDocument(this, className, minChars); | ||
| }); | ||
| })(); |
| (function() { | ||
| var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; | ||
| function findMatchingBracket(cm) { | ||
| var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1; | ||
| var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; | ||
| if (!match) return null; | ||
| var forward = match.charAt(1) == ">", d = forward ? 1 : -1; | ||
| var style = cm.getTokenAt({line: cur.line, ch: pos + 1}).type; | ||
| var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; | ||
| function scan(line, lineNo, start) { | ||
| if (!line.text) return; | ||
| var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1; | ||
| if (start != null) pos = start + d; | ||
| for (; pos != end; pos += d) { | ||
| var ch = line.text.charAt(pos); | ||
| if (re.test(ch) && cm.getTokenAt({line: lineNo, ch: pos + 1}).type == style) { | ||
| var match = matching[ch]; | ||
| if (match.charAt(1) == ">" == forward) stack.push(ch); | ||
| else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; | ||
| else if (!stack.length) return {pos: pos, match: true}; | ||
| } | ||
| } | ||
| } | ||
| for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) { | ||
| if (i == cur.line) found = scan(line, i, pos); | ||
| else found = scan(cm.getLineHandle(i), i); | ||
| if (found) break; | ||
| } | ||
| return {from: {line: cur.line, ch: pos}, to: found && {line: i, ch: found.pos}, match: found && found.match}; | ||
| } | ||
| function matchBrackets(cm, autoclear) { | ||
| var found = findMatchingBracket(cm); | ||
| if (!found) return; | ||
| var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; | ||
| var one = cm.markText(found.from, {line: found.from.line, ch: found.from.ch + 1}, | ||
| {className: style}); | ||
| var two = found.to && cm.markText(found.to, {line: found.to.line, ch: found.to.ch + 1}, | ||
| {className: style}); | ||
| var clear = function() { | ||
| cm.operation(function() { one.clear(); two && two.clear(); }); | ||
| }; | ||
| if (autoclear) setTimeout(clear, 800); | ||
| else return clear; | ||
| } | ||
| var currentlyHighlighted = null; | ||
| function doMatchBrackets(cm) { | ||
| cm.operation(function() { | ||
| if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} | ||
| if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false); | ||
| }); | ||
| } | ||
| CodeMirror.defineOption("matchBrackets", false, function(cm, val) { | ||
| if (val) cm.on("cursorActivity", doMatchBrackets); | ||
| else cm.off("cursorActivity", doMatchBrackets); | ||
| }); | ||
| CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); | ||
| CodeMirror.defineExtension("findMatchingBracket", function(){return findMatchingBracket(this);}); | ||
| })(); |
| CodeMirror.multiplexingMode = function(outer /*, others */) { | ||
| // Others should be {open, close, mode [, delimStyle]} objects | ||
| var others = Array.prototype.slice.call(arguments, 1); | ||
| var n_others = others.length; | ||
| function indexOf(string, pattern, from) { | ||
| if (typeof pattern == "string") return string.indexOf(pattern, from); | ||
| var m = pattern.exec(from ? string.slice(from) : string); | ||
| return m ? m.index + from : -1; | ||
| } | ||
| return { | ||
| startState: function() { | ||
| return { | ||
| outer: CodeMirror.startState(outer), | ||
| innerActive: null, | ||
| inner: null | ||
| }; | ||
| }, | ||
| copyState: function(state) { | ||
| return { | ||
| outer: CodeMirror.copyState(outer, state.outer), | ||
| innerActive: state.innerActive, | ||
| inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner) | ||
| }; | ||
| }, | ||
| token: function(stream, state) { | ||
| if (!state.innerActive) { | ||
| var cutOff = Infinity, oldContent = stream.string; | ||
| for (var i = 0; i < n_others; ++i) { | ||
| var other = others[i]; | ||
| var found = indexOf(oldContent, other.open, stream.pos); | ||
| if (found == stream.pos) { | ||
| stream.match(other.open); | ||
| state.innerActive = other; | ||
| state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0); | ||
| return other.delimStyle; | ||
| } else if (found != -1 && found < cutOff) { | ||
| cutOff = found; | ||
| } | ||
| } | ||
| if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff); | ||
| var outerToken = outer.token(stream, state.outer); | ||
| if (cutOff != Infinity) stream.string = oldContent; | ||
| return outerToken; | ||
| } else { | ||
| var curInner = state.innerActive, oldContent = stream.string; | ||
| var found = indexOf(oldContent, curInner.close, stream.pos); | ||
| if (found == stream.pos) { | ||
| stream.match(curInner.close); | ||
| state.innerActive = state.inner = null; | ||
| return curInner.delimStyle; | ||
| } | ||
| if (found > -1) stream.string = oldContent.slice(0, found); | ||
| var innerToken = curInner.mode.token(stream, state.inner); | ||
| if (found > -1) stream.string = oldContent; | ||
| var cur = stream.current(), found = cur.indexOf(curInner.close); | ||
| if (found > -1) stream.backUp(cur.length - found); | ||
| return innerToken; | ||
| } | ||
| }, | ||
| indent: function(state, textAfter) { | ||
| var mode = state.innerActive ? state.innerActive.mode : outer; | ||
| if (!mode.indent) return CodeMirror.Pass; | ||
| return mode.indent(state.innerActive ? state.inner : state.outer, textAfter); | ||
| }, | ||
| blankLine: function(state) { | ||
| var mode = state.innerActive ? state.innerActive.mode : outer; | ||
| if (mode.blankLine) { | ||
| mode.blankLine(state.innerActive ? state.inner : state.outer); | ||
| } | ||
| if (!state.innerActive) { | ||
| for (var i = 0; i < n_others; ++i) { | ||
| var other = others[i]; | ||
| if (other.open === "\n") { | ||
| state.innerActive = other; | ||
| state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "") : 0); | ||
| } | ||
| } | ||
| } else if (mode.close === "\n") { | ||
| state.innerActive = state.inner = null; | ||
| } | ||
| }, | ||
| electricChars: outer.electricChars, | ||
| innerMode: function(state) { | ||
| return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer}; | ||
| } | ||
| }; | ||
| }; |
| // Utility function that allows modes to be combined. The mode given | ||
| // as the base argument takes care of most of the normal mode | ||
| // functionality, but a second (typically simple) mode is used, which | ||
| // can override the style of text. Both modes get to parse all of the | ||
| // text, but when both assign a non-null style to a piece of code, the | ||
| // overlay wins, unless the combine argument was true, in which case | ||
| // the styles are combined. | ||
| // overlayParser is the old, deprecated name | ||
| CodeMirror.overlayMode = CodeMirror.overlayParser = function(base, overlay, combine) { | ||
| return { | ||
| startState: function() { | ||
| return { | ||
| base: CodeMirror.startState(base), | ||
| overlay: CodeMirror.startState(overlay), | ||
| basePos: 0, baseCur: null, | ||
| overlayPos: 0, overlayCur: null | ||
| }; | ||
| }, | ||
| copyState: function(state) { | ||
| return { | ||
| base: CodeMirror.copyState(base, state.base), | ||
| overlay: CodeMirror.copyState(overlay, state.overlay), | ||
| basePos: state.basePos, baseCur: null, | ||
| overlayPos: state.overlayPos, overlayCur: null | ||
| }; | ||
| }, | ||
| token: function(stream, state) { | ||
| if (stream.start == state.basePos) { | ||
| state.baseCur = base.token(stream, state.base); | ||
| state.basePos = stream.pos; | ||
| } | ||
| if (stream.start == state.overlayPos) { | ||
| stream.pos = stream.start; | ||
| state.overlayCur = overlay.token(stream, state.overlay); | ||
| state.overlayPos = stream.pos; | ||
| } | ||
| stream.pos = Math.min(state.basePos, state.overlayPos); | ||
| if (stream.eol()) state.basePos = state.overlayPos = 0; | ||
| if (state.overlayCur == null) return state.baseCur; | ||
| if (state.baseCur != null && combine) return state.baseCur + " " + state.overlayCur; | ||
| else return state.overlayCur; | ||
| }, | ||
| indent: base.indent && function(state, textAfter) { | ||
| return base.indent(state.base, textAfter); | ||
| }, | ||
| electricChars: base.electricChars, | ||
| innerMode: function(state) { return {state: state.base, mode: base}; }, | ||
| blankLine: function(state) { | ||
| if (base.blankLine) base.blankLine(state.base); | ||
| if (overlay.blankLine) overlay.blankLine(state.overlay); | ||
| } | ||
| }; | ||
| }; |
| (function () { | ||
| function forEach(arr, f) { | ||
| for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); | ||
| } | ||
| function arrayContains(arr, item) { | ||
| if (!Array.prototype.indexOf) { | ||
| var i = arr.length; | ||
| while (i--) { | ||
| if (arr[i] === item) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| return arr.indexOf(item) != -1; | ||
| } | ||
| function scriptHint(editor, _keywords, getToken) { | ||
| // Find the token at the cursor | ||
| var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; | ||
| // If it's not a 'word-style' token, ignore the token. | ||
| if (!/^[\w$_]*$/.test(token.string)) { | ||
| token = tprop = {start: cur.ch, end: cur.ch, string: "", state: token.state, | ||
| className: token.string == ":" ? "pig-type" : null}; | ||
| } | ||
| if (!context) var context = []; | ||
| context.push(tprop); | ||
| var completionList = getCompletions(token, context); | ||
| completionList = completionList.sort(); | ||
| //prevent autocomplete for last word, instead show dropdown with one word | ||
| if(completionList.length == 1) { | ||
| completionList.push(" "); | ||
| } | ||
| return {list: completionList, | ||
| from: {line: cur.line, ch: token.start}, | ||
| to: {line: cur.line, ch: token.end}}; | ||
| } | ||
| CodeMirror.pigHint = function(editor) { | ||
| return scriptHint(editor, pigKeywordsU, function (e, cur) {return e.getTokenAt(cur);}); | ||
| }; | ||
| var pigKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP " | ||
| + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL " | ||
| + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE " | ||
| + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE " | ||
| + "NEQ MATCHES TRUE FALSE"; | ||
| var pigKeywordsU = pigKeywords.split(" "); | ||
| var pigKeywordsL = pigKeywords.toLowerCase().split(" "); | ||
| var pigTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP"; | ||
| var pigTypesU = pigTypes.split(" "); | ||
| var pigTypesL = pigTypes.toLowerCase().split(" "); | ||
| var pigBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL " | ||
| + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS " | ||
| + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG " | ||
| + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN " | ||
| + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER " | ||
| + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS " | ||
| + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA " | ||
| + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE " | ||
| + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG " | ||
| + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER"; | ||
| var pigBuiltinsU = pigBuiltins.split(" ").join("() ").split(" "); | ||
| var pigBuiltinsL = pigBuiltins.toLowerCase().split(" ").join("() ").split(" "); | ||
| var pigBuiltinsC = ("BagSize BinStorage Bloom BuildBloom ConstantSize CubeDimensions DoubleAbs " | ||
| + "DoubleAvg DoubleBase DoubleMax DoubleMin DoubleRound DoubleSum FloatAbs FloatAvg FloatMax " | ||
| + "FloatMin FloatRound FloatSum GenericInvoker IntAbs IntAvg IntMax IntMin IntSum " | ||
| + "InvokeForDouble InvokeForFloat InvokeForInt InvokeForLong InvokeForString Invoker " | ||
| + "IsEmpty JsonLoader JsonMetadata JsonStorage LongAbs LongAvg LongMax LongMin LongSum MapSize " | ||
| + "MonitoredUDF Nondeterministic OutputSchema PigStorage PigStreaming StringConcat StringMax " | ||
| + "StringMin StringSize TextLoader TupleSize Utf8StorageConverter").split(" ").join("() ").split(" "); | ||
| function getCompletions(token, context) { | ||
| var found = [], start = token.string; | ||
| function maybeAdd(str) { | ||
| if (str.indexOf(start) == 0 && !arrayContains(found, str)) found.push(str); | ||
| } | ||
| function gatherCompletions(obj) { | ||
| if(obj == ":") { | ||
| forEach(pigTypesL, maybeAdd); | ||
| } | ||
| else { | ||
| forEach(pigBuiltinsU, maybeAdd); | ||
| forEach(pigBuiltinsL, maybeAdd); | ||
| forEach(pigBuiltinsC, maybeAdd); | ||
| forEach(pigTypesU, maybeAdd); | ||
| forEach(pigTypesL, maybeAdd); | ||
| forEach(pigKeywordsU, maybeAdd); | ||
| forEach(pigKeywordsL, maybeAdd); | ||
| } | ||
| } | ||
| if (context) { | ||
| // If this is a property, see if it belongs to some object we can | ||
| // find in the current environment. | ||
| var obj = context.pop(), base; | ||
| if (obj.type == "variable") | ||
| base = obj.string; | ||
| else if(obj.type == "variable-3") | ||
| base = ":" + obj.string; | ||
| while (base != null && context.length) | ||
| base = base[context.pop().string]; | ||
| if (base != null) gatherCompletions(base); | ||
| } | ||
| return found; | ||
| } | ||
| })(); |
| /* Just enough of CodeMirror to run runMode under node.js */ | ||
| function splitLines(string){ return string.split(/\r?\n|\r/); }; | ||
| function StringStream(string) { | ||
| this.pos = this.start = 0; | ||
| this.string = string; | ||
| } | ||
| StringStream.prototype = { | ||
| eol: function() {return this.pos >= this.string.length;}, | ||
| sol: function() {return this.pos == 0;}, | ||
| peek: function() {return this.string.charAt(this.pos) || null;}, | ||
| next: function() { | ||
| if (this.pos < this.string.length) | ||
| return this.string.charAt(this.pos++); | ||
| }, | ||
| eat: function(match) { | ||
| var ch = this.string.charAt(this.pos); | ||
| if (typeof match == "string") var ok = ch == match; | ||
| else var ok = ch && (match.test ? match.test(ch) : match(ch)); | ||
| if (ok) {++this.pos; return ch;} | ||
| }, | ||
| eatWhile: function(match) { | ||
| var start = this.pos; | ||
| while (this.eat(match)){} | ||
| return this.pos > start; | ||
| }, | ||
| eatSpace: function() { | ||
| var start = this.pos; | ||
| while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; | ||
| return this.pos > start; | ||
| }, | ||
| skipToEnd: function() {this.pos = this.string.length;}, | ||
| skipTo: function(ch) { | ||
| var found = this.string.indexOf(ch, this.pos); | ||
| if (found > -1) {this.pos = found; return true;} | ||
| }, | ||
| backUp: function(n) {this.pos -= n;}, | ||
| column: function() {return this.start;}, | ||
| indentation: function() {return 0;}, | ||
| match: function(pattern, consume, caseInsensitive) { | ||
| if (typeof pattern == "string") { | ||
| function cased(str) {return caseInsensitive ? str.toLowerCase() : str;} | ||
| if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) { | ||
| if (consume !== false) this.pos += pattern.length; | ||
| return true; | ||
| } | ||
| } | ||
| else { | ||
| var match = this.string.slice(this.pos).match(pattern); | ||
| if (match && consume !== false) this.pos += match[0].length; | ||
| return match; | ||
| } | ||
| }, | ||
| current: function(){return this.string.slice(this.start, this.pos);} | ||
| }; | ||
| exports.StringStream = StringStream; | ||
| exports.startState = function(mode, a1, a2) { | ||
| return mode.startState ? mode.startState(a1, a2) : true; | ||
| }; | ||
| var modes = exports.modes = {}, mimeModes = exports.mimeModes = {}; | ||
| exports.defineMode = function(name, mode) { modes[name] = mode; }; | ||
| exports.defineMIME = function(mime, spec) { mimeModes[mime] = spec; }; | ||
| exports.getMode = function(options, spec) { | ||
| if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) | ||
| spec = mimeModes[spec]; | ||
| if (typeof spec == "string") | ||
| var mname = spec, config = {}; | ||
| else if (spec != null) | ||
| var mname = spec.name, config = spec; | ||
| var mfactory = modes[mname]; | ||
| if (!mfactory) throw new Error("Unknown mode: " + spec); | ||
| return mfactory(options, config || {}); | ||
| }; | ||
| exports.runMode = function(string, modespec, callback) { | ||
| var mode = exports.getMode({indentUnit: 2}, modespec); | ||
| var lines = splitLines(string), state = exports.startState(mode); | ||
| for (var i = 0, e = lines.length; i < e; ++i) { | ||
| if (i) callback("\n"); | ||
| var stream = new exports.StringStream(lines[i]); | ||
| while (!stream.eol()) { | ||
| var style = mode.token(stream, state); | ||
| callback(stream.current(), style, i, stream.start); | ||
| stream.start = stream.pos; | ||
| } | ||
| } | ||
| }; |
| CodeMirror.runMode = function(string, modespec, callback, options) { | ||
| var mode = CodeMirror.getMode(CodeMirror.defaults, modespec); | ||
| if (callback.nodeType == 1) { | ||
| var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize; | ||
| var node = callback, col = 0; | ||
| node.innerHTML = ""; | ||
| callback = function(text, style) { | ||
| if (text == "\n") { | ||
| node.appendChild(document.createElement("br")); | ||
| col = 0; | ||
| return; | ||
| } | ||
| var content = ""; | ||
| // replace tabs | ||
| for (var pos = 0;;) { | ||
| var idx = text.indexOf("\t", pos); | ||
| if (idx == -1) { | ||
| content += text.slice(pos); | ||
| col += text.length - pos; | ||
| break; | ||
| } else { | ||
| col += idx - pos; | ||
| content += text.slice(pos, idx); | ||
| var size = tabSize - col % tabSize; | ||
| col += size; | ||
| for (var i = 0; i < size; ++i) content += " "; | ||
| pos = idx + 1; | ||
| } | ||
| } | ||
| if (style) { | ||
| var sp = node.appendChild(document.createElement("span")); | ||
| sp.className = "cm-" + style.replace(/ +/g, " cm-"); | ||
| sp.appendChild(document.createTextNode(content)); | ||
| } else { | ||
| node.appendChild(document.createTextNode(content)); | ||
| } | ||
| }; | ||
| } | ||
| var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode); | ||
| for (var i = 0, e = lines.length; i < e; ++i) { | ||
| if (i) callback("\n"); | ||
| var stream = new CodeMirror.StringStream(lines[i]); | ||
| while (!stream.eol()) { | ||
| var style = mode.token(stream, state); | ||
| callback(stream.current(), style, i, stream.start); | ||
| stream.start = stream.pos; | ||
| } | ||
| } | ||
| }; |
| // Define search commands. Depends on dialog.js or another | ||
| // implementation of the openDialog method. | ||
| // Replace works a little oddly -- it will do the replace on the next | ||
| // Ctrl-G (or whatever is bound to findNext) press. You prevent a | ||
| // replace by making sure the match is no longer selected when hitting | ||
| // Ctrl-G. | ||
| (function() { | ||
| function SearchState() { | ||
| this.posFrom = this.posTo = this.query = null; | ||
| this.marked = []; | ||
| } | ||
| function getSearchState(cm) { | ||
| return cm._searchState || (cm._searchState = new SearchState()); | ||
| } | ||
| function getSearchCursor(cm, query, pos) { | ||
| // Heuristic: if the query string is all lowercase, do a case insensitive search. | ||
| return cm.getSearchCursor(query, pos, typeof query == "string" && query == query.toLowerCase()); | ||
| } | ||
| function dialog(cm, text, shortText, f) { | ||
| if (cm.openDialog) cm.openDialog(text, f); | ||
| else f(prompt(shortText, "")); | ||
| } | ||
| function confirmDialog(cm, text, shortText, fs) { | ||
| if (cm.openConfirm) cm.openConfirm(text, fs); | ||
| else if (confirm(shortText)) fs[0](); | ||
| } | ||
| function parseQuery(query) { | ||
| var isRE = query.match(/^\/(.*)\/([a-z]*)$/); | ||
| return isRE ? new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i") : query; | ||
| } | ||
| var queryDialog = | ||
| 'Search: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>'; | ||
| function doSearch(cm, rev) { | ||
| var state = getSearchState(cm); | ||
| if (state.query) return findNext(cm, rev); | ||
| dialog(cm, queryDialog, "Search for:", function(query) { | ||
| cm.operation(function() { | ||
| if (!query || state.query) return; | ||
| state.query = parseQuery(query); | ||
| if (cm.lineCount() < 2000) { // This is too expensive on big documents. | ||
| for (var cursor = getSearchCursor(cm, state.query); cursor.findNext();) | ||
| state.marked.push(cm.markText(cursor.from(), cursor.to(), | ||
| {className: "CodeMirror-searching"})); | ||
| } | ||
| state.posFrom = state.posTo = cm.getCursor(); | ||
| findNext(cm, rev); | ||
| }); | ||
| }); | ||
| } | ||
| function findNext(cm, rev) {cm.operation(function() { | ||
| var state = getSearchState(cm); | ||
| var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo); | ||
| if (!cursor.find(rev)) { | ||
| cursor = getSearchCursor(cm, state.query, rev ? {line: cm.lineCount() - 1} : {line: 0, ch: 0}); | ||
| if (!cursor.find(rev)) return; | ||
| } | ||
| cm.setSelection(cursor.from(), cursor.to()); | ||
| state.posFrom = cursor.from(); state.posTo = cursor.to(); | ||
| });} | ||
| function clearSearch(cm) {cm.operation(function() { | ||
| var state = getSearchState(cm); | ||
| if (!state.query) return; | ||
| state.query = null; | ||
| for (var i = 0; i < state.marked.length; ++i) state.marked[i].clear(); | ||
| state.marked.length = 0; | ||
| });} | ||
| var replaceQueryDialog = | ||
| 'Replace: <input type="text" style="width: 10em"/> <span style="color: #888">(Use /re/ syntax for regexp search)</span>'; | ||
| var replacementQueryDialog = 'With: <input type="text" style="width: 10em"/>'; | ||
| var doReplaceConfirm = "Replace? <button>Yes</button> <button>No</button> <button>Stop</button>"; | ||
| function replace(cm, all) { | ||
| dialog(cm, replaceQueryDialog, "Replace:", function(query) { | ||
| if (!query) return; | ||
| query = parseQuery(query); | ||
| dialog(cm, replacementQueryDialog, "Replace with:", function(text) { | ||
| if (all) { | ||
| cm.operation(function() { | ||
| for (var cursor = getSearchCursor(cm, query); cursor.findNext();) { | ||
| if (typeof query != "string") { | ||
| var match = cm.getRange(cursor.from(), cursor.to()).match(query); | ||
| cursor.replace(text.replace(/\$(\d)/, function(_, i) {return match[i];})); | ||
| } else cursor.replace(text); | ||
| } | ||
| }); | ||
| } else { | ||
| clearSearch(cm); | ||
| var cursor = getSearchCursor(cm, query, cm.getCursor()); | ||
| function advance() { | ||
| var start = cursor.from(), match; | ||
| if (!(match = cursor.findNext())) { | ||
| cursor = getSearchCursor(cm, query); | ||
| if (!(match = cursor.findNext()) || | ||
| (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return; | ||
| } | ||
| cm.setSelection(cursor.from(), cursor.to()); | ||
| confirmDialog(cm, doReplaceConfirm, "Replace?", | ||
| [function() {doReplace(match);}, advance]); | ||
| } | ||
| function doReplace(match) { | ||
| cursor.replace(typeof query == "string" ? text : | ||
| text.replace(/\$(\d)/, function(_, i) {return match[i];})); | ||
| advance(); | ||
| } | ||
| advance(); | ||
| } | ||
| }); | ||
| }); | ||
| } | ||
| CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);}; | ||
| CodeMirror.commands.findNext = doSearch; | ||
| CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);}; | ||
| CodeMirror.commands.clearSearch = clearSearch; | ||
| CodeMirror.commands.replace = replace; | ||
| CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);}; | ||
| })(); |
| (function(){ | ||
| function SearchCursor(cm, query, pos, caseFold) { | ||
| this.atOccurrence = false; this.cm = cm; | ||
| if (caseFold == null && typeof query == "string") caseFold = false; | ||
| pos = pos ? cm.clipPos(pos) : {line: 0, ch: 0}; | ||
| this.pos = {from: pos, to: pos}; | ||
| // The matches method is filled in based on the type of query. | ||
| // It takes a position and a direction, and returns an object | ||
| // describing the next occurrence of the query, or null if no | ||
| // more matches were found. | ||
| if (typeof query != "string") { // Regexp match | ||
| if (!query.global) query = new RegExp(query.source, query.ignoreCase ? "ig" : "g"); | ||
| this.matches = function(reverse, pos) { | ||
| if (reverse) { | ||
| query.lastIndex = 0; | ||
| var line = cm.getLine(pos.line).slice(0, pos.ch), match = query.exec(line), start = 0; | ||
| while (match) { | ||
| start += match.index + 1; | ||
| line = line.slice(start); | ||
| query.lastIndex = 0; | ||
| var newmatch = query.exec(line); | ||
| if (newmatch) match = newmatch; | ||
| else break; | ||
| } | ||
| start--; | ||
| } else { | ||
| query.lastIndex = pos.ch; | ||
| var line = cm.getLine(pos.line), match = query.exec(line), | ||
| start = match && match.index; | ||
| } | ||
| if (match) | ||
| return {from: {line: pos.line, ch: start}, | ||
| to: {line: pos.line, ch: start + match[0].length}, | ||
| match: match}; | ||
| }; | ||
| } else { // String query | ||
| if (caseFold) query = query.toLowerCase(); | ||
| var fold = caseFold ? function(str){return str.toLowerCase();} : function(str){return str;}; | ||
| var target = query.split("\n"); | ||
| // Different methods for single-line and multi-line queries | ||
| if (target.length == 1) | ||
| this.matches = function(reverse, pos) { | ||
| var line = fold(cm.getLine(pos.line)), len = query.length, match; | ||
| if (reverse ? (pos.ch >= len && (match = line.lastIndexOf(query, pos.ch - len)) != -1) | ||
| : (match = line.indexOf(query, pos.ch)) != -1) | ||
| return {from: {line: pos.line, ch: match}, | ||
| to: {line: pos.line, ch: match + len}}; | ||
| }; | ||
| else | ||
| this.matches = function(reverse, pos) { | ||
| var ln = pos.line, idx = (reverse ? target.length - 1 : 0), match = target[idx], line = fold(cm.getLine(ln)); | ||
| var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match)); | ||
| if (reverse ? offsetA >= pos.ch || offsetA != match.length | ||
| : offsetA <= pos.ch || offsetA != line.length - match.length) | ||
| return; | ||
| for (;;) { | ||
| if (reverse ? !ln : ln == cm.lineCount() - 1) return; | ||
| line = fold(cm.getLine(ln += reverse ? -1 : 1)); | ||
| match = target[reverse ? --idx : ++idx]; | ||
| if (idx > 0 && idx < target.length - 1) { | ||
| if (line != match) return; | ||
| else continue; | ||
| } | ||
| var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length); | ||
| if (reverse ? offsetB != line.length - match.length : offsetB != match.length) | ||
| return; | ||
| var start = {line: pos.line, ch: offsetA}, end = {line: ln, ch: offsetB}; | ||
| return {from: reverse ? end : start, to: reverse ? start : end}; | ||
| } | ||
| }; | ||
| } | ||
| } | ||
| SearchCursor.prototype = { | ||
| findNext: function() {return this.find(false);}, | ||
| findPrevious: function() {return this.find(true);}, | ||
| find: function(reverse) { | ||
| var self = this, pos = this.cm.clipPos(reverse ? this.pos.from : this.pos.to); | ||
| function savePosAndFail(line) { | ||
| var pos = {line: line, ch: 0}; | ||
| self.pos = {from: pos, to: pos}; | ||
| self.atOccurrence = false; | ||
| return false; | ||
| } | ||
| for (;;) { | ||
| if (this.pos = this.matches(reverse, pos)) { | ||
| this.atOccurrence = true; | ||
| return this.pos.match || true; | ||
| } | ||
| if (reverse) { | ||
| if (!pos.line) return savePosAndFail(0); | ||
| pos = {line: pos.line-1, ch: this.cm.getLine(pos.line-1).length}; | ||
| } | ||
| else { | ||
| var maxLine = this.cm.lineCount(); | ||
| if (pos.line == maxLine - 1) return savePosAndFail(maxLine); | ||
| pos = {line: pos.line+1, ch: 0}; | ||
| } | ||
| } | ||
| }, | ||
| from: function() {if (this.atOccurrence) return this.pos.from;}, | ||
| to: function() {if (this.atOccurrence) return this.pos.to;}, | ||
| replace: function(newText) { | ||
| var self = this; | ||
| if (this.atOccurrence) | ||
| self.pos.to = this.cm.replaceRange(newText, self.pos.from, self.pos.to); | ||
| } | ||
| }; | ||
| CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) { | ||
| return new SearchCursor(this, query, pos, caseFold); | ||
| }); | ||
| })(); |
| .CodeMirror-completions { | ||
| position: absolute; | ||
| z-index: 10; | ||
| overflow: hidden; | ||
| -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); | ||
| -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); | ||
| box-shadow: 2px 3px 5px rgba(0,0,0,.2); | ||
| } | ||
| .CodeMirror-completions select { | ||
| background: #fafafa; | ||
| outline: none; | ||
| border: none; | ||
| padding: 0; | ||
| margin: 0; | ||
| font-family: monospace; | ||
| } |
| (function() { | ||
| CodeMirror.simpleHint = function(editor, getHints, givenOptions) { | ||
| // Determine effective options based on given values and defaults. | ||
| var options = {}, defaults = CodeMirror.simpleHint.defaults; | ||
| for (var opt in defaults) | ||
| if (defaults.hasOwnProperty(opt)) | ||
| options[opt] = (givenOptions && givenOptions.hasOwnProperty(opt) ? givenOptions : defaults)[opt]; | ||
| function collectHints(previousToken) { | ||
| // We want a single cursor position. | ||
| if (editor.somethingSelected()) return; | ||
| var tempToken = editor.getTokenAt(editor.getCursor()); | ||
| // Don't show completions if token has changed and the option is set. | ||
| if (options.closeOnTokenChange && previousToken != null && | ||
| (tempToken.start != previousToken.start || tempToken.type != previousToken.type)) { | ||
| return; | ||
| } | ||
| var result = getHints(editor, givenOptions); | ||
| if (!result || !result.list.length) return; | ||
| var completions = result.list; | ||
| function insert(str) { | ||
| editor.replaceRange(str, result.from, result.to); | ||
| } | ||
| // When there is only one completion, use it directly. | ||
| if (options.completeSingle && completions.length == 1) { | ||
| insert(completions[0]); | ||
| return true; | ||
| } | ||
| // Build the select widget | ||
| var complete = document.createElement("div"); | ||
| complete.className = "CodeMirror-completions"; | ||
| var sel = complete.appendChild(document.createElement("select")); | ||
| // Opera doesn't move the selection when pressing up/down in a | ||
| // multi-select, but it does properly support the size property on | ||
| // single-selects, so no multi-select is necessary. | ||
| if (!window.opera) sel.multiple = true; | ||
| for (var i = 0; i < completions.length; ++i) { | ||
| var opt = sel.appendChild(document.createElement("option")); | ||
| opt.appendChild(document.createTextNode(completions[i])); | ||
| } | ||
| sel.firstChild.selected = true; | ||
| sel.size = Math.min(10, completions.length); | ||
| var pos = editor.cursorCoords(options.alignWithWord ? result.from : null); | ||
| complete.style.left = pos.left + "px"; | ||
| complete.style.top = pos.bottom + "px"; | ||
| document.body.appendChild(complete); | ||
| // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor. | ||
| var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth); | ||
| if(winW - pos.left < sel.clientWidth) | ||
| complete.style.left = (pos.left - sel.clientWidth) + "px"; | ||
| // Hack to hide the scrollbar. | ||
| if (completions.length <= 10) | ||
| complete.style.width = (sel.clientWidth - 1) + "px"; | ||
| var done = false; | ||
| function close() { | ||
| if (done) return; | ||
| done = true; | ||
| complete.parentNode.removeChild(complete); | ||
| } | ||
| function pick() { | ||
| insert(completions[sel.selectedIndex]); | ||
| close(); | ||
| setTimeout(function(){editor.focus();}, 50); | ||
| } | ||
| CodeMirror.on(sel, "blur", close); | ||
| CodeMirror.on(sel, "keydown", function(event) { | ||
| var code = event.keyCode; | ||
| // Enter | ||
| if (code == 13) {CodeMirror.e_stop(event); pick();} | ||
| // Escape | ||
| else if (code == 27) {CodeMirror.e_stop(event); close(); editor.focus();} | ||
| else if (code != 38 && code != 40 && code != 33 && code != 34 && !CodeMirror.isModifierKey(event)) { | ||
| close(); editor.focus(); | ||
| // Pass the event to the CodeMirror instance so that it can handle things like backspace properly. | ||
| editor.triggerOnKeyDown(event); | ||
| // Don't show completions if the code is backspace and the option is set. | ||
| if (!options.closeOnBackspace || code != 8) { | ||
| setTimeout(function(){collectHints(tempToken);}, 50); | ||
| } | ||
| } | ||
| }); | ||
| CodeMirror.on(sel, "dblclick", pick); | ||
| sel.focus(); | ||
| // Opera sometimes ignores focusing a freshly created node | ||
| if (window.opera) setTimeout(function(){if (!done) sel.focus();}, 100); | ||
| return true; | ||
| } | ||
| return collectHints(); | ||
| }; | ||
| CodeMirror.simpleHint.defaults = { | ||
| closeOnBackspace: true, | ||
| closeOnTokenChange: false, | ||
| completeSingle: true, | ||
| alignWithWord: true | ||
| }; | ||
| })(); |
| (function() { | ||
| CodeMirror.xmlHints = []; | ||
| CodeMirror.xmlHint = function(cm, simbol) { | ||
| if(simbol.length > 0) { | ||
| var cursor = cm.getCursor(); | ||
| cm.replaceSelection(simbol); | ||
| cursor = {line: cursor.line, ch: cursor.ch + 1}; | ||
| cm.setCursor(cursor); | ||
| } | ||
| CodeMirror.simpleHint(cm, getHint); | ||
| }; | ||
| var getHint = function(cm) { | ||
| var cursor = cm.getCursor(); | ||
| if (cursor.ch > 0) { | ||
| var text = cm.getRange({line: 0, ch: 0}, cursor); | ||
| var typed = ''; | ||
| var simbol = ''; | ||
| for(var i = text.length - 1; i >= 0; i--) { | ||
| if(text[i] == ' ' || text[i] == '<') { | ||
| simbol = text[i]; | ||
| break; | ||
| } | ||
| else { | ||
| typed = text[i] + typed; | ||
| } | ||
| } | ||
| text = text.slice(0, text.length - typed.length); | ||
| var path = getActiveElement(text) + simbol; | ||
| var hints = CodeMirror.xmlHints[path]; | ||
| if(typeof hints === 'undefined') | ||
| hints = ['']; | ||
| else { | ||
| hints = hints.slice(0); | ||
| for (var i = hints.length - 1; i >= 0; i--) { | ||
| if(hints[i].indexOf(typed) != 0) | ||
| hints.splice(i, 1); | ||
| } | ||
| } | ||
| return { | ||
| list: hints, | ||
| from: { line: cursor.line, ch: cursor.ch - typed.length }, | ||
| to: cursor | ||
| }; | ||
| }; | ||
| }; | ||
| var getActiveElement = function(text) { | ||
| var element = ''; | ||
| if(text.length >= 0) { | ||
| var regex = new RegExp('<([^!?][^\\s/>]*).*?>', 'g'); | ||
| var matches = []; | ||
| var match; | ||
| while ((match = regex.exec(text)) != null) { | ||
| matches.push({ | ||
| tag: match[1], | ||
| selfclose: (match[0].slice(match[0].length - 2) === '/>') | ||
| }); | ||
| } | ||
| for (var i = matches.length - 1, skip = 0; i >= 0; i--) { | ||
| var item = matches[i]; | ||
| if (item.tag[0] == '/') | ||
| { | ||
| skip++; | ||
| } | ||
| else if (item.selfclose == false) | ||
| { | ||
| if (skip > 0) | ||
| { | ||
| skip--; | ||
| } | ||
| else | ||
| { | ||
| element = '<' + item.tag + '>' + element; | ||
| } | ||
| } | ||
| } | ||
| element += getOpenTag(text); | ||
| } | ||
| return element; | ||
| }; | ||
| var getOpenTag = function(text) { | ||
| var open = text.lastIndexOf('<'); | ||
| var close = text.lastIndexOf('>'); | ||
| if (close < open) | ||
| { | ||
| text = text.slice(open); | ||
| if(text != '<') { | ||
| var space = text.indexOf(' '); | ||
| if(space < 0) | ||
| space = text.indexOf('\t'); | ||
| if(space < 0) | ||
| space = text.indexOf('\n'); | ||
| if (space < 0) | ||
| space = text.length; | ||
| return text.slice(0, space); | ||
| } | ||
| } | ||
| return ''; | ||
| }; | ||
| })(); |
Sorry, the diff of this file is too big to display
| /*global jQuery */ | ||
| /*! | ||
| * FitText.js 1.1 | ||
| * | ||
| * Copyright 2011, Dave Rupert http://daverupert.com | ||
| * Released under the WTFPL license | ||
| * http://sam.zoy.org/wtfpl/ | ||
| * | ||
| * Date: Thu May 05 14:23:00 2011 -0600 | ||
| */ | ||
| (function( $ ){ | ||
| $.fn.fitText = function( kompressor, options ) { | ||
| // Setup options | ||
| var compressor = kompressor || 1, | ||
| settings = $.extend({ | ||
| 'minFontSize' : Number.NEGATIVE_INFINITY, | ||
| 'maxFontSize' : Number.POSITIVE_INFINITY | ||
| }, options); | ||
| return this.each(function(){ | ||
| // Store the object | ||
| var $this = $(this); | ||
| // Resizer() resizes items based on the object width divided by the compressor * 10 | ||
| var resizer = function () { | ||
| $this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize))); | ||
| }; | ||
| // Call once to set. | ||
| resizer(); | ||
| // Call on resize. Opera debounces their resize by default. | ||
| $(window).on('resize', resizer); | ||
| }); | ||
| }; | ||
| })( jQuery ); |
| /*! | ||
| Lo-Dash 1.0.0-rc.3 lodash.com/license | ||
| Underscore.js 1.4.3 underscorejs.org/LICENSE | ||
| */ | ||
| ;(function(e,t){function n(e){if(e&&typeof e=="object"&&e.__wrapped__)return e;if(!(this instanceof n))return new n(e);this.__wrapped__=e}function r(e,t,n){t||(t=0);var r=e.length,i=r-t>=(n||tt);if(i)for(var s={},n=t-1;++n<r;){var o=e[n]+"";(Et.call(s,o)?s[o]:s[o]=[]).push(e[n])}return function(n){if(i){var r=n+"";return Et.call(s,r)&&-1<R(s[r],n)}return-1<R(e,n,t)}}function i(e){return e.charCodeAt(0)}function s(e,t){var n=e.b,r=t.b,e=e.a,t=t.a;if(e!==t){if(e>t||typeof e=="undefined")return 1;if( | ||
| e<t||typeof t=="undefined")return-1}return n<r?-1:1}function o(e,t,n){function r(){var u=arguments,a=s?this:t;return i||(e=t[o]),n.length&&(u=u.length?n.concat(p(u)):n),this instanceof r?(h.prototype=e.prototype,a=new h,h.prototype=null,u=e.apply(a,u),x(u)?u:a):e.apply(a,u)}var i=S(e),s=!n,o=t;return s&&(n=t),i||(t=e),r}function u(e,t,n){return e?typeof e!="function"?function(t){return t[e]}:typeof t!="undefined"?n?function(n,r,i,s){return e.call(t,n,r,i,s)}:function(n,r,i){return e.call(t,n,r,i) | ||
| }:e:V}function a(){for(var e={b:"",c:"",e:Xt,f:Wt,g:"",h:Jt,i:Gt,j:mt,k:"",l:!0},t,n=0;t=arguments[n];n++)for(var r in t)e[r]=t[r];t=e.a,e.d=/^[^,]+/.exec(t)[0],n=Function,r="var i,l="+e.d+",t="+e.d+";if(!"+e.d+")return t;"+e.k+";",e.b?(r+="var m=l.length;i=-1;if(typeof m=='number'){",e.i&&(r+="if(k(l)){l=l.split('')}"),r+="while(++i<m){"+e.b+"}}else {"):e.h&&(r+="var m=l.length;i=-1;if(m&&j(l)){while(++i<m){i+='';"+e.g+"}}else {"),e.e||(r+="var u=typeof l=='function'&&s.call(l,'prototype');");if( | ||
| e.f&&e.l)r+="var q=-1,r=p[typeof l]?n(l):[],m=r.length;while(++q<m){i=r[q];",e.e||(r+="if(!(u&&i=='prototype')){"),r+=e.g+"",e.e||(r+="}");else{r+="for(i in l){";if(!e.e||e.l)r+="if(",e.e||(r+="!(u&&i=='prototype')"),!e.e&&e.l&&(r+="&&"),e.l&&(r+="h.call(l,i)"),r+="){";r+=e.g+";";if(!e.e||e.l)r+="}"}r+="}";if(e.e){r+="var f=l.constructor;";for(var i=0;7>i;i++)r+="i='"+e.j[i]+"';if(","constructor"==e.j[i]&&(r+="!(f&&f.prototype===l)&&"),r+="h.call(l,i)){"+e.g+"}"}if(e.b||e.h)r+="}";return r+=e.c+";return t" | ||
| ,n("e,h,j,k,p,n,s","return function("+t+"){"+r+"}")(u,Et,v,N,nn,At,xt)}function f(e){return"\\"+rn[e]}function l(e){return hn[e]}function c(e){return typeof e.toString!="function"&&typeof (e+"")=="string"}function h(){}function p(e,t,n){t||(t=0),typeof n=="undefined"&&(n=e?e.length:0);for(var r=-1,n=n-t||0,i=Array(0>n?0:n);++r<n;)i[r]=e[t+r];return i}function d(e){return pn[e]}function v(e){return Tt.call(e)==Dt}function m(e){var t=!1;if(!e||typeof e!="object"||v(e))return t;var n=e.constructor;return! | ||
| S(n)&&(!Yt||!c(e))||n instanceof n?Vt?(ln(e,function(e,n,r){return t=!Et.call(r,n),!1}),!1===t):(ln(e,function(e,n){t=n}),!1===t||Et.call(e,t)):t}function g(e){var t=[];return cn(e,function(e,n){t.push(n)}),t}function y(e,t,n,r,i){if(null==e)return e;n&&(t=!1);if(n=x(e)){var s=Tt.call(e);if(!en[s]||Yt&&c(e))return e;var o=vn(e)}if(!n||!t)return n?o?p(e):fn({},e):e;n=tn[s];switch(s){case Ht:case Bt:return new n(+e);case jt:case qt:return new n(e);case It:return n(e.source,at.exec(e))}r||(r=[]),i|| | ||
| (i=[]);for(s=r.length;s--;)if(r[s]==e)return i[s];var u=o?n(e.length):{};return r.push(e),i.push(u),(o?_:cn)(e,function(e,n){u[n]=y(e,t,null,r,i)}),o&&(Et.call(e,"index")&&(u.index=e.index),Et.call(e,"input")&&(u.input=e.input)),u}function b(e){var t=[];return ln(e,function(e,n){S(e)&&t.push(n)}),t.sort()}function w(e){var t={};return cn(e,function(e,n){t[e]=n}),t}function E(e,t,n,r){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;var i=Tt.call(e),s=Tt.call(t);i==Dt&&(i=Ft),s==Dt&& | ||
| (s=Ft);if(i!=s)return!1;switch(i){case Ht:case Bt:return+e==+t;case jt:return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case It:case qt:return e==t+""}s=i==Pt;if(!s){if(e.__wrapped__||t.__wrapped__)return E(e.__wrapped__||e,t.__wrapped__||t);if(i!=Ft||Yt&&(c(e)||c(t)))return!1;var i=!Kt&&v(e)?Object:e.constructor,o=!Kt&&v(t)?Object:t.constructor;if(i!=o&&(!S(i)||!(i instanceof i&&S(o)&&o instanceof o)))return!1}n||(n=[]),r||(r=[]);for(i=n.length;i--;)if(n[i]==e)return r[i]==t;var u=!0,a=0;n.push(e),r.push( | ||
| t);if(s){a=e.length;if(u=a==t.length)for(;a--&&(u=E(e[a],t[a],n,r)););return u}return ln(e,function(e,i,s){if(Et.call(s,i))return a++,u=Et.call(t,i)&&E(e,t[i],n,r)}),u&&ln(t,function(e,t,n){if(Et.call(n,t))return u=-1<--a}),u}function S(e){return typeof e=="function"}function x(e){return e?nn[typeof e]:!1}function T(e){return typeof e=="number"||Tt.call(e)==jt}function N(e){return typeof e=="string"||Tt.call(e)==qt}function C(e,t,n){var r=arguments,i=0,s=2,o=r[3],u=r[4];n!==et&&(o=[],u=[],typeof | ||
| n!="number"&&(s=r.length));for(;++i<s;)cn(r[i],function(t,n){var r,i,s;if(t&&((i=vn(t))||mn(t))){for(var a=o.length;a--;)if(r=o[a]==t)break;r?e[n]=u[a]:(o.push(t),u.push(s=(s=e[n],i)?vn(s)?s:[]:mn(s)?s:{}),e[n]=C(s,t,et,o,u))}else t!=null&&(e[n]=t)});return e}function k(e){var t=[];return cn(e,function(e){t.push(e)}),t}function L(e,t,n){var r=-1,i=e?e.length:0,s=!1,n=(0>n?Ot(0,i+n):n)||0;return typeof i=="number"?s=-1<(N(e)?e.indexOf(t,n):R(e,t,n)):an(e,function(e){if(++r>=n)return!(s=e===t)}),s} | ||
| function A(e,t,n){var r=!0,t=u(t,n);if(vn(e))for(var n=-1,i=e.length;++n<i&&(r=!!t(e[n],n,e)););else an(e,function(e,n,i){return r=!!t(e,n,i)});return r}function O(e,t,n){var r=[],t=u(t,n);if(vn(e))for(var n=-1,i=e.length;++n<i;){var s=e[n];t(s,n,e)&&r.push(s)}else an(e,function(e,n,i){t(e,n,i)&&r.push(e)});return r}function M(e,t,n){var r,t=u(t,n);return _(e,function(e,n,i){if(t(e,n,i))return r=e,!1}),r}function _(e,t,n){if(t&&typeof n=="undefined"&&vn(e))for(var n=-1,r=e.length;++n<r&&!1!==t(e[ | ||
| n],n,e););else an(e,t,n);return e}function D(e,t,n){var r=-1,i=e?e.length:0,s=Array(typeof i=="number"?i:0),t=u(t,n);if(vn(e))for(;++r<i;)s[r]=t(e[r],r,e);else an(e,function(e,n,i){s[++r]=t(e,n,i)});return s}function P(e,t,n){var r=-Infinity,s=-1,o=e?e.length:0,a=r;if(t||!vn(e))t=!t&&N(e)?i:u(t,n),an(e,function(e,n,i){n=t(e,n,i),n>r&&(r=n,a=e)});else for(;++s<o;)e[s]>a&&(a=e[s]);return a}function H(e,t){return D(e,t+"")}function B(e,t,n,r){var i=3>arguments.length,t=u(t,r,et);if(vn(e)){var s=-1,o= | ||
| e.length;for(i&&(n=e[++s]);++s<o;)n=t(n,e[s],s,e)}else an(e,function(e,r,s){n=i?(i=!1,e):t(n,e,r,s)});return n}function j(e,t,n,r){var i=e,s=e?e.length:0,o=3>arguments.length;if(typeof s!="number")var a=gn(e),s=a.length;else Gt&&N(e)&&(i=e.split(""));return t=u(t,r,et),_(e,function(e,r,u){r=a?a[--s]:--s,n=o?(o=!1,i[r]):t(n,i[r],r,u)}),n}function F(e,t,n){var r,t=u(t,n);if(vn(e))for(var n=-1,i=e.length;++n<i&&!(r=t(e[n],n,e)););else an(e,function(e,n,i){return!(r=t(e,n,i))});return!!r}function I(e | ||
| ,t,n){if(e){var r=e.length;return null==t||n?e[0]:p(e,0,Mt(Ot(0,t),r))}}function q(e,t){for(var n=-1,r=e?e.length:0,i=[];++n<r;){var s=e[n];vn(s)?St.apply(i,t?s:q(s)):i.push(s)}return i}function R(e,t,n){var r=-1,i=e?e.length:0;if(typeof n=="number")r=(0>n?Ot(0,i+n):n||0)-1;else if(n)return r=z(e,t),e[r]===t?r:-1;for(;++r<i;)if(e[r]===t)return r;return-1}function U(e,t,n){return p(e,null==t||n?1:Ot(0,t))}function z(e,t,n,r){for(var i=0,s=e?e.length:i,n=n?u(n,r):V,t=n(t);i<s;)r=i+s>>>1,n(e[r])<t?i= | ||
| r+1:s=r;return i}function W(e,t,n,r){var i=-1,s=e?e.length:0,o=[],a=o;typeof t=="function"&&(r=n,n=t,t=!1);var f=!t&&75<=s;if(f)var l={};n&&(a=[],n=u(n,r));for(;++i<s;){var r=e[i],c=n?n(r,i,e):r;if(f)var h=c+"",h=Et.call(l,h)?!(a=l[h]):a=l[h]=[];if(t?!i||a[a.length-1]!==c:h||0>R(a,c))(n||f)&&a.push(c),o.push(r)}return o}function X(e,t){return zt||Nt&&2<arguments.length?Nt.call.apply(Nt,arguments):o(e,t,p(arguments,2))}function V(e){return e}function $(e){_(b(e),function(t){var r=n[t]=e[t];n.prototype | ||
| [t]=function(){var e=[this.__wrapped__];return St.apply(e,arguments),e=r.apply(n,e),new n(e)}})}function J(){return this.__wrapped__}var K=typeof exports=="object"&&exports,Q=typeof global=="object"&&global;Q.global===Q&&(e=Q);var G=[],Y=new function(){},Z=0,et=Y,tt=30,nt=e._,rt=/[-?+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/,it=/&(?:amp|lt|gt|quot|#x27);/g,st=/\b__p\+='';/g,ot=/\b(__p\+=)''\+/g,ut=/(__e\(.*?\)|\b__t\))\+'';/g,at=/\w*$/,ft=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g | ||
| ,lt=RegExp("^"+(Y.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),ct=/\$\{((?:(?=\\?)\\?[\s\S])*?)}/g,ht=/<%=([\s\S]+?)%>/g,pt=/($^)/,dt=/[&<>"']/g,vt=/['\n\r\t\u2028\u2029\\]/g,mt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),gt=Math.ceil,yt=G.concat,bt=Math.floor,wt=lt.test(wt=Object.getPrototypeOf)&&wt,Et=Y.hasOwnProperty,St=G.push,xt=Y.propertyIsEnumerable,Tt=Y.toString,Nt=lt.test(Nt= | ||
| p.bind)&&Nt,Ct=lt.test(Ct=Array.isArray)&&Ct,kt=e.isFinite,Lt=e.isNaN,At=lt.test(At=Object.keys)&&At,Ot=Math.max,Mt=Math.min,_t=Math.random,Dt="[object Arguments]",Pt="[object Array]",Ht="[object Boolean]",Bt="[object Date]",jt="[object Number]",Ft="[object Object]",It="[object RegExp]",qt="[object String]",Rt=!!e.attachEvent,Ut=Nt&&!/\n|true/.test(Nt+Rt),zt=Nt&&!Ut,Wt=At&&(Rt||Ut),Xt,Vt,$t=($t={0:1,length:1},G.splice.call($t,0,1),$t[0]),Jt=!0;(function(){function e(){this.x=1}var t=[];e.prototype= | ||
| {valueOf:1,y:1};for(var n in new e)t.push(n);for(n in arguments)Jt=!n;Xt=!/valueOf/.test(t),Vt="x"!=t[0]})(1);var Kt=arguments.constructor==Object,Qt=!v(arguments),Gt="xx"!="x"[0]+Object("x")[0];try{var Yt=("[object Object]",Tt.call(document)==Ft)}catch(Zt){}var en={"[object Function]":!1};en[Dt]=en[Pt]=en[Ht]=en[Bt]=en[jt]=en[Ft]=en[It]=en[qt]=!0;var tn={};tn[Pt]=Array,tn[Ht]=Boolean,tn[Bt]=Date,tn[Ft]=Object,tn[jt]=Number,tn[It]=RegExp,tn[qt]=String;var nn={"boolean":!1,"function":!0,object:!0, | ||
| number:!1,string:!1,"undefined":!1},rn={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};n.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:ht,variable:""};var sn={a:"o,v,g",k:"for(var a=1,b=typeof g=='number'?2:arguments.length;a<b;a++){if((l=arguments[a])){",g:"t[i]=l[i]",c:"}}"},on={a:"d,c,w",k:"c=c&&typeof w=='undefined'?c:e(c,w)",b:"if(c(l[i],i,d)===false)return t",g:"if(c(l[i],i,d)===false)return t"},un={b:null},an=a(on),fn=a(sn | ||
| );Qt&&(v=function(e){return e?Et.call(e,"callee"):!1});var ln=a(on,un,{l:!1}),cn=a(on,un),hn={"&":"&","<":"<",">":">",'"':""","'":"'"},pn=w(hn),dn=a(sn,{g:"if(t[i]==null)"+sn.g}),vn=Ct||function(e){return Kt&&e instanceof Array||Tt.call(e)==Pt};S(/x/)&&(S=function(e){return e instanceof Function||"[object Function]"==Tt.call(e)});var mn=wt?function(e){if(!e||typeof e!="object")return!1;var t=e.valueOf,n=typeof t=="function"&&(n=wt(t))&&wt(n);return n?e==n||wt(e)==n&&!v(e):m(e) | ||
| }:m,gn=At?function(e){return typeof e=="function"&&xt.call(e,"prototype")?g(e):x(e)?At(e):[]}:g;n.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},n.assign=fn,n.bind=X,n.bindAll=function(e){for(var t=arguments,n=1<t.length?0:(t=b(e),-1),r=t.length;++n<r;){var i=t[n];e[i]=X(e[i],e)}return e},n.bindKey=function(e,t){return o(e,t,p(arguments,2))},n.compact=function(e){for(var t=-1,n=e?e.length:0,r=[];++t<n;){var i=e[t];i&&r.push(i)}return r},n.compose=function( | ||
| ){var e=arguments;return function(){for(var t=arguments,n=e.length;n--;)t=[e[n].apply(this,t)];return t[0]}},n.countBy=function(e,t,n){var r={},t=u(t,n);return _(e,function(e,n,i){n=t(e,n,i),Et.call(r,n)?r[n]++:r[n]=1}),r},n.debounce=function(e,t,n){function r(){u=null,n||(s=e.apply(o,i))}var i,s,o,u;return function(){var a=n&&!u;return i=arguments,o=this,clearTimeout(u),u=setTimeout(r,t),a&&(s=e.apply(o,i)),s}},n.defaults=dn,n.defer=function(e){var n=p(arguments,1);return setTimeout(function(){e | ||
| .apply(t,n)},1)},n.delay=function(e,n){var r=p(arguments,2);return setTimeout(function(){e.apply(t,r)},n)},n.difference=function(e){for(var t=-1,n=e?e.length:0,i=yt.apply(G,arguments),i=r(i,n),s=[];++t<n;){var o=e[t];i(o)||s.push(o)}return s},n.filter=O,n.flatten=q,n.forEach=_,n.forIn=ln,n.forOwn=cn,n.functions=b,n.groupBy=function(e,t,n){var r={},t=u(t,n);return _(e,function(e,n,i){n=t(e,n,i),(Et.call(r,n)?r[n]:r[n]=[]).push(e)}),r},n.initial=function(e,t,n){if(!e)return[];var r=e.length;return p | ||
| (e,0,Mt(Ot(0,r-(null==t||n?1:t||0)),r))},n.intersection=function(e){var t=arguments,n=t.length,i={0:{}},s=-1,o=e?e.length:0,u=100<=o,a=[],f=a;e:for(;++s<o;){var l=e[s];if(u)var c=l+"",c=Et.call(i[0],c)?!(f=i[0][c]):f=i[0][c]=[];if(c||0>R(f,l)){u&&f.push(l);for(var h=n;--h;)if(!(i[h]||(i[h]=r(t[h],0,100)))(l))continue e;a.push(l)}}return a},n.invert=w,n.invoke=function(e,t){var n=p(arguments,2),r=typeof t=="function",i=[];return _(e,function(e){i.push((r?t:e[t]).apply(e,n))}),i},n.keys=gn,n.map=D, | ||
| n.max=P,n.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return Et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},n.merge=C,n.min=function(e,t,n){var r=Infinity,s=-1,o=e?e.length:0,a=r;if(t||!vn(e))t=!t&&N(e)?i:u(t,n),an(e,function(e,n,i){n=t(e,n,i),n<r&&(r=n,a=e)});else for(;++s<o;)e[s]<a&&(a=e[s]);return a},n.object=function(e,t){for(var n=-1,r=e?e.length:0,i={};++n<r;){var s=e[n];t?i[s]=t[n]:i[s[0]]=s[1]}return i},n.omit=function(e,t,n){var r=typeof | ||
| t=="function",i={};if(r)t=u(t,n);else var s=yt.apply(G,arguments);return ln(e,function(e,n,o){if(r?!t(e,n,o):0>R(s,n,1))i[n]=e}),i},n.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},n.pairs=function(e){var t=[];return cn(e,function(e,n){t.push([n,e])}),t},n.partial=function(e){return o(e,p(arguments,1))},n.pick=function(e,t,n){var r={};if(typeof t!="function")for(var i=0,s=yt.apply(G,arguments),o=s.length;++i<o;){var a=s[i];a in e&&(r[a]=e[a])} | ||
| else t=u(t,n),ln(e,function(e,n,i){t(e,n,i)&&(r[n]=e)});return r},n.pluck=H,n.range=function(e,t,n){e=+e||0,n=+n||1,null==t&&(t=e,e=0);for(var r=-1,t=Ot(0,gt((t-e)/n)),i=Array(t);++r<t;)i[r]=e,e+=n;return i},n.reject=function(e,t,n){return t=u(t,n),O(e,function(e,n,r){return!t(e,n,r)})},n.rest=U,n.shuffle=function(e){var t=-1,n=Array(e?e.length:0);return _(e,function(e){var r=bt(_t()*(++t+1));n[t]=n[r],n[r]=e}),n},n.sortBy=function(e,t,n){var r=[],t=u(t,n);_(e,function(e,n,i){r.push({a:t(e,n,i),b | ||
| :n,c:e})}),e=r.length;for(r.sort(s);e--;)r[e]=r[e].c;return r},n.tap=function(e,t){return t(e),e},n.throttle=function(e,t){function n(){u=new Date,o=null,i=e.apply(s,r)}var r,i,s,o,u=0;return function(){var a=new Date,f=t-(a-u);return r=arguments,s=this,0>=f?(clearTimeout(o),o=null,u=a,i=e.apply(s,r)):o||(o=setTimeout(n,f)),i}},n.times=function(e,t,n){for(var e=+e||0,r=-1,i=Array(e);++r<e;)i[r]=t.call(n,r);return i},n.toArray=function(e){return typeof (e?e.length:0)=="number"?Gt&&N(e)?e.split("") | ||
| :p(e):k(e)},n.union=function(){return W(yt.apply(G,arguments))},n.uniq=W,n.values=k,n.where=function(e,t){var n=gn(t);return O(e,function(e){for(var r=n.length;r--;){var i=e[n[r]]===t[n[r]];if(!i)break}return!!i})},n.without=function(e){for(var t=-1,n=e?e.length:0,i=r(arguments,1,20),s=[];++t<n;){var o=e[t];i(o)||s.push(o)}return s},n.wrap=function(e,t){return function(){var n=[e];return St.apply(n,arguments),t.apply(this,n)}},n.zip=function(e){for(var t=-1,n=e?P(H(arguments,"length")):0,r=Array( | ||
| n);++t<n;)r[t]=H(arguments,t);return r},n.collect=D,n.drop=U,n.each=_,n.extend=fn,n.methods=b,n.select=O,n.tail=U,n.unique=W,$(n),n.clone=y,n.cloneDeep=function(e){return y(e,!0)},n.contains=L,n.escape=function(e){return null==e?"":(e+"").replace(dt,l)},n.every=A,n.find=M,n.has=function(e,t){return e?Et.call(e,t):!1},n.identity=V,n.indexOf=R,n.isArguments=v,n.isArray=vn,n.isBoolean=function(e){return!0===e||!1===e||Tt.call(e)==Ht},n.isDate=function(e){return e instanceof Date||Tt.call(e)==Bt},n.isElement= | ||
| function(e){return e?1===e.nodeType:!1},n.isEmpty=function(e){var t=!0;if(!e)return t;var n=Tt.call(e),r=e.length;return n==Pt||n==qt||n==Dt||Qt&&v(e)||n==Ft&&typeof r=="number"&&S(e.splice)?!r:(cn(e,function(){return t=!1}),t)},n.isEqual=E,n.isFinite=function(e){return kt(e)&&!Lt(parseFloat(e))},n.isFunction=S,n.isNaN=function(e){return T(e)&&e!=+e},n.isNull=function(e){return null===e},n.isNumber=T,n.isObject=x,n.isPlainObject=mn,n.isRegExp=function(e){return e instanceof RegExp||Tt.call(e)==It | ||
| },n.isString=N,n.isUndefined=function(e){return typeof e=="undefined"},n.lastIndexOf=function(e,t,n){var r=e?e.length:0;for(typeof n=="number"&&(r=(0>n?Ot(0,r+n):Mt(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},n.mixin=$,n.noConflict=function(){return e._=nt,this},n.random=function(e,t){return null==e&&null==t&&(t=1),e=+e||0,null==t&&(t=e,e=0),e+bt(_t()*((+t||0)-e+1))},n.reduce=B,n.reduceRight=j,n.result=function(e,t){var n=e?e[t]:null;return S(n)?e[t]():n},n.size=function(e){var t=e?e.length:0; | ||
| return typeof t=="number"?t:gn(e).length},n.some=F,n.sortedIndex=z,n.template=function(e,t,r){e||(e=""),r||(r={});var i,s,o=n.templateSettings,u=0,a=r.interpolate||o.interpolate||pt,l="__p+='",c=r.variable||o.variable,h=c;e.replace(RegExp((r.escape||o.escape||pt).source+"|"+a.source+"|"+(a===ht?ct:pt).source+"|"+(r.evaluate||o.evaluate||pt).source+"|$","g"),function(t,n,r,s,o,a){return r||(r=s),l+=e.slice(u,a).replace(vt,f),n&&(l+="'+__e("+n+")+'"),o&&(l+="';"+o+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'" | ||
| ),i||(i=o||rt.test(n||r)),u=a+t.length,t}),l+="';\n",h||(c="obj",i?l="with("+c+"){"+l+"}":(r=RegExp("(\\(\\s*)"+c+"\\."+c+"\\b","g"),l=l.replace(ft,"$&"+c+".").replace(r,"$1__d"))),l=(i?l.replace(st,""):l).replace(ot,"$1").replace(ut,"$1;"),l="function("+c+"){"+(h?"":c+"||("+c+"={});")+"var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":(h?"":",__d="+c+"."+c+"||"+c)+";")+l+"return __p}";try{s=Function("_","return "+l)(n)}catch(p){throw p.source= | ||
| l,p}return t?s(t):(s.source=l,s)},n.unescape=function(e){return null==e?"":(e+"").replace(it,d)},n.uniqueId=function(e){return(null==e?"":e+"")+ ++Z},n.all=A,n.any=F,n.detect=M,n.foldl=B,n.foldr=j,n.include=L,n.inject=B,cn(n,function(e,t){n.prototype[t]||(n.prototype[t]=function(){var t=[this.__wrapped__];return St.apply(t,arguments),e.apply(n,t)})}),n.first=I,n.last=function(e,t,n){if(e){var r=e.length;return null==t||n?e[r-1]:p(e,Ot(0,r-t))}},n.take=I,n.head=I,cn(n,function(e,t){n.prototype[t]|| | ||
| (n.prototype[t]=function(t,r){var i=e(this.__wrapped__,t,r);return null==t||r?i:new n(i)})}),n.VERSION="1.0.0-rc.3",n.prototype.toString=function(){return this.__wrapped__+""},n.prototype.value=J,n.prototype.valueOf=J,an(["join","pop","shift"],function(e){var t=G[e];n.prototype[e]=function(){return t.apply(this.__wrapped__,arguments)}}),an(["push","reverse","sort","unshift"],function(e){var t=G[e];n.prototype[e]=function(){return t.apply(this.__wrapped__,arguments),this}}),an(["concat","slice","splice" | ||
| ],function(e){var t=G[e];n.prototype[e]=function(){var e=t.apply(this.__wrapped__,arguments);return new n(e)}}),$t&&an(["pop","shift","splice"],function(e){var t=G[e],r="splice"==e;n.prototype[e]=function(){var e=this.__wrapped__,i=t.apply(e,arguments);return 0===e.length&&delete e[0],r?new n(i):i}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(e._=n,define(function(){return n})):K?typeof module=="object"&&module&&module.exports==K?(module.exports=n)._=n:K._=n:e._=n})(this); |
| (function(){var e,t,n,r,i=[].slice,s={}.hasOwnProperty,o=function(e,t){function r(){this.constructor=e}for(var n in t)s.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e},u=function(e,t){return function(){return e.apply(t,arguments)}},a=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};t=window.Morris={},e=jQuery,t.EventEmitter=function(){function e(){}return e.prototype.on=function(e,t){return this.handlers==null&&(this.handlers={}),this.handlers[e]==null&&(this.handlers[e]=[]),this.handlers[e].push(t)},e.prototype.fire=function(){var e,t,n,r,s,o,u;n=arguments[0],e=2<=arguments.length?i.call(arguments,1):[];if(this.handlers!=null&&this.handlers[n]!=null){o=this.handlers[n],u=[];for(r=0,s=o.length;r<s;r++)t=o[r],u.push(t.apply(null,e));return u}},e}(),t.commas=function(e){var t,n,r,i;return e!=null?(r=e<0?"-":"",t=Math.abs(e),n=Math.floor(t).toFixed(0),r+=n.replace(/(?=(?:\d{3})+$)(?!^)/g,","),i=t.toString(),i.length>n.length&&(r+=i.slice(n.length)),r):"-"},t.pad2=function(e){return(e<10?"0":"")+e},t.Grid=function(n){function r(t){typeof t.element=="string"?this.el=e(document.getElementById(t.element)):this.el=e(t.element);if(this.el==null||this.el.length===0)throw new Error("Graph container element not found");this.options=e.extend({},this.gridDefaults,this.defaults||{},t);if(this.options.data===void 0||this.options.data.length===0)return;typeof this.options.units=="string"&&(this.options.postUnits=t.units),this.r=new Raphael(this.el[0]),this.elementWidth=null,this.elementHeight=null,this.dirty=!1,this.init&&this.init(),this.setData(this.options.data)}return o(r,n),r.prototype.gridDefaults={dateFormat:null,gridLineColor:"#aaa",gridStrokeWidth:.5,gridTextColor:"#888",gridTextSize:12,numLines:5,padding:25,parseTime:!0,postUnits:"",preUnits:"",ymax:"auto",ymin:"auto 0",goals:[],goalStrokeWidth:1,goalLineColors:["#666633","#999966","#cc6666","#663333"],events:[],eventStrokeWidth:1,eventLineColors:["#005a04","#ccffbb","#3a5f0b","#005502"]},r.prototype.setData=function(e,n){var r,i,s,o,u,a,f,l,c,h,p,d;n==null&&(n=!0),h=this.cumulative?0:null,p=this.cumulative?0:null,this.options.goals.length>0&&(u=Math.min.apply(null,this.options.goals),o=Math.max.apply(null,this.options.goals),p=p!=null?Math.min(p,u):u,h=h!=null?Math.max(h,o):o),this.data=function(){var n,r,o;o=[];for(s=n=0,r=e.length;n<r;s=++n)f=e[s],a={},a.label=f[this.options.xkey],this.options.parseTime?(a.x=t.parseDate(a.label),this.options.dateFormat?a.label=this.options.dateFormat(a.x):typeof a.label=="number"&&(a.label=(new Date(a.label)).toString())):a.x=s,l=0,a.y=function(){var e,t,n,r;n=this.options.ykeys,r=[];for(i=e=0,t=n.length;e<t;i=++e)c=n[i],d=f[c],typeof d=="string"&&(d=parseFloat(d)),d!=null&&typeof d!="number"&&(d=null),d!=null&&(this.cumulative?l+=d:h!=null?(h=Math.max(d,h),p=Math.min(d,p)):h=p=d),this.cumulative&&l!=null&&(h=Math.max(l,h),p=Math.min(l,p)),r.push(d);return r}.call(this),o.push(a);return o}.call(this),this.options.parseTime&&(this.data=this.data.sort(function(e,t){return(e.x>t.x)-(t.x>e.x)})),this.xmin=this.data[0].x,this.xmax=this.data[this.data.length-1].x,this.events=[],this.options.parseTime&&this.options.events.length>0&&(this.events=function(){var e,n,i,s;i=this.options.events,s=[];for(e=0,n=i.length;e<n;e++)r=i[e],s.push(t.parseDate(r));return s}.call(this),this.xmax=Math.max(this.xmax,Math.max.apply(null,this.events)),this.xmin=Math.min(this.xmin,Math.min.apply(null,this.events))),this.xmin===this.xmax&&(this.xmin-=1,this.xmax+=1),typeof this.options.ymax=="string"?this.options.ymax.slice(0,4)==="auto"?this.options.ymax.length>5?(this.ymax=parseInt(this.options.ymax.slice(5),10),h!=null&&(this.ymax=Math.max(h,this.ymax))):this.ymax=h!=null?h:0:this.ymax=parseInt(this.options.ymax,10):this.ymax=this.options.ymax,typeof this.options.ymin=="string"?this.options.ymin.slice(0,4)==="auto"?this.options.ymin.length>5?(this.ymin=parseInt(this.options.ymin.slice(5),10),p!=null&&(this.ymin=Math.min(p,this.ymin))):this.ymin=p!==null?p:0:this.ymin=parseInt(this.options.ymin,10):this.ymin=this.options.ymin,this.ymin===this.ymax&&(p&&(this.ymin-=1),this.ymax+=1),this.yInterval=(this.ymax-this.ymin)/(this.options.numLines-1),this.yInterval>0&&this.yInterval<1?this.precision=-Math.floor(Math.log(this.yInterval)/Math.log(10)):this.precision=0,this.dirty=!0;if(n)return this.redraw()},r.prototype._calc=function(){var e,t,n;n=this.el.width(),e=this.el.height();if(this.elementWidth!==n||this.elementHeight!==e||this.dirty){this.elementWidth=n,this.elementHeight=e,this.dirty=!1,t=Math.max(this.measureText(this.yAxisFormat(this.ymin),this.options.gridTextSize).width,this.measureText(this.yAxisFormat(this.ymax),this.options.gridTextSize).width),this.left=t+this.options.padding,this.right=this.elementWidth-this.options.padding,this.top=this.options.padding,this.bottom=this.elementHeight-this.options.padding-1.5*this.options.gridTextSize,this.width=this.right-this.left,this.height=this.bottom-this.top,this.dx=this.width/(this.xmax-this.xmin),this.dy=this.height/(this.ymax-this.ymin);if(this.calc)return this.calc()}},r.prototype.transY=function(e){return this.bottom-(e-this.ymin)*this.dy},r.prototype.transX=function(e){return this.data.length===1?(this.left+this.right)/2:this.left+(e-this.xmin)*this.dx},r.prototype.redraw=function(){this.r.clear(),this._calc(),this.drawGrid(),this.drawGoals(),this.drawEvents();if(this.draw)return this.draw()},r.prototype.drawGoals=function(){var e,t,n,r,i,s;i=this.options.goals,s=[];for(t=n=0,r=i.length;n<r;t=++n)e=i[t],s.push(this.r.path("M"+this.left+","+this.transY(e)+"H"+(this.left+this.width)).attr("stroke",this.options.goalLineColors[t%this.options.goalLineColors.length]).attr("stroke-width",this.options.goalStrokeWidth));return s},r.prototype.drawEvents=function(){var e,t,n,r,i,s;i=this.events,s=[];for(t=n=0,r=i.length;n<r;t=++n)e=i[t],s.push(this.r.path("M"+this.transX(e)+","+this.bottom+"V"+this.top).attr("stroke",this.options.eventLineColors[t%this.options.eventLineColors.length]).attr("stroke-width",this.options.eventStrokeWidth));return s},r.prototype.drawGrid=function(){var e,t,n,r,i,s,o,u;e=this.ymin,t=this.ymax,u=[];for(n=s=e,o=this.yInterval;e<=t?s<=t:s>=t;n=s+=o)r=parseFloat(n.toFixed(this.precision)),i=this.transY(r),this.r.text(this.left-this.options.padding/2,i,this.yAxisFormat(r)).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor).attr("text-anchor","end"),u.push(this.r.path("M"+this.left+","+i+"H"+(this.left+this.width)).attr("stroke",this.options.gridLineColor).attr("stroke-width",this.options.gridStrokeWidth));return u},r.prototype.measureText=function(e,t){var n,r;return t==null&&(t=12),r=this.r.text(100,100,e).attr("font-size",t),n=r.getBBox(),r.remove(),n},r.prototype.yAxisFormat=function(e){return this.yLabelFormat(e)},r.prototype.yLabelFormat=function(e){return""+this.options.preUnits+t.commas(e)+this.options.postUnits},r}(t.EventEmitter),t.parseDate=function(e){var t,n,r,i,s,o,u,a,f,l,c;return typeof e=="number"?e:(n=e.match(/^(\d+) Q(\d)$/),i=e.match(/^(\d+)-(\d+)$/),s=e.match(/^(\d+)-(\d+)-(\d+)$/),u=e.match(/^(\d+) W(\d+)$/),a=e.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+)(Z|([+-])(\d\d):?(\d\d))?$/),f=e.match(/^(\d+)-(\d+)-(\d+)[ T](\d+):(\d+):(\d+(\.\d+)?)(Z|([+-])(\d\d):?(\d\d))?$/),n?(new Date(parseInt(n[1],10),parseInt(n[2],10)*3-1,1)).getTime():i?(new Date(parseInt(i[1],10),parseInt(i[2],10)-1,1)).getTime():s?(new Date(parseInt(s[1],10),parseInt(s[2],10)-1,parseInt(s[3],10))).getTime():u?(l=new Date(parseInt(u[1],10),0,1),l.getDay()!==4&&l.setMonth(0,1+(4-l.getDay()+7)%7),l.getTime()+parseInt(u[2],10)*6048e5):a?a[6]?(o=0,a[6]!=="Z"&&(o=parseInt(a[8],10)*60+parseInt(a[9],10),a[7]==="+"&&(o=0-o)),Date.UTC(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10)+o)):(new Date(parseInt(a[1],10),parseInt(a[2],10)-1,parseInt(a[3],10),parseInt(a[4],10),parseInt(a[5],10))).getTime():f?(c=parseFloat(f[6]),t=Math.floor(c),r=Math.round((c-t)*1e3),f[8]?(o=0,f[8]!=="Z"&&(o=parseInt(f[10],10)*60+parseInt(f[11],10),f[9]==="+"&&(o=0-o)),Date.UTC(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10)+o,t,r)):(new Date(parseInt(f[1],10),parseInt(f[2],10)-1,parseInt(f[3],10),parseInt(f[4],10),parseInt(f[5],10),t,r)).getTime()):(new Date(parseInt(e,10),0,1)).getTime())},t.Line=function(e){function n(e){this.updateHilight=u(this.updateHilight,this),this.hilight=u(this.hilight,this),this.updateHover=u(this.updateHover,this);if(!(this instanceof t.Line))return new t.Line(e);n.__super__.constructor.call(this,e)}return o(n,e),n.prototype.init=function(){var e,t=this;return this.pointGrow=Raphael.animation({r:this.options.pointSize+3},25,"linear"),this.pointShrink=Raphael.animation({r:this.options.pointSize},25,"linear"),this.prevHilight=null,this.el.mousemove(function(e){return t.updateHilight(e.pageX)}),this.options.hideHover&&this.el.mouseout(function(e){return t.hilight(null)}),e=function(e){var n;return n=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],t.updateHilight(n.pageX),n},this.el.bind("touchstart",e),this.el.bind("touchmove",e),this.el.bind("touchend",e),this.el.bind("click",function(e){if(t.prevHilight!==null)return t.fire("click",t.prevHilight,t.data[t.prevHilight])})},n.prototype.defaults={lineWidth:3,pointSize:4,lineColors:["#0b62a4","#7A92A3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],pointWidths:[1],pointStrokeColors:["#ffffff"],pointFillColors:[],hoverPaddingX:10,hoverPaddingY:5,hoverMargin:10,hoverFillColor:"#fff",hoverBorderColor:"#ccc",hoverBorderWidth:2,hoverOpacity:.95,hoverLabelColor:"#444",hoverFontSize:12,smooth:!0,hideHover:!1,xLabels:"auto",xLabelFormat:null,continuousLine:!0},n.prototype.calc=function(){return this.calcPoints(),this.generatePaths(),this.calcHoverMargins()},n.prototype.calcPoints=function(){var e,t,n,r,i,s;i=this.data,s=[];for(n=0,r=i.length;n<r;n++)e=i[n],e._x=this.transX(e.x),s.push(e._y=function(){var n,r,i,s;i=e.y,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],t!=null?s.push(this.transY(t)):s.push(t);return s}.call(this));return s},n.prototype.calcHoverMargins=function(){var e,t;return this.hoverMargins=function(){var n,r,i,s;i=this.data.slice(1),s=[];for(e=n=0,r=i.length;n<r;e=++n)t=i[e],s.push((t._x+this.data[e]._x)/2);return s}.call(this)},n.prototype.generatePaths=function(){var e,n,r,i,s;return this.paths=function(){var o,u,f,l;l=[];for(r=o=0,u=this.options.ykeys.length;0<=u?o<u:o>u;r=0<=u?++o:--o)s=this.options.smooth===!0||(f=this.options.ykeys[r],a.call(this.options.smooth,f)>=0),n=function(){var e,t,n,s;n=this.data,s=[];for(e=0,t=n.length;e<t;e++)i=n[e],i._y[r]!==void 0&&s.push({x:i._x,y:i._y[r]});return s}.call(this),this.options.continuousLine&&(n=function(){var t,r,i;i=[];for(t=0,r=n.length;t<r;t++)e=n[t],e.y!==null&&i.push(e);return i}()),n.length>1?l.push(t.Line.createPath(n,s,this.bottom)):l.push(null);return l}.call(this)},n.prototype.draw=function(){return this.drawXAxis(),this.drawSeries(),this.drawHover(),this.hilight(this.options.hideHover?null:this.data.length-1)},n.prototype.drawXAxis=function(){var e,n,r,i,s,o,u,a,f,l,c=this;u=this.bottom+this.options.gridTextSize*1.25,o=50,i=null,e=function(e,t){var n,r;return n=c.r.text(c.transX(t),u,e).attr("font-size",c.options.gridTextSize).attr("fill",c.options.gridTextColor),r=n.getBBox(),(i==null||i>=r.x+r.width)&&r.x>=0&&r.x+r.width<c.el.width()?i=r.x-o:n.remove()},this.options.parseTime?this.data.length===1&&this.options.xLabels==="auto"?r=[[this.data[0].label,this.data[0].x]]:r=t.labelSeries(this.xmin,this.xmax,this.width,this.options.xLabels,this.options.xLabelFormat):r=function(){var e,t,n,r;n=this.data,r=[];for(e=0,t=n.length;e<t;e++)s=n[e],r.push([s.label,s.x]);return r}.call(this),r.reverse(),l=[];for(a=0,f=r.length;a<f;a++)n=r[a],l.push(e(n[0],n[1]));return l},n.prototype.drawSeries=function(){var e,t,n,r,i,s,o,u,a;for(t=i=o=this.options.ykeys.length-1;o<=0?i<=0:i>=0;t=o<=0?++i:--i)n=this.paths[t],n!==null&&this.r.path(n).attr("stroke",this.colorForSeries(t)).attr("stroke-width",this.options.lineWidth);this.seriesPoints=function(){var e,n,r;r=[];for(t=e=0,n=this.options.ykeys.length;0<=n?e<n:e>n;t=0<=n?++e:--e)r.push([]);return r}.call(this),a=[];for(t=s=u=this.options.ykeys.length-1;u<=0?s<=0:s>=0;t=u<=0?++s:--s)a.push(function(){var n,i,s,o;s=this.data,o=[];for(n=0,i=s.length;n<i;n++)r=s[n],r._y[t]!=null?e=this.r.circle(r._x,r._y[t],this.options.pointSize).attr("fill",this.pointFillColorForSeries(t)||this.colorForSeries(t)).attr("stroke-width",this.strokeWidthForSeries(t)).attr("stroke",this.strokeForSeries(t)):e=null,o.push(this.seriesPoints[t].push(e));return o}.call(this));return a},n.createPath=function(e,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g;l="",n&&(o=t.Line.gradients(e)),c={y:null};for(u=m=0,g=e.length;m<g;u=++m){i=e[u];if(i.y!=null)if(c.y!=null)n?(s=o[u],f=o[u-1],a=(i.x-c.x)/4,h=c.x+a,d=Math.min(r,c.y+a*f),p=i.x-a,v=Math.min(r,i.y-a*s),l+="C"+h+","+d+","+p+","+v+","+i.x+","+i.y):l+="L"+i.x+","+i.y;else if(!n||o[u]!=null)l+="M"+i.x+","+i.y;c=i}return l},n.gradients=function(e){var t,n,r,i,s,o,u,a;n=function(e,t){return(e.y-t.y)/(e.x-t.x)},a=[];for(r=o=0,u=e.length;o<u;r=++o)t=e[r],t.y!=null?(i=e[r+1]||{y:null},s=e[r-1]||{y:null},s.y!=null&&i.y!=null?a.push(n(s,i)):s.y!=null?a.push(n(s,t)):i.y!=null?a.push(n(t,i)):a.push(null)):a.push(null);return a},n.prototype.drawHover=function(){var e,t,n,r,i,s;this.hoverHeight=this.options.hoverFontSize*1.5*(this.options.ykeys.length+1),this.hover=this.r.rect(-10,-this.hoverHeight/2-this.options.hoverPaddingY,20,this.hoverHeight+this.options.hoverPaddingY*2,10).attr("fill",this.options.hoverFillColor).attr("stroke",this.options.hoverBorderColor).attr("stroke-width",this.options.hoverBorderWidth).attr("opacity",this.options.hoverOpacity),this.xLabel=this.r.text(0,this.options.hoverFontSize*.75-this.hoverHeight/2,"").attr("fill",this.options.hoverLabelColor).attr("font-weight","bold").attr("font-size",this.options.hoverFontSize),this.hoverSet=this.r.set(),this.hoverSet.push(this.hover),this.hoverSet.push(this.xLabel),this.yLabels=[],s=[];for(e=r=0,i=this.options.ykeys.length;0<=i?r<i:r>i;e=0<=i?++r:--r)t=this.cumulative?this.options.ykeys.length-e-1:e,n=this.r.text(0,this.options.hoverFontSize*1.5*(t+1.5)-this.hoverHeight/2,"").attr("fill",this.colorForSeries(e)).attr("font-size",this.options.hoverFontSize),this.yLabels.push(n),s.push(this.hoverSet.push(n));return s},n.prototype.updateHover=function(e){var t,n,r,i,s,o,u,a,f,l;this.hoverSet.show(),i=this.data[e],this.xLabel.attr("text",i.label),l=i.y;for(t=a=0,f=l.length;a<f;t=++a)o=l[t],this.yLabels[t].attr("text",""+this.options.labels[t]+": "+this.yLabelFormat(o));return r=Math.max.apply(null,function(){var e,t,r,i;r=this.yLabels,i=[];for(e=0,t=r.length;e<t;e++)n=r[e],i.push(n.getBBox().width);return i}.call(this)),r=Math.max(r,this.xLabel.getBBox().width),this.hover.attr("width",r+this.options.hoverPaddingX*2),this.hover.attr("x",-this.options.hoverPaddingX-r/2),u=Math.min.apply(null,function(){var e,t,n,r;n=i._y,r=[];for(e=0,t=n.length;e<t;e++)o=n[e],o!=null&&r.push(o);return r}().concat(this.bottom)),u>this.hoverHeight+this.options.hoverPaddingY*2+this.options.hoverMargin+this.top?u=u-this.hoverHeight/2-this.options.hoverPaddingY-this.options.hoverMargin:u=u+this.hoverHeight/2+this.options.hoverPaddingY+this.options.hoverMargin,u=Math.max(this.top+this.hoverHeight/2+this.options.hoverPaddingY,u),u=Math.min(this.bottom-this.hoverHeight/2-this.options.hoverPaddingY,u),s=Math.min(this.right-r/2-this.options.hoverPaddingX,this.data[e]._x),s=Math.max(this.left+r/2+this.options.hoverPaddingX,s),this.hoverSet.attr("transform","t"+s+","+u)},n.prototype.hideHover=function(){return this.hoverSet.hide()},n.prototype.hilight=function(e){var t,n,r,i,s;if(this.prevHilight!==null&&this.prevHilight!==e)for(t=n=0,i=this.seriesPoints.length-1;0<=i?n<=i:n>=i;t=0<=i?++n:--n)this.seriesPoints[t][this.prevHilight]&&this.seriesPoints[t][this.prevHilight].animate(this.pointShrink);if(e!==null&&this.prevHilight!==e){for(t=r=0,s=this.seriesPoints.length-1;0<=s?r<=s:r>=s;t=0<=s?++r:--r)this.seriesPoints[t][e]&&this.seriesPoints[t][e].animate(this.pointGrow);this.updateHover(e)}this.prevHilight=e;if(e==null)return this.hideHover()},n.prototype.updateHilight=function(e){var t,n,r;e-=this.el.offset().left;for(t=n=0,r=this.hoverMargins.length;0<=r?n<r:n>r;t=0<=r?++n:--n)if(this.hoverMargins[t]>e)break;return this.hilight(t)},n.prototype.colorForSeries=function(e){return this.options.lineColors[e%this.options.lineColors.length]},n.prototype.strokeWidthForSeries=function(e){return this.options.pointWidths[e%this.options.pointWidths.length]},n.prototype.strokeForSeries=function(e){return this.options.pointStrokeColors[e%this.options.pointStrokeColors.length]},n.prototype.pointFillColorForSeries=function(e){return this.options.pointFillColors[e%this.options.pointFillColors.length]},n}(t.Grid),t.labelSeries=function(n,r,i,s,o){var u,a,f,l,c,h,p,d,v,m,g;f=200*(r-n)/i,a=new Date(n),p=t.LABEL_SPECS[s];if(p===void 0){g=t.AUTO_LABEL_ORDER;for(v=0,m=g.length;v<m;v++){l=g[v],h=t.LABEL_SPECS[l];if(f>=h.span){p=h;break}}}p===void 0&&(p=t.LABEL_SPECS.second),o&&(p=e.extend({},p,{fmt:o})),u=p.start(a),c=[];while((d=u.getTime())<=r)d>=n&&c.push([p.fmt(u),d]),p.incr(u);return c},n=function(e){return{span:e*60*1e3,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours())},fmt:function(e){return""+t.pad2(e.getHours())+":"+t.pad2(e.getMinutes())},incr:function(t){return t.setMinutes(t.getMinutes()+e)}}},r=function(e){return{span:e*1e3,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes())},fmt:function(e){return""+t.pad2(e.getHours())+":"+t.pad2(e.getMinutes())+":"+t.pad2(e.getSeconds())},incr:function(t){return t.setSeconds(t.getSeconds()+e)}}},t.LABEL_SPECS={decade:{span:1728e8,start:function(e){return new Date(e.getFullYear()-e.getFullYear()%10,0,1)},fmt:function(e){return""+e.getFullYear()},incr:function(e){return e.setFullYear(e.getFullYear()+10)}},year:{span:1728e7,start:function(e){return new Date(e.getFullYear(),0,1)},fmt:function(e){return""+e.getFullYear()},incr:function(e){return e.setFullYear(e.getFullYear()+1)}},month:{span:24192e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),1)},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)},incr:function(e){return e.setMonth(e.getMonth()+1)}},day:{span:864e5,start:function(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())},fmt:function(e){return""+e.getFullYear()+"-"+t.pad2(e.getMonth()+1)+"-"+t.pad2(e.getDate())},incr:function(e){return e.setDate(e.getDate()+1)}},hour:n(60),"30min":n(30),"15min":n(15),"10min":n(10),"5min":n(5),minute:n(1),"30sec":r(30),"15sec":r(15),"10sec":r(10),"5sec":r(5),second:r(1)},t.AUTO_LABEL_ORDER=["decade","year","month","day","hour","30min","15min","10min","5min","minute","30sec","15sec","10sec","5sec","second"],t.Area=function(e){function n(e){if(!(this instanceof t.Area))return new t.Area(e);this.cumulative=!0,n.__super__.constructor.call(this,e)}return o(n,e),n.prototype.calcPoints=function(){var e,t,n,r,i,s,o;s=this.data,o=[];for(r=0,i=s.length;r<i;r++)e=s[r],e._x=this.transX(e.x),t=0,o.push(e._y=function(){var r,i,s,o;s=e.y,o=[];for(r=0,i=s.length;r<i;r++)n=s[r],t+=n||0,o.push(this.transY(t));return o}.call(this));return o},n.prototype.drawSeries=function(){var e,t,r,i;for(e=r=i=this.options.ykeys.length-1;i<=0?r<=0:r>=0;e=i<=0?++r:--r)t=this.paths[e],t!==null&&(t+="L"+this.transX(this.xmax)+","+this.bottom+"L"+this.transX(this.xmin)+","+this.bottom+"Z",this.r.path(t).attr("fill",this.fillForSeries(e)).attr("stroke-width",0));return n.__super__.drawSeries.call(this)},n.prototype.fillForSeries=function(e){var t;return t=Raphael.rgb2hsl(this.colorForSeries(e)),Raphael.hsl(t.h,Math.min(255,t.s*.75),Math.min(255,t.l*1.25))},n}(t.Line),t.Bar=function(n){function r(n){this.updateHilight=u(this.updateHilight,this),this.hilight=u(this.hilight,this),this.updateHover=u(this.updateHover,this);if(!(this instanceof t.Bar))return new t.Bar(n);r.__super__.constructor.call(this,e.extend({},n,{parseTime:!1}))}return o(r,n),r.prototype.init=function(){var e,t=this;return this.cumulative=this.options.stacked,this.prevHilight=null,this.el.mousemove(function(e){return t.updateHilight(e.pageX)}),this.options.hideHover&&this.el.mouseout(function(e){return t.hilight(null)}),e=function(e){var n;return n=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],t.updateHilight(n.pageX),n},this.el.bind("touchstart",e),this.el.bind("touchmove",e),this.el.bind("touchend",e),this.el.bind("click",function(e){if(t.prevHilight!==null)return t.fire("click",t.prevHilight,t.data[t.prevHilight])})},r.prototype.defaults={barSizeRatio:.75,barGap:3,barColors:["#0b62a4","#7a92a3","#4da74d","#afd8f8","#edc240","#cb4b4b","#9440ed"],hoverPaddingX:10,hoverPaddingY:5,hoverMargin:10,hoverFillColor:"#fff",hoverBorderColor:"#ccc",hoverBorderWidth:2,hoverOpacity:.95,hoverLabelColor:"#444",hoverFontSize:12,hideHover:!1},r.prototype.calc=function(){return this.calcBars(),this.calcHoverMargins()},r.prototype.calcBars=function(){var e,t,n,r,i,s,o;s=this.data,o=[];for(e=r=0,i=s.length;r<i;e=++r)t=s[e],t._x=this.left+this.width*(e+.5)/this.data.length,o.push(t._y=function(){var e,r,i,s;i=t.y,s=[];for(e=0,r=i.length;e<r;e++)n=i[e],n!=null?s.push(this.transY(n)):s.push(null);return s}.call(this));return o},r.prototype.calcHoverMargins=function(){var e;return this.hoverMargins=function(){var t,n,r;r=[];for(e=t=1,n=this.data.length;1<=n?t<n:t>n;e=1<=n?++t:--t)r.push(this.left+e*this.width/this.data.length);return r}.call(this)},r.prototype.draw=function(){return this.drawXAxis(),this.drawSeries(),this.drawHover(),this.hilight(this.options.hideHover?null:this.data.length-1)},r.prototype.drawXAxis=function(){var e,t,n,r,i,s,o,u,a,f;o=this.bottom+this.options.gridTextSize*1.25,s=50,r=null,f=[];for(e=u=0,a=this.data.length;0<=a?u<a:u>a;e=0<=a?++u:--u)i=this.data[this.data.length-1-e],t=this.r.text(i._x,o,i.label).attr("font-size",this.options.gridTextSize).attr("fill",this.options.gridTextColor),n=t.getBBox(),(r==null||r>=n.x+n.width)&&n.x>=0&&n.x+n.width<this.el.width()?f.push(r=n.x-s):f.push(t.remove());return f},r.prototype.drawSeries=function(){var e,t,n,r,i,s,o,u,a,f,l,c,h,p;return n=this.width/this.options.data.length,u=this.options.stacked!=null?1:this.options.ykeys.length,e=(n*this.options.barSizeRatio-this.options.barGap*(u-1))/u,o=n*(1-this.options.barSizeRatio)/2,p=this.ymin<=0&&this.ymax>=0?this.transY(0):null,this.bars=function(){var u,d,v,m;v=this.data,m=[];for(r=u=0,d=v.length;u<d;r=++u)a=v[r],i=0,m.push(function(){var u,d,v,m;v=a._y,m=[];for(f=u=0,d=v.length;u<d;f=++u)h=v[f],h!==null?(p?(c=Math.min(h,p),t=Math.max(h,p)):(c=h,t=this.bottom),s=this.left+r*n+o,this.options.stacked||(s+=f*(e+this.options.barGap)),l=t-c,this.options.stacked&&(c-=i),this.r.rect(s,c,e,l).attr("fill",this.colorFor(a,f,"bar")).attr("stroke-width",0),m.push(i+=l)):m.push(null);return m}.call(this));return m}.call(this)},r.prototype.drawHover=function(){var e,t,n,r,i;this.hoverHeight=this.options.hoverFontSize*1.5*(this.options.ykeys.length+1),this.hover=this.r.rect(-10,-this.hoverHeight/2-this.options.hoverPaddingY,20,this.hoverHeight+this.options.hoverPaddingY*2,10).attr("fill",this.options.hoverFillColor).attr("stroke",this.options.hoverBorderColor).attr("stroke-width",this.options.hoverBorderWidth).attr("opacity",this.options.hoverOpacity),this.xLabel=this.r.text(0,this.options.hoverFontSize*.75-this.hoverHeight/2,"").attr("fill",this.options.hoverLabelColor).attr("font-weight","bold").attr("font-size",this.options.hoverFontSize),this.hoverSet=this.r.set(),this.hoverSet.push(this.hover),this.hoverSet.push(this.xLabel),this.yLabels=[],i=[];for(e=n=0,r=this.options.ykeys.length;0<=r?n<r:n>r;e=0<=r?++n:--n)t=this.r.text(0,this.options.hoverFontSize*1.5*(e+1.5)-this.hoverHeight/2,"").attr("font-size",this.options.hoverFontSize),this.yLabels.push(t),i.push(this.hoverSet.push(t));return i},r.prototype.updateHover=function(e){var t,n,r,i,s,o,u,a,f,l;this.hoverSet.show(),i=this.data[e],this.xLabel.attr("text",i.label),l=i.y;for(t=a=0,f=l.length;a<f;t=++a)o=l[t],this.yLabels[t].attr("fill",this.colorFor(i,t,"hover")),this.yLabels[t].attr("text",""+this.options.labels[t]+": "+this.yLabelFormat(o));return r=Math.max.apply(null,function(){var e,t,r,i;r=this.yLabels,i=[];for(e=0,t=r.length;e<t;e++)n=r[e],i.push(n.getBBox().width);return i}.call(this)),r=Math.max(r,this.xLabel.getBBox().width),this.hover.attr("width",r+this.options.hoverPaddingX*2),this.hover.attr("x",-this.options.hoverPaddingX-r/2),u=(this.bottom+this.top)/2,s=Math.min(this.right-r/2-this.options.hoverPaddingX,this.data[e]._x),s=Math.max(this.left+r/2+this.options.hoverPaddingX,s),this.hoverSet.attr("transform","t"+s+","+u)},r.prototype.hideHover=function(){return this.hoverSet.hide()},r.prototype.hilight=function(e){e!==null&&this.prevHilight!==e&&this.updateHover(e),this.prevHilight=e;if(e==null)return this.hideHover()},r.prototype.updateHilight=function(e){var t,n,r;e-=this.el.offset().left;for(t=n=0,r=this.hoverMargins.length;0<=r?n<r:n>r;t=0<=r?++n:--n)if(this.hoverMargins[t]>e)break;return this.hilight(t)},r.prototype.colorFor=function(e,t,n){var r,i;return typeof this.options.barColors=="function"?(r={x:e.x,y:e.y[t],label:e.label},i={index:t,key:this.options.ykeys[t],label:this.options.labels[t]},this.options.barColors.call(this,r,i,n)):this.options.barColors[t%this.options.barColors.length]},r}(t.Grid),t.Donut=function(n){function r(n){this.click=u(this.click,this),this.select=u(this.select,this);if(!(this instanceof t.Donut))return new t.Donut(n);typeof n.element=="string"?this.el=e(document.getElementById(n.element)):this.el=e(n.element),this.options=e.extend({},this.defaults,n);if(this.el===null||this.el.length===0)throw new Error("Graph placeholder not found.");if(n.data===void 0||n.data.length===0)return;this.data=n.data,this.redraw()}return o(r,n),r.prototype.defaults={colors:["#0B62A4","#3980B5","#679DC6","#95BBD7","#B0CCE1","#095791","#095085","#083E67","#052C48","#042135"],formatter:t.commas},r.prototype.redraw=function(){var e,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T;this.el.empty(),this.r=new Raphael(this.el[0]),n=this.el.width()/2,r=this.el.height()/2,p=(Math.min(n,r)-10)/3,h=0,E=this.data;for(v=0,y=E.length;v<y;v++)d=E[v],h+=d.value;f=5/(2*p),e=1.9999*Math.PI-f*this.data.length,u=0,o=0,this.segments=[],S=this.data;for(s=m=0,b=S.length;m<b;s=++m)i=S[s],l=u+f+e*(i.value/h),c=new t.DonutSegment(n,r,p*2,p,u,l,this.options.colors[o%this.options.colors.length],i,s),c.render(this.r),this.segments.push(c),c.on("hover",this.select),c.on("click",this.click),u=l,o+=1;this.text1=this.r.text(n,r-10,"").attr({"font-size":15,"font-weight":800}),this.text2=this.r.text(n,r+10,"").attr({"font-size":14}),a=Math.max.apply(null,function(){var e,t,n,r;n=this.data,r=[];for(e=0,t=n.length;e<t;e++)i=n[e],r.push(i.value);return r}.call(this)),o=0,x=this.data,T=[];for(g=0,w=x.length;g<w;g++){i=x[g];if(i.value===a){this.select(o);break}T.push(o+=1)}return T},r.prototype.select=function(e){var t,n,r,i,s;s=this.segments;for(r=0,i=s.length;r<i;r++)t=s[r],t.deselect();return typeof e=="number"?n=this.segments[e]:n=e,n.select(),this.setLabels(n.data.label,this.options.formatter(n.data.value,n.data))},r.prototype.click=function(e,t){return this.fire("click",e,t)},r.prototype.setLabels=function(e,t){var n,r,i,s,o,u,a,f;return n=(Math.min(this.el.width()/2,this.el.height()/2)-10)*2/3,s=1.8*n,i=n/2,r=n/3,this.text1.attr({text:e,transform:""}),o=this.text1.getBBox(),u=Math.min(s/o.width,i/o.height),this.text1.attr({transform:"S"+u+","+u+","+(o.x+o.width/2)+","+(o.y+o.height)}),this.text2.attr({text:t,transform:""}),a=this.text2.getBBox(),f=Math.min(s/a.width,r/a.height),this.text2.attr({transform:"S"+f+","+f+","+(a.x+a.width/2)+","+a.y})},r}(t.EventEmitter),t.DonutSegment=function(e){function t(e,t,n,r,i,s,o,a,f){this.cx=e,this.cy=t,this.inner=n,this.outer=r,this.color=o,this.data=a,this.i=f,this.deselect=u(this.deselect,this),this.select=u(this.select,this),this.sin_p0=Math.sin(i),this.cos_p0=Math.cos(i),this.sin_p1=Math.sin(s),this.cos_p1=Math.cos(s),this.long=s-i>Math.PI?1:0,this.path=this.calcSegment(this.inner+3,this.inner+this.outer-5),this.selectedPath=this.calcSegment(this.inner+3,this.inner+this.outer),this.hilight=this.calcArc(this.inner)}return o(t,e),t.prototype.calcArcPoints=function(e){return[this.cx+e*this.sin_p0,this.cy+e*this.cos_p0,this.cx+e*this.sin_p1,this.cy+e*this.cos_p1]},t.prototype.calcSegment=function(e,t){var n,r,i,s,o,u,a,f,l,c;return l=this.calcArcPoints(e),n=l[0],i=l[1],r=l[2],s=l[3],c=this.calcArcPoints(t),o=c[0],a=c[1],u=c[2],f=c[3],"M"+n+","+i+("A"+e+","+e+",0,"+this.long+",0,"+r+","+s)+("L"+u+","+f)+("A"+t+","+t+",0,"+this.long+",1,"+o+","+a)+"Z"},t.prototype.calcArc=function(e){var t,n,r,i,s;return s=this.calcArcPoints(e),t=s[0],r=s[1],n=s[2],i=s[3],"M"+t+","+r+("A"+e+","+e+",0,"+this.long+",0,"+n+","+i)},t.prototype.render=function(e){var t=this;return this.arc=e.path(this.hilight).attr({stroke:this.color,"stroke-width":2,opacity:0}),this.seg=e.path(this.path).attr({fill:this.color,stroke:"white","stroke-width":3}).hover(function(){return t.fire("hover",t)}).click(function(){return t.fire("click",t.i,t.data)})},t.prototype.select=function(){if(!this.selected)return this.seg.animate({path:this.selectedPath},150,"<>"),this.arc.animate({opacity:1},150,"<>"),this.selected=!0},t.prototype.deselect=function(){if(this.selected)return this.seg.animate({path:this.path},150,"<>"),this.arc.animate({opacity:0},150,"<>"),this.selected=!1},t}(t.EventEmitter)}).call(this); |
Sorry, the diff of this file is too big to display
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title></title> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta name="description" content=""> | ||
| <meta name="author" content=""> | ||
| <!--[if lt IE 9]> | ||
| <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
| <![endif]--> | ||
| <link href="../../assets/css/vendor/morris.css" rel="stylesheet"> | ||
| <link href="../../assets/css/vendor/bootstrap-3.0.0-wip.css" rel="stylesheet"> | ||
| <link href="../../assets/css/vendor/font-awesome.css" rel="stylesheet"> | ||
| <link href="../../assets/css/vendor/font-awesome-ie7.css" rel="stylesheet"> | ||
| <link href="../../assets/css/vendor/codemirror.css" rel="stylesheet"> | ||
| <link href="../../assets/css/plato.css" rel="stylesheet"> | ||
| <link href="../../assets/css/plato-file.css" rel="stylesheet"> | ||
| </head> | ||
| <body> | ||
| <div class="navbar navbar-fixed-top"> | ||
| <div class="container"> | ||
| <a class="brand" href="http://github.com/jsoverson/plato">Plato on Github</a> | ||
| <ul class="nav"> | ||
| <li> | ||
| <a href="../../index.html">Report Home</a> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| <div class="jumbotron"> | ||
| <div class="container"> | ||
| <h1>lib/afd.js</h1> | ||
| </div> | ||
| </div> | ||
| <div class="container aggregate-stats"> | ||
| <div class="row"> | ||
| <div class="span6"> | ||
| <h2 class="header">Maintainability <a href="http://blogs.msdn.com/b/codeanalysis/archive/2007/11/20/maintainability-index-range-and-meaning.aspx"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="A value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability." data-original-title="Maintainability Index"></i></a></h2> | ||
| <p class="stat">73.92</p> | ||
| </div> | ||
| <div class="span6"> | ||
| <h2 class="header">Lines of code <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code / Logical Lines of Code" data-original-title="SLOC/LSLOC"></i></h2> | ||
| <p class="stat">84</p> | ||
| </div> | ||
| </div> | ||
| <div class="row historical"> | ||
| <div class="span6"> | ||
| <p id="chart_historical_maint" class="chart"></p> | ||
| </div> | ||
| <div class="span6"> | ||
| <p id="chart_historical_sloc" class="chart"></p> | ||
| </div> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="span6"> | ||
| <h2 class="header">Difficulty <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="The difficulty measure is related to the difficulty of the program to write or understand." data-original-title="Difficulty"></i></a></h2> | ||
| <p class="stat">33.56</p> | ||
| </div> | ||
| <div class="span6"> | ||
| <h2 class="header">Estimated Errors <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Halstead's delivered bugs is an estimate for the number of errors in the implementation." data-original-title="Delivered Bugs"></i></a></h2> | ||
| <p class="stat">0.59</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="container charts"> | ||
| <div class="row"> | ||
| <h2 class="header">Function weight</h2> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="span6"> | ||
| <h3 class="chart-header">By Complexity <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="This metric counts the number of distinct paths through a block of code. Lower values are better." data-original-title="Cyclomatic Complexity"></i></a></h3> | ||
| <div id="fn-by-complexity" class="stat"></div> | ||
| </div> | ||
| <div class="span6"> | ||
| <h3 class="chart-header">By SLOC <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code / Logical Lines of Code" data-original-title="SLOC/LSLOC"></i></h3> | ||
| <div id="fn-by-sloc" class="stat"></div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="container"> | ||
| <div class="row"> | ||
| <textarea id="file-source" class="span12">/** | ||
| * Accrual Failure Detector | ||
| * @module afd | ||
| */ | ||
| /** | ||
| * @constructor | ||
| * @param {Number} {ws=100} How many heartbeat intervals we keep track of (window size) | ||
| * @param {Number} {last=Date.now()} Last report timestamp | ||
| */ | ||
| var afd = function (ws, last) { | ||
| if(!exists(last)) last = Date.now() | ||
| if(!exists(ws)) ws = 100 | ||
| this._ws = ws | ||
| this._last = last | ||
| this._intervals = Array() | ||
| this._variance = -1 | ||
| this._mean = -1 | ||
| } | ||
| /** | ||
| * Report a received heartbeat | ||
| * @param {Number} when | ||
| */ | ||
| afd.prototype.report = function (when) { | ||
| if(this._intervals.length > this._ws) this.intervals.shift() | ||
| if(!when) when = Date.now() | ||
| var interval = when - this._last | ||
| this._intervals.push(interval) | ||
| this._last = when | ||
| } | ||
| /** | ||
| * Get the current phi to determine failure | ||
| * See {@link https://issues.apache.org/jira/browse/CASSANDRA-2597 CASSANDRA-2597} for an explanation of the math at work here. | ||
| * Using 1 as a threshold means the likeliness of mistaken failure is 10% | ||
| * Using 2 as a threshold means the likeliness of mistaken failure is 1% | ||
| * Using 3 as a threshold means the likeliness of mistaken failure is 0.1% | ||
| * | ||
| * @param {Number} when | ||
| */ | ||
| afd.prototype.phi = function (when) { | ||
| if(!when) when = Date.now() | ||
| var interval = when - this._last | ||
| // If it's only 5 seconds from the start - let's give the system some | ||
| // slack and allow it to fuck up. | ||
| if((this._intervals.length < 3) && (interval < 5000)) return 0 | ||
| this._variance = this.variance() | ||
| this._mean = this.mean() | ||
| var probability = Math.pow(Math.E, -1 * interval / this._mean) | ||
| return (-1) * (Math.log(probability) / Math.LN10) | ||
| } | ||
| /** | ||
| * Get the mean interval | ||
| * @returns mean | ||
| */ | ||
| afd.prototype.mean = function () { | ||
| return this._intervals.reduce(function (prev, curr) { | ||
| return prev + curr | ||
| }) / this._intervals.length | ||
| } | ||
| /** | ||
| * Get the variance | ||
| * @returns variance | ||
| */ | ||
| afd.prototype.variance = function () { | ||
| var mean = this._mean | ||
| return this._intervals.reduce(function (prev, curr) { | ||
| var x = curr - mean | ||
| return prev + (x * x) | ||
| }) / this._intervals.length | ||
| } | ||
| /** | ||
| * Exports the afd constructor | ||
| */ | ||
| module.exports = function (ws, last) { | ||
| return new afd(ws, last) | ||
| } | ||
| var exists = function (e) { | ||
| return !((typeof e === 'undefined') || (e === null)) | ||
| }</textarea> | ||
| </div> | ||
| </div> | ||
| <footer class="footer"> | ||
| <div class="container"> | ||
| <p>.</p> | ||
| </div> | ||
| </footer> | ||
| <script type="text/html" id="complexity-popover-template"> | ||
| <div class="complexity-notice"> | ||
| Complexity : {{ complexity.cyclomatic }} <br> | ||
| Length : {{ complexity.halstead.length }} <br> | ||
| Difficulty : {{ complexity.halstead.difficulty.toFixed(2) }} <br> | ||
| Est # bugs : {{ complexity.halstead.bugs.toFixed(2) }}<br> | ||
| </div> | ||
| </script> | ||
| <script type="text/javascript" src="../../assets/scripts/bundles/core-bundle.js"></script> | ||
| <script type="text/javascript" src="../../assets/scripts/bundles/codemirror.js"></script> | ||
| <script type="text/javascript" src="../../assets/scripts/codemirror.markpopovertext.js"></script> | ||
| <script type="text/javascript" src="report.js"></script> | ||
| <script type="text/javascript" src="report.history.js"></script> | ||
| <script type="text/javascript" src="../../assets/scripts/plato-file.js"></script> | ||
| </body> | ||
| </html> |
| __history = [{"date":"Sun, 02 Jun 2013 22:22:09 GMT","sloc":84,"lloc":40,"functions":9,"deliveredBugs":0.5942069575521408,"maintainability":73.91682071488053,"lintErrors":34,"difficulty":33.55555555555556}] |
| [{"date":"Sun, 02 Jun 2013 22:22:09 GMT","sloc":84,"lloc":40,"functions":9,"deliveredBugs":0.5942069575521408,"maintainability":73.91682071488053,"lintErrors":34,"difficulty":33.55555555555556}] |
| __report = {"info":{"file":"lib/afd.js","fileShort":"lib/afd.js","fileSafe":"lib_afd_js","link":"files/lib_afd_js/index.html"},"complexity":{"aggregate":{"line":12,"complexity":{"sloc":{"physical":84,"logical":40},"cyclomatic":8,"halstead":{"operators":{"distinct":20,"total":145,"identifiers":["__stripped__"]},"operands":{"distinct":45,"total":151,"identifiers":["__stripped__"]},"length":296,"vocabulary":65,"difficulty":33.55555555555556,"volume":1782.6208726564225,"effort":59816.833726915516,"bugs":0.5942069575521408,"time":3323.1574292730843},"params":11}},"functions":[{"name":"afd","line":12,"complexity":{"sloc":{"physical":10,"logical":9},"cyclomatic":3,"halstead":{"operators":{"distinct":6,"total":23,"identifiers":["__stripped__"]},"operands":{"distinct":14,"total":26,"identifiers":["__stripped__"]},"length":49,"vocabulary":20,"difficulty":5.571428571428571,"volume":211.77447664948076,"effort":1179.88636990425,"bugs":0.07059149221649359,"time":65.54924277245833},"params":2}},{"name":"<anonymous>.report","line":27,"complexity":{"sloc":{"physical":8,"logical":7},"cyclomatic":3,"halstead":{"operators":{"distinct":8,"total":22,"identifiers":["__stripped__"]},"operands":{"distinct":12,"total":24,"identifiers":["__stripped__"]},"length":46,"vocabulary":20,"difficulty":8,"volume":198.80869236481868,"effort":1590.4695389185495,"bugs":0.06626956412160623,"time":88.3594188288083},"params":1}},{"name":"<anonymous>.phi","line":45,"complexity":{"sloc":{"physical":16,"logical":9},"cyclomatic":3,"halstead":{"operators":{"distinct":13,"total":40,"identifiers":["__stripped__"]},"operands":{"distinct":22,"total":39,"identifiers":["__stripped__"]},"length":79,"vocabulary":35,"difficulty":11.522727272727273,"volume":405.21335833865237,"effort":4669.1630154022,"bugs":0.13507111944621747,"time":259.3979453001222},"params":1}},{"name":"<anonymous>.mean","line":66,"complexity":{"sloc":{"physical":5,"logical":1},"cyclomatic":1,"halstead":{"operators":{"distinct":5,"total":8,"identifiers":["__stripped__"]},"operands":{"distinct":5,"total":7,"identifiers":["__stripped__"]},"length":15,"vocabulary":10,"difficulty":3.5,"volume":49.82892142331044,"effort":174.40122498158655,"bugs":0.016609640474436815,"time":9.688956943421475},"params":0}},{"name":"<anonymous>","line":67,"complexity":{"sloc":{"physical":3,"logical":1},"cyclomatic":1,"halstead":{"operators":{"distinct":2,"total":2,"identifiers":["__stripped__"]},"operands":{"distinct":2,"total":4,"identifiers":["__stripped__"]},"length":6,"vocabulary":4,"difficulty":2,"volume":12,"effort":24,"bugs":0.004,"time":1.3333333333333333},"params":2}},{"name":"<anonymous>.variance","line":76,"complexity":{"sloc":{"physical":8,"logical":2},"cyclomatic":1,"halstead":{"operators":{"distinct":7,"total":11,"identifiers":["__stripped__"]},"operands":{"distinct":7,"total":10,"identifiers":["__stripped__"]},"length":21,"vocabulary":14,"difficulty":5,"volume":79.95445336320968,"effort":399.7722668160484,"bugs":0.026651484454403226,"time":22.209570378669355},"params":0}},{"name":"<anonymous>","line":79,"complexity":{"sloc":{"physical":4,"logical":2},"cyclomatic":1,"halstead":{"operators":{"distinct":6,"total":6,"identifiers":["__stripped__"]},"operands":{"distinct":4,"total":8,"identifiers":["__stripped__"]},"length":14,"vocabulary":10,"difficulty":6,"volume":46.50699332842308,"effort":279.04195997053847,"bugs":0.01550233110947436,"time":15.50233110947436},"params":2}},{"name":"module.exports","line":89,"complexity":{"sloc":{"physical":3,"logical":1},"cyclomatic":1,"halstead":{"operators":{"distinct":2,"total":2,"identifiers":["__stripped__"]},"operands":{"distinct":3,"total":5,"identifiers":["__stripped__"]},"length":7,"vocabulary":5,"difficulty":1.6666666666666667,"volume":16.253496664211536,"effort":27.089161107019226,"bugs":0.005417832221403845,"time":1.5049533948344014},"params":2}},{"name":"exists","line":93,"complexity":{"sloc":{"physical":3,"logical":1},"cyclomatic":2,"halstead":{"operators":{"distinct":5,"total":6,"identifiers":["__stripped__"]},"operands":{"distinct":3,"total":5,"identifiers":["__stripped__"]},"length":11,"vocabulary":8,"difficulty":4.166666666666667,"volume":33,"effort":137.5,"bugs":0.011,"time":7.638888888888889},"params":1}}],"maintainability":73.91682071488053,"params":1.2222222222222223,"module":"lib/afd.js"},"jshint":{"messages":[{"severity":"error","line":13,"column":38,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":14,"column":27,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":16,"column":16,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":17,"column":20,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":18,"column":28,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":19,"column":22,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":20,"column":18,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":21,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":28,"column":63,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":29,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":31,"column":35,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":32,"column":33,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":33,"column":20,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":34,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":46,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":48,"column":35,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":52,"column":65,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":54,"column":35,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":55,"column":27,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":57,"column":65,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":59,"column":52,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":60,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":68,"column":23,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":69,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":70,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":77,"column":24,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":80,"column":24,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":81,"column":26,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":82,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":83,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":90,"column":27,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":91,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":94,"column":55,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":95,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."}]}} |
| {"info":{"file":"lib/afd.js","fileShort":"lib/afd.js","fileSafe":"lib_afd_js","link":"files/lib_afd_js/index.html"},"complexity":{"aggregate":{"line":12,"complexity":{"sloc":{"physical":84,"logical":40},"cyclomatic":8,"halstead":{"operators":{"distinct":20,"total":145,"identifiers":["__stripped__"]},"operands":{"distinct":45,"total":151,"identifiers":["__stripped__"]},"length":296,"vocabulary":65,"difficulty":33.55555555555556,"volume":1782.6208726564225,"effort":59816.833726915516,"bugs":0.5942069575521408,"time":3323.1574292730843},"params":11}},"functions":[{"name":"afd","line":12,"complexity":{"sloc":{"physical":10,"logical":9},"cyclomatic":3,"halstead":{"operators":{"distinct":6,"total":23,"identifiers":["__stripped__"]},"operands":{"distinct":14,"total":26,"identifiers":["__stripped__"]},"length":49,"vocabulary":20,"difficulty":5.571428571428571,"volume":211.77447664948076,"effort":1179.88636990425,"bugs":0.07059149221649359,"time":65.54924277245833},"params":2}},{"name":"<anonymous>.report","line":27,"complexity":{"sloc":{"physical":8,"logical":7},"cyclomatic":3,"halstead":{"operators":{"distinct":8,"total":22,"identifiers":["__stripped__"]},"operands":{"distinct":12,"total":24,"identifiers":["__stripped__"]},"length":46,"vocabulary":20,"difficulty":8,"volume":198.80869236481868,"effort":1590.4695389185495,"bugs":0.06626956412160623,"time":88.3594188288083},"params":1}},{"name":"<anonymous>.phi","line":45,"complexity":{"sloc":{"physical":16,"logical":9},"cyclomatic":3,"halstead":{"operators":{"distinct":13,"total":40,"identifiers":["__stripped__"]},"operands":{"distinct":22,"total":39,"identifiers":["__stripped__"]},"length":79,"vocabulary":35,"difficulty":11.522727272727273,"volume":405.21335833865237,"effort":4669.1630154022,"bugs":0.13507111944621747,"time":259.3979453001222},"params":1}},{"name":"<anonymous>.mean","line":66,"complexity":{"sloc":{"physical":5,"logical":1},"cyclomatic":1,"halstead":{"operators":{"distinct":5,"total":8,"identifiers":["__stripped__"]},"operands":{"distinct":5,"total":7,"identifiers":["__stripped__"]},"length":15,"vocabulary":10,"difficulty":3.5,"volume":49.82892142331044,"effort":174.40122498158655,"bugs":0.016609640474436815,"time":9.688956943421475},"params":0}},{"name":"<anonymous>","line":67,"complexity":{"sloc":{"physical":3,"logical":1},"cyclomatic":1,"halstead":{"operators":{"distinct":2,"total":2,"identifiers":["__stripped__"]},"operands":{"distinct":2,"total":4,"identifiers":["__stripped__"]},"length":6,"vocabulary":4,"difficulty":2,"volume":12,"effort":24,"bugs":0.004,"time":1.3333333333333333},"params":2}},{"name":"<anonymous>.variance","line":76,"complexity":{"sloc":{"physical":8,"logical":2},"cyclomatic":1,"halstead":{"operators":{"distinct":7,"total":11,"identifiers":["__stripped__"]},"operands":{"distinct":7,"total":10,"identifiers":["__stripped__"]},"length":21,"vocabulary":14,"difficulty":5,"volume":79.95445336320968,"effort":399.7722668160484,"bugs":0.026651484454403226,"time":22.209570378669355},"params":0}},{"name":"<anonymous>","line":79,"complexity":{"sloc":{"physical":4,"logical":2},"cyclomatic":1,"halstead":{"operators":{"distinct":6,"total":6,"identifiers":["__stripped__"]},"operands":{"distinct":4,"total":8,"identifiers":["__stripped__"]},"length":14,"vocabulary":10,"difficulty":6,"volume":46.50699332842308,"effort":279.04195997053847,"bugs":0.01550233110947436,"time":15.50233110947436},"params":2}},{"name":"module.exports","line":89,"complexity":{"sloc":{"physical":3,"logical":1},"cyclomatic":1,"halstead":{"operators":{"distinct":2,"total":2,"identifiers":["__stripped__"]},"operands":{"distinct":3,"total":5,"identifiers":["__stripped__"]},"length":7,"vocabulary":5,"difficulty":1.6666666666666667,"volume":16.253496664211536,"effort":27.089161107019226,"bugs":0.005417832221403845,"time":1.5049533948344014},"params":2}},{"name":"exists","line":93,"complexity":{"sloc":{"physical":3,"logical":1},"cyclomatic":2,"halstead":{"operators":{"distinct":5,"total":6,"identifiers":["__stripped__"]},"operands":{"distinct":3,"total":5,"identifiers":["__stripped__"]},"length":11,"vocabulary":8,"difficulty":4.166666666666667,"volume":33,"effort":137.5,"bugs":0.011,"time":7.638888888888889},"params":1}}],"maintainability":73.91682071488053,"params":1.2222222222222223,"module":"lib/afd.js"},"jshint":{"messages":[{"severity":"error","line":13,"column":38,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":14,"column":27,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":16,"column":16,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":17,"column":20,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":18,"column":28,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":19,"column":22,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":20,"column":18,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":21,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":28,"column":63,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":29,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":31,"column":35,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":32,"column":33,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":33,"column":20,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":34,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":46,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":48,"column":35,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":52,"column":65,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":54,"column":35,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":55,"column":27,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":57,"column":65,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":59,"column":52,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":60,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":68,"column":23,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":69,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":70,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":77,"column":24,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":80,"column":24,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":81,"column":26,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":82,"column":30,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":83,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":90,"column":27,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":91,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":94,"column":55,"message":"Missing semicolon.","source":"Missing semicolon."},{"severity":"error","line":95,"column":2,"message":"Missing semicolon.","source":"Missing semicolon."}]}} |
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8"> | ||
| <title>Plato - JavaScript Introspection</title> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <meta name="description" content=""> | ||
| <meta name="author" content=""> | ||
| <!--[if lt IE 9]> | ||
| <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
| <![endif]--> | ||
| <script> | ||
| var __options = {"flags":{"complexity":{"logicalor":true,"switchcase":true,"forin":false,"trycatch":false,"newmi":true},"jshint":{"options":{},"globals":{}}}} | ||
| </script> | ||
| <link href="assets/css/vendor/bootstrap-3.0.0-wip.css" rel="stylesheet"> | ||
| <link href="assets/css/vendor/font-awesome.css" rel="stylesheet"> | ||
| <link href="assets/css/vendor/font-awesome-ie7.css" rel="stylesheet"> | ||
| <link href="assets/css/vendor/morris.css" rel="stylesheet"> | ||
| <link href="assets/css/plato.css" rel="stylesheet"> | ||
| <link href="assets/css/plato-overview.css" rel="stylesheet"> | ||
| </head> | ||
| <body> | ||
| <div class="navbar navbar-fixed-top"> | ||
| <div class="container"> | ||
| <a class="brand" href="http://github.com/jsoverson/plato">Plato on Github</a> | ||
| <ul class="nav"> | ||
| <li class="active"> | ||
| <a href="index.html">Report Home</a> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| <div class="jumbotron"> | ||
| <div class="container"> | ||
| <h1>JavaScript Source Analysis</h1> | ||
| </div> | ||
| </div> | ||
| <div class="container aggregate-stats"> | ||
| <div class="row"> | ||
| <h1 class="span12">Summary</h1> | ||
| </div> | ||
| <div class="row"> | ||
| <div class="span6"> | ||
| <h2 class="header">Total/Average Lines <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code" data-original-title="SLOC"></i></h2> | ||
| <p class="stat">84 / 84</p> | ||
| </div> | ||
| <div class="span6"> | ||
| <h2 class="header">Average Maintainability <a href="http://blogs.msdn.com/b/codeanalysis/archive/2007/11/20/maintainability-index-range-and-meaning.aspx"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="A value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability." data-original-title="Maintainability Index"></i></a></h2> | ||
| <p class="stat">73.92</p> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="container historical"> | ||
| <div class="row"> | ||
| <div class="span6"> | ||
| <div id="chart_historical_sloc" class="chart js-chart"></div> | ||
| </div> | ||
| <div class="span6"> | ||
| <div id="chart_historical_maint" class="chart js-chart"></div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="container overview"> | ||
| <div class="row"> | ||
| <h2 class="span12">Maintainability <a href="http://blogs.msdn.com/b/codeanalysis/archive/2007/11/20/maintainability-index-range-and-meaning.aspx"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="A value between 0 and 100 that represents the relative ease of maintaining the code. A high value means better maintainability." data-original-title="Maintainability Index"></i></a></h2> | ||
| <div class="span12"><div id='chart_maintainability' class='chart js-chart'></div></div> | ||
| </div> | ||
| <div class="row"> | ||
| <h2 class="span12">Lines of code <i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Source Lines of Code" data-original-title="SLOC"></i></h2> | ||
| <div class="span12"><div id='chart_sloc' class='chart js-chart'></div></div> | ||
| </div> | ||
| <div class="row"> | ||
| <h2 class="span12">Estimated errors in implementation <a href="http://en.wikipedia.org/wiki/Halstead_complexity_measures"><i class="icon icon-info-sign" rel="popover" data-placement="top" data-trigger="hover" data-content="Halstead's delivered bugs is an estimate for the number of errors in the implementation." data-original-title="Delivered Bugs"></i></a></h2> | ||
| <div class="span12"><div id='chart_bugs' class='chart js-chart'></div></div> | ||
| </div> | ||
| <div class="row"> | ||
| <h2 class="span12">Lint errors</h2> | ||
| <div class="span12"><div id='chart_lint' class='chart js-chart'></div></div> | ||
| </div> | ||
| </div> | ||
| <div class="container"> | ||
| <div class="row"> | ||
| <h1 class="span12">Files</h1> | ||
| </div> | ||
| <div class="row"> | ||
| <ul class="file-list list-unstyled"> | ||
| <li class="span12"> | ||
| <span class="fade-left fadeout visible-desktop"></span> | ||
| <span class="span4 file"><a class="file-link" href="./files/lib_afd_js/index.html">lib/afd.js</a></span> | ||
| <span class="span8 file-chart js-file-chart" | ||
| data-lint="34" | ||
| data-sloc="84" | ||
| data-bugs="0.59" | ||
| data-complexity="8" | ||
| ></span> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </div> | ||
| <footer class="footer"> | ||
| <div class="container"> | ||
| <p>.</p> | ||
| </div> | ||
| </footer> | ||
| <script type="text/javascript" src="assets/scripts/bundles/core-bundle.js"></script> | ||
| <script type="text/javascript" src="report.js"></script> | ||
| <script type="text/javascript" src="report.history.js"></script> | ||
| <script type="text/javascript" src="assets/scripts/plato-overview.js"></script> | ||
| </body> | ||
| </html> |
| __history = [{"date":"Sun, 02 Jun 2013 22:22:10 GMT","total":{"sloc":84,"maintainability":73.91682071488053},"average":{"sloc":84,"maintainability":"73.92"}}] |
| [{"date":"Sun, 02 Jun 2013 22:22:10 GMT","total":{"sloc":84,"maintainability":73.91682071488053},"average":{"sloc":84,"maintainability":"73.92"}}] |
| __report = {"summary":{"total":{"sloc":84,"maintainability":73.91682071488053},"average":{"sloc":84,"maintainability":"73.92"}},"reports":[{"info":{"file":"lib/afd.js","fileShort":"lib/afd.js","fileSafe":"lib_afd_js","link":"files/lib_afd_js/index.html"},"jshint":{"messages":34},"complexity":{"aggregate":{"line":12,"complexity":{"sloc":{"physical":84,"logical":40},"cyclomatic":8,"halstead":{"operators":{"distinct":20,"total":145,"identifiers":["__stripped__"]},"operands":{"distinct":45,"total":151,"identifiers":["__stripped__"]},"length":296,"vocabulary":65,"difficulty":33.55555555555556,"volume":1782.6208726564225,"effort":59816.833726915516,"bugs":0.5942069575521408,"time":3323.1574292730843},"params":11}},"module":"lib/afd.js","maintainability":73.91682071488053}}]} |
| {"summary":{"total":{"sloc":84,"maintainability":73.91682071488053},"average":{"sloc":84,"maintainability":"73.92"}},"reports":[{"info":{"file":"lib/afd.js","fileShort":"lib/afd.js","fileSafe":"lib_afd_js","link":"files/lib_afd_js/index.html"},"jshint":{"messages":34},"complexity":{"aggregate":{"line":12,"complexity":{"sloc":{"physical":84,"logical":40},"cyclomatic":8,"halstead":{"operators":{"distinct":20,"total":145,"identifiers":["__stripped__"]},"operands":{"distinct":45,"total":151,"identifiers":["__stripped__"]},"length":296,"vocabulary":65,"difficulty":33.55555555555556,"volume":1782.6208726564225,"effort":59816.833726915516,"bugs":0.5942069575521408,"time":3323.1574292730843},"params":11}},"module":"lib/afd.js","maintainability":73.91682071488053}}]} |
+66
| var mean = require('mean') | ||
| /** | ||
| * Wrapper around the `afd` constructor | ||
| * @param {Number} [ws=100] How many heartbeat we keep track of | ||
| * @param {Number} [last=Date.now()] Last report timestamp | ||
| * @returns {afd} | ||
| */ | ||
| module.exports = function (ws, last) { | ||
| return new afd(ws, last) | ||
| } | ||
| /** | ||
| * @param {Number} [ws=100] How many heartbeat we keep track of | ||
| * @param {Number} [last=Date.now()] Last report timestamp | ||
| */ | ||
| var afd = module.exports.afd = function (ws, last) { | ||
| if(typeof ws !== 'number') ws = 100 | ||
| if(typeof last !== 'number') last = Date.now() | ||
| this.ws = ws | ||
| this.last = last | ||
| this.intervals = [] | ||
| } | ||
| /** | ||
| * Report a received heartbeat | ||
| * | ||
| * @param {Number} [when=Date.now()] | ||
| */ | ||
| afd.prototype.report = function (when) { | ||
| if(this.intervals.length > this.ws) this.intervals.shift() | ||
| if(!when) when = Date.now() | ||
| var interval = when - this.last | ||
| this.intervals.push(interval) | ||
| this.last = when | ||
| } | ||
| /** | ||
| * Get the current phi to determine failure. | ||
| * | ||
| * See [CASSANDRA-2597](https://issues.apache.org/jira/browse/CASSANDRA-2597) for an explanation of the math at work here. | ||
| * | ||
| * * Using `1` as a threshold means the likeliness of mistaken failure is `10%` | ||
| * | ||
| * * Using `2` as a threshold means the likeliness of mistaken failure is `1%` | ||
| * | ||
| * * Using `3` as a threshold means the likeliness of mistaken failure is `0.1%` | ||
| * | ||
| * @param {Number} [when=Date.now()] | ||
| */ | ||
| afd.prototype.phi = function (when) { | ||
| if(!when) when = Date.now() | ||
| var interval = when - this.last | ||
| // If it's only 5 seconds from the start - let's give the system some | ||
| // slack and allow it to fuck up. | ||
| if((this.intervals.length < 3) && (interval < 5000)) return 0 | ||
| var probability = Math.pow(Math.E, -1 * interval / mean(this.intervals)) | ||
| return (-1) * (Math.log(probability) / Math.LN10) | ||
| } |
+6
-17
| { | ||
| "name": "afd", | ||
| "version": "0.2.5", | ||
| "version": "0.2.6", | ||
| "description": "Accrual Failure Detector", | ||
@@ -42,5 +42,5 @@ "keywords": [ | ||
| ], | ||
| "main": "lib/afd.js", | ||
| "main": "src/afd.js", | ||
| "directories": { | ||
| "lib": "lib", | ||
| "lib": "src", | ||
| "doc": "doc", | ||
@@ -56,2 +56,5 @@ "man": "man" | ||
| }, | ||
| "dependencies": { | ||
| "mean": "0.1.x" | ||
| }, | ||
| "devDependencies": { | ||
@@ -67,17 +70,3 @@ "mocha-lcov-reporter": "0.0.x", | ||
| "node": ">=0.8" | ||
| }, | ||
| "testling": { | ||
| "harness" : "mocha", | ||
| "files": "test/*.js", | ||
| "browsers": { | ||
| "ie": [8, 9, 10, 11], | ||
| "chrome": [20, 21, 22, 23, 24, 25, "canary"], | ||
| "firefox": [26, 17, 18, 19, "nightly"], | ||
| "safari": [4.0, 5.1, 6.0], | ||
| "opera": [10, 11, 12, "next"], | ||
| "iphone": [6.0], | ||
| "ipad": [6.0], | ||
| "android-browser": [4.2] | ||
| } | ||
| } | ||
| } |
+0
-2
@@ -9,4 +9,2 @@ # Accrual Failure Detector | ||
| [](https://ci.testling.com/kordon/afd) | ||
| ## install | ||
@@ -13,0 +11,0 @@ |
+3
-2
| var afd = process.env.AFD_COVERAGE ? require('../lib-cov/afd.js') : require('..'), | ||
| assert = require('chai').assert | ||
| assert = require('chai').assert, | ||
| mean = require('mean') | ||
@@ -16,3 +17,3 @@ describe('Obvious', function () { | ||
| it('mean should be almost exactly one second', function () { | ||
| assert.ok(999 <= peer._mean && peer._mean <= 1001) | ||
| assert.ok(999 <= mean(peer.intervals) && mean(peer.intervals) <= 1001) | ||
| }) | ||
@@ -19,0 +20,0 @@ |
-95
| /** | ||
| * Accrual Failure Detector | ||
| * @module afd | ||
| */ | ||
| /** | ||
| * @constructor | ||
| * @param {Number} {ws=100} How many heartbeat intervals we keep track of (window size) | ||
| * @param {Number} {last=Date.now()} Last report timestamp | ||
| */ | ||
| var afd = function (ws, last) { | ||
| if(!exists(last)) last = Date.now() | ||
| if(!exists(ws)) ws = 100 | ||
| this._ws = ws | ||
| this._last = last | ||
| this._intervals = Array() | ||
| this._variance = -1 | ||
| this._mean = -1 | ||
| } | ||
| /** | ||
| * Report a received heartbeat | ||
| * @param {Number} when | ||
| */ | ||
| afd.prototype.report = function (when) { | ||
| if(this._intervals.length > this._ws) this.intervals.shift() | ||
| if(!when) when = Date.now() | ||
| var interval = when - this._last | ||
| this._intervals.push(interval) | ||
| this._last = when | ||
| } | ||
| /** | ||
| * Get the current phi to determine failure | ||
| * See {@link https://issues.apache.org/jira/browse/CASSANDRA-2597 CASSANDRA-2597} for an explanation of the math at work here. | ||
| * Using 1 as a threshold means the likeliness of mistaken failure is 10% | ||
| * Using 2 as a threshold means the likeliness of mistaken failure is 1% | ||
| * Using 3 as a threshold means the likeliness of mistaken failure is 0.1% | ||
| * | ||
| * @param {Number} when | ||
| */ | ||
| afd.prototype.phi = function (when) { | ||
| if(!when) when = Date.now() | ||
| var interval = when - this._last | ||
| // If it's only 5 seconds from the start - let's give the system some | ||
| // slack and allow it to fuck up. | ||
| if((this._intervals.length < 3) && (interval < 5000)) return 0 | ||
| this._variance = this.variance() | ||
| this._mean = this.mean() | ||
| var probability = Math.pow(Math.E, -1 * interval / this._mean) | ||
| return (-1) * (Math.log(probability) / Math.LN10) | ||
| } | ||
| /** | ||
| * Get the mean interval | ||
| * @returns mean | ||
| */ | ||
| afd.prototype.mean = function () { | ||
| return this._intervals.reduce(function (prev, curr) { | ||
| return prev + curr | ||
| }) / this._intervals.length | ||
| } | ||
| /** | ||
| * Get the variance | ||
| * @returns variance | ||
| */ | ||
| afd.prototype.variance = function () { | ||
| var mean = this._mean | ||
| return this._intervals.reduce(function (prev, curr) { | ||
| var x = curr - mean | ||
| return prev + (x * x) | ||
| }) / this._intervals.length | ||
| } | ||
| /** | ||
| * Exports the afd constructor | ||
| */ | ||
| module.exports = function (ws, last) { | ||
| return new afd(ws, last) | ||
| } | ||
| var exists = function (e) { | ||
| return !((typeof e === 'undefined') || (e === null)) | ||
| } |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1542650
3788.61%77
327.78%24329
6202.85%1
Infinity%9
800%45
-4.26%73
812.5%5
Infinity%+ Added
+ Added