WordPress.org

Plugin Directory

Changeset 629752


Ignore:
Timestamp:
11/25/12 18:14:36 (17 months ago)
Author:
TobiasBg
Message:

Update to a new beta version 0.8-beta.

Location:
tablepress/trunk
Files:
2 added
33 edited

Legend:

Unmodified
Added
Removed
  • tablepress/trunk/admin/codemirror.css

    r623199 r629752  
     1/* CodeMirror Default Styling */ 
     2/* BASICS */ 
     3 
    14.CodeMirror { 
    2   line-height: 1em; 
     5  /* Set height, width, borders, and global font properties here */ 
    36  font-family: monospace; 
    4  
    5   /* Necessary so the scrollbar can be absolutely positioned within the wrapper on Lion. */ 
    6   position: relative; 
    7   /* This prevents unwanted scrollbars from showing up on the body and wrapper in IE. */ 
    8   overflow: hidden; 
    9 } 
    10  
     7  height: 300px; 
     8} 
    119.CodeMirror-scroll { 
     10  /* Set scrolling behaviour here */ 
    1211  overflow: auto; 
    13   height: 300px; 
    14   /* This is needed to prevent an IE[67] bug where the scrolled content 
    15      is visible outside of the scrolling box. */ 
    16   position: relative; 
    17   outline: none; 
    18 } 
    19  
    20 /* Vertical scrollbar */ 
    21 .CodeMirror-scrollbar { 
    22   position: absolute; 
    23   right: 0; top: 0; 
    24   overflow-x: hidden; 
    25   overflow-y: scroll; 
    26   z-index: 5; 
    27 } 
    28 .CodeMirror-scrollbar-inner { 
    29   /* This needs to have a nonzero width in order for the scrollbar to appear 
    30      in Firefox and IE9. */ 
    31   width: 1px; 
    32 } 
    33 .CodeMirror-scrollbar.cm-sb-overlap { 
    34   /* Ensure that the scrollbar appears in Lion, and that it overlaps the content 
    35      rather than sitting to the right of it. */ 
    36   position: absolute; 
    37   z-index: 1; 
    38   float: none; 
    39   right: 0; 
    40   min-width: 12px; 
    41 } 
    42 .CodeMirror-scrollbar.cm-sb-nonoverlap { 
    43   min-width: 12px; 
    44 } 
    45 .CodeMirror-scrollbar.cm-sb-ie7 { 
    46   min-width: 18px; 
    47 } 
    48  
    49 .CodeMirror-gutter { 
    50   position: absolute; left: 0; top: 0; 
    51   z-index: 10; 
     12} 
     13 
     14/* PADDING */ 
     15 
     16.CodeMirror-lines { 
     17  padding: 4px 0; /* Vertical padding around content */ 
     18} 
     19.CodeMirror pre { 
     20  padding: 0 4px; /* Horizontal padding of content */ 
     21} 
     22 
     23.CodeMirror-scrollbar-filler { 
     24  background-color: white; /* The little square between H and V scrollbars */ 
     25} 
     26 
     27/* GUTTER */ 
     28 
     29.CodeMirror-gutters { 
     30  border-right: 1px solid #ddd; 
    5231  background-color: #f7f7f7; 
    53   border-right: 1px solid #eee; 
    54   min-width: 2em; 
    55   height: 100%; 
    56 } 
    57 .CodeMirror-gutter-text { 
    58   color: #aaa; 
     32} 
     33.CodeMirror-linenumbers {} 
     34.CodeMirror-linenumber { 
     35  padding: 0 3px 0 5px; 
     36  min-width: 20px; 
    5937  text-align: right; 
    60   padding: .4em .2em .4em .4em; 
    61   white-space: pre !important; 
    62   cursor: default; 
    63 } 
    64 .CodeMirror-lines { 
    65   padding: .4em; 
    66   white-space: pre; 
    67   cursor: text; 
    68 } 
    69  
    70 .CodeMirror pre { 
    71   -moz-border-radius: 0; 
    72   -webkit-border-radius: 0; 
    73   -o-border-radius: 0; 
    74   border-radius: 0; 
    75   border-width: 0; margin: 0; padding: 0; background: transparent; 
    76   font-family: inherit; 
    77   font-size: inherit; 
    78   padding: 0; margin: 0; 
    79   white-space: pre; 
    80   word-wrap: normal; 
    81   line-height: inherit; 
    82   color: inherit; 
    83   overflow: visible; 
    84 } 
    85  
    86 .CodeMirror-wrap pre { 
    87   word-wrap: break-word; 
    88   white-space: pre-wrap; 
    89   word-break: normal; 
    90 } 
    91 .CodeMirror-wrap .CodeMirror-scroll { 
    92   overflow-x: hidden; 
    93 } 
    94  
    95 .CodeMirror textarea { 
    96   outline: none !important; 
    97 } 
     38  color: #999; 
     39} 
     40 
     41/* CURSOR */ 
    9842 
    9943.CodeMirror pre.CodeMirror-cursor { 
    100   z-index: 10; 
    101   position: absolute; 
    102   visibility: hidden; 
    10344  border-left: 1px solid black; 
    104   border-right: none; 
    105   width: 0; 
     45} 
     46/* Shown when moving in bi-directional text */ 
     47.CodeMirror pre.CodeMirror-secondarycursor { 
     48  border-left: 1px solid silver; 
    10649} 
    10750.cm-keymap-fat-cursor pre.CodeMirror-cursor { 
     
    11659  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); 
    11760} 
     61/* Can style cursor different in overwrite (non-insert) mode */ 
    11862.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {} 
     63 
     64/* DEFAULT THEME */ 
     65 
     66.cm-s-default .cm-keyword {color: #708;} 
     67.cm-s-default .cm-atom {color: #219;} 
     68.cm-s-default .cm-number {color: #164;} 
     69.cm-s-default .cm-def {color: #00f;} 
     70.cm-s-default .cm-variable {color: black;} 
     71.cm-s-default .cm-variable-2 {color: #05a;} 
     72.cm-s-default .cm-variable-3 {color: #085;} 
     73.cm-s-default .cm-property {color: black;} 
     74.cm-s-default .cm-operator {color: black;} 
     75.cm-s-default .cm-comment {color: #a50;} 
     76.cm-s-default .cm-string {color: #a11;} 
     77.cm-s-default .cm-string-2 {color: #f50;} 
     78.cm-s-default .cm-meta {color: #555;} 
     79.cm-s-default .cm-error {color: #f00;} 
     80.cm-s-default .cm-qualifier {color: #555;} 
     81.cm-s-default .cm-builtin {color: #30a;} 
     82.cm-s-default .cm-bracket {color: #997;} 
     83.cm-s-default .cm-tag {color: #170;} 
     84.cm-s-default .cm-attribute {color: #00c;} 
     85.cm-s-default .cm-header {color: blue;} 
     86.cm-s-default .cm-quote {color: #090;} 
     87.cm-s-default .cm-hr {color: #999;} 
     88.cm-s-default .cm-link {color: #00c;} 
     89 
     90.cm-header, .cm-strong {font-weight: bold;} 
     91.cm-em {font-style: italic;} 
     92.cm-emstrong {font-style: italic; font-weight: bold;} 
     93.cm-link {text-decoration: underline;} 
     94 
     95.cm-invalidchar {color: #f00;} 
     96 
     97div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} 
     98div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} 
     99 
     100/* STOP */ 
     101 
     102/* The rest of this file contains styles related to the mechanics of 
     103   the editor. You probably shouldn't touch them. */ 
     104 
     105.CodeMirror { 
     106  line-height: 1; 
     107  position: relative; 
     108  overflow: hidden; 
     109} 
     110 
     111.CodeMirror-scroll { 
     112  /* 30px is the magic margin used to hide the element's real scrollbars */ 
     113  /* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */ 
     114  margin-bottom: -30px; margin-right: -30px; 
     115  padding-bottom: 30px; padding-right: 30px; 
     116  height: 100%; 
     117  outline: none; /* Prevent dragging from highlighting the element */ 
     118  position: relative; 
     119} 
     120.CodeMirror-sizer { 
     121  position: relative; 
     122} 
     123 
     124/* The fake, visible scrollbars. Used to force redraw during scrolling 
     125   before actuall scrolling happens, thus preventing shaking and 
     126   flickering artifacts. */ 
     127.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler { 
     128  position: absolute; 
     129  z-index: 6; 
     130  display: none; 
     131} 
     132.CodeMirror-vscrollbar { 
     133  right: 0; top: 0; 
     134  overflow-x: hidden; 
     135  overflow-y: scroll; 
     136} 
     137.CodeMirror-hscrollbar { 
     138  bottom: 0; left: 0; 
     139  overflow-y: hidden; 
     140  overflow-x: scroll; 
     141} 
     142.CodeMirror-scrollbar-filler { 
     143  right: 0; bottom: 0; 
     144  z-index: 6; 
     145} 
     146 
     147.CodeMirror-gutters { 
     148  position: absolute; left: 0; top: 0; 
     149  height: 100%; 
     150  z-index: 3; 
     151} 
     152.CodeMirror-gutter { 
     153  height: 100%; 
     154  display: inline-block; 
     155  /* Hack to make IE7 behave */ 
     156  *zoom:1; 
     157  *display:inline; 
     158} 
     159.CodeMirror-gutter-elt { 
     160  position: absolute; 
     161  cursor: default; 
     162  z-index: 4; 
     163} 
     164 
     165.CodeMirror-lines { 
     166  cursor: text; 
     167} 
     168.CodeMirror pre { 
     169  /* Reset some styles that the rest of the page might have set */ 
     170  -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0; 
     171  border-width: 0; 
     172  background: transparent; 
     173  font-family: inherit; 
     174  font-size: inherit; 
     175  margin: 0; 
     176  white-space: pre; 
     177  word-wrap: normal; 
     178  line-height: inherit; 
     179  color: inherit; 
     180  z-index: 2; 
     181  position: relative; 
     182  overflow: visible; 
     183} 
     184.CodeMirror-wrap pre { 
     185  word-wrap: break-word; 
     186  white-space: pre-wrap; 
     187  word-break: normal; 
     188} 
     189.CodeMirror-linebackground { 
     190  position: absolute; 
     191  left: 0; right: 0; top: 0; bottom: 0; 
     192  z-index: 0; 
     193} 
     194 
     195.CodeMirror-linewidget { 
     196  position: relative; 
     197  z-index: 2; 
     198} 
     199 
     200.CodeMirror-wrap .CodeMirror-scroll { 
     201  overflow-x: hidden; 
     202} 
     203 
     204.CodeMirror-measure { 
     205  position: absolute; 
     206  width: 100%; height: 0px; 
     207  overflow: hidden; 
     208  visibility: hidden; 
     209} 
     210.CodeMirror-measure pre { position: static; } 
     211 
     212.CodeMirror pre.CodeMirror-cursor { 
     213  position: absolute; 
     214  visibility: hidden; 
     215  border-right: none; 
     216  width: 0; 
     217} 
    119218.CodeMirror-focused pre.CodeMirror-cursor { 
    120219  visibility: visible; 
    121220} 
    122221 
    123 div.CodeMirror-selected { background: #d9d9d9; } 
    124 .CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; } 
     222.CodeMirror-selected { background: #d9d9d9; } 
     223.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } 
    125224 
    126225.CodeMirror-searching { 
     
    129228} 
    130229 
    131 /* Default theme */ 
    132  
    133 .cm-s-default span.cm-keyword {color: #708;} 
    134 .cm-s-default span.cm-atom {color: #219;} 
    135 .cm-s-default span.cm-number {color: #164;} 
    136 .cm-s-default span.cm-def {color: #00f;} 
    137 .cm-s-default span.cm-variable {color: black;} 
    138 .cm-s-default span.cm-variable-2 {color: #05a;} 
    139 .cm-s-default span.cm-variable-3 {color: #085;} 
    140 .cm-s-default span.cm-property {color: black;} 
    141 .cm-s-default span.cm-operator {color: black;} 
    142 .cm-s-default span.cm-comment {color: #a50;} 
    143 .cm-s-default span.cm-string {color: #a11;} 
    144 .cm-s-default span.cm-string-2 {color: #f50;} 
    145 .cm-s-default span.cm-meta {color: #555;} 
    146 .cm-s-default span.cm-error {color: #f00;} 
    147 .cm-s-default span.cm-qualifier {color: #555;} 
    148 .cm-s-default span.cm-builtin {color: #30a;} 
    149 .cm-s-default span.cm-bracket {color: #997;} 
    150 .cm-s-default span.cm-tag {color: #170;} 
    151 .cm-s-default span.cm-attribute {color: #00c;} 
    152 .cm-s-default span.cm-header {color: blue;} 
    153 .cm-s-default span.cm-quote {color: #090;} 
    154 .cm-s-default span.cm-hr {color: #999;} 
    155 .cm-s-default span.cm-link {color: #00c;} 
    156  
    157 span.cm-header, span.cm-strong {font-weight: bold;} 
    158 span.cm-em {font-style: italic;} 
    159 span.cm-emstrong {font-style: italic; font-weight: bold;} 
    160 span.cm-link {text-decoration: underline;} 
    161  
    162 span.cm-invalidchar {color: #f00;} 
    163  
    164 div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} 
    165 div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} 
     230/* IE7 hack to prevent it from returning funny offsetTops on the spans */ 
     231.CodeMirror span { *vertical-align: text-bottom; } 
    166232 
    167233@media print { 
    168  
    169234  /* Hide the cursor when printing */ 
    170235  .CodeMirror pre.CodeMirror-cursor { 
    171236    visibility: hidden; 
    172237  } 
    173  
    174238} 
    175239 
     
    180244    font-size: 12px; 
    181245    line-height: inherit; 
    182     margin-bottom: 6px; 
     246    width: 98%; 
     247    height: 100px; 
     248    margin: 1px 1px 7px; 
    183249} 
    184250#option-custom-css { 
    185     width: 98%; 
    186     height: 102px; 
    187251    margin: 1px; 
    188252    -moz-tab-size: 2; 
     
    192256#tablepress-page .CodeMirror-scroll { 
    193257    background-color: #ffffff; 
    194     border-color: #dfdfdf; 
    195     -webkit-border-radius: 3px; 
     258    border: 1px solid #dfdfdf; 
    196259    border-radius: 3px; 
    197     border-width: 1px; 
    198     border-style: solid; 
    199     cursor: text; 
    200     width: 98%; 
    201     height: 100px; 
    202     margin: 1px; 
    203     resize: vertical; /* currently not always working if scrolling is necessary */ 
     260    height: 98%; 
     261    padding-bottom: 0; 
     262    margin-right: 0; 
    204263} 
    205264#tablepress-page .CodeMirror-lines { 
    206265    padding: 3px; 
    207266} 
    208 #tablepress-page .CodeMirror-scroll.disabled { 
     267#tablepress-page .CodeMirror pre { 
     268    padding: 0px; 
     269} 
     270#tablepress-page .CodeMirror.disabled .CodeMirror-scroll { 
    209271    background-color: #eeeeee; 
    210     height: 100px !important; 
    211272} 
    212273#option-custom-css:focus, 
     
    216277    box-shadow: 1px 1px 2px rgba(0,0,0,0.1); 
    217278} 
    218 #tablepress-page .large .CodeMirror-scroll { 
     279#tablepress-page .CodeMirror.large { 
    219280    height: 300px; 
    220281} 
     282#tablepress-page .CodeMirror.disabled { 
     283    height: 100px; 
     284} 
  • tablepress/trunk/admin/codemirror.min.css

    r623199 r629752  
    1 .CodeMirror{line-height:1em;font-family:monospace;position:relative;overflow:hidden}.CodeMirror-scroll{overflow:auto;height:300px;position:relative;outline:0}.CodeMirror-scrollbar{position:absolute;right:0;top:0;overflow-x:hidden;overflow-y:scroll;z-index:5}.CodeMirror-scrollbar-inner{width:1px}.CodeMirror-scrollbar.cm-sb-overlap{position:absolute;z-index:1;float:none;right:0;min-width:12px}.CodeMirror-scrollbar.cm-sb-nonoverlap{min-width:12px}.CodeMirror-scrollbar.cm-sb-ie7{min-width:18px}.CodeMirror-gutter{position:absolute;left:0;top:0;z-index:10;background-color:#f7f7f7;border-right:1px solid #eee;min-width:2em;height:100%}.CodeMirror-gutter-text{color:#aaa;text-align:right;padding:.4em .2em .4em .4em;white-space:pre!important;cursor:default}.CodeMirror-lines{padding:.4em;white-space:pre;cursor:text}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;margin:0;padding:0;background:transparent;font-family:inherit;font-size:inherit;padding:0;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;overflow:visible}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror textarea{outline:none!important}.CodeMirror pre.CodeMirror-cursor{z-index:10;position:absolute;visibility:hidden;border-left:1px solid black;border-right:0;width:0}.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)}.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id){filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.CodeMirror-focused pre.CodeMirror-cursor{visibility:visible}div.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused div.CodeMirror-selected{background:#d7d4f0}.CodeMirror-searching{background:#ffa;background:rgba(255,255,0,.4)}.cm-s-default span.cm-keyword{color:#708}.cm-s-default span.cm-atom{color:#219}.cm-s-default span.cm-number{color:#164}.cm-s-default span.cm-def{color:#00f}.cm-s-default span.cm-variable{color:black}.cm-s-default span.cm-variable-2{color:#05a}.cm-s-default span.cm-variable-3{color:#085}.cm-s-default span.cm-property{color:black}.cm-s-default span.cm-operator{color:black}.cm-s-default span.cm-comment{color:#a50}.cm-s-default span.cm-string{color:#a11}.cm-s-default span.cm-string-2{color:#f50}.cm-s-default span.cm-meta{color:#555}.cm-s-default span.cm-error{color:#f00}.cm-s-default span.cm-qualifier{color:#555}.cm-s-default span.cm-builtin{color:#30a}.cm-s-default span.cm-bracket{color:#997}.cm-s-default span.cm-tag{color:#170}.cm-s-default span.cm-attribute{color:#00c}.cm-s-default span.cm-header{color:blue}.cm-s-default span.cm-quote{color:#090}.cm-s-default span.cm-hr{color:#999}.cm-s-default span.cm-link{color:#00c}span.cm-header,span.cm-strong{font-weight:bold}span.cm-em{font-style:italic}span.cm-emstrong{font-style:italic;font-weight:bold}span.cm-link{text-decoration:underline}span.cm-invalidchar{color:#f00}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22}@media print{.CodeMirror pre.CodeMirror-cursor{visibility:hidden}}#option-custom-css,#tablepress-page .CodeMirror{font-family:Consolas,Monaco,monospace;font-size:12px;line-height:inherit;margin-bottom:6px}#option-custom-css{width:98%;height:102px;margin:1px;-moz-tab-size:2;-o-tab-size:2;tab-size:2}#tablepress-page .CodeMirror-scroll{background-color:#fff;border-color:#dfdfdf;-webkit-border-radius:3px;border-radius:3px;border-width:1px;border-style:solid;cursor:text;width:98%;height:100px;margin:1px;resize:vertical}#tablepress-page .CodeMirror-lines{padding:3px}#tablepress-page .CodeMirror-scroll.disabled{background-color:#eee;height:100px!important}#option-custom-css:focus,#tablepress-page .CodeMirror-focused{border-color:#a1a1a1;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.1);box-shadow:1px 1px 2px rgba(0,0,0,0.1)}#tablepress-page .large .CodeMirror-scroll{height:300px} 
     1.CodeMirror{font-family:monospace;height:300px}.CodeMirror-scroll{overflow:auto}.CodeMirror-lines{padding:4px 0}.CodeMirror pre{padding:0 4px}.CodeMirror-scrollbar-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999}.CodeMirror pre.CodeMirror-cursor{border-left:1px solid black}.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)}.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id){filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.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-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}.CodeMirror{line-height:1;position:relative;overflow:hidden}.CodeMirror-scroll{margin-bottom:-30px;margin-right:-30px;padding-bottom:30px;padding-right:30px;height:100%;outline:0;position:relative}.CodeMirror-sizer{position:relative}.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;*zoom:1;*display:inline}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-lines{cursor:text}.CodeMirror pre{-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:0;overflow:hidden;visibility:hidden}.CodeMirror-measure pre{position:static}.CodeMirror pre.CodeMirror-cursor{position:absolute;visibility:hidden;border-right:0;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)}.CodeMirror span{*vertical-align:text-bottom}@media print{.CodeMirror pre.CodeMirror-cursor{visibility:hidden}}#option-custom-css,#tablepress-page .CodeMirror{font-family:Consolas,Monaco,monospace;font-size:12px;line-height:inherit;width:98%;height:100px;margin:1px 1px 7px}#option-custom-css{margin:1px;-moz-tab-size:2;-o-tab-size:2;tab-size:2}#tablepress-page .CodeMirror-scroll{background-color:#fff;border:1px solid #dfdfdf;border-radius:3px;height:98%;padding-bottom:0;margin-right:0}#tablepress-page .CodeMirror-lines{padding:3px}#tablepress-page .CodeMirror pre{padding:0}#tablepress-page .CodeMirror.disabled .CodeMirror-scroll{background-color:#eee}#option-custom-css:focus,#tablepress-page .CodeMirror-focused{border-color:#a1a1a1;-webkit-box-shadow:1px 1px 2px rgba(0,0,0,0.1);box-shadow:1px 1px 2px rgba(0,0,0,0.1)}#tablepress-page .CodeMirror.large{height:300px}#tablepress-page .CodeMirror.disabled{height:100px} 
  • tablepress/trunk/admin/codemirror.min.js

    r623199 r629752  
    1 // CodeMirror version 2.35 
    2 window.CodeMirror=function(){function n(a,b){function c(d){(!i.onDragEvent||!i.onDragEvent(B,Xa(d)))&&jb(d)}function e(d){return 0<=d&&d<u.size}function g(d){for(var a=u;!a.lines;)for(var l=0;;++l){var b=a.children[l],c=b.chunkSize();if(d<c){a=b;break}d-=c}return a.lines[d]}function j(d,a){ma=!0;for(var l=a-d.height,b=d;b;b=b.parent)b.height+=l}function m(d,a){d.styles||d.highlight(O,d.stateAfter=Ya(Fa(d)),i.tabSize);return d.getContent(i.tabSize,a,i.lineWrapping)}function ga(d){var a={line:0,ch:0}; 
    3 qc(a,{line:u.size-1,ch:g(u.size-1).text.length},kb(d),a,a);xa=!0}function y(d){if(!i.onDragEvent||!i.onDragEvent(B,Xa(d))){E(d);var a=Za(d,!0),l=d.dataTransfer.files;if(a&&!i.readOnly)if(l&&l.length&&window.FileReader&&window.File)for(var b=l.length,c=Array(b),k=0,d=function(d,l){var h=new FileReader;h.onload=function(){c[l]=h.result;++k==b&&(a=D(a),q(function(){var d=T(c.join(""),a,a);ia(a,d)})())};h.readAsText(d)},h=0;h<b;++h)d(l[h],h);else if(!lb||L(a,f.from)||L(f.to,a))try{(c=d.dataTransfer.getData("Text"))&& 
    4 rc(function(){var d=f.from,l=f.to;ia(a,a);lb&&T("",d,l);P(c);ja()})}catch(Vc){}}}function Qb(d){var a=Rb();d.dataTransfer.setData("Text",a);d.dataTransfer.setDragImage&&d.dataTransfer.setDragImage(w("img"),0,0)}function mb(d,a){if("string"==typeof d&&(d=Sb[d],!d))return!1;var l=ka;try{i.readOnly&&(nb=!0),a&&(ka=null),d(B)}catch(b){if(b!=sc)throw b;return!1}finally{ka=l,nb=!1}return!0}function tc(d){function a(){h=!0}var l=Tb(i.keyMap),b=l.auto;clearTimeout(uc);b&&!vc(d)&&(uc=setTimeout(function(){Tb(i.keyMap)== 
    5 l&&(i.keyMap=b.call?b.call(null,B):b)},50));var c=Ga[G(d,"keyCode")],k=!1,k=ya&&ob;if(null==c||d.altGraphKey)return!1;G(d,"altKey")&&(c="Alt-"+c);if(G(d,k?"metaKey":"ctrlKey"))c="Ctrl-"+c;if(G(d,k?"ctrlKey":"metaKey"))c="Cmd-"+c;var h=!1,k=G(d,"shiftKey")?pb("Shift-"+c,i.extraKeys,i.keyMap,function(d){return mb(d,!0)},a)||pb(c,i.extraKeys,i.keyMap,function(d){if("string"==typeof d&&/^go[A-Z]/.test(d))return mb(d)},a):pb(c,i.extraKeys,i.keyMap,mb,a);h&&(k=!1);k&&(E(d),qb(),Ha&&(d.oldKeyCode=d.keyCode, 
    6 d.keyCode=0));return k}function wc(d){X||Q();Ha&&27==d.keyCode&&(d.returnValue=!1);Ma&&ca()&&(Ma=!1);if(!i.onKeyEvent||!i.onKeyEvent(B,Xa(d))){var a=G(d,"keyCode");La(16==a||G(d,"shiftKey"));var l=tc(d);ya&&(Ub=l?a:null,!l&&(88==a&&G(d,ob?"metaKey":"ctrlKey"))&&P(""))}}function Q(){if("nocursor"!=i.readOnly){if(!X){if(i.onFocus)i.onFocus(B);X=!0;-1==s.className.search(/\bCodeMirror-focused\b/)&&(s.className+=" CodeMirror-focused")}da();qb()}}function M(){if(X){if(i.onBlur)i.onBlur(B);X=!1;za&&q(function(){za&& 
    7 (za(),za=null)})();s.className=s.className.replace(" CodeMirror-focused","")}clearInterval(Vb);setTimeout(function(){X||(ka=null)},150)}function qc(d,a,l,b,c){if(!nb){var k=[];u.iter(d.line,a.line+1,function(d){k.push(Na(d.text,d.markedSpans))});if(I)for(I.addChange(d.line,l.length,k);I.done.length>i.undoDepth;)I.done.shift();var h=J(k[0]),g=J(H(k)),e=d.ch,f=a.ch;if(h||g){if(h)for(var j=0,v;j<h.length;++j){var p=h[j],m=p.marker;if(null==p.from||(m.inclusiveLeft?p.from<=e:p.from<e)||"bookmark"==m.type&& 
    8 p.from==e&&void 0!=p.from){var s=null==p.to||(m.inclusiveRight?p.to>=e:p.to>e);(v||(v=[])).push({from:p.from,to:s?null:p.to,marker:m})}}h=v;if(g)for(var j=0,A;j<g.length;++j)if(v=g[j],p=v.marker,null==v.to||(p.inclusiveRight?v.to>=f:v.to>f)||"bookmark"==p.type&&v.from==f)m=null==v.from||(p.inclusiveLeft?v.from<=f:v.from<f),(A||(A=[])).push({from:m?null:v.from-f,to:null==v.to?null:v.to-f,marker:p});g=A;A=1==l.length;j=H(l).length+(A?e:0);if(h)for(f=0;f<h.length;++f)v=h[f],null==v.to&&((p=rb(g,v.marker))? 
    9 A&&(v.to=null==p.to?null:p.to+j):v.to=e);if(g)for(f=0;f<g.length;++f)v=g[f],null!=v.to&&(v.to+=j),null==v.from?(p=rb(h,v.marker),p||(v.from=j,A&&(h||(h=[])).push(v))):(v.from+=j,A&&(h||(h=[])).push(v));e=[Na(l[0],h)];if(!A){A=l.length-2;var q;if(0<A&&h)for(f=0;f<h.length;++f)null==h[f].to&&(q||(q=[])).push({from:null,to:null,marker:h[f].marker});for(f=0;f<A;++f)e.push(Na(l[f+1],q));e.push(Na(H(l),g))}l=e}ua(d,a,l,b,c)}}function N(d,a){if(d.length){for(var l=d.pop(),b=[],c=l.length-1;0<=c;c-=1){var k= 
    10 l[c],h=[],f=k.start+k.added;u.iter(k.start,f,function(d){h.push(Na(d.text,d.markedSpans))});b.push({start:k.start,added:k.old.length,old:h});var e=k.start+k.old.length-1,i;i=R(H(h));var j=R(H(k.old));if(j)if(i){for(var m=i.length,p=j.length;0<=m&&0<=p&&i.charAt(m)==j.charAt(p);--m,--p);i=p+1}else i=j.length;else i=0;e={line:e,ch:i};ua({line:k.start,ch:0},{line:f-1,ch:g(f-1).text.length},k.old,e,e)}xa=!0;a.push(b)}}function ua(d,a,l,b,c){if(!nb){var k=!1,h=na.text.length;i.lineWrapping||u.iter(d.line, 
    11 a.line+1,function(d){if(!d.hidden&&d.text.length==h)return k=!0});if(d.line!=a.line||1<l.length)ma=!0;var e=a.line-d.line,ha=g(d.line),m=g(a.line),q=H(l);if(0==d.ch&&0==a.ch&&""==R(q)){for(var v=[],p=0,n=l.length-1;p<n;++p)v.push(new Oa(R(l[p]),J(l[p])));m.update(m.text,J(q));e&&u.remove(d.line,e,$a);v.length&&u.insert(d.line,v)}else if(ha==m)if(1==l.length)ha.update(ha.text.slice(0,d.ch)+R(l[0])+ha.text.slice(a.ch),J(l[0]));else{v=[];p=1;for(n=l.length-1;p<n;++p)v.push(new Oa(R(l[p]),J(l[p])));v.push(new Oa(R(q)+ 
    12 ha.text.slice(a.ch),J(q)));ha.update(ha.text.slice(0,d.ch)+R(l[0]),J(l[0]));u.insert(d.line+1,v)}else if(1==l.length)ha.update(ha.text.slice(0,d.ch)+R(l[0])+m.text.slice(a.ch),J(l[0])),u.remove(d.line+1,e,$a);else{v=[];ha.update(ha.text.slice(0,d.ch)+R(l[0]),J(l[0]));m.update(R(q)+m.text.slice(a.ch),J(q));p=1;for(n=l.length-1;p<n;++p)v.push(new Oa(R(l[p]),J(l[p])));1<e&&u.remove(d.line+1,e-1,$a);u.insert(d.line+1,v)}if(i.lineWrapping){var w=Math.max(5,s.clientWidth/Wb()-3);u.iter(d.line,d.line+l.length, 
    13 function(d){if(!d.hidden){var a=Math.ceil(d.text.length/w)||1;a!=d.height&&j(d,a)}})}else u.iter(d.line,d.line+l.length,function(d){var a=d.text;!d.hidden&&a.length>h&&(na=d,h=a.length,sb=!0,k=!1)}),k&&(ab=!0);Z=Math.min(Z,d.line);tb(400);e=l.length-e-1;qa.push({from:d.line,to:a.line+1,diff:e});if(i.onChange){for(p=0;p<l.length;++p)"string"!=typeof l[p]&&(l[p]=l[p].text);d={from:d,to:a,text:l};if(Pa){for(l=Pa;l.next;l=l.next);l.next=d}else Pa=d}bb(D(b),D(c),f.from.line<=Math.min(a.line,a.line+e)? 
    14 f.from.line:f.from.line+e,f.to.line<=Math.min(a.line,a.line+e)?f.to.line:f.to.line+e)}}function $(){var d=u.height*oa()+2*C.offsetTop;return 0.99*d>s.offsetHeight?d:!1}function Y(d){var a=$();x.style.display=a?"block":"none";a?(xc.style.height=pa.style.minHeight=a+"px",x.style.height=s.clientHeight+"px",null!=d&&(x.scrollTop=s.scrollTop=d,ub&&setTimeout(function(){x.scrollTop==d&&(x.scrollTop=d+(d?-1:1),x.scrollTop=d)},0))):pa.style.minHeight="";vb.style.top=Qa*oa()+"px"}function yc(){na=g(0);sb= 
    15 !0;var d=na.text.length;u.iter(1,u.size,function(a){var l=a.text;!a.hidden&&l.length>d&&(d=l.length,na=a)});ab=!1}function T(d,a,l){function b(la){if(L(la,a))return la;if(!L(l,la))return c;var h=la.line+d.length-(l.line-a.line)-1,e=la.ch;la.line==l.line&&(e+=H(d).length-(l.ch-(l.line==a.line?a.ch:0)));return{line:h,ch:e}}var a=D(a),l=l?D(l):a,d=kb(d),c;ea(d,a,l,function(d){c=d;return{from:b(f.from),to:b(f.to)}});return c}function P(d,a){ea(kb(d),f.from,f.to,function(d){return"end"==a?{from:d,to:d}: 
    16 "start"==a?{from:f.from,to:f.from}:{from:f.from,to:d}})}function ea(d,a,l,b){var c=1==d.length?d[0].length+a.ch:H(d).length,b=b({line:a.line+d.length-1,ch:c});qc(a,l,d,b.from,b.to)}function zc(d,a,l){var b=d.line,c=a.line;if(b==c)return g(b).text.slice(d.ch,a.ch);var k=[g(b).text.slice(d.ch)];u.iter(b+1,c,function(d){k.push(d.text)});k.push(g(c).text.slice(0,a.ch));return k.join(l||"\n")}function Rb(d){return zc(f.from,f.to,d)}function da(){Ma||Xb.set(i.pollInterval,function(){ca();X&&da()})}function cb(){function d(){!ca()&& 
    17 !a?(a=!0,Xb.set(60,d)):(Ma=!1,da())}var a=!1;Ma=!0;Xb.set(20,d)}function ca(){if(!X||Rc(t)||i.readOnly)return!1;var d=t.value;if(d==fa)return!1;wb||Ac();ka=null;for(var a=0,l=Math.min(fa.length,d.length);a<l&&fa[a]==d[a];)++a;a<fa.length?f.from={line:f.from.line,ch:f.from.ch-(fa.length-a)}:xb&&(z(f.from,f.to)&&!Yb)&&(f.to={line:f.to.line,ch:Math.min(g(f.to.line).text.length,f.to.ch+(d.length-a))});P(d.slice(a),"end");1E3<d.length?t.value=fa="":fa=d;wb||Bc();Yb=!1;return!0}function yb(d){z(f.from, 
    18 f.to)?d&&(fa=t.value=""):(fa="",t.value=Rb(),X&&(d=t,Zb?(d.selectionStart=0,d.selectionEnd=d.value.length):d.select()))}function ja(){"nocursor"!=i.readOnly&&t.focus()}function Cc(){var d=ra(f.inverted?f.from:f.to);return{x:i.lineWrapping?Math.min(d.x,C.offsetWidth):d.x,y:d.y,yBot:d.yBot}}function Dc(d,a,l,b){d=Ec(d,a,l,b);null!=d.scrollLeft&&(s.scrollLeft=d.scrollLeft);null!=d.scrollTop&&(x.scrollTop=s.scrollTop=d.scrollTop)}function Ec(d,a,l,b){var c=C.offsetLeft,k=C.offsetTop,a=a+k,b=b+k,d=d+c, 
    19 l=l+c,h=s.clientHeight,e=x.scrollTop,f={},g=$()||Infinity,j=a<k+10,k=b+k>g-10;a<e?f.scrollTop=j?0:Math.max(0,a):b>e+h&&(f.scrollTop=(k?g:b)-h);a=s.clientWidth;b=s.scrollLeft;h=i.fixedGutter?W.clientWidth:0;c=d<h+c+10;d<b+h||c?(c&&(d=0),f.scrollLeft=Math.max(0,d-10-h)):l>a+b-3&&(f.scrollLeft=l+10-a);return f}function Da(d){var a=oa(),l=(null!=d?d:x.scrollTop)-C.offsetTop,d=Math.max(0,Math.floor(l/a)),a=Math.ceil((l+s.clientHeight)/a);return{from:$b(u,d),to:$b(u,a)}}function Aa(d,a,l){function b(){var d= 
    20 aa.firstChild,a=!1;u.iter(F,K,function(b){if(d){if(!b.hidden){var l=Math.round(d.offsetHeight/ga)||1;b.height!=l&&(j(b,l),ma=a=!0)}d=d.nextSibling}});return a}if(s.clientWidth){var c=Da(l);if(!0!==d&&0==d.length&&c.from>F&&c.to<K)Y(l);else{var k=Math.max(c.from-100,0),h=Math.min(u.size,c.to+100);F<k&&20>k-F&&(k=F);K>h&&20>K-h&&(h=Math.min(u.size,K));if(!0===d)d=[];else{for(var c=[{from:F,to:K,domStart:0}],e=0,f=d.length||0;e<f;++e){for(var g=d[e],q=[],v=g.diff||0,p=0,n=c.length;p<n;++p){var t=c[p]; 
    21 g.to<=t.from&&g.diff?q.push({from:t.from+v,to:t.to+v,domStart:t.domStart}):g.to<=t.from||g.from>=t.to?q.push(t):(g.from>t.from&&q.push({from:t.from,to:g.from,domStart:t.domStart}),g.to<t.to&&q.push({from:g.to+v,to:t.to+v,domStart:t.domStart+(g.to-t.from)}))}c=q}d=c}for(var A=d,c=d=0;c<A.length;++c)e=A[c],e.from<k&&(e.domStart+=k-e.from,e.from=k),e.to>h&&(e.to=h),e.from>=e.to?A.splice(c--,1):d+=e.to-e.from;if(d==h-k&&k==F&&h==K)Y(l);else{A.sort(function(d,a){return d.domStart-a.domStart});var ga=oa(), 
    22 d=W.style.display;aa.style.display="none";c=k;e=h;f=function(d){var a=d.nextSibling;d.parentNode.removeChild(d);return a};if(A.length){for(var g=0,r=aa.firstChild,q=0;q<A.length;++q){for(v=A[q];v.domStart>g;)r=f(r),g++;for(var x=0,v=v.to-v.from;x<v;++x)r=r.nextSibling,g++}for(;r;)r=f(r)}else Ia(aa);var ca=A.shift(),r=aa.firstChild,x=c;u.iter(c,e,function(d){ca&&ca.to==x&&(ca=A.shift());if(!ca||ca.from>x){if(d.hidden)var a=w("pre");else a=m(d),d.className&&(a.className=d.className),d.bgClassName&& 
    23 (d=w("pre","\u00a0",d.bgClassName,"position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"),a=w("div",[d,a],null,"position: relative"));aa.insertBefore(a,r)}else r=r.nextSibling;++x});aa.style.display=W.style.display="";(c=k!=F||h!=K||Fc!=s.clientHeight+ga)&&(Fc=s.clientHeight+ga);(k!=F||h!=K&&i.onViewportChange)&&setTimeout(function(){if(i.onViewportChange)i.onViewportChange(B,k,h)});F=k;K=h;Qa=ac(u,k);tb(100);if(aa.childNodes.length!=K-F)throw Error("BAD PATCH! "+JSON.stringify(A)+ 
    24 " size="+(K-F)+" nodes="+aa.childNodes.length);i.lineWrapping&&b();W.style.display=d;(c||ma)&&va()&&i.lineWrapping&&b()&&va();Y(l);Ea();if(!a&&i.onUpdate)i.onUpdate(B);return!0}}}else F=K=Qa=0}function va(){if(i.gutter||i.lineNumbers){var d=vb.offsetHeight,a=s.clientHeight;W.style.height=(2>d-a?a:d)+"px";var b=document.createDocumentFragment(),c=F,e;u.iter(F,Math.max(K,F+1),function(d){if(d.hidden)b.appendChild(w("pre"));else{var a=d.gutterMarker,V=i.lineNumbers?i.lineNumberFormatter(c+i.firstLineNumber): 
    25 null;a&&a.text?V=a.text.replace("%N%",null!=V?V:""):null==V&&(V="\u00a0");var h=b.appendChild(w("pre",null,a&&a.style));h.innerHTML=V;for(V=1;V<d.height;++V)h.appendChild(w("br")),h.appendChild(document.createTextNode("\u00a0"));a||(e=c)}++c});W.style.display="none";Ia(Ra).appendChild(b);if(null!=e&&i.lineNumbers){for(var d=Ra.childNodes[e-F],a=String(u.size).length,f=d.firstChild.textContent||d.firstChild.innerText||d.firstChild.nodeValue||"",h="";f.length+h.length<a;)h+="\u00a0";h&&d.insertBefore(document.createTextNode(h), 
    26 d.firstChild)}W.style.display="";d=2<Math.abs((parseInt(C.style.marginLeft)||0)-W.offsetWidth);C.style.marginLeft=W.offsetWidth+"px";ma=!1;return d}}function Ea(){var d=z(f.from,f.to),a=ra(f.from,!0),b=d?a:ra(f.to,!0),c=f.inverted?a:b,e=oa(),k=Sa(U),h=Sa(aa);Ja.style.top=Math.max(0,Math.min(s.offsetHeight,c.y+h.top-k.top))+"px";Ja.style.left=Math.max(0,Math.min(s.offsetWidth,c.x+h.left-k.left))+"px";if(d)S.style.top=c.y+"px",S.style.left=(i.lineWrapping?Math.min(c.x,C.offsetWidth):c.x)+"px",S.style.display= 
    27 "",zb.style.display="none";else{var d=a.y==b.y,g=document.createDocumentFragment(),j=C.clientWidth||C.offsetWidth,c=C.clientHeight||C.offsetHeight,k=function(d,a,b,l){g.appendChild(w("div",null,"CodeMirror-selected","position: absolute; left: "+d+"px; top: "+a+"px; "+(Sc?"width: "+(!b?j:j-b-d)+"px":"right: "+b+"px")+"; height: "+l+"px"))};f.from.ch&&0<=a.y&&k(a.x,a.y,d?j-b.x:0,e);a=Math.max(0,a.y+(f.from.ch?e:0));h=Math.min(b.y,c)-a;h>0.2*e&&k(0,a,0,h);(!d||!f.from.ch)&&b.y<c-0.5*e&&k(0,b.y,j-b.x, 
    28 e);Ia(zb).appendChild(g);S.style.display="none";zb.style.display=""}}function La(d){ka=d?ka||(f.inverted?f.to:f.from):null}function ia(d,a){var b=ka&&D(ka);b&&(L(b,d)?d=b:L(a,b)&&(a=b));bb(d,a);Ab=!0}function bb(d,a,b,c){Bb=null;null==b&&(b=f.from.line,c=f.to.line);if(!z(f.from,d)||!z(f.to,a)){if(L(a,d))var e=a,a=d,d=e;d.line!=b&&((b=ta(d,b,f.from.ch))?d=b:bc(d.line,!1));a.line!=c&&(a=ta(a,c,f.to.ch));z(d,a)?f.inverted=!1:z(d,f.to)?f.inverted=!1:z(a,f.from)&&(f.inverted=!0);if(i.autoClearEmptyLines&& 
    29 z(f.from,f.to)&&(f.inverted?d:a).line!=f.from.line&&f.from.line<u.size){var k=g(f.from.line);/^\s+$/.test(k.text)&&setTimeout(q(function(){if(k.parent&&/^\s+$/.test(k.text)){var d=Fa(k);T("",{line:d,ch:0},{line:d,ch:k.text.length})}},10))}f.from=d;f.to=a;Ba=!0}}function ta(d,a,b){function c(a){for(var V=d.line+a,e=1==a?u.size:-1;V!=e;){var la=g(V);if(!la.hidden){a=d.ch;if(f||a>b||a>la.text.length)a=la.text.length;return{line:V,ch:a}}V+=a}}var e=g(d.line),f=d.ch==e.text.length&&d.ch!=b;return!e.hidden? 
    30 d:d.line>=a?c(1)||c(-1):c(-1)||c(1)}function Ca(d,a,b){d=D({line:d,ch:a||0});(b?ia:bb)(d,d)}function wa(d){return Math.max(0,Math.min(d,u.size-1))}function D(d){if(0>d.line)return{line:0,ch:0};if(d.line>=u.size)return{line:u.size-1,ch:g(u.size-1).text.length};var a=d.ch,b=g(d.line).text.length;return null==a||a>b?{line:d.line,ch:b}:0>a?{line:d.line,ch:0}:d}function Ka(d,a){function b(a){if(k==(0>d?0:h.text.length)){if(a=!a)a:{for(var a=e+d,c=0>d?-1:u.size;a!=c;a+=d){var l=g(a);if(!l.hidden){e=a;h= 
    31 l;a=!0;break a}}a=void 0}if(a)k=0>d?h.text.length:0;else return!1}else k+=d;return!0}var c=f.inverted?f.from:f.to,e=c.line,k=c.ch,h=g(e);if("char"==a)b();else if("column"==a)b(!0);else if("word"==a)for(c=!1;!(0>d)||b();){if(Cb(h.text.charAt(k)))c=!0;else if(c){0>d&&(d=1,b());break}if(0<d&&!b())break}return{line:e,ch:k}}function Wa(a){var b=g(a.line).text,l=a.ch,c=a.ch;if(b){!1===a.after||c==b.length?--l:++c;for(var e=b.charAt(l),e=Cb(e)?Cb:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&& 
    32 Cb(a)};0<l&&e(b.charAt(l-1));)--l;for(;c<b.length&&e(b.charAt(c));)++c}return{from:{line:a.line,ch:l},to:{line:a.line,ch:c}}}function Db(a,b){b||(b="add");if("smart"==b)if(O.indent)var c=Ya(a);else b="prev";var e=g(a),f=e.indentation(i.tabSize),k=e.text.match(/^\s*/)[0],h;"smart"==b&&(h=O.indent(c,e.text.slice(k.length),e.text),h==sc&&(b="prev"));"prev"==b?h=a?g(a-1).indentation(i.tabSize):0:"add"==b?h=f+i.indentUnit:"subtract"==b&&(h=f-i.indentUnit);h=Math.max(0,h);c="";f=0;if(i.indentWithTabs)for(var j= 
    33 Math.floor(h/i.tabSize);j;--j)f+=i.tabSize,c+="\t";f<h&&(c+=Gc(h-f));c!=k&&T(c,{line:a,ch:0},{line:a,ch:k.length});e.stateAfter=null}function gb(){O=n.getMode(i,i.mode);u.iter(0,u.size,function(a){a.stateAfter=null});Z=0;tb(100)}function Pb(){if(i.lineWrapping){U.className+=" CodeMirror-wrap";var a=s.clientWidth/Wb()-3;u.iter(0,u.size,function(b){if(!b.hidden){var c=Math.ceil(b.text.length/a)||1;1!=c&&j(b,c)}});C.style.minWidth=Eb.style.left=""}else U.className=U.className.replace(" CodeMirror-wrap", 
    34 ""),yc(),u.iter(0,u.size,function(a){1!=a.height&&!a.hidden&&j(a,1)});qa.push({from:0,to:u.size})}function hb(){s.className=s.className.replace(/\s*cm-s-\S+/g,"")+i.theme.replace(/(^|\s)\s*/g," cm-s-")}function ib(){var a=ba[i.keyMap].style;U.className=U.className.replace(/\s*cm-keymap-\S+/g,"")+(a?" cm-keymap-"+a:"")}function Fb(a,b){this.lines=[];this.type=a;b&&(this.style=b)}function cc(a,b,c,e){var a=D(a),b=D(b),f=new Fb("range",c);if(e)for(var g in e)e.hasOwnProperty(g)&&(f[g]=e[g]);var h=a.line; 
    35 u.iter(h,b.line+1,function(c){c.markedSpans=(c.markedSpans||[]).concat([{from:h==a.line?a.ch:null,to:h==b.line?b.ch:null,marker:f}]);f.lines.push(c);++h});qa.push({from:a.line,to:b.line+1});return f}function Hc(a,b){var c=a,e=a;"number"==typeof a?e=g(wa(a)):c=Fa(a);if(null!=c&&b(e,c))qa.push({from:c,to:c+1});else return null;return e}function bc(a,b){return Hc(a,function(a,d){if(a.hidden!=b){a.hidden=b;i.lineWrapping||(b&&a.text.length==na.text.length?ab=!0:!b&&a.text.length>na.text.length&&(na=a, 
    36 ab=!1));j(a,b?0:1);var c=f.from.line,e=f.to.line;if(b&&(c==d||e==d)){c=c==d?ta({line:c,ch:0},c,0):f.from;e=e==d?ta({line:e,ch:0},e,0):f.to;if(!e)return;bb(c,e)}return ma=!0}})}function dc(a,b){if(0==b)return{top:0,left:0};var c=m(a,b);Ia(Ta).appendChild(c);var c=c.anchor,e=c.offsetTop,f=c.offsetLeft;Ha&&(0==e&&0==f)&&(e=w("span","x"),c.parentNode.insertBefore(e,c.nextSibling),e=e.offsetTop);return{top:e,left:f}}function ra(a,b){var c,e=oa(),f=e*(ac(u,a.line)-(b?Qa:0));if(0==a.ch)c=0;else{var k=dc(g(a.line), 
    37 a.ch);c=k.left;i.lineWrapping&&(f+=Math.max(0,k.top))}return{x:c,y:f,yBot:f+e}}function Gb(a,b){function c(a){a=dc(j,a);if(q){var d=Math.round(a.top/e);v=d!=t;return Math.max(0,a.left+(d-t)*s.clientWidth)}return a.left}var e=oa(),f=Wb(),k=Qa+Math.floor(b/e);if(0>k)return{line:0,ch:0};var h=$b(u,k);if(h>=u.size)return{line:u.size-1,ch:g(u.size-1).text.length};var j=g(h),m=j.text,q=i.lineWrapping,t=q?k-ac(u,h):0;if(0>=a&&0==t)return{line:h,ch:0};for(var v=!1,p=k=0,m=m.length,n,f=Math.min(m,Math.ceil((a+ 
    38 0.9*t*s.clientWidth)/f));;){var r=c(f);if(r<=a&&f<m)f=Math.min(m,Math.ceil(1.2*f));else{n=r;m=f;break}}if(a>n)return{line:h,ch:m};f=Math.floor(0.8*m);r=c(f);r<a&&(k=f,p=r);for(;;){if(1>=m-k)return n=a-p<n-a,{line:h,ch:n?k:m,after:n};f=Math.ceil((k+m)/2);r=c(f);r>a?(m=f,n=r,v&&(n+=1E3)):(k=f,p=r)}}function oa(){if(null==Ua){Ua=w("pre");for(var a=0;49>a;++a)Ua.appendChild(document.createTextNode("x")),Ua.appendChild(w("br"));Ua.appendChild(document.createTextNode("x"))}a=aa.clientHeight;if(a==Ic)return ec; 
    39 Ic=a;a=Ua.cloneNode(!0);Ia(Ta).appendChild(a);ec=Ta.firstChild.offsetHeight/50||1;Ia(Ta);return ec}function Wb(){if(s.clientWidth==Jc)return Kc;Jc=s.clientWidth;var a=w("span","x"),b=w("pre",[a]);Ia(Ta).appendChild(b);return Kc=a.offsetWidth||10}function Za(a,b){var c=Sa(s,!0),e,f;try{e=a.clientX,f=a.clientY}catch(g){return null}if(!b&&(e-c.left>s.clientWidth||f-c.top>s.clientHeight))return null;c=Sa(C,!0);return Gb(e-c.left,f-c.top)}function Lc(a){function b(){Ja.style.position="relative";t.style.cssText= 
    40 g;fc&&(x.scrollTop=e);da();if(null!=t.selectionStart){clearTimeout(gc);var a=t.value=" "+(z(f.from,f.to)?"":t.value),d=0;fa=" ";t.selectionStart=1;t.selectionEnd=a.length;gc=setTimeout(function Qc(){" "==fa&&0==t.selectionStart?q(Sb.selectAll)(B):10>d++?gc=setTimeout(Qc,500):yb()},200)}}var c=Za(a),e=x.scrollTop;if(c&&!ya){(z(f.from,f.to)||L(c,f.from)||!L(c,f.to))&&q(Ca)(c.line,c.ch);var g=t.style.cssText;Ja.style.position="absolute";t.style.cssText="position: fixed; width: 30px; height: 30px; top: "+ 
    41 (a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";ja();yb(!0);z(f.from,f.to)&&(t.value=fa=" ");if(db){jb(a);var k=r(window,"mouseup",function(){k();setTimeout(b,20)},!0)}else setTimeout(b,50)}}function qb(){clearInterval(Vb);var a=!0;S.style.visibility="";Vb=setInterval(function(){S.style.visibility=(a=!a)?"":"hidden"},i.cursorBlinkRate)}function Mc(a){var b=f.inverted?f.from:f.to, 
    42 c=g(b.line),e=b.ch-1,i=0<=e&&hc[c.text.charAt(e)]||hc[c.text.charAt(++e)];if(i){i.charAt(0);for(var k=(i=">"==i.charAt(1))?1:-1,h=c.styles,j=e+1,m=0,s=h.length;m<s;m+=2)if(0>=(j-=h[m].length)){var n=h[m+1];break}h=[c.text.charAt(e)];j=/[(){}[\]]/;m=b.line;for(s=i?Math.min(m+100,u.size):Math.max(-1,m-100);m!=s;m+=k){var c=g(m),v=m==b.line,p;a:{p=v&&i?e+1:0;v=v&&!i?e:c.text.length;if(c.text)for(var t=c.styles,c=i?0:c.text.length-1,r=void 0,A=i?0:t.length-2,w=i?t.length:-2;A!=w;A+=2*k){var ga=t[A];if(t[A+ 
    43 1]!=n)c+=k*ga.length;else for(var x=i?0:ga.length-1,ca=i?ga.length:-1;x!=ca;x+=k,c+=k)if(c>=p&&c<v&&j.test(r=ga.charAt(x))){var B=hc[r];if(">"==B.charAt(1)==i)h.push(r);else if(h.pop()!=B.charAt(0)){p={pos:c,match:!1};break a}else if(!h.length){p={pos:c,match:!0};break a}}}p=void 0}if(p)break}p||(p={pos:null,match:!1});var n=p.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",D=cc({line:b.line,ch:e},{line:b.line,ch:e+1},n),C=null!=p.pos&&cc({line:m,ch:p.pos},{line:m,ch:p.pos+1},n), 
    44 b=q(function(){D.clear();C&&C.clear()});a?setTimeout(b,800):za=b}}function Ya(a){var b;a:{for(var c,e,f=a,k=a-40;f>k;--f){if(0==f){b=0;break a}var h=g(f-1);if(h.stateAfter){b=f;break a}h=h.indentation(i.tabSize);if(null==e||c>h)e=f-1,c=h}b=e}var j=b&&g(b-1).stateAfter,j=j?Va(O,j):Nc(O);u.iter(b,a,function(c){c.process(O,j,i.tabSize);c.stateAfter=b==a-1||0==b%5?Va(O,j):null});return j}function oc(){if(!(Z>=K)){var a=+new Date+i.workTime,b=Va(O,Ya(Z)),c=Z;u.iter(Z,K,function(c){Z>=F?(c.highlight(O, 
    45 b,i.tabSize),c.stateAfter=Va(O,b)):(c.process(O,b,i.tabSize),c.stateAfter=0==Z%5?Va(O,b):null);++Z;if(+new Date>a)return tb(i.workDelay),!0});K>c&&Z>=F&&q(function(){qa.push({from:c,to:Z})})()}}function tb(a){Z<K&&pc.set(a,oc)}function Ac(){xa=Ab=Pa=null;qa=[];Ba=!1;$a=[]}function Bc(){ab&&yc();if(sb&&!i.lineWrapping){var a=Eb.offsetWidth,b=dc(na,na.text.length).left;Hb||(Eb.style.left=b+"px",C.style.minWidth=b+a+"px");sb=!1}var c,e;Ba&&(a=Cc(),c=Ec(a.x,a.y,a.x,a.yBot));if(qa.length||c&&null!=c.scrollTop)e= 
    46 Aa(qa,!0,c&&c.scrollTop);e||(Ba&&Ea(),ma&&va());if(c&&(a=Cc(),Dc(a.x,a.y,a.x,a.yBot),X)){c=pa.getBoundingClientRect();b=null;if(0>a.y+c.top)b=!0;else if(a.y+c.top+oa()>(window.innerHeight||document.documentElement.clientHeight))b=!1;if(null!=b){if(c="none"==S.style.display)S.style.display="",S.style.left=a.x+"px",S.style.top=a.y-Qa+"px";S.scrollIntoView(b);c&&(S.style.display="none")}}Ba&&qb();X&&(!0===xa||!1!==xa&&Ba)&&yb(Ab);Ba&&i.matchBrackets&&setTimeout(q(function(){za&&(za(),za=null);z(f.from, 
    47 f.to)&&Mc(!1)}),20);b=Ba;a=$a;if(Pa&&i.onChange&&B)i.onChange(B,Pa);if(b&&i.onCursorActivity)i.onCursorActivity(B);for(b=0;b<a.length;++b)a[b](B);if(e&&i.onUpdate)i.onUpdate(B)}function q(a){return function(){wb++||Ac();try{var b=a.apply(this,arguments)}finally{--wb||Bc()}return b}}function rc(a){I.startCompound();try{return a()}finally{I.endCompound()}}var i={},ic=n.defaults,eb;for(eb in ic)ic.hasOwnProperty(eb)&&(i[eb]=(b&&b.hasOwnProperty(eb)?b:ic)[eb]);var t=w("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em"); 
    48 t.setAttribute("wrap","off");t.setAttribute("autocorrect","off");t.setAttribute("autocapitalize","off");var Ja=w("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"),xc=w("div",null,"CodeMirror-scrollbar-inner"),x=w("div",[xc],"CodeMirror-scrollbar"),aa=w("div"),zb=w("div",null,null,"position: relative; z-index: -1"),S=w("pre","\u00a0","CodeMirror-cursor"),Eb=w("pre","\u00a0","CodeMirror-cursor","visibility: hidden"),Ta=w("div",null,null,"position: absolute; width: 100%; height: 0px; overflow: hidden; visibility: hidden;"), 
    49 C=w("div",[Ta,S,Eb,zb,aa],null,"position: relative; z-index: 0"),Ra=w("div",null,"CodeMirror-gutter-text"),W=w("div",[Ra],"CodeMirror-gutter"),vb=w("div",[W,w("div",[C],"CodeMirror-lines")],null,"position: relative"),pa=w("div",[vb],null,"position: relative"),s=w("div",[pa],"CodeMirror-scroll");s.setAttribute("tabIndex","-1");var U=w("div",[Ja,x,s],"CodeMirror"+(i.lineWrapping?" CodeMirror-wrap":""));a.appendChild?a.appendChild(U):a(U);hb();ib();Zb&&(t.style.width="0px");ub||(s.draggable=!0);C.style.outline= 
    50 "none";null!=i.tabindex&&(t.tabIndex=i.tabindex);i.autofocus&&ja();!i.gutter&&!i.lineNumbers&&(W.style.display="none");jc&&(Ja.style.height="1px",Ja.style.position="absolute");Tc?(x.style.zIndex=-2,x.style.visibility="hidden"):Hb&&(x.style.minWidth="18px");var Xb=new kc,pc=new kc,Vb,O,u=new Ib([new Jb([new Oa("")])]),Z=0,X;gb();var f={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},ka,Kb,Lb,sa=0,lb,xb=!1,nb=!1,Yb=!1,xa,Ab,qa,Pa,Ba,ma,$a,Qa=0,F=0,K=0,Fc=0,za,na=g(0),ab=!1,sb=!0,Ma=!1,Bb=null;q(function(){ga(i.value|| 
    51 "");xa=!1})();var I=new Mb;r(s,"mousedown",q(function(a){function b(c){ub&&(s.draggable=!1);lb=!1;t();v();10>Math.abs(a.clientX-c.clientX)+Math.abs(a.clientY-c.clientY)&&(E(c),Ca(h.line,h.ch,!0),ja())}function c(a){if("single"==j)ia(h,a);else if("double"==j){var d=Wa(a);L(a,p)?ia(d.from,u):ia(p,d.to)}else"triple"==j&&(L(a,p)?ia(u,D({line:a.line,ch:0})):ia(p,D({line:a.line+1,ch:0})))}function e(a){var d=Za(a,!0);if(d&&!z(d,m)){X||Q();m=d;c(d);xa=!1;var b=Da();if(d.line>=b.to||d.line<b.from)n=setTimeout(q(function(){e(a)}), 
    52 150)}}function g(a){clearTimeout(n);var d=Za(a);d&&c(d);E(a);ja();xa=!0;w();t()}La(G(a,"shiftKey"));for(var k=a.target||a.srcElement;k!=U;k=k.parentNode)if(k.parentNode==pa&&k!=vb)return;for(k=a.target||a.srcElement;k!=U;k=k.parentNode)if(k.parentNode==Ra){if(i.onGutterClick)i.onGutterClick(B,Nb(Ra.childNodes,k)+F,a);return E(a)}var h=Za(a);switch(Oc(a)){case 3:db&&Lc(a);return;case 2:h&&Ca(h.line,h.ch,!0);setTimeout(ja,20);E(a);return}if(h){X||Q();var k=+new Date,j="single";Lb&&Lb.time>k-400&&z(Lb.pos, 
    53 h)?(j="triple",E(a),setTimeout(ja,20),k=h.line,ia({line:k,ch:0},D({line:k+1,ch:0}))):Kb&&Kb.time>k-400&&z(Kb.pos,h)?(j="double",Lb={time:k,pos:h},E(a),k=Wa(h),ia(k.from,k.to)):Kb={time:k,pos:h};var m=h,n;if(i.dragDrop&&lc&&!i.readOnly&&!z(f.from,f.to)&&!L(h,f.from)&&!L(f.to,h)&&"single"==j){ub&&(s.draggable=!0);var t=r(document,"mouseup",q(b),!0),v=r(s,"drop",q(b),!0);lb=!0;s.dragDrop&&s.dragDrop()}else{E(a);"single"==j&&Ca(h.line,h.ch,!0);var p=f.from,u=f.to,w=r(document,"mousemove",q(function(a){clearTimeout(n); 
    54 E(a);!Ha&&!Oc(a)?g(a):e(a)}),!0),t=r(document,"mouseup",q(g),!0)}}else(a.target||a.srcElement)==s&&E(a)}));r(s,"dblclick",q(function(a){for(var b=a.target||a.srcElement;b!=U;b=b.parentNode)if(b.parentNode==Ra)return E(a);E(a)}));r(C,"selectstart",E);db||r(s,"contextmenu",Lc);r(s,"scroll",function(){i.fixedGutter&&W.style.left!=s.scrollLeft+"px"&&(W.style.left=s.scrollLeft+"px");s.scrollTop!=sa&&(sa=s.scrollTop,x.scrollTop!=sa&&(x.scrollTop=sa),Aa([]));if(i.onScroll)i.onScroll(B)});r(x,"scroll",function(){x.scrollTop!= 
    55 sa&&(sa=s.scrollTop=x.scrollTop,Aa([]))});r(x,"mousedown",function(){X&&setTimeout(ja,0)});var Uc=r(window,"resize",function(){U.parentNode?Aa(!0):Uc()},!0);r(t,"keyup",q(function(a){if(!i.onKeyEvent||!i.onKeyEvent(B,Xa(a)))16==G(a,"keyCode")&&(ka=null)}));r(t,"input",cb);r(t,"keydown",q(wc));r(t,"keypress",q(function(a){Ma&&ca();if(!i.onKeyEvent||!i.onKeyEvent(B,Xa(a))){var b=G(a,"keyCode"),c=G(a,"charCode");if(ya&&b==Ub)Ub=null,E(a);else if(!(ya&&(!a.which||10>a.which)||jc)||!tc(a)){b=String.fromCharCode(null== 
    56 c?b:c);i.electricChars&&O.electricChars&&i.smartIndent&&!i.readOnly&&-1<O.electricChars.indexOf(b)&&setTimeout(q(function(){Db(f.to.line,"smart")}),75);if(b=pb("'"+b+"'",i.extraKeys,i.keyMap,function(a){return mb(a,!0)}))E(a),qb();b||cb()}}}));r(t,"focus",Q);r(t,"blur",M);i.dragDrop&&(r(s,"dragstart",Qb),r(s,"dragenter",c),r(s,"dragover",c),r(s,"drop",q(y)));r(s,"paste",function(){ja();cb()});r(t,"paste",function(){Yb=!0;cb()});r(t,"cut",q(function(){i.readOnly||P("")}));jc&&r(pa,"mouseup",function(){document.activeElement== 
    57 t&&t.blur();ja()});var Pc;try{Pc=document.activeElement==t}catch(Wc){}Pc||i.autofocus?setTimeout(Q,20):M();var B=U.CodeMirror={getValue:function(a){var b=[];u.iter(0,u.size,function(a){b.push(a.text)});return b.join(a||"\n")},setValue:q(ga),getSelection:Rb,replaceSelection:q(P),focus:function(){window.focus();ja();Q();cb()},setOption:function(a,b){var c=i[a];i[a]=b;"mode"==a||"indentUnit"==a?gb():"readOnly"==a&&"nocursor"==b?(M(),t.blur()):"readOnly"==a&&!b?yb(!0):"theme"==a?hb():"lineWrapping"== 
    58 a&&c!=b?q(Pb)():"tabSize"==a?Aa(!0):"keyMap"==a?ib():"tabindex"==a&&(t.tabIndex=b);if("lineNumbers"==a||"gutter"==a||"firstLineNumber"==a||"theme"==a||"lineNumberFormatter"==a)c=i.gutter||i.lineNumbers,W.style.display=c?"":"none",c?ma=!0:aa.parentNode.style.marginLeft=0,Aa(!0)},getOption:function(a){return i[a]},getMode:function(){return O},undo:q(function(){N(I.done,I.undone)}),redo:q(function(){N(I.undone,I.done)}),indentLine:q(function(a,b){"string"!=typeof b&&(b=null==b?i.smartIndent?"smart": 
    59 "prev":b?"add":"subtract");e(a)&&Db(a,b)}),indentSelection:q(function(a){if(z(f.from,f.to))return Db(f.from.line,a);for(var b=f.to.line-(f.to.ch?0:1),c=f.from.line;c<=b;++c)Db(c,a)}),historySize:function(){return{undo:I.done.length,redo:I.undone.length}},clearHistory:function(){I=new Mb},setHistory:function(a){I=new Mb;I.done=a.done;I.undone=a.undone},getHistory:function(){function a(b){for(var d=0,c=[],e;d<b.length;++d){c.push(e=[]);for(var f=0,g=b[d];f<g.length;++f){var i=[],j=g[f];e.push({start:j.start, 
    60 added:j.added,old:i});for(var m=0;m<j.old.length;++m)i.push(R(j.old[m]))}}return c}return{done:a(I.done),undone:a(I.undone)}},matchBrackets:q(function(){Mc(!0)}),getTokenAt:q(function(a){a=D(a);return g(a.line).getTokenAt(O,Ya(a.line),i.tabSize,a.ch)}),getStateAfter:function(a){a=wa(null==a?u.size-1:a);return Ya(a+1)},cursorCoords:function(a,b){null==a&&(a=f.inverted);return this.charCoords(a?f.from:f.to,b)},charCoords:function(a,b){a=D(a);if("local"==b)return ra(a,!1);if("div"==b)return ra(a,!0); 
    61 var c=ra(a,!0),e=Sa(C);return{x:e.left+c.x,y:e.top+c.y,yBot:e.top+c.yBot}},coordsChar:function(a){var b=Sa(C);return Gb(a.x-b.left,a.y-b.top)},markText:q(cc),setBookmark:function(a){var a=D(a),b=new Fb("bookmark"),c=g(a.line);I.addChange(a.line,1,[Na(c.text,c.markedSpans)],!0);c.markedSpans=(c.markedSpans||[]).concat([{from:a.ch,to:a.ch,marker:b}]);b.lines.push(c);return b},findMarksAt:function(a){var a=D(a),b=[],c=g(a.line).markedSpans;if(c)for(var e=0;e<c.length;++e){var f=c[e];(null==f.from||f.from<= 
    62 a.ch)&&(null==f.to||f.to>=a.ch)&&b.push(f.marker)}return b},setMarker:q(function(a,b,c){"number"==typeof a&&(a=g(wa(a)));a.gutterMarker={text:b,style:c};ma=!0;return a}),clearMarker:q(function(a){"number"==typeof a&&(a=g(wa(a)));a.gutterMarker=null;ma=!0}),setLineClass:q(function(a,b,c){return Hc(a,function(a){if(a.className!=b||a.bgClassName!=c)return a.className=b,a.bgClassName=c,!0})}),hideLine:q(function(a){return bc(a,!0)}),showLine:q(function(a){return bc(a,!1)}),onDeleteLine:function(a,b){if("number"== 
    63 typeof a){if(!e(a))return null;a=g(a)}(a.handlers||(a.handlers=[])).push(b);return a},lineInfo:function(a){if("number"==typeof a){if(!e(a))return null;var b=a,a=g(a);if(!a)return null}else if(b=Fa(a),null==b)return null;var c=a.gutterMarker;return{line:b,handle:a,text:a.text,markerText:c&&c.text,markerClass:c&&c.style,lineClass:a.className,bgClass:a.bgClassName}},getViewport:function(){return{from:F,to:K}},addWidget:function(a,b,c,e,f){var a=ra(D(a)),g=a.yBot,h=a.x;b.style.position="absolute";pa.appendChild(b); 
    64 if("over"==e)g=a.y;else if("near"==e){var e=Math.max(s.offsetHeight,u.height*oa()),i=Math.max(pa.clientWidth,C.clientWidth)-C.offsetLeft;a.yBot+b.offsetHeight>e&&a.y>b.offsetHeight&&(g=a.y-b.offsetHeight);h+b.offsetWidth>i&&(h=i-b.offsetWidth)}b.style.top=g+C.offsetTop+"px";b.style.left=b.style.right="";"right"==f?(h=pa.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==f?h=0:"middle"==f&&(h=(pa.clientWidth-b.offsetWidth)/2),b.style.left=h+C.offsetLeft+"px");c&&Dc(h,g,h+b.offsetWidth,g+b.offsetHeight)}, 
    65 lineCount:function(){return u.size},clipPos:D,getCursor:function(a){null==a&&(a=f.inverted);return{line:(a?f.from:f.to).line,ch:(a?f.from:f.to).ch}},somethingSelected:function(){return!z(f.from,f.to)},setCursor:q(function(a,b,c){null==b&&"number"==typeof a.line?Ca(a.line,a.ch,c):Ca(a,b,c)}),setSelection:q(function(a,b,c){(c?ia:bb)(D(a),D(b||a))}),getLine:function(a){if(e(a))return g(a).text},getLineHandle:function(a){if(e(a))return g(a)},setLine:q(function(a,b){e(a)&&T(b,{line:a,ch:0},{line:a,ch:g(a).text.length})}), 
    66 removeLine:q(function(a){e(a)&&T("",{line:a,ch:0},D({line:a+1,ch:0}))}),replaceRange:q(T),getRange:function(a,b,c){return zc(D(a),D(b),c)},triggerOnKeyDown:q(wc),execCommand:function(a){return Sb[a](B)},moveH:q(function(a,b){var c=0>a?f.from:f.to;if(ka||z(f.from,f.to))c=Ka(a,b);Ca(c.line,c.ch,!0)}),deleteH:q(function(a,b){z(f.from,f.to)?0>a?T("",Ka(a,b),f.to):T("",f.from,Ka(a,b)):T("",f.from,f.to);Ab=!0}),moveV:q(function(a,b){var c=ra(f.inverted?f.from:f.to,!0);null!=Bb&&(c.x=Bb);if("page"==b)var e= 
    67 Math.min(s.clientHeight,window.innerHeight||document.documentElement.clientHeight),e=Gb(c.x,c.y+e*a);else"line"==b&&(e=oa(),e=Gb(c.x,c.y+0.5*e+a*e));"page"==b&&(x.scrollTop+=ra(e,!0).y-c.y);Ca(e.line,e.ch,!0);Bb=c.x}),toggleOverwrite:function(){xb?(xb=!1,S.className=S.className.replace(" CodeMirror-overwrite","")):(xb=!0,S.className+=" CodeMirror-overwrite")},posFromIndex:function(a){var b=0,c;u.iter(0,u.size,function(e){e=e.text.length+1;if(e>a)return c=a,!0;a-=e;++b});return D({line:b,ch:c})},indexFromPos:function(a){if(0> 
    68 a.line||0>a.ch)return 0;var b=a.ch;u.iter(0,a.line,function(a){b+=a.text.length+1});return b},scrollTo:function(a,b){null!=a&&(s.scrollLeft=a);null!=b&&(x.scrollTop=s.scrollTop=b);Aa([])},getScrollInfo:function(){return{x:s.scrollLeft,y:x.scrollTop,height:x.scrollHeight,width:s.scrollWidth}},setSize:function(a,b){function c(a){a=String(a);return/^\d+$/.test(a)?a+"px":a}null!=a&&(U.style.width=c(a));null!=b&&(s.style.height=c(b));B.refresh()},operation:function(a){return q(a)()},compoundChange:function(a){return rc(a)}, 
    69 refresh:function(){Aa(!0,null,sa);x.scrollHeight>sa&&(x.scrollTop=sa)},getInputField:function(){return t},getWrapperElement:function(){return U},getScrollerElement:function(){return s},getGutterElement:function(){return W}},uc,Ub=null,fa="";Fb.prototype.clear=q(function(){for(var a,b,c=0;c<this.lines.length;++c){var e=this.lines[c],f=rb(e.markedSpans,this);null!=f.from&&(a=Fa(e));null!=f.to&&(b=Fa(e));for(var g=e,e=e.markedSpans,h=void 0,i=0;i<e.length;++i)e[i]!=f&&(h||(h=[])).push(e[i]);g.markedSpans= 
    70 h}null!=a&&qa.push({from:a,to:b+1});this.lines.length=0;this.explicitlyCleared=!0});Fb.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var e=this.lines[c],f=rb(e.markedSpans,this);if(null!=f.from||null!=f.to)e=Fa(e),null!=f.from&&(a={line:e,ch:f.from}),null!=f.to&&(b={line:e,ch:f.to})}return"bookmark"==this.type?a:a&&{from:a,to:b}};var ec,Ic,Ua,Kc,Jc=0,gc,hc={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},wb=0,fb;for(fb in Ob)Ob.propertyIsEnumerable(fb)&&!B.propertyIsEnumerable(fb)&& 
    71 (B[fb]=Ob[fb]);for(var mc=0;mc<nc.length;++mc)nc[mc](B);return B}function Tb(a){return"string"==typeof a?ba[a]:a}function pb(a,b,c,e,g){function j(b){var b=Tb(b),c=b[a];if(!1===c)return g&&g(),!0;if(null!=c&&e(c))return!0;if(b.nofallthrough)return g&&g(),!0;b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return j(b);for(var c=0,n=b.length;c<n;++c)if(j(b[c]))return!0;return!1}return b&&j(b)?!0:j(c)}function vc(a){a=Ga[G(a,"keyCode")];return"Ctrl"==a||"Alt"== 
    72 a||"Shift"==a||"Mod"==a}function Va(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},e;for(e in b){var g=b[e];g instanceof Array&&(g=g.concat([]));c[e]=g}return c}function Nc(a,b,c){return a.startState?a.startState(b,c):!0}function Da(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8}function rb(a,b){if(a)for(var c=0;c<a.length;++c){var e=a[c];if(e.marker==b)return e}}function R(a){return"string"==typeof a?a:a.text}function J(a){if("string"==typeof a)return null;for(var a= 
    73 a.markedSpans,b=null,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return!b?a:b.length?b:null}function Na(a,b){return b?{text:a,markedSpans:b}:a}function gb(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c){var e=b[c].marker.lines,g=Nb(e,a);e.splice(g,1)}a.markedSpans=null}}function Pb(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.lines.push(a);a.markedSpans=b}}function Oa(a,b){this.text=a;this.height=1;Pb(this,b)}function Jb(a){this.lines=a;this.parent= 
    74 null;for(var b=0,c=a.length,e=0;b<c;++b)a[b].parent=this,e+=a[b].height;this.height=e}function Ib(a){this.children=a;for(var b=0,c=0,e=0,g=a.length;e<g;++e){var j=a[e],b=b+j.chunkSize(),c=c+j.height;j.parent=this}this.size=b;this.height=c;this.parent=null}function Fa(a){if(null==a.parent)return null;for(var b=a.parent,a=Nb(b.lines,a),c=b.parent;c;b=c,c=c.parent)for(var e=0;c.children[e]!=b;++e)a+=c.children[e].chunkSize();return a}function $b(a,b){var c=0;a:do{for(var e=0,g=a.children.length;e<g;++e){var j= 
    75 a.children[e],m=j.height;if(b<m){a=j;continue a}b-=m;c+=j.chunkSize()}return c}while(!a.lines);e=0;for(g=a.lines.length;e<g;++e){j=a.lines[e].height;if(b<j)break;b-=j}return c+e}function ac(a,b){var c=0;a:do{for(var e=0,g=a.children.length;e<g;++e){var j=a.children[e],m=j.chunkSize();if(b<m){a=j;continue a}b-=m;c+=j.height}return c}while(!a.lines);for(e=0;e<b;++e)c+=a.lines[e].height;return c}function Mb(){this.time=0;this.done=[];this.undone=[];this.compound=0;this.closed=!1}function oc(){jb(this)} 
    76 function Xa(a){a.stop||(a.stop=oc);return a}function E(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function hb(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function jb(a){E(a);hb(a)}function Oc(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));ob&&(a.ctrlKey&&1==b)&&(b=3);return b}function G(a,b){return a.override&&a.override.hasOwnProperty(b)?a.override[b]:a[b]}function r(a,b,c,e){if("function"==typeof a.addEventListener){if(a.addEventListener(b, 
    77 c,!1),e)return function(){a.removeEventListener(b,c,!1)}}else{var g=function(a){c(a||window.event)};a.attachEvent("on"+b,g);if(e)return function(){a.detachEvent("on"+b,g)}}}function kc(){this.id=null}function Ka(a,b,c){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var e=0,g=0;e<b;++e)"\t"==a.charAt(e)?g+=c-g%c:++g;return g}function Sa(a,b){try{var c=a.getBoundingClientRect(),c={top:c.top,left:c.left}}catch(e){c={top:0,left:0}}if(!b)if(null==window.pageYOffset){var g=document.documentElement|| 
    78 document.body.parentNode;null==g.scrollTop&&(g=document.body);c.top+=g.scrollTop;c.left+=g.scrollLeft}else c.top+=window.pageYOffset,c.left+=window.pageXOffset;return c}function Gc(a){for(;La.length<=a;)La.push(H(La)+" ");return La[a]}function H(a){return a[a.length-1]}function z(a,b){return a.line==b.line&&a.ch==b.ch}function L(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function w(a,b,c,e){a=document.createElement(a);c&&(a.className=c);e&&(a.style.cssText=e);if("string"==typeof b)ib(a, 
    79 b);else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function Ia(a){a.innerHTML="";return a}function ib(a,b){fc?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function Nb(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,e=a.length;c<e;++c)if(a[c]==b)return c;return-1}function Cb(a){return/\w/.test(a)||a.toUpperCase()!=a.toLowerCase()||/[\u4E00-\u9FA5]/.test(a)}n.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4, 
    80 keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,onDragEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onViewportChange:null,onGutterClick:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,cursorBlinkRate:530,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null,lineNumberFormatter:function(a){return a}};var Zb= 
    81 /AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ob=Zb||/Mac/.test(navigator.platform);/Win/.test(navigator.platform);var ta=n.modes={},ua=n.mimeModes={};n.defineMode=function(a,b){!n.defaults.mode&&"null"!=a&&(n.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}ta[a]=b};n.defineMIME=function(a,b){ua[a]=b};n.resolveMode=function(a){if("string"==typeof a&&ua.hasOwnProperty(a))a=ua[a];else if("string"== 
    82 typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return n.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};n.getMode=function(a,b){var b=n.resolveMode(b),c=ta[b.name];if(!c)return n.getMode(a,"text/plain");c=c(a,b);if(va.hasOwnProperty(b.name)){var e=va[b.name],g;for(g in e)e.hasOwnProperty(g)&&(c[g]=e[g])}c.name=b.name;return c};n.listModes=function(){var a=[],b;for(b in ta)ta.propertyIsEnumerable(b)&&a.push(b);return a};n.listMIMEs=function(){var a=[],b;for(b in ua)ua.propertyIsEnumerable(b)&& 
    83 a.push({mime:b,mode:ua[b]});return a};var Ob=n.extensions={};n.defineExtension=function(a,b){Ob[a]=b};var nc=[];n.defineInitHook=function(a){nc.push(a)};var va=n.modeExtensions={};n.extendMode=function(a,b){var c=va.hasOwnProperty(a)?va[a]:va[a]={},e;for(e in b)b.hasOwnProperty(e)&&(c[e]=b[e])};var Sb=n.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),e=!z(b,c);!e&&a.getLine(b.line).length==b.ch?a.replaceRange("", 
    84 b,{line:b.line+1,ch:0}):a.replaceRange("",b,e?c:{line:b.line})},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b})},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.setCursor(0,0,!0)},goDocEnd:function(a){a.setSelection({line:a.lineCount()-1},null,!0)},goLineStart:function(a){a.setCursor(a.getCursor().line,0,!0)},goLineStartSmart:function(a){var b=a.getCursor(),c=a.getLine(b.line),c=Math.max(0,c.search(/\S/));a.setCursor(b.line, 
    85 b.ch<=c&&b.ch?0:c,!0)},goLineEnd:function(a){a.setSelection({line:a.getCursor().line},null,!0)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1, 
    86 "word")},delCharLeft:function(a){a.deleteH(-1,"char")},delCharRight:function(a){a.deleteH(1,"char")},delWordLeft:function(a){a.deleteH(-1,"word")},delWordRight:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t","end")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection("\t","end")}, 
    87 transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);0<b.ch&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),{line:b.line,ch:b.ch-1},{line:b.line,ch:b.ch+1})},newlineAndIndent:function(a){a.replaceSelection("\n","end");a.indentLine(a.getCursor().line)},toggleOverwrite:function(a){a.toggleOverwrite()}},ba=n.keyMap={};ba.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown", 
    88 Delete:"delCharRight",Backspace:"delCharLeft",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};ba.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight", 
    89 "Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};ba.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight", 
    90 "Alt-Delete":"delWordRight","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]};ba["default"]=ob?ba.macDefault:ba.pcDefault;ba.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageUp","Shift-Ctrl-V":"goPageDown", 
    91 "Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};n.isModifierKey=vc;n.fromTextArea=function(a,b){function c(){a.value=w.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);if(null==b.autofocus){var e=document.body;try{e=document.activeElement}catch(g){}b.autofocus=e==a||null!=a.getAttribute("autofocus")&&e==document.body}if(a.form){var j=r(a.form,"submit",c,!0);if("function"== 
    92 typeof a.form.submit){var m=a.form.submit;a.form.submit=function Qb(){c();a.form.submit=m;a.form.submit();a.form.submit=Qb}}}a.style.display="none";var w=n(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);w.save=c;w.getTextArea=function(){return a};w.toTextArea=function(){c();a.parentNode.removeChild(w.getWrapperElement());a.style.display="";a.form&&(j(),"function"==typeof a.form.submit&&(a.form.submit=m))};return w};var db=/gecko\/\d{7}/i.test(navigator.userAgent),Ha=/MSIE \d/.test(navigator.userAgent), 
    93 Hb=/MSIE [1-7]\b/.test(navigator.userAgent),fc=/MSIE [1-8]\b/.test(navigator.userAgent),Sc=Ha&&5==document.documentMode,ub=/WebKit\//.test(navigator.userAgent),y=/Chrome\//.test(navigator.userAgent),ya=/Opera\//.test(navigator.userAgent),pc=/Apple Computer/.test(navigator.vendor),jc=/KHTML\//.test(navigator.userAgent),Tc=/Mac OS X 10\D([7-9]|\d\d)\D/.test(navigator.userAgent);n.copyState=Va;n.startState=Nc;n.innerMode=function(a,b){for(;a.innerMode;)var c=a.innerMode(b),b=c.state,a=c.mode;return c|| 
    94 {mode:a,state:b}};Da.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos; 
    95 return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){return Ka(this.string,this.start,this.tabSize)},indentation:function(){return Ka(this.string,null,this.tabSize)},match:function(a,b,c){if("string"==typeof a){if((c?this.string.toLowerCase():this.string).indexOf(c?a.toLowerCase():a,this.pos)==this.pos)return!1!==b&&(this.pos+=a.length),!0}else{if((a= 
    96 this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)}};n.StringStream=Da;var Wa=" ";db||Ha&&!Hb?Wa="\u200b":ya&&(Wa="");Oa.prototype={update:function(a,b){this.text=a;this.stateAfter=this.styles=null;gb(this);Pb(this,b)},highlight:function(a,b,c){var c=new Da(this.text,c),e=this.styles||(this.styles=[]),g=e.length=0;for(""==this.text&&a.blankLine&&a.blankLine(b);!c.eol();){var j= 
    97 a.token(c,b),m=c.current();c.start=c.pos;g&&e[g-1]==j?e[g-2]+=m:m&&(e[g++]=m,e[g++]=j);if(5E3<c.pos){e[g++]=this.text.slice(c.pos);e[g++]=null;break}}},process:function(a,b,c){c=new Da(this.text,c);for(""==this.text&&a.blankLine&&a.blankLine(b);!c.eol()&&5E3>=c.pos;)a.token(c,b),c.start=c.pos},getTokenAt:function(a,b,c,e){for(c=new Da(this.text,c);c.pos<e&&!c.eol();){c.start=c.pos;var g=a.token(c,b)}return{start:c.start,end:c.pos,string:c.current(),className:g||null,state:b}},indentation:function(a){return Ka(this.text, 
    98 null,a)},getContent:function(a,b,c){function e(b,c,e){if(c){j&&(Ha&&" "==c.charAt(0))&&(c="\u00a0"+c.slice(1));j=!1;if(n.test(c))for(var g=document.createDocumentFragment(),r=0;;){n.lastIndex=r;var y=n.exec(c),z=y?y.index-r:c.length-r;z&&(g.appendChild(document.createTextNode(c.slice(r,r+z))),m+=z);if(!y)break;r+=z+1;"\t"==y[0]?(y=a-m%a,g.appendChild(w("span",Gc(y),"cm-tab")),m+=y):(z=w("span","\u2022","cm-invalidchar"),z.title="\\u"+y[0].charCodeAt(0).toString(16),g.appendChild(z),m+=1)}else{m+= 
    99 c.length;var g=document.createTextNode(c)}e?b.appendChild(w("span",[g],e)):b.appendChild(g)}}function g(a){return!a?null:"cm-"+a.replace(/ +/g," cm-")}var j=!0,m=0,n=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g,r=w("pre"),z=e;if(null!=b)var y=0,E=r.anchor=w("span"),z=function(a,g,j){var m=g.length;if(b>=y&&b<y+m){var n=b-y;if(n&&(e(a,g.slice(0,n),j),c)){var r=g.slice(n-1,n+1);wa.test(r)?a.appendChild(w("wbr")):!Hb&&/\w\w/.test(r)&&a.appendChild(document.createTextNode("\u200d"))}a.appendChild(E); 
    100 e(E,ya?g.slice(n,n+1):g.slice(n),j);ya&&e(a,g.slice(n+1),j);b--;y+=m}else y+=m,e(a,g,j),y==b&&y==G?(ib(E,Wa),a.appendChild(E)):y>b+10&&/\s/.test(g)&&(z=function(){})};var L=this.styles,Q=this.text,M=this.markedSpans,G=Q.length;if(!Q&&null==b)z(r," ");else if(!M||!M.length)for(M=Q=0;M<G;Q+=2){var N=L[Q],R=L[Q+1],$=N.length;M+$>G&&(N=N.slice(0,G-M));M+=$;z(r,N,g(R))}else{M.sort(function(a,b){return a.from-b.from});for(var Q=N=0,$="",Y=M[0].from||0,J=[],T=0;N<G;){if(Y==N){for(Y=void 0;T<M.length&&((Y= 
    101 M[T]).from==N||null==Y.from);)"range"==Y.marker.type&&J.push(Y),++T;for(var Y=T<M.length?M[T].from:Infinity,P=0;P<J.length;++P){var ea=J[P].to;null==ea&&(ea=Infinity);ea==N?J.splice(P--,1):Y=Math.min(ea,Y)}}for(P=Math.min(G,Y);;){if($){for(var ea=N+$.length,H=R,ba=0;ba<J.length;++ba){var da=J[ba],H=(H?H+" ":"")+da.marker.style;da.marker.endStyle&&da.to===Math.min(ea,P)&&(H+=" "+da.marker.endStyle);da.marker.startStyle&&da.from===N&&(H+=" "+da.marker.startStyle)}z(r,ea>P?$.slice(0,P-N):$,H);if(ea>= 
    102 P){$=$.slice(P-N);N=P;break}N=ea}$=L[Q++];R=g(L[Q++])}}}return r},cleanUp:function(){this.parent=null;gb(this)}};Jb.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var e=a,g=a+b;e<g;++e){var j=this.lines[e];this.height-=j.height;j.cleanUp();if(j.handlers)for(var m=0;m<j.handlers.length;++m)c.push(j.handlers[m])}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c;this.lines= 
    103 this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));a=0;for(c=b.length;a<c;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Ib.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var e=0;e<this.children.length;++e){var g=this.children[e],j=g.chunkSize();if(a<j){var m=Math.min(b,j-a),n=g.height;g.remove(a,m,c);this.height-=n-g.height;j==m&&(this.children.splice(e--,1),g.parent=null);if(0==(b-=m))break;a=0}else a-= 
    104 j}25>this.size-b&&(a=[],this.collapse(a),this.children=[new Jb(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insert:function(a,b){for(var c=0,e=0,g=b.length;e<g;++e)c+=b[e].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length;this.height+=c;for(var e=0,g=this.children.length;e<g;++e){var j=this.children[e],m=j.chunkSize();if(a<=m){j.insertHeight(a,b,c);if(j.lines&&50<j.lines.length){for(;50< 
    105 j.lines.length;)a=j.lines.splice(j.lines.length-25,25),a=new Jb(a),j.height-=a.height,this.children.splice(e+1,0,a),a.parent=this;this.maybeSpill()}break}a-=m}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Ib(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=Nb(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Ib(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length); 
    106 a.parent.maybeSpill()}},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var e=0,g=this.children.length;e<g;++e){var j=this.children[e],m=j.chunkSize();if(a<m){m=Math.min(b,m-a);if(j.iterN(a,m,c))return!0;if(0==(b-=m))break;a=0}else a-=m}}};Mb.prototype={addChange:function(a,b,c){this.undone.length=0;var e=+new Date,g=H(this.done),j=g&&H(g),m=e-this.time;if(g&&!this.closed&&this.compound)g.push({start:a,added:b,old:c});else if(400<m||!j||this.closed||j.start>a+c.length||j.start+ 
    107 j.added<a)this.done.push([{start:a,added:b,old:c}]),this.closed=!1;else{for(var g=Math.max(0,j.start-a),m=Math.max(0,a+c.length-(j.start+j.added)),n=g;0<n;--n)j.old.unshift(c[n-1]);for(n=m;0<n;--n)j.old.push(c[c.length-n]);g&&(j.start=a);j.added+=b-(c.length-g-m)}this.time=e},startCompound:function(){this.compound++||(this.closed=!0)},endCompound:function(){--this.compound||(this.closed=!0)}};n.e_stop=jb;n.e_preventDefault=E;n.e_stopPropagation=hb;n.connect=r;kc.prototype={set:function(a,b){clearTimeout(this.id); 
    108 this.id=setTimeout(b,a)}};var sc=n.Pass={toString:function(){return"CodeMirror.Pass"}},lc;if(fc)lc=!1;else{var Ea=w("div");lc="draggable"in Ea||"dragDrop"in Ea}Ea=w("textarea");Ea.value="foo\nbar";Ea.value.indexOf("\r");var wa=/^$/;db?wa=/$'/:pc?wa=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:y&&(wa=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var La=[""],kb=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],e=a.length;b<=e;){var g=a.indexOf("\n",b);-1==g&&(g= 
    109 a.length);var j=a.slice(b,"\r"==a.charAt(g-1)?g-1:g),m=j.indexOf("\r");-1!=m?(c.push(j.slice(0,m)),b+=m+1):(c.push(j),b=g+1)}return c}:function(a){return a.split(/\r\n?|\n/)};n.splitLines=kb;var Rc=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:0!=b.compareEndPoints("StartToEnd",b)};n.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}); 
    110 n.defineMIME("text/plain","null");var Ga={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left", 
    111 63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};n.keyNames=Ga;for(y=0;10>y;y++)Ga[y+48]=String(y);for(y=65;90>=y;y++)Ga[y]=String.fromCharCode(y);for(y=1;12>=y;y++)Ga[y+111]=Ga[y+63235]="F"+y;n.version="2.35";return n}(); 
     1// CodeMirror version 3.0rc1 
     2window.CodeMirror=function(){function m(a,b){if(!(this instanceof m))return new m(a,b);this.options=b=b||{};for(var c in sb)!b.hasOwnProperty(c)&&sb.hasOwnProperty(c)&&(b[c]=sb[c]);tb(b);c={};var d=c.input=n("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");d.setAttribute("wrap","off");d.setAttribute("autocorrect","off");d.setAttribute("autocapitalize","off");c.inputDiv=n("div",[d],null,"overflow: hidden; position: relative; width: 3px; height: 0px;"); 
     3c.scrollbarH=n("div",[n("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");c.scrollbarV=n("div",[n("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");c.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler");c.lineDiv=n("div");c.selectionDiv=n("div",null,null,"position: relative; z-index: 1");c.cursor=n("pre","\u00a0","CodeMirror-cursor");c.otherCursor=n("pre","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor");c.measure=n("div",null,"CodeMirror-measure");c.lineSpace=n("div",[c.measure, 
     4c.selectionDiv,c.lineDiv,c.cursor,c.otherCursor],null,"position: relative; outline: none");c.mover=n("div",[n("div",[c.lineSpace],"CodeMirror-lines")],null,"position: relative");c.sizer=n("div",[c.mover],"CodeMirror-sizer");c.heightForcer=n("div","\u00a0",null,"position: absolute; height: "+qa+"px");c.gutters=n("div",null,"CodeMirror-gutters");c.lineGutter=null;var e=n("div",[c.sizer,c.heightForcer,c.gutters],null,"position: relative; min-height: 100%");c.scroller=n("div",[e],"CodeMirror-scroll"); 
     5c.scroller.setAttribute("tabIndex","-1");c.wrapper=n("div",[c.inputDiv,c.scrollbarH,c.scrollbarV,c.scrollbarFiller,c.scroller],"CodeMirror");ra&&(c.gutters.style.zIndex=-1,c.scroller.style.paddingRight=0);a.appendChild?a.appendChild(c.wrapper):a(c.wrapper);ub&&(d.style.width="0px");X||(c.scroller.draggable=!0);vb?(c.inputDiv.style.height="1px",c.inputDiv.style.position="absolute"):ra&&(c.scrollbarH.style.minWidth=c.scrollbarV.style.minWidth="18px");c.viewOffset=c.showingFrom=c.showingTo=c.lastSizeC= 
     60;c.lineNumWidth=c.lineNumInnerWidth=c.lineNumChars=null;c.prevInput="";c.alignWidgets=!1;c.pollingFast=!1;c.poll=new wb;c.draggingText=!1;c.cachedCharWidth=c.cachedTextHeight=null;c.measureLineCache=[];c.measureLineCachePos=0;c.inaccurateSelection=!1;c.pasteIncoming=!1;c=this.display=c;c.wrapper.CodeMirror=this;Yb(this);b.autofocus&&G(this);d=new Ka([new La([sa("",null,aa(c))])]);this.view={doc:d,frontier:0,highlight:new wb,sel:{from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1,shift:!1},scrollTop:0, 
     7scrollLeft:0,overwrite:!1,focused:!1,maxLine:w(d,0),maxLineLength:0,maxLineChanged:!1,suppressEdits:!1,goalColumn:null,cantEdit:!1};this.nextOpId=0;Ma(this);Zb(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");this.setValue(b.value||"");ga&&setTimeout(M(ha,this,!0),20);this.view.history=xb();var f=this,d=function(){f.view.focused&&setTimeout(M(G,f),0)},e=function(a){(!f.options.onDragEvent||!f.options.onDragEvent(f,ta(a)))&&Na(a)},g=function(){h.inaccurateSelection&&(h.prevInput= 
     8"",h.inaccurateSelection=!1,h.input.value=f.getSelection(),$b(h.input))},h=f.display;v(h.scroller,"mousedown",s(f,cd));v(h.scroller,"dblclick",s(f,y));v(h.lineSpace,"selectstart",function(a){ac(h,a)||y(a)});ba||v(h.scroller,"contextmenu",function(a){bc(f,a)});v(h.scroller,"scroll",function(){yb(f,h.scroller.scrollTop);zb(f,h.scroller.scrollLeft);ia(f,"scroll",f)});v(h.scrollbarV,"scroll",function(){yb(f,h.scrollbarV.scrollTop)});v(h.scrollbarH,"scroll",function(){zb(f,h.scrollbarH.scrollLeft)});v(h.scroller, 
     9"mousewheel",function(a){cc(f,a)});v(h.scroller,"DOMMouseScroll",function(a){cc(f,a)});v(h.scrollbarH,"mousedown",d);v(h.scrollbarV,"mousedown",d);v(h.wrapper,"scroll",function(){h.wrapper.scrollTop=h.wrapper.scrollLeft=0});v(window,"resize",function j(){h.cachedCharWidth=h.cachedTextHeight=null;Oa(f);h.wrapper.parentNode?P(f,!0):Q(window,"resize",j)});v(h.input,"keyup",s(f,function(a){if((!f.options.onKeyEvent||!f.options.onKeyEvent(f,ta(a)))&&16==D(a,"keyCode"))f.view.sel.shift=null}));v(h.input, 
     10"input",M(ua,f));v(h.input,"keydown",s(f,dc));v(h.input,"keypress",s(f,dd));v(h.input,"focus",M(ca,f));v(h.input,"blur",M(Ab,f));f.options.dragDrop&&(v(h.scroller,"dragstart",function(a){var b=f.getSelection();a.dataTransfer.setData("Text",b);a.dataTransfer.setDragImage&&a.dataTransfer.setDragImage(n("img"),0,0)}),v(h.scroller,"dragenter",e),v(h.scroller,"dragover",e),v(h.scroller,"drop",s(f,ed)));v(h.scroller,"paste",function(){G(f);ua(f)});v(h.input,"paste",function(){h.pasteIncoming=!0;ua(f)}); 
     11v(h.input,"cut",g);v(h.input,"copy",g);vb&&v(h.sizer,"mouseup",function(){document.activeElement==h.input&&h.input.blur();G(f)});var i;try{i=document.activeElement==c.input}catch(l){}i||b.autofocus?setTimeout(M(ca,this),20):Ab(this);s(this,function(){for(var a in ja)if(ja.propertyIsEnumerable(a))ja[a](this,b[a],ec);for(a=0;a<Bb.length;++a)Bb[a](this)})()}function Ma(a){var b=a.view.doc;a.view.mode=m.getMode(a.options,a.options.mode);b.iter(0,b.size,function(a){a.stateAfter=null});a.view.frontier= 
     120;Pa(a,100)}function Zb(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-")}function va(a){Yb(a);P(a,!0)}function Yb(a){var b=a.display.gutters,c=a.options.gutters;Qa(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(n("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function Ra(a,b){if(0==b.height)return 0; 
     13for(var c=b.text.length,d,e=b;d=wa(e);)d=d.find(),e=w(a,d.from.line),c+=d.from.ch-d.to.ch;for(e=b;d=Sa(e);)d=d.find(),c-=e.text.length-d.from.ch,e=w(a,d.to.line),c+=e.text.length-d.to.ch;return c}function fc(a){a.maxLine=w(a.doc,0);a.maxLineLength=Ra(a.doc,a.maxLine);a.maxLineChanged=!0;a.doc.iter(1,a.doc.size,function(b){var c=Ra(a.doc,b);c>a.maxLineLength&&(a.maxLineLength=c,a.maxLine=b)})}function tb(a){for(var b=!1,c=0;c<a.gutters.length;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers? 
     14b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function gc(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top);d=Math.floor(d-a.lineSpace.offsetTop);a=Math.ceil(d+e);return{from:Ta(b,d),to:Ta(b,a)}}function hc(a,b){if(a.alignWidgets||a.gutters.firstChild){var c=a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left;null!=b&&(c+=a.scroller.scrollLeft-b);for(var d=a.gutters.offsetWidth, 
     15e=c+"px",f=a.lineDiv.firstChild;f;f=f.nextSibling)if(f.alignable)for(var g=0,h=f.alignable;g<h.length;++g)h[g].style.left=e;a.gutters.style.left=c+d+"px"}}function P(a,b,c){var d,e,f,g=a.display.showingFrom,h=a.display.showingTo;a:{var i=b,b=a.display,l=a.view.doc;if(b.wrapper.clientWidth){var k=gc(b,l,c);if(!(!0!==i&&0==i.length&&k.from>b.showingFrom&&k.to<b.showingTo)){if(c=i)if(a.options.lineNumbers){var c=String(a.options.lineNumberFormatter(a.view.doc.size-1+a.options.firstLineNumber)),j=a.display; 
     16if(c.length!=j.lineNumChars){var p=j.measure.appendChild(n("div",[n("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),q=p.firstChild.offsetWidth,p=p.offsetWidth-q;j.lineGutter.style.width="";j.lineNumInnerWidth=Math.max(q,j.lineGutter.offsetWidth-p);j.lineNumWidth=j.lineNumInnerWidth+p;j.lineNumChars=j.lineNumInnerWidth?c.length:-1;j.lineGutter.style.width=j.lineNumWidth+"px";c=!0}else c=!1}else c=!1;c&&(i=!0);b.sizer.style.marginLeft=b.scrollbarH.style.left=b.gutters.offsetWidth+"px";if(!0!== 
     17i&&xa)for(q=0;q<i.length;++q)for(j=i[q];c=wa(w(l,j.from));)c=c.find().from.line,j.diff&&(j.diff-=j.from-c),j.from=c;j=!0===i?0:Infinity;if(a.options.lineNumbers&&i&&!0!==i)for(q=0;q<i.length;++q)if(i[q].diff){j=i[q].from;break}c=Math.max(k.from-a.options.viewportMargin,0);k=Math.min(l.size,k.to+a.options.viewportMargin);b.showingFrom<c&&20>c-b.showingFrom&&(c=b.showingFrom);b.showingTo>k&&20>b.showingTo-k&&(k=Math.min(l.size,b.showingTo));if(xa)for(c=H(Ua(l,w(l,c)));k<l.size&&Y(w(l,k));)++k;if(!0=== 
     18i)i=[];else{for(var q=[{from:b.showingFrom,to:b.showingTo}],p=0,J=i.length||0;p<J;++p){for(var R=i[p],t=[],u=R.diff||0,m=0,s=q.length;m<s;++m){var E=q[m];R.to<=E.from&&R.diff?t.push({from:E.from+u,to:E.to+u}):R.to<=E.from||R.from>=E.to?t.push(E):(R.from>E.from&&t.push({from:E.from,to:R.from}),R.to<E.to&&t.push({from:R.to+u,to:E.to+u}))}q=t}i=q}for(var N=i,q=i=0;q<N.length;++q)p=N[q],p.from<c&&(p.from=c),p.to>k&&(p.to=k),p.from>=p.to?N.splice(q--,1):i+=p.to-p.from;if(!(i==k-c&&c==b.showingFrom&&k== 
     19b.showingTo)){N.sort(function(a,b){return a.from-b.from});i<0.7*(k-c)&&(b.lineDiv.style.display="none");for(var i=c,q=k,fd=j,v=function(b){var c=b.nextSibling;X&&ka&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):A.removeChild(b);return c},j=a.display,r={},z={},p=j.gutters.firstChild,J=0;p;p=p.nextSibling,++J)r[a.options.gutters[J]]=p.offsetLeft,z[a.options.gutters[J]]=p.offsetWidth;d=j.scroller.getBoundingClientRect().left-j.sizer.getBoundingClientRect().left;e=j.gutters.offsetWidth; 
     20f=j.wrapper.clientWidth;var j=a.display,x=a.options.lineNumbers;!N.length&&(!ga&&(!X||!a.display.currentWheelTarget))&&Qa(j.lineDiv);var A=j.lineDiv,K=A.firstChild,y=N.shift(),B=i;for(a.view.doc.iter(i,q,function(b){y&&y.to==B&&(y=N.shift());if(Y(b))0!=b.height&&Z(b,0);else if(y&&y.from<=B&&y.to>B){for(;K.lineObj!=b;)K=v(K);x&&(fd<=B&&K.lineNumber)&&jc(K.lineNumber,String(a.options.lineNumberFormatter(B+a.options.firstLineNumber)));K=K.nextSibling}else{var c;var g=B;c=kc(a,b);var h=b.gutterMarkers, 
     21i=a.display;if(a.options.lineNumbers||h||b.bgClass||b.wrapClass||b.widgets&&b.widgets.length){var j=n("div",null,b.wrapClass,"position: relative");if(a.options.lineNumbers||h){var k=j.appendChild(n("div",null,null,"position: absolute; left: "+d+"px"));j.alignable=[k];if(a.options.lineNumbers&&(!h||!h["CodeMirror-linenumbers"]))j.lineNumber=k.appendChild(n("div",String(a.options.lineNumberFormatter(g+a.options.firstLineNumber)),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r["CodeMirror-linenumbers"]+ 
     22"px; width: "+i.lineNumInnerWidth+"px"));if(h)for(g=0;g<a.options.gutters.length;++g){var i=a.options.gutters[g],l=h.hasOwnProperty(i)&&h[i];l&&k.appendChild(n("div",[l],"CodeMirror-gutter-elt","left: "+r[i]+"px; width: "+z[i]+"px"))}}b.bgClass&&j.appendChild(n("div","\u00a0",b.bgClass+" CodeMirror-linebackground"));j.appendChild(c);if(b.widgets){h=0;for(g=b.widgets;h<g.length;++h){i=g[h];l=n("div",[i.node],"CodeMirror-linewidget");l.widget=i;if(i.noHScroll){(j.alignable||(j.alignable=[])).push(l); 
     23var p=f;l.style.left=d+"px";i.coverGutter||(p-=e,l.style.paddingLeft=e+"px");l.style.width=p+"px"}i.coverGutter&&(l.style.zIndex=5,l.style.position="relative",i.noHScroll||(l.style.marginLeft=-e+"px"));i.above?j.insertBefore(l,a.options.lineNumbers&&0!=b.height?k:c):j.appendChild(l)}}ra&&(j.style.zIndex=2);c=j}A.insertBefore(c,K);c.lineObj=b}++B});K;)K=v(K);b.lineDiv.style.display="";if(c!=b.showingFrom||k!=b.showingTo||b.lastSizeC!=b.wrapper.clientHeight)b.lastSizeC=b.wrapper.clientHeight;b.showingFrom= 
     24c;b.showingTo=k;Pa(a,100);k=b.lineDiv.offsetTop;for(j=b.lineDiv.firstChild;j;j=j.nextSibling)j.lineObj&&(ra?(q=j.offsetTop+j.offsetHeight,i=q-k,k=q):(i=j.getBoundingClientRect(),i=i.bottom-i.top),q=j.lineObj.height-i,2>i&&(i=aa(b)),(0.001<q||-0.001>q)&&Z(j.lineObj,i));b.viewOffset=ya(a,w(l,c));b.mover.style.top=b.viewOffset+"px";b=!0;break a}}}else b.showingFrom=b.showingTo=b.viewOffset=0;b=void 0}b&&(la(a,a,"update",a),(a.display.showingFrom!=g||a.display.showingTo!=h)&&la(a,a,"viewportChange",a, 
     25a.display.showingFrom,a.display.showingTo));lc(a);g=a.display;h=a.view.doc.height+2*g.lineSpace.offsetTop;g.sizer.style.minHeight=g.heightForcer.style.top=h+"px";h=Math.max(h,g.scroller.scrollHeight);l=g.scroller.scrollWidth>g.scroller.clientWidth;(c=h>g.scroller.clientHeight)?(g.scrollbarV.style.display="block",g.scrollbarV.style.bottom=l?Va(g.measure)+"px":"0",g.scrollbarV.firstChild.style.height=h-g.scroller.clientHeight+g.scrollbarV.clientHeight+"px"):g.scrollbarV.style.display="";l?(g.scrollbarH.style.display= 
     26"block",g.scrollbarH.style.right=c?Va(g.measure)+"px":"0",g.scrollbarH.firstChild.style.width=g.scroller.scrollWidth-g.scroller.clientWidth+g.scrollbarH.clientWidth+"px"):g.scrollbarH.style.display="";l&&c?(g.scrollbarFiller.style.display="block",g.scrollbarFiller.style.height=g.scrollbarFiller.style.width=Va(g.measure)+"px"):g.scrollbarFiller.style.display="";gd&&0===Va(g.measure)&&(g.scrollbarV.style.minWidth=g.scrollbarH.style.minHeight=hd?"18px":"12px");return b}function S(a){return a.sel.inverted? 
     27a.sel.from:a.sel.to}function lc(a){var b;if(z(a.view.sel.from,a.view.sel.to)){b=a.display;var c=T(a,a.view.sel.from,"div");b.cursor.style.left=c.left+"px";b.cursor.style.top=c.top+"px";b.cursor.style.height=Math.max(0,c.bottom-c.top)*a.options.cursorHeight+"px";b.cursor.style.display="";b.selectionDiv.style.display="none";c.other?(b.otherCursor.style.display="",b.otherCursor.style.left=c.other.left+"px",b.otherCursor.style.top=c.other.top+"px",b.otherCursor.style.height=0.85*(c.other.bottom-c.other.top)+ 
     28"px"):b.otherCursor.style.display="none";b=c}else{var d=function(a,b,c,d){0>b&&(b=0);g.appendChild(n("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?h-a:c)+"px; height: "+(d-b)+"px"))},c=function(b,c,f,g){var j=w(e,b),l=j.text.length,k=g?Infinity:-Infinity;var p=U(j),m=c||0,n=null==f?l:f,s=function(e,p,m){var n=Wa(a,{line:b,ch:"rtl"==m?p-1:e},"div",j),m=Wa(a,{line:b,ch:"rtl"==m?e:p-1},"div",j),s=n.left,N=m.right;3<m.top-n.top&&(d(s,n.top,null,n.bottom), 
     29s=i,n.bottom<m.top&&d(s,n.bottom,null,m.top));null==f&&p==l&&(N=h);null==c&&0==e&&(s=i);k=g?Math.min(m.top,k):Math.max(m.bottom,k);s<i+1&&(s=i);d(s,m.top,N-s,m.bottom)};if(p)for(var v=0;v<p.length;++v){var r=p[v];r.from<n&&r.to>m&&s(Math.max(r.from,m),Math.min(r.to,n),1==r.level?"rtl":"ltr")}else s(m,n,"ltr");return k};b=a.display;var e=a.view.doc,f=a.view.sel,g=document.createDocumentFragment(),h=b.lineSpace.offsetWidth,i=mc(a.display);if(f.from.line==f.to.line)c(f.from.line,f.from.ch,f.to.ch);else{for(var l= 
     30w(e,f.from.line),k=l,j=[f.from.line,f.from.ch],p;k=Sa(k);){k=k.find();j.push(k.from.ch,k.to.line,k.to.ch);if(k.to.line==f.to.line){j.push(f.to.ch);p=!0;break}k=w(e,k.to.line)}if(p)for(f=0;f<j.length;f+=3)c(j[f],j[f+1],j[f+2]);else j=w(e,f.to.line),l=f.from.ch?c(f.from.line,f.from.ch,null,!1):ya(a,l)-b.viewOffset,c=f.to.ch?c(f.to.line,wa(j)?null:0,f.to.ch,!0):ya(a,j)-b.viewOffset,l<c&&d(i,l,null,c)}da(b.selectionDiv,g);b.cursor.style.display=b.otherCursor.style.display="none";b.selectionDiv.style.display= 
     31"";b=T(a,S(a.view),"div")}c=a.display;f=c.wrapper.getBoundingClientRect();l=c.lineDiv.getBoundingClientRect();c.inputDiv.style.top=Math.max(0,Math.min(c.wrapper.clientHeight-10,b.top+l.top-f.top))+"px";c.inputDiv.style.left=Math.max(0,Math.min(c.wrapper.clientWidth-10,b.left+l.left-f.left))+"px"}function Xa(a){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="";b.blinker=setInterval(function(){b.cursor.style.visibility=b.otherCursor.style.visibility= 
     32(c=!c)?"":"hidden"},a.options.cursorBlinkRate)}function Pa(a,b){a.view.frontier<a.display.showingTo&&a.view.highlight.set(b,M(id,a))}function id(a){var b=a.view,c=b.doc;if(!(b.frontier>=a.display.showingTo)){var d=+new Date+a.options.workTime,e=ma(b.mode,za(a,b.frontier)),f=[],g;c.iter(b.frontier,Math.min(c.size,a.display.showingTo+500),function(c){b.frontier>=a.display.showingFrom?(nc(a,c,e)&&b.frontier>=a.display.showingFrom&&(g&&g.end==b.frontier?g.end++:f.push(g={start:b.frontier,end:b.frontier+ 
     331})),c.stateAfter=ma(b.mode,e)):(oc(a,c,e),c.stateAfter=0==b.frontier%5?ma(b.mode,e):null);++b.frontier;if(+new Date>d)return Pa(a,a.options.workDelay),!0});f.length&&s(a,function(){for(var a=0;a<f.length;++a)$(this,f[a].start,f[a].end)})()}}function za(a,b){var c=a.view,d;a:{for(var e,f,g=a.view.doc,h=b,i=b-100;h>i;--h){if(0==h){d=0;break a}var l=w(g,h-1);if(l.stateAfter){d=h;break a}l=na(l.text,null,a.options.tabSize);if(null==f||e>l)f=h-1,e=l}d=f}var k=d&&w(c.doc,d-1).stateAfter,k=k?ma(c.mode, 
     34k):pc(c.mode);c.doc.iter(d,b,function(e){oc(a,e,k);e.stateAfter=d==b-1||0==d%5||d>=c.showingFrom&&d<c.showingTo?ma(c.mode,k):null;++d});return k}function mc(a){return da(a.measure,n("pre")).appendChild(n("span","x")).offsetLeft}function Cb(a,b,c,d){d=d||Db(a,b);a=-1;for(b=c;;b+=a){var e=d[b];if(e)break;0>a&&0==b&&(a=1)}return{left:b<c?e.right:e.left,right:b>c?e.left:e.right,top:e.top,bottom:e.bottom}}function Db(a,b){for(var c=a.display,d=a.display.measureLineCache,e=0;e<d.length;++e){var f=d[e]; 
     35if(f.text==b.text&&f.markedSpans==b.markedSpans&&c.scroller.clientWidth==f.width)return f.measure}var e=a.display,g=qc(b.text.length),h=kc(a,b,g);da(e.measure,h);for(var i=e.lineDiv.getBoundingClientRect(),f=[],e=qc(b.text.length),l=h.offsetHeight,h=0;h<g.length;++h)if(g[h]){for(var k=g[h].getBoundingClientRect(),j=Math.max(0,k.top-i.top),p=Math.min(k.bottom-i.top,l),q=0;q<f.length;q+=2){var J=f[q],m=f[q+1];if(!(J>p||m<j))if(J<=j&&m>=p||j<=J&&p>=m||Math.min(p,m)-Math.max(j,J)>=p-j>>1){f[q]=Math.min(j, 
     36J);f[q+1]=Math.max(p,m);break}}q==f.length&&f.push(j,p);e[h]={left:k.left-i.left,right:k.right-i.left,top:q}}for(h=0;h<e.length;++h)if(g=e[h])i=g.top,g.top=f[i],g.bottom=f[i+1];f={text:b.text,width:c.scroller.clientWidth,markedSpans:b.markedSpans,measure:e};16==d.length?d[++c.measureLineCachePos%16]=f:d.push(f);return e}function Oa(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0}function rc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f= 
     37b.widgets[e].node.offsetHeight;c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=ya(a,b);"local"!=d&&(b-=a.display.viewOffset);"page"==d&&(a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+(window.pageYOffset||(document.documentElement||document.body).scrollTop),a=a.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=a,c.right+=a);c.top+=b;c.bottom+=b;return c}function Wa(a,b,c,d){d||(d=w(a.view.doc,b.line));return rc(a,d,Cb(a,d,b.ch),c)}function T(a, 
     38b,c,d,e){function f(b,f){var g=Cb(a,d,b,e);f?g.left=g.right:g.right=g.left;return rc(a,d,g,c)}d=d||w(a.view.doc,b.line);e||(e=Db(a,d));var g=U(d),b=b.ch;if(!g)return f(b);for(var h,i,l=g[0].level,k=0;k<g.length;++k){var j=g[k],p=j.level%2,q;if(j.from<b&&j.to>b)return f(b,p);var m=p?j.from:j.to;if((p?j.to:j.from)==b)j=k&&j.level<(q=g[k-1]).level?f(q.level%2?q.from:q.to-1,!0):f(p&&j.from!=j.to?b-1:b),p==l?h=j:i=j;else if(m==b&&(q=k<g.length-1&&g[k+1],p||!(q&&q.from==q.to)))j=q&&j.level<q.level?f(q.level% 
     392?q.to-1:q.from):f(p?b:b-1,!0),p==l?h=j:i=j}l&&!b&&(i=f(g[0].to-1));if(!h)return i;i&&(h.other=i);return h}function Eb(a,b,c){var d=a.view.doc,c=c+a.display.viewOffset;if(0>c)return{line:0,ch:0,outside:!0};var e=Ta(d,c);if(e>=d.size)return{line:d.size-1,ch:w(d,d.size-1).text.length};for(0>b&&(b=0);;){var f=w(d,e),e=jd(a,f,e,b,c),g=Sa(f);if(g&&e.ch==Aa(f))e=g.find().to.line;else return e}}function jd(a,b,c,d,e){function f(d){d=T(a,{line:c,ch:d},"line",b,l);h=!0;if(g>d.bottom)return Math.max(0,d.left- 
     40i);if(g<d.top)return d.left+i;h=!1;return d.left}var g=e-ya(a,b),h=!1,i=a.display.wrapper.clientWidth,l=Db(a,b),k=U(b),j=b.text.length,e=Ya(b),p=Aa(b),q=mc(a.display),m=f(p);if(d>m)return{line:c,ch:p,outside:h};for(;;){if(k?p==e||p==Fb(b,e,1):1>=p-e){for(e=(d=d-q<m-d)?e:p;Gb.test(b.text.charAt(e));)++e;return{line:c,ch:e,after:d,outside:h}}var n=Math.ceil(j/2),t=e+n;if(k)for(var t=e,u=0;u<n;++u)t=Fb(b,t,1);u=f(t);u>d?(p=t,m=u,h&&(m+=1E3),j-=n):(e=t,q=u,j=n)}}function aa(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight; 
     41if(null==ea){ea=n("pre");for(var b=0;49>b;++b)ea.appendChild(document.createTextNode("x")),ea.appendChild(n("br"));ea.appendChild(document.createTextNode("x"))}da(a.measure,ea);b=ea.offsetHeight/50;3<b&&(a.cachedTextHeight=b);Qa(a.measure);return b||1}function sc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=n("span","x"),c=n("pre",[b]);da(a.measure,c);b=b.offsetWidth;2<b&&(a.cachedCharWidth=b);return b||10}function Hb(a){a.curOp?++a.curOp.depth:a.curOp={depth:1,changes:[],delayedCallbacks:[], 
     42updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,updateMaxLine:!1,id:++a.nextOpId}}function Ib(a){var b=a.curOp;if(!--b.depth){a.curOp=null;var c=a.view,d=a.display;b.updateMaxLine&&fc(c);if(c.maxLineChanged&&!a.options.lineWrapping){var e=Cb(a,c.maxLine,c.maxLine.text.length).right;d.sizer.style.minWidth=e+3+qa+"px";c.maxLineChanged=!1}var f,g;b.selectionChanged&&(d=T(a,S(c)),f=tc(a,d.left,d.top,d.left,d.bottom));if(b.changes.length||f&&null!=f.scrollTop)g=P(a,b.changes,f&& 
     43f.scrollTop);!g&&b.selectionChanged&&lc(a);if(f&&(d=a.view,g=T(a,S(d)),Jb(a,g.left,g.top,g.left,g.bottom),d.focused)){d=a.display;f=d.sizer.getBoundingClientRect();e=null;if(0>g.top+f.top)e=!0;else if(g.bottom+f.top>(window.innerHeight||document.documentElement.clientHeight))e=!1;if(null!=e&&!kd){if(f="none"==d.cursor.style.display)d.cursor.style.display="",d.cursor.style.left=g.left+"px",d.cursor.style.top=g.top-d.viewOffset+"px";d.cursor.scrollIntoView(e);f&&(d.cursor.style.display="none")}}b.selectionChanged&& 
     44Xa(a);c.focused&&b.updateInput&&ha(a,b.userSelChange);b.textChanged&&ia(a,"change",a,b.textChanged);b.selectionChanged&&ia(a,"cursorActivity",a);for(c=0;c<b.delayedCallbacks.length;++c)b.delayedCallbacks[c](a)}}function s(a,b){return function(){var c=a||this;Hb(c);try{var d=b.apply(c,arguments)}finally{Ib(c)}return d}}function $(a,b,c,d){a.curOp.changes.push({from:b,to:c,diff:d})}function Za(a){a.view.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Kb(a);a.view.focused&&Za(a)})} 
     45function ua(a){function b(){!Kb(a)&&!c?(c=!0,a.display.poll.set(60,b)):(a.display.pollingFast=!1,Za(a))}var c=!1;a.display.pollingFast=!0;a.display.poll.set(20,b)}function Kb(a){var b=a.display.input,c=a.display.prevInput,d=a.view,e=d.sel;if(!d.focused||ld(b)||Ba(a))return!1;var f=b.value;if(f==c&&z(e.from,e.to))return!1;Hb(a);d.sel.shift=null;for(var g=0,h=Math.min(c.length,f.length);g<h&&c[g]==f[g];)++g;g<c.length?e.from={line:e.from.line,ch:e.from.ch-(c.length-g)}:d.overwrite&&(z(e.from,e.to)&& 
     46!a.display.pasteIncoming)&&(e.to={line:e.to.line,ch:Math.min(w(a.view.doc,e.to.line).text.length,e.to.ch+(f.length-g))});c=a.curOp.updateInput;Lb(a,e.from,e.to,Ca(f.slice(g)),"end",a.display.pasteIncoming?"paste":"input");a.curOp.updateInput=c;1E3<f.length?b.value=a.display.prevInput="":a.display.prevInput=f;Ib(a);a.display.pasteIncoming=!1;return!0}function ha(a,b){var c=a.view,d,e;z(c.sel.from,c.sel.to)?b&&(a.display.prevInput=a.display.input.value=""):(a.display.prevInput="",d=$a&&(100<c.sel.to.line- 
     47c.sel.from.line||1E3<(e=a.getSelection()).length),a.display.input.value=d?"-":e||a.getSelection(),c.focused&&$b(a.display.input));a.display.inaccurateSelection=d}function G(a){"nocursor"!=a.options.readOnly&&a.display.input.focus()}function Ba(a){return a.options.readOnly||a.view.cantEdit}function ac(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(/\bCodeMirror-(?:line)?widget\b/.test(c.className)||c.parentNode==a.sizer&&c!=a.mover)return!0}function Da(a,b,c){var d=a.display; 
     48if(!c&&(c=b.target||b.srcElement,c==d.scrollbarH||c==d.scrollbarH.firstChild||c==d.scrollbarV||c==d.scrollbarV.firstChild||c==d.scrollbarFiller))return null;var e,f,d=d.lineSpace.getBoundingClientRect();try{e=b.clientX,f=b.clientY}catch(g){return null}return Eb(a,e-d.left,f-d.top)}function cd(a){function b(a){if("single"==p)B(e,j,a);else if("double"==p){var b=uc(w(i,a.line).text,a);A(a,n)?B(e,b.from,t):B(e,n,b.to)}else"triple"==p&&(A(a,n)?B(e,t,x(i,{line:a.line,ch:0})):B(e,n,x(i,{line:a.line+1,ch:0})))} 
     49function c(a){var d=++r,h=Da(e,a,!0);if(h)if(z(h,q)){var j=a.clientY<u.top?-20:a.clientY>u.bottom?20:0;j&&setTimeout(s(e,function(){r==d&&(f.scroller.scrollTop+=j,c(a))}),50)}else{g.focused||ca(e);q=h;b(h);var k=gc(f,i);(h.line>=k.to||h.line<k.from)&&setTimeout(s(e,function(){r==d&&c(a)}),150)}}function d(a){r=Infinity;var c=Da(e,a);c&&b(c);y(a);G(e);Q(document,"mousemove",ic);Q(document,"mouseup",E)}var e=this,f=e.display,g=e.view,h=g.sel,i=g.doc,l=e.view,k=D(a,"shiftKey");l.sel.shift=k?l.sel.shift|| 
     50S(l):null;if(ac(f,a))X||(f.scroller.draggable=!1,setTimeout(function(){f.scroller.draggable=!0},100));else if(!md(e,a)){var j=Da(e,a);switch(vc(a)){case 3:ba&&bc.call(e,e,a);return;case 2:j&&B(e,j,j);setTimeout(M(G,e),20);y(a);return}if(j){g.focused||ca(e);var l=+new Date,p="single";ab&&ab.time>l-400&&z(ab.pos,j)?(p="triple",y(a),setTimeout(M(G,e),20),l=j.line,B(e,{line:l,ch:0},x(e.view.doc,{line:l+1,ch:0}))):bb&&bb.time>l-400&&z(bb.pos,j)?(p="double",ab={time:l,pos:j},y(a),l=uc(w(i,j.line).text, 
     51j),B(e,l.from,l.to)):bb={time:l,pos:j};var q=j;if(e.options.dragDrop&&Mb&&!Ba(e)&&!z(h.from,h.to)&&!A(j,h.from)&&!A(h.to,j)&&"single"==p){var m=s(e,function(b){X&&(f.scroller.draggable=!1);g.draggingText=!1;Q(document,"mouseup",m);Q(f.scroller,"drop",m);10>Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)&&(y(b),B(e,j,j),G(e))});X&&(f.scroller.draggable=!0);g.draggingText=m;f.scroller.dragDrop&&f.scroller.dragDrop();v(document,"mouseup",m);v(f.scroller,"drop",m)}else{y(a);"single"==p&&B(e, 
     52j,j);var n=h.from,t=h.to,u=f.wrapper.getBoundingClientRect(),r=0,ic=s(e,function(a){!ga&&!vc(a)?d(a):c(a)}),E=s(e,d);v(document,"mousemove",ic);v(document,"mouseup",E)}}else(a.target||a.srcElement)==f.scroller&&y(a)}}function ed(a){var b=this;if(!b.options.onDragEvent||!b.options.onDragEvent(b,ta(a))){y(a);var c=Da(b,a,!0),d=a.dataTransfer.files;if(c&&!Ba(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=d.length,f=Array(e),g=0,a=function(a,d){var h=new FileReader;h.onload=function(){f[d]= 
     53h.result;++g==e&&(c=x(b.view.doc,c),s(b,function(){var a=V(b,f.join(""),c,c,"paste");B(b,c,a)})())};h.readAsText(a)},h=0;h<e;++h)a(d[h],h);else if(b.view.draggingText&&!A(c,b.view.sel.from)&&!A(b.view.sel.to,c))b.view.draggingText(a),ga&&setTimeout(M(G,b),50);else try{if(f=a.dataTransfer.getData("Text")){var h=b.view.sel.from,i=b.view.sel.to;B(b,c,c);b.view.draggingText&&V(b,"",h,i,"paste");b.replaceSelection(f,null,"paste");G(b);ca(b)}}catch(l){}}}function md(a,b){var c=a.display;try{var d=b.clientX, 
     54e=b.clientY}catch(f){return!1}if(d>=Math.floor(c.gutters.getBoundingClientRect().right))return!1;y(b);if(!wc(a,"gutterClick"))return!0;var g=c.lineDiv.getBoundingClientRect();if(e>g.bottom)return!0;e-=g.top-c.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=c.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=d){c=Ta(a.view.doc,e);la(a,a,"gutterClick",a,c,a.options.gutters[g],b);break}}return!0}function yb(a,b){2>Math.abs(a.view.scrollTop-b)||(a.view.scrollTop=b,ba||P(a,[],b),a.display.scroller.scrollTop!= 
     55b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),ba&&P(a,[]))}function zb(a,b){2>Math.abs(a.view.scrollLeft-b)||(a.view.scrollLeft=b,a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b),hc(a.display))}function cc(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&(b.detail&&b.axis==b.HORIZONTAL_AXIS)&&(c=b.detail);null==d&&b.detail&&b.axis==b.VERTICAL_AXIS? 
     56d=b.detail:null==d&&(d=b.wheelDelta);var e=a.display.scroller;if(d&&null!=O){var f=d*O,g=a.view.scrollTop,h=g+a.display.wrapper.clientHeight;0>f?g=Math.max(0,g+f-50):h=Math.min(a.view.doc.height,h+f+50);if(ka&&X)for(f=b.target;f!=e;f=f.parentNode)if(f.lineObj){a.display.currentWheelTarget=f;break}P(a,[],{top:g,bottom:h})}c&&null!=O&&(g=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,c*O+e.scrollLeft)),g!=e.scrollLeft&&hc(a.display,g));20>cb&&(null==db?(db=e.scrollLeft,Nb=e.scrollTop,Ea=c,Fa=d,setTimeout(function(){var a= 
     57e.scrollLeft-db,b=e.scrollTop-Nb,a=b&&Fa&&b/Fa||a&&Ea&&a/Ea;db=Nb=null;a&&(O=(O*cb+a)/(cb+1),++cb)},200)):(Ea+=c,Fa+=d))}function eb(a,b,c){if("string"==typeof b&&(b=Ob[b],!b))return!1;a.display.pollingFast&&Kb(a)&&(a.display.pollingFast=!1);var d=a.view,e=d.sel.shift;try{Ba(a)&&(d.suppressEdits=!0),c&&(d.sel.shift=null),b(a)}catch(f){if(f!=xc)throw f;return!1}finally{d.sel.shift=e,d.suppressEdits=!1}return!0}function yc(a,b){function c(){h=!0}var d=Pb(a.options.keyMap),e=d.auto;clearTimeout(zc); 
     58e&&!Ac(b)&&(zc=setTimeout(function(){Pb(a.options.keyMap)==d&&(a.options.keyMap=e.call?e.call(null,a):e)},50));var f=fa[D(b,"keyCode")],g=!1,g=ka&&(Ga||nd);if(null==f||b.altGraphKey)return!1;D(b,"altKey")&&(f="Alt-"+f);if(D(b,g?"metaKey":"ctrlKey"))f="Ctrl-"+f;if(D(b,g?"ctrlKey":"metaKey"))f="Cmd-"+f;var h=!1,g=D(b,"shiftKey")?fb("Shift-"+f,a.options.extraKeys,a.options.keyMap,function(b){return eb(a,b,!0)},c)||fb(f,a.options.extraKeys,a.options.keyMap,function(b){if("string"==typeof b&&/^go[A-Z]/.test(b))return eb(a, 
     59b)},c):fb(f,a.options.extraKeys,a.options.keyMap,function(b){return eb(a,b)},c);h&&(g=!1);g&&(y(b),Xa(a),gb&&(b.oldKeyCode=b.keyCode,b.keyCode=0));return g}function dc(a){this.view.focused||ca(this);ga&&27==a.keyCode&&(a.returnValue=!1);if(!this.options.onKeyEvent||!this.options.onKeyEvent(this,ta(a))){var b=D(a,"keyCode"),c=this.view,d=16==b||D(a,"shiftKey");c.sel.shift=d?c.sel.shift||S(c):null;c=yc(this,a);Ga&&(Qb=c?b:null,!c&&(88==b&&!$a&&D(a,ka?"metaKey":"ctrlKey"))&&this.replaceSelection(""))}} 
     60function dd(a){var b=this;if(!b.options.onKeyEvent||!b.options.onKeyEvent(b,ta(a))){var c=D(a,"keyCode"),d=D(a,"charCode");if(Ga&&c==Qb)Qb=null,y(a);else if(!(Ga&&(!a.which||10>a.which)||vb)||!yc(b,a)){c=String.fromCharCode(null==d?c:d);this.options.electricChars&&(this.view.mode.electricChars&&this.options.smartIndent&&!Ba(this)&&-1<this.view.mode.electricChars.indexOf(c))&&setTimeout(s(b,function(){hb(b,b.view.sel.to.line,"smart")}),75);if(c=fb("'"+c+"'",b.options.extraKeys,b.options.keyMap,function(a){return eb(b, 
     61a,!0)}))y(a),Xa(b);c||ua(b)}}}function ca(a){"nocursor"!=a.options.readOnly&&(a.view.focused||(ia(a,"focus",a),a.view.focused=!0,-1==a.display.scroller.className.search(/\bCodeMirror-focused\b/)&&(a.display.scroller.className+=" CodeMirror-focused"),ha(a,!0)),Za(a),Xa(a))}function Ab(a){a.view.focused&&(ia(a,"blur",a),a.view.focused=!1,a.display.scroller.className=a.display.scroller.className.replace(" CodeMirror-focused",""));clearInterval(a.display.blinker);setTimeout(function(){a.view.focused|| 
     62(a.view.sel.shift=null)},150)}function bc(a,b){function c(){d.inputDiv.style.position="relative";d.input.style.cssText=h;gb&&(d.scrollbarV.scrollTop=d.scroller.scrollTop=g);Za(a);if(null!=d.input.selectionStart){clearTimeout(Rb);var b=d.input.value=" "+(z(e.from,e.to)?"":d.input.value),c=0;d.prevInput=" ";d.input.selectionStart=1;d.input.selectionEnd=b.length;Rb=setTimeout(function j(){" "==d.prevInput&&0==d.input.selectionStart?s(a,Ob.selectAll)(a):10>c++?Rb=setTimeout(j,500):ha(a)},200)}}var d= 
     63a.display,e=a.view.sel,f=Da(a,b),g=d.scroller.scrollTop;if(f&&!Ga){(z(e.from,e.to)||A(f,e.from)||!A(f,e.to))&&s(a,oa)(a,f,f);var h=d.input.style.cssText;d.inputDiv.style.position="absolute";d.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";G(a);ha(a,!0);z(e.from,e.to)&&(d.input.value=d.prevInput= 
     64" ");ba?(Na(b),v(window,"mouseup",function l(){Q(window,"mouseup",l);setTimeout(c,20)})):setTimeout(c,50)}}function Lb(a,b,c,d,e,f){var g;if(g=Bc){var h=null;a.view.doc.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;if(c.readOnly&&(!h||-1==ib(h,c)))(h||(h=[])).push(c)}});if(h){g=[{from:b,to:c}];for(var i=0;i<h.length;++i)for(var l=h[i].find(),k=0;k<g.length;++k){var j=g[k];if(A(l.from,j.to)&&!A(l.to,j.from)){var p=[k,1];A(j.from, 
     65l.from)&&p.push({from:j.from,to:l.from});A(l.to,j.to)&&p.push({from:l.to,to:j.to});g.splice.apply(g,p);k+=p.length-1}}}else g=null}if(g){for(b=g.length-1;1<=b;--b)jb(a,g[b].from,g[b].to,[""],f);if(g.length)return jb(a,g[0].from,g[0].to,d,e,f)}else return jb(a,b,c,d,e,f)}function jb(a,b,c,d,e,f){if(!a.view.suppressEdits){var g=a.view,h=[];g.doc.iter(b.line,c.line+1,function(a){h.push(Ha(a.text,a.markedSpans))});var i=g.sel.from,l=g.sel.to,k;var j=I(h[0]),p=I(L(h)),q=b.ch,m=c.ch;if(!j&&!p)k=d;else{if(j)for(var n= 
     660,t;n<j.length;++n){var u=j[n],s=u.marker;if(null==u.from||(s.inclusiveLeft?u.from<=q:u.from<q)||"bookmark"==s.type&&u.from==q){var w=null==u.to||(s.inclusiveRight?u.to>=q:u.to>q);(t||(t=[])).push({from:u.from,to:w?null:u.to,marker:s})}}j=t;if(p)for(var n=0,r;n<p.length;++n)if(t=p[n],u=t.marker,null==t.to||(u.inclusiveRight?t.to>=m:t.to>m)||"bookmark"==u.type&&t.from==m&&t.from!=q)s=null==t.from||(u.inclusiveLeft?t.from<=m:t.from<m),(r||(r=[])).push({from:s?null:t.from-m,to:null==t.to?null:t.to-m, 
     67marker:u});p=r;r=1==d.length;n=L(d).length+(r?q:0);if(j)for(m=0;m<j.length;++m)t=j[m],null==t.to&&((u=kb(p,t.marker))?r&&(t.to=null==u.to?null:u.to+n):t.to=q);if(p)for(m=0;m<p.length;++m)t=p[m],null!=t.to&&(t.to+=n),null==t.from?(u=kb(j,t.marker),u||(t.from=n,r&&(j||(j=[])).push(t))):(t.from+=n,r&&(j||(j=[])).push(t));q=[Ha(d[0],j)];if(!r){r=d.length-2;if(0<r&&j)for(m=0;m<j.length;++m)null==j[m].to&&(k||(k=[])).push({from:null,to:null,marker:j[m].marker});for(m=0;m<r;++m)q.push(Ha(d[m+1],k));q.push(Ha(L(d), 
     68p))}k=q}c=Cc(a,b,c,k,e,f);if(g.history){b=b.line;d=d.length;e=g.sel.from;g=g.sel.to;k=a.view.history;k.undone.length=0;q=+new Date;if((j=L(k.done))&&(k.lastOp==a.curOp.id||k.lastOrigin==f&&("input"==f||"delete"==f)&&k.lastTime>q-600)){i=L(j.events);if(i.start>b+h.length||i.start+i.added<b)j.events.push({start:b,added:d,old:h});else{l=Math.max(0,i.start-b);p=Math.max(0,b+h.length-(i.start+i.added));for(m=l;0<m;--m)i.old.unshift(h[m-1]);for(m=p;0<m;--m)i.old.push(h[h.length-m]);l&&(i.start=b);i.added+= 
     69d-(h.length-l-p)}j.fromAfter=e;j.toAfter=g}else{j={events:[{start:b,added:d,old:h}],fromBefore:i,toBefore:l,fromAfter:e,toAfter:g};for(k.done.push(j);k.done.length>a.options.undoDepth;)k.done.shift();0>k.dirtyCounter?k.dirtyCounter=NaN:k.dirtyCounter++}k.lastTime=q;k.lastOp=a.curOp.id;k.lastOrigin=f}return c}}function Dc(a,b){var c=a.view.doc,d=a.view.history,e=("undo"==b?d.done:d.undone).pop();if(e){for(var f={events:[],fromBefore:e.fromAfter,toBefore:e.toAfter,fromAfter:e.fromBefore,toAfter:e.toBefore}, 
     70g=e.events.length-1;0<=g;g-=1){d.dirtyCounter+="undo"==b?-1:1;var h=e.events[g],i=[],l=h.start+h.added;c.iter(h.start,l,function(a){i.push(Ha(a.text,a.markedSpans))});f.events.push({start:h.start,added:h.old.length,old:i});var k=g?null:{from:e.fromBefore,to:e.toBefore};Cc(a,{line:h.start,ch:0},{line:l-1,ch:w(c,l-1).text.length},h.old,k,b)}("undo"==b?d.undone:d.done).push(f)}}function Cc(a,b,c,d,e,f){var g=a.view,h=g.doc,i=a.display;if(!g.suppressEdits){var l=c.line-b.line,k=w(h,b.line),j=w(h,c.line), 
     71p=!1,m=b.line;a.options.lineWrapping||(m=H(Ua(h,k)),h.iter(m,c.line+1,function(a){if(Ra(h,a)==g.maxLineLength)return p=!0}));var n=L(d),s=aa(i);if(0==b.ch&&0==c.ch&&""==F(n)){for(var t=[],u=0,r=d.length-1;u<r;++u)t.push(sa(F(d[u]),I(d[u]),s));pa(a,j,j.text,I(n));l&&h.remove(b.line,l,a);t.length&&h.insert(b.line,t)}else if(k==j)if(1==d.length)pa(a,k,k.text.slice(0,b.ch)+F(d[0])+k.text.slice(c.ch),I(d[0]));else{t=[];u=1;for(r=d.length-1;u<r;++u)t.push(sa(F(d[u]),I(d[u]),s));t.push(sa(F(n)+k.text.slice(c.ch), 
     72I(n),s));pa(a,k,k.text.slice(0,b.ch)+F(d[0]),I(d[0]));h.insert(b.line+1,t)}else if(1==d.length)pa(a,k,k.text.slice(0,b.ch)+F(d[0])+j.text.slice(c.ch),I(d[0])),h.remove(b.line+1,l,a);else{t=[];pa(a,k,k.text.slice(0,b.ch)+F(d[0]),I(d[0]));pa(a,j,F(n)+j.text.slice(c.ch),I(n));u=1;for(r=d.length-1;u<r;++u)t.push(sa(F(d[u]),I(d[u]),s));1<l&&h.remove(b.line+1,l-1,a);h.insert(b.line+1,t)}if(a.options.lineWrapping){var v=Math.max(5,i.scroller.clientWidth/sc(i)-3);h.iter(b.line,b.line+d.length,function(a){if(0!= 
     73a.height){var b=(Math.ceil(a.text.length/v)||1)*s;b!=a.height&&Z(a,b)}})}else h.iter(m,b.line+d.length,function(a){var b=Ra(h,a);b>g.maxLineLength&&(g.maxLine=a,g.maxLineLength=b,g.maxLineChanged=!0,p=!1)}),p&&(a.curOp.updateMaxLine=!0);g.frontier=Math.min(g.frontier,b.line);Pa(a,400);var z=d.length-l-1;$(a,b.line,c.line+1,z);if(wc(a,"change")){for(u=0;u<d.length;++u)"string"!=typeof d[u]&&(d[u]=d[u].text);f={from:b,to:c,text:d,origin:f};if(a.curOp.textChanged){for(i=a.curOp.textChanged;i.next;i= 
     74i.next);i.next=f}else a.curOp.textChanged=f}var x={line:b.line+d.length-1,ch:F(n).length+(1==d.length?b.ch:0)};e&&"string"!=typeof e?e.from?(d=e.from,e=e.to):d=e:"end"==e?d=e=x:"start"==e?d=e=b:"around"==e?(d=b,e=x):(e=function(a){if(A(a,b))return a;if(!A(c,a))return x;var d=a.line+z,e=a.ch;a.line==c.line&&(e+=F(n).length-(c.ch-(c.line==b.line?b.ch:0)));return{line:d,ch:e}},d=e(g.sel.from),e=e(g.sel.to));oa(a,d,e,null,!0);return x}}function V(a,b,c,d,e){d||(d=c);if(A(d,c))var f=d,d=c,c=f;return Lb(a, 
     75c,d,Ca(b),null,e)}function z(a,b){return a.line==b.line&&a.ch==b.ch}function A(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function x(a,b){if(0>b.line)return{line:0,ch:0};if(b.line>=a.size)return{line:a.size-1,ch:w(a,a.size-1).text.length};var c=b.ch,d=w(a,b.line).text.length;return null==c||c>d?{line:b.line,ch:d}:0>c?{line:b.line,ch:0}:b}function B(a,b,c,d){var e=a.view,f=e.sel.shift;f&&(f=x(e.doc,f),A(f,b)?b=f:A(c,f)&&(c=f));oa(a,b,c,d);a.curOp.userSelChange=!0}function oa(a,b,c,d,e){a.curOp.updateInput= 
     76!0;var f=a.view.sel,g=a.view.doc;a.view.goalColumn=null;if(A(c,b))var h=c,c=b,b=h;if(e||!z(b,f.from))b=lb(a,b,d,"push"!=e);if(e||!z(c,f.to))c=lb(a,c,d,"push"!=e);if(!z(f.from,b)||!z(f.to,c)){z(b,c)?f.inverted=!1:z(b,f.to)?f.inverted=!1:z(c,f.from)&&(f.inverted=!0);if(a.options.autoClearEmptyLines&&z(f.from,f.to)&&S(a.view).line!=f.from.line&&f.from.line<g.size){var i=w(g,f.from.line);/^\s+$/.test(i.text)&&setTimeout(s(a,function(){if(i.parent&&/^\s+$/.test(i.text)){var b=H(i);V(a,"",{line:b,ch:0}, 
     77{line:b,ch:i.text.length})}},10))}f.from=b;f.to=c;a.curOp.selectionChanged=!0}}function Ec(a){oa(a,a.view.sel.from,a.view.sel.to,null,"push")}function lb(a,b,c,d){var e=a.view.doc,f=!1,g=b,h=c||1;a.view.cantEdit=!1;a:for(;;){var i=w(e,g.line),l;if(i.markedSpans){for(var k=0;k<i.markedSpans.length;++k){var j=i.markedSpans[k],m=j.marker;if((null==j.from||(m.inclusiveLeft?j.from<=g.ch:j.from<g.ch))&&(null==j.to||(m.inclusiveRight?j.to>=g.ch:j.to>g.ch)))if(d&&m.clearOnEnter)(l||(l=[])).push(m);else if(m.atomic){k= 
     78m.find()[0>h?"from":"to"];if(z(k,g)&&(k.ch+=h,0>k.ch?k=k.line?x(e,{line:k.line-1}):null:k.ch>i.text.length&&(k=k.line<e.size-1?{line:k.line+1,ch:0}:null),!k)){if(f){if(!d)return lb(a,b,c,!0);a.view.cantEdit=!0;return{line:0,ch:0}}f=!0;k=b;h=-h}g=k;continue a}}if(l)for(k=0;k<l.length;++k)l[k].clear()}return g}}function Jb(a,b,c,d,e){b=tc(a,b,c,d,e);null!=b.scrollTop&&yb(a,b.scrollTop);null!=b.scrollLeft&&zb(a,b.scrollLeft)}function tc(a,b,c,d,e){var f=a.display,g=f.lineSpace.offsetTop,c=c+g,e=e+g, 
     79h=f.scroller.clientHeight-qa,i=f.scroller.scrollTop,l={},a=a.view.doc.height+2*g,k=c<g+10,g=e+g>a-10;c<i?l.scrollTop=k?0:Math.max(0,c):e>i+h&&(l.scrollTop=(g?a:e)-h);c=f.scroller.clientWidth-qa;e=f.scroller.scrollLeft;b+=f.gutters.offsetWidth;d+=f.gutters.offsetWidth;f=f.gutters.offsetWidth;h=b<f+10;b<e+f||h?(h&&(b=0),l.scrollLeft=Math.max(0,b-10-f)):d>c+e-3&&(l.scrollLeft=d+10-c);return l}function hb(a,b,c,d){var e=a.view.doc;c||(c="add");if("smart"==c)if(a.view.mode.indent)var f=za(a,b);else c= 
     80"prev";var g=a.options.tabSize,h=w(e,b),i=na(h.text,null,g),l=h.text.match(/^\s*/)[0],k;if("smart"==c&&(k=a.view.mode.indent(f,h.text.slice(l.length),h.text),k==xc)){if(!d)return;c="prev"}"prev"==c?k=b?na(w(e,b-1).text,null,g):0:"add"==c?k=i+a.options.indentUnit:"subtract"==c&&(k=i-a.options.indentUnit);k=Math.max(0,k);c="";d=0;if(a.options.indentWithTabs)for(e=Math.floor(k/g);e;--e)d+=g,c+="\t";d<k&&(c+=Fc(k-d));c!=l&&V(a,c,{line:b,ch:0},{line:b,ch:l.length},"input");h.stateAfter=null}function mb(a, 
     81b,c){var d=b,e=b,f=a.view.doc;"number"==typeof b?e=w(f,Math.max(0,Math.min(b,f.size-1))):d=H(b);if(null!=d&&c(e,d))$(a,d,d+1);else return null;return e}function Gc(a,b,c,d){function e(a){var c=(d?Fb:Hc)(l,i,b,!0);if(null==c){if(a=!a)a=h+b,0>a||a==f.size?a=!1:(h=a,a=l=w(f,a));if(a)i=d?(0>b?Aa:Ya)(l):0>b?l.text.length:0;else return!1}else i=c;return!0}var f=a.view.doc,g=S(a.view),h=g.line,i=g.ch,l=w(f,h);if("char"==c)e();else if("column"==c)e(!0);else if("word"==c)for(c=!1;!(0>b)||e();){if(nb(l.text.charAt(i)))c= 
     82!0;else if(c){0>b&&(b=1,e());break}if(0<b&&!e())break}return lb(a,{line:h,ch:i},b,!0)}function uc(a,b){var c=b.ch,d=b.ch;if(a){!1===b.after||d==a.length?--c:++d;for(var e=a.charAt(c),e=nb(e)?nb:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!nb(a)};0<c&&e(a.charAt(c-1));)--c;for(;d<a.length&&e(a.charAt(d));)++d}return{from:{line:b.line,ch:c},to:{line:b.line,ch:d}}}function r(a,b,c,d){m.defaults[a]=b;c&&(ja[a]=d?function(a,b,d){d!=ec&&c(a,b,d)}:c)}function ma(a,b){if(!0=== 
     83b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c}function pc(a,b,c){return a.startState?a.startState(b,c):!0}function Pb(a){return"string"==typeof a?W[a]:a}function fb(a,b,c,d,e){function f(b){var b=Pb(b),c=b[a];if(!1===c)return e&&e(),!0;if(null!=c&&d(c))return!0;if(b.nofallthrough)return e&&e(),!0;b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return f(b);for(var c=0, 
     84i=b.length;c<i;++c)if(f(b[c]))return!0;return!1}return b&&f(b)?!0:f(c)}function Ac(a){a=fa[D(a,"keyCode")];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Ia(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8}function Sb(a,b){this.lines=[];this.type=b;this.cm=a}function Ic(a,b,c,d,e){var f=a.view.doc,g=new Sb(a,e);if("range"==e&&!A(b,c))return g;if(d)for(var h in d)d.hasOwnProperty(h)&&(g[h]=d[h]);g.replacedWith&&(g.collapsed=!0,g.replacedWith=n("span",[g.replacedWith],"CodeMirror-widget")); 
     85g.collapsed&&(xa=!0);var i=b.line,l=0,k,j;f.iter(i,c.line+1,function(a){var d={from:null,to:null,marker:g};l+=a.text.length;i==b.line&&(d.from=b.ch,l-=b.ch);i==c.line&&(d.to=c.ch,l-=a.text.length-c.ch);g.collapsed&&(i==c.line&&(j=ob(a,c.ch)),i==b.line?k=ob(a,b.ch):Z(a,0));a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.lines.push(a);g.collapsed&&(i==b.line&&Y(a))&&Z(a,0);++i});g.readOnly&&(Bc=!0,(a.view.history.done.length||a.view.history.undone.length)&&a.clearHistory());if(g.collapsed){if(k!= 
     86j)throw Error("Inserting collapsed marker overlapping an existing one");g.size=l;g.atomic=!0}(g.className||g.startStyle||g.endStyle||g.collapsed)&&$(a,b.line,c.line+1);g.atomic&&Ec(a);return g}function kb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function ob(a,b){var c=xa&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)if(e=c[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!d||d.width<e.marker.width))d=e.marker;return d}function wa(a){return ob(a, 
     87-1)}function Sa(a){return ob(a,a.text.length+1)}function Ua(a,b){for(var c;c=wa(b);)b=w(a,c.find().from.line);return b}function Y(a){var b=xa&&a.markedSpans;if(b)for(var c,d=0;d<b.length;++d)if(c=b[d],c.marker.collapsed&&(null==c.from||0==c.from&&c.marker.inclusiveLeft&&Jc(a,c)))return!0}function Jc(a,b){if(null==b.to||b.marker.inclusiveRight&&b.to==a.text.length)return!0;for(var c,d=0;d<a.markedSpans.length;++d)if(c=a.markedSpans[d],c.marker.collapsed&&c.from==b.to&&(c.marker.inclusiveLeft||b.marker.inclusiveRight)&& 
     88Jc(a,c))return!0}function F(a){return"string"==typeof a?a:a.text}function I(a){if("string"==typeof a)return null;for(var a=a.markedSpans,b=null,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return!b?a:b.length?b:null}function Ha(a,b){return b?{text:a,markedSpans:b}:a}function Kc(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c){var d=b[c].marker.lines,e=ib(d,a);d.splice(e,1)}a.markedSpans=null}}function Lc(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.lines.push(a); 
     89a.markedSpans=b}}function sa(a,b,c){a={text:a,height:c};Lc(a,b);Y(a)&&(a.height=0);return a}function pa(a,b,c,d){b.text=c;b.stateAfter=b.styles=null;null!=b.order&&(b.order=null);Kc(b);Lc(b,d);Y(b)?b.height=0:b.height||(b.height=aa(a.display));la(a,b,"change")}function nc(a,b,c){var d=a.view.mode,e=a.options.flattenSpans,f=!b.styles,g=0,h="",i=null,a=new Ia(b.text,a.options.tabSize),l=b.styles||(b.styles=[]);for(""==b.text&&d.blankLine&&d.blankLine(c);!a.eol();){var k=d.token(a,c),j=a.current();a.start= 
     90a.pos;!e||i!=k?(h&&(f=f||g>=l.length||h!=l[g]||i!=l[g+1],l[g++]=h,l[g++]=i),h=j,i=k):h+=j;if(5E3<a.pos)break}h&&(f=f||g>=l.length||h!=l[g]||i!=l[g+1],l[g++]=h,l[g++]=i);5E3<a.pos&&(l[g++]=b.text.slice(a.pos),l[g++]=null);g!=l.length&&(l.length=g,f=!0);return f}function oc(a,b,c){var d=a.view.mode,a=new Ia(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!a.eol()&&5E3>=a.pos;)d.token(a,c),a.start=a.pos}function Mc(a){return!a?null:Nc[a]||(Nc[a]="cm-"+a.replace(/ +/g," cm-"))}function kc(a, 
     91b,c){for(var d,e=b,f,g,h=!0;d=wa(e);)h=!1,e=w(a.view.doc,d.find().from.line),f||(f=e);d={pre:n("pre"),col:0,pos:0,display:!c,measure:null,addedOne:!1,cm:a};e.textClass&&(d.pre.className=e.textClass);do{e.styles||nc(a,e,e.stateAfter=za(a,H(e)));d.measure=e==b&&c;d.pos=0;d.addToken=d.measure?od:Oc;c&&(g&&e!=b&&!d.addedOne)&&(c[0]=d.pre.appendChild(Pc(a.display.measure)),d.addedOne=!0);var i;a:{var l=e;g=d;i=l.styles;var k=l.markedSpans;if(k)for(var l=l.text.length,j=0,m=0,q="",s=void 0,r=0,t=void 0, 
     92u=void 0,v=void 0,x=void 0;;){if(r==j){for(var t=u=v="",x=null,r=Infinity,z=null,B=0;B<k.length;++B){var y=k[B],A=y.marker;if(y.from<=j&&(null==y.to||y.to>j)){if(null!=y.to&&r>y.to&&(r=y.to,u=""),A.className&&(t+=" "+A.className),A.startStyle&&y.from==j&&(v+=" "+A.startStyle),A.endStyle&&y.to==r&&(u+=" "+A.endStyle),A.collapsed&&(!x||x.marker.width<A.width))x=y}else y.from>j&&r>y.from&&(r=y.from);"bookmark"==A.type&&(y.from==j&&A.replacedWith)&&(z=A.replacedWith)}if(x&&(x.from||0)==j)if(Qc(g,(null== 
     93x.to?l:x.to)-j,null!=x.from&&x.marker.replacedWith),null==x.to){i=x.marker.find();break a}z&&!x&&Qc(g,0,z)}if(j>=l)break;for(z=Math.min(l,r);;){if(q){B=j+q.length;x||(y=B>z?q.slice(0,z-j):q,g.addToken(g,y,s+t,v,j+y.length==r?u:""));if(B>=z){q=q.slice(z-j);j=z;break}j=B;v=""}q=i[m++];s=Mc(i[m++])}}else for(var m=0;m<i.length;m+=2)g.addToken(g,i[m],Mc(i[m+1]));i=void 0}g=e==f;i&&(e=w(a.view.doc,i.to.line),h=!1)}while(i);c&&!d.addedOne&&(c[0]=d.pre.appendChild(h?n("span","\u00a0"):Pc(a.display.measure))); 
     94!d.pre.firstChild&&!Y(b)&&d.pre.appendChild(document.createTextNode("\u00a0"));return d.pre}function Oc(a,b,c,d,e){if(b){if(Tb.test(b))for(var f=document.createDocumentFragment(),g=0;;){Tb.lastIndex=g;var h=Tb.exec(b),i=h?h.index-g:b.length-g;i&&(f.appendChild(document.createTextNode(b.slice(g,g+i))),a.col+=i);if(!h)break;g+=i+1;"\t"==h[0]?(h=a.cm.options.tabSize,h-=a.col%h,f.appendChild(n("span",Fc(h),"cm-tab")),a.col+=h):(i=n("span","\u2022","cm-invalidchar"),i.title="\\u"+h[0].charCodeAt(0).toString(16), 
     95f.appendChild(i),a.col+=1)}else{a.col+=b.length;var f=document.createTextNode(b)}if(c||d||e||a.measure)return b=c||"",d&&(b+=d),e&&(b+=e),a.pre.appendChild(n("span",[f],b));a.pre.appendChild(f)}}function od(a,b,c,d,e){for(var f=0;f<b.length;++f)f&&(f<b.length-1&&a.cm.options.lineWrapping&&pb.test(b.slice(f-1,f+1)))&&a.pre.appendChild(n("wbr")),a.measure[a.pos++]=Oc(a,b.charAt(f),c,0==f&&d,f==b.length-1&&e);b.length&&(a.addedOne=!0)}function Qc(a,b,c){c&&(a.display||(c=c.cloneNode(!0)),a.pre.appendChild(c), 
     96a.measure&&b&&(a.measure[a.pos]=c,a.addedOne=!0));a.pos+=b}function La(a){this.lines=a;this.parent=null;for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function Ka(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;d<e;++d){var f=a[d],b=b+f.chunkSize(),c=c+f.height;f.parent=this}this.size=b;this.height=c;this.parent=null}function w(a,b){for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function Z(a,b){for(var c= 
     97b-a.height,d=a;d;d=d.parent)d.height+=c}function H(a){if(null==a.parent)return null;for(var b=a.parent,a=ib(b.lines,a),c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a}function Ta(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.height;if(b<g){a=f;continue a}b-=g;c+=f.chunkSize()}return c}while(!a.lines);d=0;for(e=a.lines.length;d<e;++d){f=a.lines[d].height;if(b<f)break;b-=f}return c+d}function ya(a,b){for(var b=Ua(a.view.doc, 
     98b),c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;else c+=f.height}for(f=d.parent;f;d=f,f=d.parent)for(e=0;e<f.children.length;++e){var g=f.children[e];if(g==d)break;else c+=g.height}return c}function U(a){var b=a.order;null==b&&(b=a.order=Rc(a.text));return b}function xb(){return{done:[],undone:[],lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function pd(){Na(this)}function ta(a){a.stop||(a.stop=pd);return a}function y(a){a.preventDefault?a.preventDefault():a.returnValue= 
     99!1}function Sc(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Na(a){y(a);Sc(a)}function vc(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));ka&&(a.ctrlKey&&1==b)&&(b=3);return b}function D(a,b){return a.override&&a.override.hasOwnProperty(b)?a.override[b]:a[b]}function v(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),(a[b]||(a[b]=[])).push(c))}function Q(a,b,c){if(a.removeEventListener)a.removeEventListener(b, 
     100c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}}function ia(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function la(a,b,c){function d(a){return function(){a.apply(null,f)}}var e=b._handlers&&b._handlers[c];if(e)for(var f=Array.prototype.slice.call(arguments,3),g=a.curOp&&a.curOp.delayedCallbacks,h=0;h<e.length;++h)g? 
     101g.push(d(e[h])):e[h].apply(null,f)}function wc(a,b){var c=a._handlers&&a._handlers[b];return c&&0<c.length}function wb(){this.id=null}function na(a,b,c){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var d=0,e=0;d<b;++d)"\t"==a.charAt(d)?e+=c-e%c:++e;return e}function Fc(a){for(;qb.length<=a;)qb.push(L(qb)+" ");return qb[a]}function L(a){return a[a.length-1]}function $b(a){ub?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function ib(a,b){if(a.indexOf)return a.indexOf(b); 
     102for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function qc(a){for(var b=[],c=0;c<a;++c)b.push(void 0);return b}function M(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function nb(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||qd.test(a))}function Tc(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&a[c]&&++b;return!b}function n(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)jc(a, 
     103b);else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function Qa(a){a.innerHTML="";return a}function da(a,b){return Qa(a).appendChild(b)}function jc(a,b){gb?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function Va(a){if(null!=rb)return rb;var b=n("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");da(a,b);b.offsetWidth&&(rb=b.offsetHeight-b.clientHeight);return rb||0}function Pc(a){if(null==Ub){var b=n("span","\u200b");da(a,n("span",[b,document.createTextNode("x")])); 
     1040!=a.firstChild.offsetHeight&&(Ub=1>=b.offsetWidth&&2<b.offsetHeight&&!ra)}return Ub?n("span","\u200b"):n("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px")}function Vb(a){return a.level%2?a.from:a.to}function Ya(a){return(a=U(a))?a[0].level%2?a[0].to:a[0].from:0}function Aa(a){var b=U(a);return!b?a.text.length:Vb(L(b))}function Uc(a,b){var c=w(a.view.doc,b),d=Ua(a.view.doc,c);d!=c&&(b=H(d));c=U(d);d=!c?0:c[0].level%2?Aa(d):Ya(d);return{line:b,ch:d}}function rd(a,b){for(var c, 
     105d;c=Sa(d=w(a.view.doc,b));)b=c.find().to.line;c=U(d);d=!c?d.text.length:c[0].level%2?Ya(d):Aa(d);return{line:b,ch:d}}function Fb(a,b,c,d){var e=U(a);if(!e)return Hc(a,b,c,d);for(var d=d?function(b,c){do b+=c;while(0<b&&Gb.test(a.text.charAt(b)));return b}:function(a,b){return a+b},f=e[0].level,g=0;g<e.length;++g){var h=e[g],i=h.level%2==f;if(h.from<b&&h.to>b||i&&(h.from==b||h.to==b))break}for(b=d(b,h.level%2?-c:c);null!=b;)if(h.level%2==f)if(b<h.from||b>h.to)b=(h=e[g+=c])&&(0<c==h.level%2?d(h.to, 
     106-1):d(h.from,1));else break;else if(b==(h.level%2?h.to:h.from))b=(h=e[--g])&&Vb(h);else if(b==Vb(h))b=(h=e[++g])&&(h.level%2?h.to:h.from);else break;return 0>b||b>a.text.length?null:b}function Hc(a,b,c,d){b+=c;if(d)for(;0<b&&Gb.test(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var ba=/gecko\/\d{7}/i.test(navigator.userAgent),ga=/MSIE \d/.test(navigator.userAgent),ra=/MSIE [1-7]\b/.test(navigator.userAgent),gb=/MSIE [1-8]\b/.test(navigator.userAgent),X=/WebKit\//.test(navigator.userAgent), 
     107nd=X&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Vc=/Chrome\//.test(navigator.userAgent),Ga=/Opera\//.test(navigator.userAgent),Wc=/Apple Computer/.test(navigator.vendor),vb=/KHTML\//.test(navigator.userAgent),gd=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),hd=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),kd=/PhantomJS/.test(navigator.userAgent),ub=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),ka=ub||/Mac/.test(navigator.platform),Bc=!1,xa=!1, 
     108ea,bb,ab,cb=0,Ea,Fa,db,Nb,O=null;ga?O=-0.53:ba?O=15:Vc?O=-0.7:Wc&&(O=-1/3);var zc,Qb=null,Rb;m.prototype={getValue:function(a){var b=[],c=this.view.doc;c.iter(0,c.size,function(a){b.push(a.text)});return b.join(a||"\n")},setValue:s(null,function(a){var b=this.view.doc,c={line:0,ch:0},d=w(b,b.size-1).text.length;jb(this,c,{line:b.size-1,ch:d},Ca(a),c,c,"setValue")}),getSelection:function(a){return this.getRange(this.view.sel.from,this.view.sel.to,a)},replaceSelection:s(null,function(a,b,c){var d=this.view.sel; 
     109Lb(this,d.from,d.to,Ca(a),b||"around",c)}),focus:function(){window.focus();G(this);ca(this);ua(this)},setOption:function(a,b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,ja.hasOwnProperty(a)&&s(this,ja[a])(this,b,d))},getOption:function(a){return this.options[a]},getMode:function(){return this.view.mode},undo:s(null,function(){Dc(this,"undo")}),redo:s(null,function(){Dc(this,"redo")}),indentLine:s(null,function(a,b,c){"string"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev": 
     110b?"add":"subtract");0<=a&&a<this.view.doc.size&&hb(this,a,b,c)}),indentSelection:s(null,function(a){var b=this.view.sel;if(z(b.from,b.to))return hb(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),b=b.from.line;b<=c;++b)hb(this,b,a)}),historySize:function(){var a=this.view.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.view.history=xb()},markClean:function(){this.view.history.dirtyCounter=0;this.view.history.lastOp=this.view.history.lastOrigin=null},isClean:function(){return 0== 
     111this.view.history.dirtyCounter},getHistory:function(){function a(a){for(var b=0,e=[],f;b<a.length;++b){var g=a[b];e.push({events:f=[],fromBefore:g.fromBefore,toBefore:g.toBefore,fromAfter:g.fromAfter,toAfter:g.toAfter});for(var h=0,g=g.events;h<g.length;++h){var i=[],l=g[h];f.push({start:l.start,added:l.added,old:i});for(var k=0;k<l.old.length;++k)i.push(F(l.old[k]))}}return e}var b=this.view.history;return{done:a(b.done),undone:a(b.undone)}},setHistory:function(a){var b=this.view.history=xb();b.done= 
     112a.done;b.undone=a.undone},getTokenAt:function(a){for(var b=this.view.doc,a=x(b,a),c=za(this,a.line),d=this.view.mode,b=w(b,a.line),b=new Ia(b.text,this.options.tabSize);b.pos<a.ch&&!b.eol();){b.start=b.pos;var e=d.token(b,c)}return{start:b.start,end:b.pos,string:b.current(),className:e||null,type:e||null,state:c}},getStateAfter:function(a){var b=this.view.doc,a=Math.max(0,Math.min(null==a?b.size-1:a,b.size-1));return za(this,a+1)},cursorCoords:function(a,b){var c;c=this.view.sel;null==a&&(a=c.inverted); 
     113c="object"==typeof a?x(this.view.doc,a):a?c.from:c.to;return T(this,c,b||"page")},charCoords:function(a,b){return Wa(this,x(this.view.doc,a),b||"page")},coordsChar:function(a){var b=this.display.lineSpace.getBoundingClientRect();return Eb(this,a.left-b.left,a.top-b.top)},defaultTextHeight:function(){return aa(this.display)},markText:s(null,function(a,b,c){return Ic(this,x(this.view.doc,a),x(this.view.doc,b),c,"range")}),setBookmark:s(null,function(a,b){a=x(this.view.doc,a);return Ic(this,a,a,b?{replacedWith:b}: 
     114{},"bookmark")}),findMarksAt:function(a){var b=this.view.doc,a=x(b,a),c=[];if(b=w(b,a.line).markedSpans)for(var d=0;d<b.length;++d){var e=b[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&c.push(e.marker)}return c},setGutterMarker:s(null,function(a,b,c){return mb(this,a,function(a){var e=a.gutterMarkers||(a.gutterMarkers={});e[b]=c;!c&&Tc(e)&&(a.gutterMarkers=null);return!0})}),clearGutter:s(null,function(a){var b=0,c=this,d=c.view.doc;d.iter(0,d.size,function(d){d.gutterMarkers&&d.gutterMarkers[a]&& 
     115(d.gutterMarkers[a]=null,$(c,b,b+1),Tc(d.gutterMarkers)&&(d.gutterMarkers=null));++b})}),addLineClass:s(null,function(a,b,c){return mb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[e]){if(RegExp("\\b"+c+"\\b").test(a[e]))return!1;a[e]+=" "+c}else a[e]=c;return!0})}),removeLineClass:s(null,function(a,b,c){return mb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",f=a[e];if(f)if(null==c)a[e]=null;else{var g=f.replace(RegExp("^"+ 
     116c+"\\b\\s*|\\s*\\b"+c+"\\b"),"");if(g==f)return!1;a[e]=g||null}else return!1;return!0})}),addLineWidget:s(null,function(a,b,c){var d=c||{};d.node=b;d.noHScroll&&(this.display.alignWidgets=!0);mb(this,a,function(a){(a.widgets||(a.widgets=[])).push(d);d.line=a;return!0});return d}),removeLineWidget:s(null,function(a){var b=a.line.widgets,c=H(a.line);if(null!=c){for(var d=0;d<b.length;++d)b[d]==a&&b.splice(d--,1);$(this,c,c+1)}}),lineInfo:function(a){if("number"==typeof a){if(!(0<=a&&a<this.view.doc.size))return null; 
     117var b=a,a=w(this.view.doc,a);if(!a)return null}else if(b=H(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display,a=T(this,x(this.view.doc,a)),g=a.top,h=a.left;b.style.position="absolute";f.sizer.appendChild(b);if("over"==d)g=a.top;else if("near"==d){var d= 
     118Math.max(f.wrapper.clientHeight,this.view.doc.height),i=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);a.bottom+b.offsetHeight>d&&a.top>b.offsetHeight&&(g=a.top-b.offsetHeight);h+b.offsetWidth>i&&(h=i-b.offsetWidth)}b.style.top=g+f.lineSpace.offsetTop+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px");c&&Jb(this,h,g,h+b.offsetWidth,g+b.offsetHeight)}, 
     119lineCount:function(){return this.view.doc.size},clipPos:function(a){return x(this.view.doc,a)},getCursor:function(a){var b=this.view.sel;null==a&&(a=b.inverted);return{line:(a?b.from:b.to).line,ch:(a?b.from:b.to).ch}},somethingSelected:function(){return!z(this.view.sel.from,this.view.sel.to)},setCursor:s(null,function(a,b,c){a=x(this.view.doc,"number"==typeof a?{line:a,ch:b||0}:a);(c?B:oa)(this,a,a)}),setSelection:s(null,function(a,b,c){var d=this.view.doc;(c?B:oa)(this,x(d,a),x(d,b||a))}),getLine:function(a){return(a= 
     120this.getLineHandle(a))&&a.text},getLineHandle:function(a){var b=this.view.doc;if(0<=a&&a<b.size)return w(b,a)},getLineNumber:function(a){return H(a)},setLine:s(null,function(a,b){0<=a&&a<this.view.doc.size&&V(this,b,{line:a,ch:0},{line:a,ch:w(this.view.doc,a).text.length})}),removeLine:s(null,function(a){0<=a&&a<this.view.doc.size&&V(this,"",{line:a,ch:0},x(this.view.doc,{line:a+1,ch:0}))}),replaceRange:s(null,function(a,b,c){var d=this.view.doc,b=x(d,b),c=c?x(d,c):b;return V(this,a,b,c)}),getRange:function(a, 
     121b,c){var d=this.view.doc,a=x(d,a),b=x(d,b),e=a.line,f=b.line;if(e==f)return w(d,e).text.slice(a.ch,b.ch);var g=[w(d,e).text.slice(a.ch)];d.iter(e+1,f,function(a){g.push(a.text)});g.push(w(d,f).text.slice(0,b.ch));return g.join(c||"\n")},triggerOnKeyDown:s(null,dc),execCommand:function(a){return Ob[a](this)},moveH:s(null,function(a,b){var c=this.view.sel,d=0>a?c.from:c.to;if(c.shift||z(c.from,c.to))d=Gc(this,a,b,!0);B(this,d,d,a)}),deleteH:s(null,function(a,b){var c=this.view.sel;z(c.from,c.to)?V(this, 
     122"",c.from,Gc(this,a,b,!1),"delete"):V(this,"",c.from,c.to,"delete");this.curOp.userSelChange=!0}),moveV:s(null,function(a,b){var c=this.view,d=c.doc,e=this.display,f=S(c),f=T(this,f,"div"),g=f.left,h;null!=c.goalColumn&&(g=c.goalColumn);"page"==b?(h=Math.min(e.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),h=f.top+a*h):"line"==b&&(h=0<a?f.bottom+3:f.top-3);do{var i=Eb(this,g,h);h+=5*a}while(i.outside&&(0>a?0<h:h<d.height));"page"==b&&(e.scrollbarV.scrollTop+=Wa(this, 
     123i,"div").top-f.top);B(this,i,i,a);c.goalColumn=g}),toggleOverwrite:function(){this.display.cursor.className=(this.view.overwrite=!this.view.overwrite)?this.display.cursor.className+" CodeMirror-overwrite":this.display.cursor.className.replace(" CodeMirror-overwrite","")},posFromIndex:function(a){var b=0,c,d=this.view.doc;d.iter(0,d.size,function(d){d=d.text.length+1;if(d>a)return c=a,!0;a-=d;++b});return x(d,{line:b,ch:c})},indexFromPos:function(a){if(0>a.line||0>a.ch)return 0;var b=a.ch;this.view.doc.iter(0, 
     124a.line,function(a){b+=a.text.length+1});return b},scrollTo:function(a,b){null!=a&&(this.display.scrollbarH.scrollLeft=this.display.scroller.scrollLeft=a);null!=b&&(this.display.scrollbarV.scrollTop=this.display.scroller.scrollTop=b);P(this,[])},getScrollInfo:function(){var a=this.display.scroller,b=qa;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:function(a){a=a?x(this.view.doc,a):S(this.view); 
     125a=T(this,a);Jb(this,a.left,a.top,a.left,a.bottom)},setSize:function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.refresh()},on:function(a,b){v(this,a,b)},off:function(a,b){Q(this,a,b)},operation:function(a){return s(this,a)()},refresh:function(){Oa(this);P(this,!0,this.view.scrollTop);this.display.scrollbarV.scrollHeight>this.view.scrollTop&&(this.display.scrollbarV.scrollTop= 
     126this.view.scrollTop)},getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}};var ja=m.optionHandlers={},sb=m.defaults={},ec=m.Init={toString:function(){return"CodeMirror.Init"}};r("value","",function(a,b){a.setValue(b)},!0);r("mode",null,Ma,!0);r("indentUnit",2,Ma,!0);r("indentWithTabs",!1);r("smartIndent",!0);r("tabSize",4,function(a){Ma(a); 
     127Oa(a);P(a,!0)},!0);r("electricChars",!0);r("autoClearEmptyLines",!1);r("theme","default",function(a){Oa(a);Zb(a);va(a)},!0);r("keyMap","default",function(a){var b=W[a.options.keyMap].style;a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")});r("extraKeys",null);r("onKeyEvent",null);r("onDragEvent",null);r("lineWrapping",!1,function(a){var b=a.view.doc,c=aa(a.display);if(a.options.lineWrapping){a.display.wrapper.className+=" CodeMirror-wrap"; 
     128var d=a.display.scroller.clientWidth/sc(a.display)-3;b.iter(0,b.size,function(a){if(0!=a.height){var b=Math.ceil(a.text.length/d)||1;1!=b&&Z(a,b*c)}});a.display.mover.style.minWidth=""}else a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap",""),fc(a.view),b.iter(0,b.size,function(a){0!=a.height&&Z(a,c)});$(a,0,b.size)},!0);r("gutters",[],function(a){tb(a.options);va(a)},!0);r("lineNumbers",!1,function(a){tb(a.options);va(a)},!0);r("firstLineNumber",1,va,!0);r("lineNumberFormatter", 
     129function(a){return a},va,!0);r("readOnly",!1,function(a,b){"nocursor"==b?(Ab(a),a.display.input.blur()):b||ha(a,!0)});r("dragDrop",!0);r("cursorBlinkRate",530);r("cursorHeight",1);r("workTime",100);r("workDelay",100);r("flattenSpans",!0);r("pollInterval",100);r("undoDepth",40);r("viewportMargin",10,function(a){a.refresh()},!0);r("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});r("autofocus",null);var Xc=m.modes={},Wb=m.mimeModes={};m.defineMode=function(a,b){!m.defaults.mode&&"null"!= 
     130a&&(m.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Xc[a]=b};m.defineMIME=function(a,b){Wb[a]=b};m.resolveMode=function(a){if("string"==typeof a&&Wb.hasOwnProperty(a))a=Wb[a];else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return m.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};m.getMode=function(a,b){var b=m.resolveMode(b),c=Xc[b.name];if(!c)return m.getMode(a,"text/plain"); 
     131c=c(a,b);if(Ja.hasOwnProperty(b.name)){var d=Ja[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c[e]=d[e])}c.name=b.name;return c};m.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});m.defineMIME("text/plain","null");var Ja=m.modeExtensions={};m.extendMode=function(a,b){var c=Ja.hasOwnProperty(a)?Ja[a]:Ja[a]={},d;for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d])};m.defineExtension=function(a,b){m.prototype[a]=b};m.defineOption=r;var Bb=[];m.defineInitHook=function(a){Bb.push(a)};m.copyState= 
     132ma;m.startState=pc;m.innerMode=function(a,b){for(;a.innerMode;)var c=a.innerMode(b),b=c.state,a=c.mode;return c||{mode:a,state:b}};var Ob=m.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!z(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,{line:b.line+1,ch:0},"delete"):a.replaceRange("",b,d?c:{line:b.line},"delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b, 
     133ch:0},{line:b},"delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.setCursor(0,0,!0)},goDocEnd:function(a){a.setSelection({line:a.lineCount()-1},null,!0)},goLineStart:function(a){a.setCursor(Uc(a,a.getCursor().line),null,!0)},goLineStartSmart:function(a){var b=a.getCursor(),c=Uc(a,b.line),d=a.getLineHandle(c.line),e=U(d);!e||0==e[0].level?(d=Math.max(0,d.text.search(/\S/)),a.setCursor(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d,!0)):a.setCursor(c,null,!0)},goLineEnd:function(a){a.setCursor(rd(a, 
     134a.getCursor().line),null,!0)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1, 
     135"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t","end","input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection("\t","end","input")},transposeChars:function(a){var b= 
     136a.getCursor(),c=a.getLine(b.line);0<b.ch&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),{line:b.line,ch:b.ch-1},{line:b.line,ch:b.ch+1})},newlineAndIndent:function(a){s(a,function(){a.replaceSelection("\n","end","input");a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},W=m.keyMap={};W.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown", 
     137Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};W.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordBefore","Ctrl-Delete":"delWordAfter", 
     138"Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore",fallthrough:"basic"};W.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordBefore","Ctrl-Alt-Backspace":"delWordAfter", 
     139"Alt-Delete":"delWordAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]};W["default"]=ka?W.macDefault:W.pcDefault;W.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp", 
     140"Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};m.isModifierKey=Ac;m.fromTextArea=function(a,b){function c(){a.value=h.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);if(null==b.autofocus){var d=document.body;try{d=document.activeElement}catch(e){}b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form){v(a.form,"submit",c);var f=a.form.submit; 
     141try{a.form.submit=function l(){c();a.form.submit=f;a.form.submit();a.form.submit=l}}catch(g){}}a.style.display="none";var h=m(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);h.save=c;h.getTextArea=function(){return a};h.toTextArea=function(){c();a.parentNode.removeChild(h.getWrapperElement());a.style.display="";a.form&&(Q(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=f))};return h};Ia.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0== 
     142this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos= 
     143this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){return na(this.string,this.start,this.tabSize)},indentation:function(){return na(this.string,null,this.tabSize)},match:function(a,b,c){if("string"==typeof a){if((c?this.string.toLowerCase():this.string).indexOf(c?a.toLowerCase():a,this.pos)==this.pos)return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null; 
     144a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)}};m.StringStream=Ia;Sb.prototype.clear=function(){if(!this.explicitlyCleared){Hb(this.cm);for(var a=null,b=null,c=0;c<this.lines.length;++c){var d=this.lines[c],e=kb(d.markedSpans,this);null!=e.to&&(b=H(d));for(var f=d,g=d.markedSpans,h=e,i=void 0,l=0;l<g.length;++l)g[l]!=h&&(i||(i=[])).push(g[l]);f.markedSpans=i;null!=e.from?a=H(d):this.collapsed&&!Y(d)&&Z(d,aa(this.cm.display))}null!=a&& 
     145$(this.cm,a,b+1);this.lines.length=0;this.explicitlyCleared=!0;this.collapsed&&this.cm.view.cantEdit&&(this.cm.view.cantEdit=!1,Ec(this.cm));Ib(this.cm);la(this.cm,this,"clear")}};Sb.prototype.find=function(){for(var a,b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=kb(d.markedSpans,this);if(null!=e.from||null!=e.to)d=H(d),null!=e.from&&(a={line:d,ch:e.from}),null!=e.to&&(b={line:d,ch:e.to})}return"bookmark"==this.type?a:a&&{from:a,to:b}};window.lineIsHidden=Y;var Nc={},Tb=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g; 
     146La.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var d=a,e=a+b;d<e;++d){var f=this.lines[d];this.height-=f.height;var g=f;g.parent=null;Kc(g);la(c,f,"delete")}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));a=0;for(c=b.length;a<c;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}}; 
     147Ka.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a),h=e.height;e.remove(a,g,c);this.height-=h-e.height;f==g&&(this.children.splice(d--,1),e.parent=null);if(0==(b-=g))break;a=0}else a-=f}25>this.size-b&&(a=[],this.collapse(a),this.children=[new La(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)}, 
     148insert:function(a,b){for(var c=0,d=0,e=b.length;d<e;++d)c+=b[d].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<=g){f.insertHeight(a,b,c);if(f.lines&&50<f.lines.length){for(;50<f.lines.length;)a=f.lines.splice(f.lines.length-25,25),a=new La(a),f.height-=a.height,this.children.splice(d+1,0,a),a.parent=this;this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(10>= 
     149this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Ka(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=ib(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Ka(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<g){g=Math.min(b, 
     150g-a);if(f.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=g}}};m.e_stop=Na;m.e_preventDefault=y;m.e_stopPropagation=Sc;m.on=v;m.off=Q;m.signal=ia;var qa=30,xc=m.Pass={toString:function(){return"CodeMirror.Pass"}};wb.prototype={set:function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)}};m.countColumn=na;var qb=[""],qd=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/,Gb=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/, 
     151Mb;if(gb)Mb=!1;else{var Yc=n("div");Mb="draggable"in Yc||"dragDrop"in Yc}var pb=/^$/;ba?pb=/$'/:Wc?pb=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:Vc&&(pb=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var rb,Ub,Ca=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)}; 
     152m.splitLines=Ca;var ld=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:0!=b.compareEndPoints("StartToEnd",b)},$a;var Xb=n("div");"oncopy"in Xb?$a=!0:(Xb.setAttribute("oncopy","return;"),$a="function"==typeof Xb.oncopy);var fa={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp", 
     15334:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};m.keyNames=fa;for(var C=0;10>C;C++)fa[C+48]=String(C);for(C=65;90>=C;C++)fa[C]=String.fromCharCode(C); 
     154for(C=1;12>=C;C++)fa[C+111]=fa[C+63235]="F"+C;var Rc,ud=function(a){return 255>=a?sd.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1791>=a?td.charAt(a-1536):1792<=a&&2220>=a?"r":"L"},sd="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",td="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr", 
     155vd=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,Zc=/[stwN]/,$c=/[LRr]/,ad=/[Lb1n]/,bd=/[1n]/;Rc=function(a){if(!vd.test(a))return!1;for(var b=a.length,c=[],d=null,e=0,f;e<b;++e)if(c.push(f=ud(a.charCodeAt(e))),null==d)if("L"==f)d="L";else if("R"==f||"r"==f)d="R";null==d&&(d="L");for(var e=0,g=d;e<b;++e)f=c[e],"m"==f?c[e]=g:g=f;e=0;for(g=d;e<b;++e)f=c[e],"1"==f&&"r"==g?c[e]="n":$c.test(f)&&(g=f,"r"==f&&(c[e]="R"));e=1;for(g=c[0];e<b-1;++e){f=c[e];if("+"==f&&"1"==g&&"1"==c[e+1])c[e]="1";else if(","== 
     156f&&g==c[e+1]&&("1"==g||"n"==g))c[e]=g;g=f}for(e=0;e<b;++e)if(f=c[e],","==f)c[e]="N";else if("%"==f){for(g=e+1;g<b&&"%"==c[g];++g);var h=e&&"!"==c[e-1]||g<b-1&&"1"==c[g]?"1":"N";for(f=e;f<g;++f)c[f]=h;e=g-1}e=0;for(g=d;e<b;++e)f=c[e],"L"==g&&"1"==f?c[e]="L":$c.test(f)&&(g=f);for(e=0;e<b;++e)if(Zc.test(c[e])){for(g=e+1;g<b&&Zc.test(c[g]);++g);f="L"==(g<b-1?c[g]:d);h="L"==(e?c[e-1]:d)||f?"L":"R";for(f=e;f<g;++f)c[f]=h;e=g-1}for(var d=[],i,e=0;e<b;)if(ad.test(c[e])){f=e;for(++e;e<b&&ad.test(c[e]);++e); 
     157d.push({from:f,to:e,level:0})}else{h=e;g=d.length;for(++e;e<b&&"L"!=c[e];++e);for(f=h;f<e;)if(bd.test(c[f])){h<f&&d.splice(g,0,{from:h,to:f,level:1});h=f;for(++f;f<e&&bd.test(c[f]);++f);d.splice(g,0,{from:h,to:f,level:2});h=f}else++f;h<e&&d.splice(g,0,{from:h,to:e,level:1})}if(1==d[0].level&&(i=a.match(/^\s+/)))d[0].from=i[0].length,d.unshift({from:0,to:i[0].length,level:0});if(1==L(d).level&&(i=a.match(/\s+$/)))L(d).to-=i[0].length,d.push({from:b-i[0].length,to:b,level:0});d[0].level!=L(d).level&& 
     158d.push({from:b,to:b,level:d[0].level});return d};m.version="3.0 rc1";return m}(); 
    112159 
    113 // CodeMirror CSS mode version 2.35 
     160// CodeMirror CSS mode version 3.0rc1 
    114161CodeMirror.defineMode("css",function(m){function g(a){for(var c={},b=0;b<a.length;++b)c[a[b]]=!0;return c}function e(a,c){f=c;return a}function h(a,c){var b=a.next();if("@"==b)return a.eatWhile(/[\w\\\-]/),e("def",a.current());if("/"==b&&a.eat("*"))return c.tokenize=j,j(a,c);if("<"==b&&a.eat("!"))return c.tokenize=k,k(a,c);if("="==b)e(null,"compare");else{if(("~"==b||"|"==b)&&a.eat("="))return e(null,"compare");if('"'==b||"'"==b)return c.tokenize=function(a,c){for(var f=!1,g;null!=(g=a.next())&&(g!= 
    115162b||f);)f=!f&&"\\"==g;f||(c.tokenize=h);return e("string","string")},c.tokenize(a,c);if("#"==b)return a.eatWhile(/[\w\\\-]/),e("atom","hash");if("!"==b)return a.match(/^\s*\w*/),e("keyword","important");if(/\d/.test(b))return a.eatWhile(/[\w.%]/),e("number","unit");if("-"===b){if(/\d/.test(a.peek()))return a.eatWhile(/[\w.%]/),e("number","unit");if(a.match(/^[^-]+-/))return e("meta",f)}else{if(/[,+>*\/]/.test(b))return e(null,"select-op");if("."==b&&a.match(/^-?[_a-z][_a-z0-9-]*/i))return e("qualifier", 
  • tablepress/trunk/admin/common.css

    r623199 r629752  
    1010/* Screen icon */ 
    1111#icon-tablepress { 
    12     background-image: url( 'tablepress-icon.png' ); 
    13 } 
    14 /* Retina images */ 
    15 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) { 
     12    background-image: url(tablepress-icon.png); 
     13} 
     14/* HiDPI images */ 
     15@media print, 
     16 (-o-min-device-pixel-ratio: 5/4), 
     17 (-webkit-min-device-pixel-ratio: 1.25), 
     18 (min-resolution: 120dpi) { 
    1619    /* Screen icon */ 
    1720    #icon-tablepress { 
    18         background-image: url( 'tablepress-icon-2x.png' ); 
     21        background-image: url(tablepress-icon-2x.png); 
    1922        background-size: 36px 36px; 
    2023    } 
    2124    /* Admin Menu icon */ 
    2225    #toplevel_page_tablepress .wp-menu-image { 
    23         background-image: url( 'tablepress-icon-small-2x.png' ); 
     26        background-image: url(tablepress-icon-small-2x.png); 
    2427        background-size: 16px 16px; 
    2528        background-position: 7px 7px; 
  • tablepress/trunk/admin/common.min.css

    r623199 r629752  
    1 #icon-tablepress{background-image:url('tablepress-icon.png')}@media only screen and (-webkit-min-device-pixel-ratio:1.5){#icon-tablepress{background-image:url('tablepress-icon-2x.png');background-size:36px 36px}#toplevel_page_tablepress .wp-menu-image{background-image:url('tablepress-icon-small-2x.png');background-size:16px 16px;background-position:7px 7px}#toplevel_page_tablepress .wp-menu-image img{display:none}}#icon-tablepress_options_invisible{display:none}#tablepress-page div.updated,#tablepress-page div.error{margin:10px 0 0}#tablepress-nav .separator{margin:6px}#tablepress-nav .nav-tab{color:#21759b}#tablepress-nav .nav-tab:hover{color:#d54e21}#tablepress-nav .nav-tab-active{padding-bottom:5px;text-shadow:1px 1px 1px #fff;color:#333}#tablepress-nav .nav-tab-active:hover{color:#464646}#tablepress_add-add-table div.inside{margin:6px;padding:0}#tablepress_add-add-table .form-wrap{max-width:500px}#tablepress_add-add-table .form-field{margin:0;padding:5px}#tablepress_add-add-table .form-field-small{float:left;width:150px;margin-right:20px}.js #tablepress-page .placeholder-active{color:#bbb}.tablepress-all-tables thead .column-table_id{width:50px}.tablepress-all-tables thead .column-table_name{width:30%}.tablepress-all-tables thead .column-table_author{width:12%}.tablepress-all-tables thead .column-table_last_modified{width:15%}.tablepress-all-tables tbody .column-table_id{font-weight:bold}.tablenav #bulk-action-top,.tablenav #bulk-action-bottom{width:130px}#tablepress-page .subtitle{float:left;padding-left:0}#tablepress-page textarea{outline:0}#tablepress-page .table-shortcode-inline{background:transparent;border:0;color:#333;width:90px;margin:0;padding:0;font-weight:bold;-webkit-box-shadow:none;box-shadow:none}#tablepress-page .table-shortcode{cursor:text}#tables-export{width:100%}#tablepress-page form :invalid,#tablepress-page form .invalid{border-color:#c00!important}.tablepress-postbox-table{border-spacing:0;width:800px}.tablepress-postbox-table .column-1{width:175px}.tablepress-postbox-table .column-2{width:625px}.tablepress-postbox-table th{text-align:left;font-weight:normal}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table th,.tablepress-postbox-table td{padding:6px 6px 2px 2px;border-spacing:0;word-wrap:break-word}.tablepress-postbox-table .top-border th,.tablepress-postbox-table .top-border td{padding:6px 6px 2px 2px;border-top:1px solid #fff}.tablepress-postbox-table .bottom-border th,.tablepress-postbox-table .bottom-border td{padding:2px 6px 6px 2px;border-bottom:1px solid #dfdfdf}.tablepress-postbox-table .no-border th,.tablepress-postbox-table .no-border td{padding:2px 6px 2px 2px}.tablepress-postbox-table .top-border.bottom-border th,.tablepress-postbox-table .top-border.bottom-border td{padding:6px 6px 6px 2px}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table .top-border .top-align{padding-top:7px}.tablepress-postbox-table .bottom-border .top-align{padding-top:4px}#tablepress_export-export-form .column-2 label,#tablepress_import-import-form .column-2 label{vertical-align:top}#tables-import-url,#tables-import-server{margin-bottom:4px}#tablepress_import-import-form .column-2 input[type="radio"],#tablepress_import-import-wp-table-reloaded .column-2 input[type="radio"]{margin-left:5px} 
     1#icon-tablepress{background-image:url(tablepress-icon.png)}@media print,(-o-min-device-pixel-ratio:5/4),(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){#icon-tablepress{background-image:url(tablepress-icon-2x.png);background-size:36px 36px}#toplevel_page_tablepress .wp-menu-image{background-image:url(tablepress-icon-small-2x.png);background-size:16px 16px;background-position:7px 7px}#toplevel_page_tablepress .wp-menu-image img{display:none}}#icon-tablepress_options_invisible{display:none}#tablepress-page div.updated,#tablepress-page div.error{margin:10px 0 0}#tablepress-nav .separator{margin:6px}#tablepress-nav .nav-tab{color:#21759b}#tablepress-nav .nav-tab:hover{color:#d54e21}#tablepress-nav .nav-tab-active{padding-bottom:5px;text-shadow:1px 1px 1px #fff;color:#333}#tablepress-nav .nav-tab-active:hover{color:#464646}#tablepress_add-add-table div.inside{margin:6px;padding:0}#tablepress_add-add-table .form-wrap{max-width:500px}#tablepress_add-add-table .form-field{margin:0;padding:5px}#tablepress_add-add-table .form-field-small{float:left;width:150px;margin-right:20px}.js #tablepress-page .placeholder-active{color:#bbb}.tablepress-all-tables thead .column-table_id{width:50px}.tablepress-all-tables thead .column-table_name{width:30%}.tablepress-all-tables thead .column-table_author{width:12%}.tablepress-all-tables thead .column-table_last_modified{width:15%}.tablepress-all-tables tbody .column-table_id{font-weight:bold}.tablenav #bulk-action-top,.tablenav #bulk-action-bottom{width:130px}#tablepress-page .subtitle{float:left;padding-left:0}#tablepress-page textarea{outline:0}#tablepress-page .table-shortcode-inline{background:transparent;border:0;color:#333;width:90px;margin:0;padding:0;font-weight:bold;-webkit-box-shadow:none;box-shadow:none}#tablepress-page .table-shortcode{cursor:text}#tables-export{width:100%}#tablepress-page form :invalid,#tablepress-page form .invalid{border-color:#c00!important}.tablepress-postbox-table{border-spacing:0;width:800px}.tablepress-postbox-table .column-1{width:175px}.tablepress-postbox-table .column-2{width:625px}.tablepress-postbox-table th{text-align:left;font-weight:normal}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table th,.tablepress-postbox-table td{padding:6px 6px 2px 2px;border-spacing:0;word-wrap:break-word}.tablepress-postbox-table .top-border th,.tablepress-postbox-table .top-border td{padding:6px 6px 2px 2px;border-top:1px solid #fff}.tablepress-postbox-table .bottom-border th,.tablepress-postbox-table .bottom-border td{padding:2px 6px 6px 2px;border-bottom:1px solid #dfdfdf}.tablepress-postbox-table .no-border th,.tablepress-postbox-table .no-border td{padding:2px 6px 2px 2px}.tablepress-postbox-table .top-border.bottom-border th,.tablepress-postbox-table .top-border.bottom-border td{padding:6px 6px 6px 2px}.tablepress-postbox-table .top-align{vertical-align:top;padding-top:7px}.tablepress-postbox-table .top-border .top-align{padding-top:7px}.tablepress-postbox-table .bottom-border .top-align{padding-top:4px}#tablepress_export-export-form .column-2 label,#tablepress_import-import-form .column-2 label{vertical-align:top}#tables-import-url,#tables-import-server{margin-bottom:4px}#tablepress_import-import-form .column-2 input[type="radio"],#tablepress_import-import-wp-table-reloaded .column-2 input[type="radio"]{margin-left:5px} 
  • tablepress/trunk/admin/edit.css

    r623199 r629752  
    2323} 
    2424 
     25/* allow wide tables to scroll sideways, only on "Edit" screen */ 
     26#wpbody-content { 
     27    overflow: visible !important; /* !important is necessary to override an inline style that postboxes.js sets via JS */ 
     28} 
     29 
    2530/* move Thickbox more to the front, so that it's always above a jQuery UI dialog */ 
    2631#TB_HideSelect { 
     
    8388} 
    8489 
    85 /* make postboxes at least as wide as their contents, 
    86 Attention: This decreases usability of the the sorting/moving feature of postboxes! */ 
     90/* make postboxes at least as wide as their contents, to prevent overlapping elements */ 
    8791#tablepress-page .postbox { 
    88     display: inline-block; /* e.g. stretch to the width of the table */ 
    89     min-width: 100%; /* but use the full width */ 
     92    min-width: 836px; /* sum of inner table width, padding, border, ... */ 
     93} 
     94#tablepress-page #tablepress_edit-table-data { 
     95    display: inline-block; /* stretch to the width of the table */ 
     96    min-width: 99.9%; /* but use the full width, bus minus like 1px as the box is wider than the others otherwise */ 
    9097} 
    9198 
     
    96103} 
    97104 
    98 /* cells of currently focussed row/autogrow */ 
     105/* cells of currently focussed row/autogrow, and automatically increase cells if JS is disabled */ 
     106.no-js #edit-form-body td, 
    99107#edit-form-body .focus td { 
    100108    height: 64px; 
     
    193201} 
    194202 
    195 #tablepress_edit-table-manipulation td { 
    196     width: 50%; 
    197 } 
     203#tablepress_edit-table-manipulation .column-1 { 
     204    width: 45%; 
     205} 
     206#tablepress_edit-table-manipulation .column-2 { 
     207    width: 55%; 
     208} 
  • tablepress/trunk/admin/edit.js

    r623199 r629752  
    171171                        tp.table.preview.show( $(this).attr( 'href' ) + '&TB_iframe=true' ); 
    172172                        return false; 
     173                    } 
     174 
     175                    // validation checks 
     176                    if ( $( '#option-datatables-paginate' ).prop( 'checked' ) && ! ( /^[1-9][0-9]{0,4}$/ ).test( $( '#option-datatables-paginate_entries' ).val() ) ) { 
     177                        alert( tablepress_strings.num_pagination_entries_invalid ); 
     178                        $( '#option-datatables-paginate_entries' ).focus().select(); 
     179                        return; 
     180                    } 
     181                    if ( ( /[^A-Za-z0-9- _]/ ).test( $( '#option-extra-css-classes' ).val() ) ) { 
     182                        alert( tablepress_strings.extra_css_classes_invalid ); 
     183                        $( '#option-extra-css-classes' ).focus().select(); 
     184                        return; 
    173185                    } 
    174186 
     
    420432                $rows.filter( ':even' ).addClass( 'odd' ); 
    421433                $rows = $rows.not( '.row-hidden' ); 
    422                 if( helper.hasClass( 'row-hidden' ) ) 
     434                if ( helper.hasClass( 'row-hidden' ) ) 
    423435                    $rows = $rows.not( '.ui-sortable-placeholder' ); 
    424436                if ( tp.table.head ) 
     
    704716                thickbox_size: function() { 
    705717                    var $link = $( '#advanced-editor-content-add_media' ), 
    706                         url = $link.attr( 'href' ), 
     718                        url, 
    707719                        width = $(window).width(), 
    708720                        W = ( 720 < width ) ? 720 : width, 
    709721                        H = $(window).height(); 
     722 
     723                    if ( ! $link.length ) // for temporary 3.5 compatibility 
     724                        return; 
     725 
     726                    url = $link.attr( 'href' ); 
    710727 
    711728                    if ( $( 'body.admin-bar' ).length ) 
     
    890907        save_changes: { 
    891908            trigger: function( event ) { 
     909                // validation checks 
     910                if ( $( '#option-datatables-paginate' ).prop( 'checked' ) && ! ( /^[1-9][0-9]{0,4}$/ ).test( $( '#option-datatables-paginate_entries' ).val() ) ) { 
     911                    alert( tablepress_strings.num_pagination_entries_invalid ); 
     912                    $( '#option-datatables-paginate_entries' ).focus().select(); 
     913                    return; 
     914                } 
    892915                if ( ( /[^A-Za-z0-9- _]/ ).test( $( '#option-extra-css-classes' ).val() ) ) { 
    893916                    alert( tablepress_strings.extra_css_classes_invalid ); 
     
    943966                $( '#nonce-preview-table' ).val( data.new_preview_nonce ); 
    944967                // update URLs in Preview links 
    945                 $( '.show-preview-button' ).attr( 'href', 
    946                     $( '.show-preview-button' ).first().attr( 'href' ) 
    947                         .replace( /item=[a-zA-Z0-9_-]+/g, 'item=' + data.table_id ) 
    948                         .replace( /&_wpnonce=[a-z0-9]+/ig, '&_wpnonce=' + data.new_preview_nonce ) 
    949                 ); 
     968                var $show_preview_buttons = $( '.show-preview-button' ); 
     969                if ( $show_preview_buttons.length ) { // check necessary, because Preview button might not be visible 
     970                    $show_preview_buttons.attr( 'href', 
     971                        $show_preview_buttons.first().attr( 'href' ) 
     972                            .replace( /item=[a-zA-Z0-9_-]+/g, 'item=' + data.table_id ) 
     973                            .replace( /&_wpnonce=[a-z0-9]+/ig, '&_wpnonce=' + data.new_preview_nonce ) 
     974                    ); 
     975                } 
    950976                // update last modified date and user nickname 
    951977                $( '#last-modified' ).text( data.last_modified ); 
     
    10971123    }; 
    10981124 
    1099     // allow wide tables to scroll sideways, only on "Edit" screen 
    1100     $( '#wpbody-content' ).css( 'overflow', 'visible' ); 
    1101  
    11021125    // run TablePress initialization 
    11031126    tp.init(); 
  • tablepress/trunk/admin/edit.min.css

    r623199 r629752  
    1 body.wait *{cursor:wait!important}.hidden-container{display:none}.hidden-help-box-container p{margin:6px}#TB_HideSelect{z-index:301099}#TB_overlay{z-index:301100}#TB_window{z-index:301102}#TB_load{z-index:301103}#table-preview-iframe{width:100%;height:100%;margin:0;border:0}#table-preview{height:100%;margin:-2px -15px -15px -15px}#advanced-editor{padding:3px}#advanced-editor .submitbox{padding:6px 6px 0;font-size:11px;overflow:auto;height:30px}#advanced-editor-confirm{float:right}#advanced-editor-cancel{line-height:30px}.spinner.animation-saving,.spinner.animation-preview{display:inline-block;float:none;margin:7px 0 0 7px;vertical-align:top}#tablepress-page div.save-changes-success,#tablepress-page div.save-changes-error,#tablepress-page div.preview-error{margin:0 0 15px}#tablepress-page .postbox{display:inline-block;min-width:100%}#edit-form-body td{padding:2px 2px 2px 0;height:32px}#edit-form-body .focus td{height:64px}#edit-form-body .odd{background-color:#eee}#edit-form-body textarea{display:block;width:150px;height:100%}#edit-form-body textarea:focus{border-color:#000}#edit-form-body input[type="checkbox"]{margin-right:3px}#edit-form-foot input[type="checkbox"]{margin-top:6px}#edit-form{border-collapse:collapse;margin-bottom:5px}#edit-form .move-handle{display:block;margin:auto;width:16px;height:16px;text-align:center;font-weight:bold}.js #edit-form .move-handle{cursor:move}#edit-form-body .move-handle{margin:auto 3px;min-width:16px;width:auto}#edit-form .move-hover{position:absolute;z-index:1000;height:26px}#edit-form .focus .move-hover{height:54px}#edit-form-body .head-row,#edit-form-body .foot-row{background-color:#d9edf7}#edit-form-head th{height:16px;vertical-align:top}#edit-form-head .sort-control{float:right;width:12px;height:12px;cursor:pointer;margin:2px 3px 0 0}#edit-form-head .sorting-indicator{display:block;margin:4px 2px 0 0}#edit-form-head .sort-asc .sorting-indicator{background-position:0 0}#edit-form-head .sort-desc .sorting-indicator{background-position:-7px 0}#edit-form .row-hidden td,#edit-form .row-hidden textarea,#edit-form .column-hidden,#edit-form .column-hidden textarea{background-color:#ffe0e0}#tablepress_edit-table-manipulation td{width:50%} 
     1body.wait *{cursor:wait!important}.hidden-container{display:none}.hidden-help-box-container p{margin:6px}#wpbody-content{overflow:visible!important}#TB_HideSelect{z-index:301099}#TB_overlay{z-index:301100}#TB_window{z-index:301102}#TB_load{z-index:301103}#table-preview-iframe{width:100%;height:100%;margin:0;border:0}#table-preview{height:100%;margin:-2px -15px -15px -15px}#advanced-editor{padding:3px}#advanced-editor .submitbox{padding:6px 6px 0;font-size:11px;overflow:auto;height:30px}#advanced-editor-confirm{float:right}#advanced-editor-cancel{line-height:30px}.spinner.animation-saving,.spinner.animation-preview{display:inline-block;float:none;margin:7px 0 0 7px;vertical-align:top}#tablepress-page div.save-changes-success,#tablepress-page div.save-changes-error,#tablepress-page div.preview-error{margin:0 0 15px}#tablepress-page .postbox{min-width:836px}#tablepress-page #tablepress_edit-table-data{display:inline-block;min-width:99.9%}#edit-form-body td{padding:2px 2px 2px 0;height:32px}.no-js #edit-form-body td,#edit-form-body .focus td{height:64px}#edit-form-body .odd{background-color:#eee}#edit-form-body textarea{display:block;width:150px;height:100%}#edit-form-body textarea:focus{border-color:#000}#edit-form-body input[type="checkbox"]{margin-right:3px}#edit-form-foot input[type="checkbox"]{margin-top:6px}#edit-form{border-collapse:collapse;margin-bottom:5px}#edit-form .move-handle{display:block;margin:auto;width:16px;height:16px;text-align:center;font-weight:bold}.js #edit-form .move-handle{cursor:move}#edit-form-body .move-handle{margin:auto 3px;min-width:16px;width:auto}#edit-form .move-hover{position:absolute;z-index:1000;height:26px}#edit-form .focus .move-hover{height:54px}#edit-form-body .head-row,#edit-form-body .foot-row{background-color:#d9edf7}#edit-form-head th{height:16px;vertical-align:top}#edit-form-head .sort-control{float:right;width:12px;height:12px;cursor:pointer;margin:2px 3px 0 0}#edit-form-head .sorting-indicator{display:block;margin:4px 2px 0 0}#edit-form-head .sort-asc .sorting-indicator{background-position:0 0}#edit-form-head .sort-desc .sorting-indicator{background-position:-7px 0}#edit-form .row-hidden td,#edit-form .row-hidden textarea,#edit-form .column-hidden,#edit-form .column-hidden textarea{background-color:#ffe0e0}#tablepress_edit-table-manipulation .column-1{width:45%}#tablepress_edit-table-manipulation .column-2{width:55%} 
  • tablepress/trunk/admin/edit.min.js

    r623199 r629752  
    88datatables_sort:a("#option-datatables-sort").prop("checked"),datatables_filter:a("#option-datatables-filter").prop("checked"),datatables_paginate:a("#option-datatables-paginate").prop("checked"),datatables_lengthchange:a("#option-datatables-lengthchange").prop("checked"),datatables_paginate_entries:a("#option-datatables-paginate_entries").val(),datatables_info:a("#option-datatables-info").prop("checked"),datatables_scrollX:a("#option-datatables-scrollX").prop("checked"),datatables_custom_commands:a("#option-datatables-custom-commands").val()}; 
    99f=JSON.stringify(f);i.rows=d.find('input[type="hidden"]').map(function(){if("1"==a(this).val())return 1;h.hidden_rows+=1;return 0}).get();i.columns=a("#edit-form-foot").find('input[type="hidden"]').map(function(){if("1"==a(this).val())return 1;h.hidden_columns+=1;return 0}).get();i=JSON.stringify(i);return{action:b,_ajax_nonce:a(c).val(),tablepress:{id:tp.table.id,new_id:tp.table.new_id,name:a("#table-name").val(),description:a("#table-description").val(),number:h,data:e,options:f,visibility:i}}}, 
    10 preview:{trigger:function(){if(!tp.made_changes)return tp.table.preview.show(a(this).attr("href")+"&TB_iframe=true"),!1;a(this).closest("p").append('<span class="animation-preview spinner" title="'+tablepress_strings.preparing_preview+'"/>');a("body").addClass("wait");a("#table-preview").empty();a.post(ajaxurl,tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),function(){},"json").success(tp.table.preview.ajax_success).error(tp.table.preview.ajax_error);return!1},ajax_success:function(a, 
    11 c){"undefined"==typeof c||"success"!=c?tp.table.preview.error("AJAX call successful, but unclear status."):"undefined"==typeof a||null==a||"-1"==a||"undefined"==typeof a.success||!0!==a.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(a)},ajax_error:function(a,c,d){tp.table.preview.error("AJAX call failed: "+c+" - "+d)},success:function(b){a("#table-preview").empty();a('<iframe id="table-preview-iframe" />').load(function(){var c=a(this).contents(); 
    12 c.find("head").append(b.head_html);c.find("body").append(b.body_html)}).appendTo("#table-preview");a(".animation-preview").remove();a("body").removeClass("wait");tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(b){a(".animation-preview").closest("p").after('<div class="preview-error error"><p><strong>'+tablepress_strings.preview_error+": "+b+"</strong></p></div>");a(".animation-preview").remove();a(".preview-error").delay(6E3).fadeOut(2E3,function(){a(this).remove()}); 
    13 a("body").removeClass("wait")},show:function(b){var c=a(window).width()-120,d=a(window).height()-120;a("body.admin-bar").length&&(d-=28);tb_show(a(".show-preview-button").first().text(),b+"&height="+d+"&width="+c,!1)}}},rows:{create:function(b){var c,d,e,f="";for(c=0;c<b;c++){f+=tp.table.body_cells_pre;for(d=0;d<tp.table.columns;d++)f+=tp.table.body_cell;f+=tp.table.body_cells_post}e=a("#edit-form-foot").find(".column-hidden").map(function(){return a(this).index()}).get();return a(f).each(function(b, 
    14 c){a(c).children().filter(function(a){return-1!=jQuery.inArray(a,e)}).addClass("column-hidden")})},append:function(){var b=a("#rows-append-number").val();/^[1-9][0-9]{0,4}$/.test(b)?(a("#edit-form-body").append(tp.rows.create(b)),tp.rows.stripe(),tp.reindex()):(alert(tablepress_strings.append_num_rows_invalid),a("#rows-append-number").focus().select())},insert:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected): 
    15 (b.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex())},hide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed())},unhide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.removeClass("row-hidden").find(".visibility").val("1"), 
    16 tp.rows.stripe(),tp.table.set_table_changed())},remove:function(){var b,c=a("#edit-form-body").find("input:checked").closest("tr");0===c.length?alert(tablepress_strings.no_rows_selected):tp.table.rows==c.length?alert(tablepress_strings.no_remove_all_rows):(b=1==c.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(b)&&(c.remove(),tp.rows.stripe(),tp.reindex()))},move:{start:function(b,c){a(c.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+ 
    17 (tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>');a(c.helper).removeClass("odd head-row foot-row")},change:function(a,c){tp.rows.stripe(c.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var b=a(this).parent().index(),c=a(this).hasClass("sort-asc")?1:-1,d=a("#edit-form-body"),e=d.find(".head-row").prevAll().andSelf(),f=d.find(".foot-row").nextAll().andSelf(),h=d.children().not(e).not(f).get(),i=function(a,b){var c=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi, 
    18 d=/(^[ ]*|[ ]*$)/g,e=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,f=/^0x[0-9a-f]+$/i,h=/^0/,g=a.replace(d,"")||"",i=b.replace(d,"")||"",d=g.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),c=i.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),g=parseInt(g.match(f))||1!=d.length&&g.match(e)&&Date.parse(g);if(e=parseInt(i.match(f))||g&&i.match(e)&&Date.parse(i)||null){if(g<e)return-1; 
    19 if(g>e)return 1}g=0;for(i=Math.max(d.length,c.length);g<i;g++){e=!(d[g]||"").match(h)&&parseFloat(d[g])||d[g]||0;f=!(c[g]||"").match(h)&&parseFloat(c[g])||c[g]||0;if(isNaN(e)!==isNaN(f))return isNaN(e)?1:-1;typeof e!==typeof f&&(e+="",f+="");if(e<f)return-1;if(e>f)return 1}return 0};a.each(h,function(c,d){d.sort_key=(""+a(d).children().eq(b).find("textarea").val()).toLowerCase()});h.sort(function(a,b){return c*i(a.sort_key,b.sort_key)});a.each(h,function(a,b){b.sort_key=null});d.append(e);d.append(h); 
    20 d.append(f);tp.rows.stripe();tp.reindex()},stripe:function(b){"undefined"==typeof b&&(b=null);var b=a(b),c=a("#edit-form-body").children().removeClass("odd head-row foot-row").not(b);c.filter(":even").addClass("odd");c=c.not(".row-hidden");b.hasClass("row-hidden")&&(c=c.not(".ui-sortable-placeholder"));tp.table.head&&c.first().addClass("head-row");tp.table.foot&&c.last().addClass("foot-row")}},columns:{append:function(){var b,c=a("#columns-append-number").val(),d=new_head_cells=new_foot_cells=""; 
    21 if(/^[1-9][0-9]{0,4}$/.test(c)){for(b=0;b<c;b++)d+=tp.table.body_cell,new_head_cells+=tp.table.head_cell,new_foot_cells+=tp.table.foot_cell;a("#edit-form-body").children().each(function(b,c){a(c).children().slice(-tp.table.no_data_columns_post).before(d)});a("#edit-form-head").children().slice(-tp.table.no_data_columns_post).before(new_head_cells);a("#edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(new_foot_cells);tp.reindex()}else alert(tablepress_strings.append_num_columns_invalid), 
    22 a("#columns-append-number").focus().select()},insert:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.body_cell)}),a("#edit-form-head").children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.head_cell), 
    23 b.before(tp.table.foot_cell),tp.reindex())},hide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).addClass("column-hidden")}),b.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed())}, 
    24 unhide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).removeClass("column-hidden")}),b.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed())},remove:function(){var b, 
    25 c,d=a("#edit-form-foot").find("input:checked").closest("th");0===d.length?alert(tablepress_strings.no_columns_selected):tp.table.columns==d.length?alert(tablepress_strings.no_remove_all_columns):(c=1==d.length?tablepress_strings.ays_remove_columns_singular:tablepress_strings.ays_remove_columns_plural,confirm(c)&&(b=d.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(c,d){a(d).children().filter(function(a){return-1!=jQuery.inArray(a, 
    26 b)}).remove()}),d.remove(),tp.reindex()))},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(b,c){var d=a(c.item);tp.columns.move.source_idx=d.index();tp.columns.move.$rows=a("#edit-form-body").children().add("#edit-form-foot");tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=a(this);a('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell); 
    27 tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide();tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover");d=tp.columns.move.$helper.eq(1).width();tp.columns.move.$helper.eq(0).width(d);tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder");tp.columns.move.$placeholder.find("div").width(d)},change:function(b, 
    28 c){tp.columns.move.target_idx=a(c.placeholder).index();1==tp.columns.move.target_idx-tp.columns.move.source_idx?tp.columns.move.target_idx+=1:tp.columns.move.target_idx==tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1);tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell=a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))});tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1); 
    29 tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(a,c){tp.columns.move.$helper.css("left",c.position.left)},stop:function(){tp.columns.move.$helper.remove();tp.columns.move.$cells.each(function(){tp.columns.move.$cell=a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show();tp.columns.move.$placeholder.remove();tp.columns.move.source_idx=tp.columns.move.target_idx=-1;tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell= 
    30 tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null;tp.reindex()}},number_to_letter:function(a){for(var c="";0<a;)c=String.fromCharCode(65+(a-1)%26)+c,a=Math.floor((a-1)/26);return c}},cells:{$focus:a(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus");tp.cells.$focus=a(this).closest("tr").addClass("focus")},advanced_editor:{keyopen:function(b){b.shiftKey&&(b=a("#advanced-editor-content"),tp.cells.advanced_editor.thickbox_size(),tp.cells.$textarea= 
    31 a(this).blur(),b.val(tp.cells.$textarea.val()),a("#advanced-editor").wpdialog("open"),b.get(0).selectionStart=b.get(0).selectionEnd=b.val().length,b.focus())},buttonopen:function(){if(confirm(tablepress_strings.advanced_editor_open))a("#edit-form-body").one("click","textarea",function(){var b=a("#advanced-editor-content");tp.cells.advanced_editor.thickbox_size();tp.cells.$textarea=a(this).blur();b.val(tp.cells.$textarea.val());a("#advanced-editor").wpdialog("open");b.get(0).selectionStart=b.get(0).selectionEnd= 
    32 b.val().length;b.focus()})},save:function(){var b=a("#advanced-editor-content").blur().val();tp.cells.$textarea.val()!=b&&(tp.cells.$textarea.val(b),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed());tp.cells.$textarea.focus();tp.cells.advanced_editor.close()},close:function(){a("#advanced-editor").wpdialog("close");return!1},thickbox_size:function(){var b=a("#advanced-editor-content-add_media"),c=b.attr("href"), 
    33 d=a(window).width(),d=720<d?720:d,e=a(window).height();a("body.admin-bar").length&&(e-=28);c=c.replace(/&width=[0-9]+/g,"").replace(/&height=[0-9]+/g,"");b.attr("href",c+("&width="+(d-80)+"&height="+(e-85)))}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(b){if("undefined"==b.shiftKey)return!0;if(b.shiftKey){if(!tp.cells.checkboxes.last_clicked[b.data.parent])return!0;var c=a(b.data.parent).find(":checkbox"),d=c.index(tp.cells.checkboxes.last_clicked[b.data.parent]), 
    34 e=c.index(this);d!=e&&c.slice(Math.min(d,e),Math.max(d,e)).prop("checked",a(this).prop("checked"))}tp.cells.checkboxes.last_clicked[b.data.parent]=this;return!0}}},content:{link:{add:function(){if(confirm(tablepress_strings.link_add))a("#edit-form-body").one("mousedown","textarea",function(){wpActiveEditor=this.id;a(window).one("mouseup",function(){wpLink.open();tp.table.set_table_changed()})})}},image:{add:function(){if(confirm(tablepress_strings.image_add))a("#edit-form-body").one("click","textarea", 
    35 function(){wpActiveEditor=this.id;this.selectionStart=this.selectionEnd=this.value.length;var b=a("#image-add"),c=a(window).width(),c=720<c?720:c,d=a(window).height();a("body.admin-bar").length&&(d-=28);tb_show(b.text(),b.attr("href")+"&TB_iframe=true&height="+(d-85)+"&width="+(c-80),!1);a(this).blur()});return!1}},span:{add:function(b){if(confirm("#rowspan#"==b?tablepress_strings.rowspan_add:tablepress_strings.colspan_add))a("#edit-form-body").one("click","textarea",function(){var c=a(this),d=c.parent().index(), 
    36 e=c.closest("tr").index();if("#rowspan#"==b){if(0==e){alert(tablepress_strings.no_rowspan_first_row);return}if(tp.table.head&&1==e){alert(tablepress_strings.no_rowspan_table_head);return}if(tp.table.foot&&tp.table.rows-1==e){alert(tablepress_strings.no_rowspan_table_foot);return}}else if("#colspan#"==b&&tp.table.no_data_columns_pre==d){alert(tablepress_strings.no_colspan_first_col);return}c.val(b);tp.table.set_table_changed()})}}},check:{table_id:function(b){37==b.which||39==b.which||(b=a(this),b.val(b.val().replace(/[^0-9a-zA-Z-_]/g, 
    37 "")))},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},reindex:function(){var b,c=a("#edit-form-body").children(),d,e={};tp.table.rows=c.length;tp.table.columns=0<tp.table.rows?c.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:0;c.each(function(c,h){b=a(h);b.find("textarea").val(function(b,c){return""==c||"="!=c.charAt(0)?c:c.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(b,c,f){e.hasOwnProperty(c)||(d=a("#cell-"+ 
    38 c),e[c]=d.length?tp.columns.number_to_letter(d.parent().index()-tp.table.no_data_columns_pre+1)+(d.closest("tr").index()+1):c);b=e[c];"undefined"!=typeof f&&(e.hasOwnProperty(f)||(d=a("#cell-"+f),e[f]=d.length?tp.columns.number_to_letter(d.parent().index()-tp.table.no_data_columns_pre+1)+(d.closest("tr").index()+1):f),b+=":"+e[f]);return b})}).attr("name",function(a){return"table[data]["+c+"]["+a+"]"});b.find(".move-handle").html(c+1)}).each(function(b,c){a(c).find("textarea").attr("id",function(a){return"cell-"+ 
    39 tp.columns.number_to_letter(a+1)+(b+1)})});a("#edit-form-head").find(".move-handle").html(function(a){return tp.columns.number_to_letter(a+1)});a("#number-rows").val(tp.table.rows);a("#number-columns").val(tp.table.columns);tp.table.set_table_changed()},save_changes:{trigger:function(b){/[^A-Za-z0-9- _]/.test(a("#option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),a("#option-extra-css-classes").focus().select()):b.shiftKey?(tp.made_changes=!1,a("#tablepress-page").find("form").submit()): 
    40 (a(this).closest("p").append('<span class="animation-saving spinner" title="'+tablepress_strings.saving_changes+'"/>'),a(".save-changes-button").prop("disabled",!0),a("body").addClass("wait"),a.post(ajaxurl,tp.table.prepare_ajax_request("tablepress_save_table","#nonce-edit-table"),function(){},"json").success(tp.save_changes.ajax_success).error(tp.save_changes.ajax_error))},ajax_success:function(a,c){"undefined"==typeof c||"success"!=c?tp.save_changes.error("AJAX call successful, but unclear status. Try again while holding down the &#8220;Shift&#8221; key."): 
    41 "undefined"==typeof a||null==a||"-1"==a||"undefined"==typeof a.success||!0!==a.success?tp.save_changes.error("AJAX call successful, but unclear data. Try again while holding down the &#8220;Shift&#8221; key."):tp.save_changes.success(a)},ajax_error:function(a,c,d){tp.save_changes.error("AJAX call failed: "+c+" - "+d+". Try again while holding down the &#8220;Shift&#8221; key.")},success:function(b){tp.table.id!=b.table_id&&"pushState"in window.history&&null!==window.history.pushState&&window.history.pushState("", 
    42 "",window.location.href.replace(/table_id=[0-9a-zA-Z-_]+/gi,"table_id="+b.table_id));tp.table.id=tp.table.new_id=b.table_id;a("#table-id").val(tp.table.id);a("#table-new-id").val(tp.table.new_id);a(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]");a("#nonce-edit-table").val(b.new_edit_nonce);a("#nonce-preview-table").val(b.new_preview_nonce);a(".show-preview-button").attr("href",a(".show-preview-button").first().attr("href").replace(/item=[a-zA-Z0-9_-]+/g,"item="+ 
    43 b.table_id).replace(/&_wpnonce=[a-z0-9]+/ig,"&_wpnonce="+b.new_preview_nonce));a("#last-modified").text(b.last_modified);a("#last-editor").text(b.last_editor);tp.table.unset_table_changed();tp.save_changes.after_saving_dialog("success",tablepress_strings[b.message])},error:function(a){tp.save_changes.after_saving_dialog("error",a)},after_saving_dialog:function(b,c){var c="undefined"==typeof c?"":": "+c,d,e="save-changes-"+b;"success"==b?(e+=" updated",d=3E3):(e+=" error",d=6E3);a(".animation-saving").closest("p").after('<div class="'+ 
    44 e+'"><p><strong>'+tablepress_strings["save_changes_"+b]+c+"</strong></p></div>");a(".animation-saving").remove();a(".save-changes-"+b).delay(d).fadeOut(2E3,function(){a(this).remove()});a(".save-changes-button").prop("disabled",!1);a("body").removeClass("wait")}},init:function(){var b={click:{"#rows-insert":tp.rows.insert,"#columns-insert":tp.columns.insert,"#rows-remove":tp.rows.remove,"#columns-remove":tp.columns.remove,"#rows-hide":tp.rows.hide,"#columns-hide":tp.columns.hide,"#rows-unhide":tp.rows.unhide, 
    45 "#columns-unhide":tp.columns.unhide,"#rows-append":tp.rows.append,"#columns-append":tp.columns.append,"#link-add":tp.content.link.add,"#image-add":tp.content.image.add,"#span-add-rowspan":function(){tp.content.span.add("#rowspan#")},"#span-add-colspan":function(){tp.content.span.add("#colspan#")},".show-preview-button":tp.table.preview.trigger,".save-changes-button":tp.save_changes.trigger,".show-help-box":function(){a(this).next().wpdialog({title:a(this).attr("title"),height:400,width:300,modal:!0, 
    46 dialogClass:"wp-dialog",resizable:!1})}},keyup:{"#table-new-id":tp.check.table_id},change:{"#option-table-head":tp.table.change_table_head,"#option-table-foot":tp.table.change_table_foot,"#option-use-datatables":tp.table.change_datatables,"#option-datatables-paginate":tp.table.change_datatables_pagination},blur:{"#table-new-id":tp.table.change_id}},c=a("#edit-form-body");a.each(b,function(b,c){a.each(c,function(c,e){a(c).on(b,e)})});a(window).on("beforeunload",tp.check.changes_saved);a("#option-table-head").change(); 
    47 a("#option-print-name").change(tp.table.change_print_name_description).change();a("#option-print-description").change(tp.table.change_print_name_description).change();c.one("change","textarea",tp.table.set_table_changed);a("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed);tablepress_options.cells_advanced_editor?(c.on("click","textarea",tp.cells.advanced_editor.keyopen),a("#advanced-editor-open").on("click", 
    48 tp.cells.advanced_editor.buttonopen),a("#advanced-editor-confirm").on("click",tp.cells.advanced_editor.save),a("#advanced-editor-cancel").on("click",tp.cells.advanced_editor.close),a("#advanced-editor").wpdialog({autoOpen:!1,title:a("#advanced-editor-open").val(),width:600,modal:!0,dialogClass:"wp-dialog",resizable:!1})):a("#advanced-editor-open").hide();if(tablepress_options.cells_auto_grow)c.on("focus","textarea",tp.cells.autogrow);a("#edit-form-body").on("click","input:checkbox",{parent:"#edit-form-body"}, 
    49 tp.cells.checkboxes.multi_select);a("#edit-form-foot").on("click","input:checkbox",{parent:"#edit-form-foot"},tp.cells.checkboxes.multi_select);a("#edit-form-head").on("click",".sort-control",tp.rows.sort);a("#tablepress-page").find("form").on("submit",function(){a(this).find(".tablepress-postbox-table").find("input, select").prop("disabled",!1)});c.sortable({axis:"y",containment:a("#edit-form"),forceHelperSize:!0,handle:".move-handle",start:tp.rows.move.start,change:tp.rows.move.change,stop:tp.rows.move.stop, 
    50 update:tp.reindex});a("#edit-form-head").sortable({axis:"x",items:".head",containment:"parent",forceHelperSize:!0,helper:"clone",handle:".move-handle",start:tp.columns.move.start,stop:tp.columns.move.stop,change:tp.columns.move.change,sort:tp.columns.move.sort}).disableSelection()}};a("#wpbody-content").css("overflow","visible");tp.init();window.send_to_editor=function(a){"undefined"!=typeof QTags?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a;try{tb_remove()}catch(c){}tp.table.set_table_changed()}}); 
     10preview:{trigger:function(){if(!tp.made_changes)return tp.table.preview.show(a(this).attr("href")+"&TB_iframe=true"),!1;if(a("#option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(a("#option-datatables-paginate_entries").val()))alert(tablepress_strings.num_pagination_entries_invalid),a("#option-datatables-paginate_entries").focus().select();else if(/[^A-Za-z0-9- _]/.test(a("#option-extra-css-classes").val()))alert(tablepress_strings.extra_css_classes_invalid),a("#option-extra-css-classes").focus().select(); 
     11else return a(this).closest("p").append('<span class="animation-preview spinner" title="'+tablepress_strings.preparing_preview+'"/>'),a("body").addClass("wait"),a("#table-preview").empty(),a.post(ajaxurl,tp.table.prepare_ajax_request("tablepress_preview_table","#nonce-preview-table"),function(){},"json").success(tp.table.preview.ajax_success).error(tp.table.preview.ajax_error),!1},ajax_success:function(a,c){"undefined"==typeof c||"success"!=c?tp.table.preview.error("AJAX call successful, but unclear status."): 
     12"undefined"==typeof a||null==a||"-1"==a||"undefined"==typeof a.success||!0!==a.success?tp.table.preview.error("AJAX call successful, but unclear data."):tp.table.preview.success(a)},ajax_error:function(a,c,d){tp.table.preview.error("AJAX call failed: "+c+" - "+d)},success:function(b){a("#table-preview").empty();a('<iframe id="table-preview-iframe" />').load(function(){var c=a(this).contents();c.find("head").append(b.head_html);c.find("body").append(b.body_html)}).appendTo("#table-preview");a(".animation-preview").remove(); 
     13a("body").removeClass("wait");tp.table.preview.show("#TB_inline?inlineId=preview-container")},error:function(b){a(".animation-preview").closest("p").after('<div class="preview-error error"><p><strong>'+tablepress_strings.preview_error+": "+b+"</strong></p></div>");a(".animation-preview").remove();a(".preview-error").delay(6E3).fadeOut(2E3,function(){a(this).remove()});a("body").removeClass("wait")},show:function(b){var c=a(window).width()-120,d=a(window).height()-120;a("body.admin-bar").length&&(d-= 
     1428);tb_show(a(".show-preview-button").first().text(),b+"&height="+d+"&width="+c,!1)}}},rows:{create:function(b){var c,d,e,f="";for(c=0;c<b;c++){f+=tp.table.body_cells_pre;for(d=0;d<tp.table.columns;d++)f+=tp.table.body_cell;f+=tp.table.body_cells_post}e=a("#edit-form-foot").find(".column-hidden").map(function(){return a(this).index()}).get();return a(f).each(function(b,c){a(c).children().filter(function(a){return-1!=jQuery.inArray(a,e)}).addClass("column-hidden")})},append:function(){var b=a("#rows-append-number").val(); 
     15/^[1-9][0-9]{0,4}$/.test(b)?(a("#edit-form-body").append(tp.rows.create(b)),tp.rows.stripe(),tp.reindex()):(alert(tablepress_strings.append_num_rows_invalid),a("#rows-append-number").focus().select())},insert:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.before(tp.rows.create(1)),tp.rows.stripe(),tp.reindex())},hide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked", 
     16b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.addClass("row-hidden").find(".visibility").val("0"),tp.rows.stripe(),tp.table.set_table_changed())},unhide:function(b){b=a("#edit-form-body").find("input:checked").prop("checked",b.shiftKey).closest("tr");0===b.length?alert(tablepress_strings.no_rows_selected):(b.removeClass("row-hidden").find(".visibility").val("1"),tp.rows.stripe(),tp.table.set_table_changed())},remove:function(){var b,c=a("#edit-form-body").find("input:checked").closest("tr"); 
     170===c.length?alert(tablepress_strings.no_rows_selected):tp.table.rows==c.length?alert(tablepress_strings.no_remove_all_rows):(b=1==c.length?tablepress_strings.ays_remove_rows_singular:tablepress_strings.ays_remove_rows_plural,confirm(b)&&(c.remove(),tp.rows.stripe(),tp.reindex()))},move:{start:function(b,c){a(c.placeholder).removeClass("row-hidden").css("visibility","visible").html('<td colspan="'+(tp.table.columns+tp.table.no_data_columns_pre+tp.table.no_data_columns_post)+'"><div/></td>');a(c.helper).removeClass("odd head-row foot-row")}, 
     18change:function(a,c){tp.rows.stripe(c.helper)},stop:function(){tp.rows.stripe()}},sort:function(){var b=a(this).parent().index(),c=a(this).hasClass("sort-asc")?1:-1,d=a("#edit-form-body"),e=d.find(".head-row").prevAll().andSelf(),f=d.find(".foot-row").nextAll().andSelf(),h=d.children().not(e).not(f).get(),i=function(a,b){var c=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,d=/(^[ ]*|[ ]*$)/g,e=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/, 
     19f=/^0x[0-9a-f]+$/i,h=/^0/,g=a.replace(d,"")||"",i=b.replace(d,"")||"",d=g.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),c=i.replace(c,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),g=parseInt(g.match(f))||1!=d.length&&g.match(e)&&Date.parse(g);if(e=parseInt(i.match(f))||g&&i.match(e)&&Date.parse(i)||null){if(g<e)return-1;if(g>e)return 1}g=0;for(i=Math.max(d.length,c.length);g<i;g++){e=!(d[g]||"").match(h)&&parseFloat(d[g])||d[g]||0;f=!(c[g]||"").match(h)&& 
     20parseFloat(c[g])||c[g]||0;if(isNaN(e)!==isNaN(f))return isNaN(e)?1:-1;typeof e!==typeof f&&(e+="",f+="");if(e<f)return-1;if(e>f)return 1}return 0};a.each(h,function(c,d){d.sort_key=(""+a(d).children().eq(b).find("textarea").val()).toLowerCase()});h.sort(function(a,b){return c*i(a.sort_key,b.sort_key)});a.each(h,function(a,b){b.sort_key=null});d.append(e);d.append(h);d.append(f);tp.rows.stripe();tp.reindex()},stripe:function(b){"undefined"==typeof b&&(b=null);var b=a(b),c=a("#edit-form-body").children().removeClass("odd head-row foot-row").not(b); 
     21c.filter(":even").addClass("odd");c=c.not(".row-hidden");b.hasClass("row-hidden")&&(c=c.not(".ui-sortable-placeholder"));tp.table.head&&c.first().addClass("head-row");tp.table.foot&&c.last().addClass("foot-row")}},columns:{append:function(){var b,c=a("#columns-append-number").val(),d=new_head_cells=new_foot_cells="";if(/^[1-9][0-9]{0,4}$/.test(c)){for(b=0;b<c;b++)d+=tp.table.body_cell,new_head_cells+=tp.table.head_cell,new_foot_cells+=tp.table.foot_cell;a("#edit-form-body").children().each(function(b, 
     22c){a(c).children().slice(-tp.table.no_data_columns_post).before(d)});a("#edit-form-head").children().slice(-tp.table.no_data_columns_post).before(new_head_cells);a("#edit-form-foot").children().slice(-tp.table.no_data_columns_post).before(new_foot_cells);tp.reindex()}else alert(tablepress_strings.append_num_columns_invalid),a("#columns-append-number").focus().select()},insert:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected): 
     23(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.body_cell)}),a("#edit-form-head").children().filter(function(a){return-1!=jQuery.inArray(a,c)}).before(tp.table.head_cell),b.before(tp.table.foot_cell),tp.reindex())},hide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected): 
     24(c=b.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).addClass("column-hidden")}),b.addClass("column-hidden").find(".visibility").val("0"),tp.table.set_table_changed())},unhide:function(b){var c,b=a("#edit-form-foot").find("input:checked").prop("checked",b.shiftKey).closest("th");0===b.length?alert(tablepress_strings.no_columns_selected):(c=b.map(function(){return a(this).index()}).get(), 
     25a("#edit-form-body").children().add("#edit-form-head").each(function(b,e){a(e).children().filter(function(a){return-1!=jQuery.inArray(a,c)}).removeClass("column-hidden")}),b.removeClass("column-hidden").find(".visibility").val("1"),tp.table.set_table_changed())},remove:function(){var b,c,d=a("#edit-form-foot").find("input:checked").closest("th");0===d.length?alert(tablepress_strings.no_columns_selected):tp.table.columns==d.length?alert(tablepress_strings.no_remove_all_columns):(c=1==d.length?tablepress_strings.ays_remove_columns_singular: 
     26tablepress_strings.ays_remove_columns_plural,confirm(c)&&(b=d.map(function(){return a(this).index()}).get(),a("#edit-form-body").children().add("#edit-form-head").each(function(c,d){a(d).children().filter(function(a){return-1!=jQuery.inArray(a,b)}).remove()}),d.remove(),tp.reindex()))},move:{source_idx:-1,target_idx:-1,$rows:null,$row_children:null,$cell:null,$cells:null,$placeholder:null,$helper:null,start:function(b,c){var d=a(c.item);tp.columns.move.source_idx=d.index();tp.columns.move.$rows=a("#edit-form-body").children().add("#edit-form-foot"); 
     27tp.columns.move.$cells=tp.columns.move.$rows.find(":nth-child("+(tp.columns.move.source_idx+1)+")").each(function(){tp.columns.move.$cell=a(this);a('<td class="move-placeholder"><div/></td>').insertBefore(tp.columns.move.$cell);tp.columns.move.$cell.insertAfter(tp.columns.move.$cell.nextAll().last()).clone().addClass("move-hover").insertAfter(tp.columns.move.$cell).find("textarea").val(tp.columns.move.$cell.find("textarea").val())}).hide();tp.columns.move.$helper=tp.columns.move.$rows.find(".move-hover"); 
     28d=tp.columns.move.$helper.eq(1).width();tp.columns.move.$helper.eq(0).width(d);tp.columns.move.$placeholder=tp.columns.move.$rows.find(".move-placeholder");tp.columns.move.$placeholder.find("div").width(d)},change:function(b,c){tp.columns.move.target_idx=a(c.placeholder).index();1==tp.columns.move.target_idx-tp.columns.move.source_idx?tp.columns.move.target_idx+=1:tp.columns.move.target_idx==tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1);tp.columns.move.$placeholder.each(function(){tp.columns.move.$cell= 
     29a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().children().eq(tp.columns.move.target_idx))});tp.columns.move.target_idx>tp.columns.move.source_idx&&(tp.columns.move.target_idx-=1);tp.columns.move.source_idx=tp.columns.move.target_idx},sort:function(a,c){tp.columns.move.$helper.css("left",c.position.left)},stop:function(){tp.columns.move.$helper.remove();tp.columns.move.$cells.each(function(){tp.columns.move.$cell=a(this);tp.columns.move.$cell.insertBefore(tp.columns.move.$cell.parent().find(".move-placeholder"))}).show(); 
     30tp.columns.move.$placeholder.remove();tp.columns.move.source_idx=tp.columns.move.target_idx=-1;tp.columns.move.$rows=tp.columns.move.$row_children=tp.columns.move.$cell=tp.columns.move.$cells=tp.columns.move.$placeholder=tp.columns.move.$helper=null;tp.reindex()}},number_to_letter:function(a){for(var c="";0<a;)c=String.fromCharCode(65+(a-1)%26)+c,a=Math.floor((a-1)/26);return c}},cells:{$focus:a(null),$textarea:null,autogrow:function(){tp.cells.$focus.removeClass("focus");tp.cells.$focus=a(this).closest("tr").addClass("focus")}, 
     31advanced_editor:{keyopen:function(b){b.shiftKey&&(b=a("#advanced-editor-content"),tp.cells.advanced_editor.thickbox_size(),tp.cells.$textarea=a(this).blur(),b.val(tp.cells.$textarea.val()),a("#advanced-editor").wpdialog("open"),b.get(0).selectionStart=b.get(0).selectionEnd=b.val().length,b.focus())},buttonopen:function(){if(confirm(tablepress_strings.advanced_editor_open))a("#edit-form-body").one("click","textarea",function(){var b=a("#advanced-editor-content");tp.cells.advanced_editor.thickbox_size(); 
     32tp.cells.$textarea=a(this).blur();b.val(tp.cells.$textarea.val());a("#advanced-editor").wpdialog("open");b.get(0).selectionStart=b.get(0).selectionEnd=b.val().length;b.focus()})},save:function(){var b=a("#advanced-editor-content").blur().val();tp.cells.$textarea.val()!=b&&(tp.cells.$textarea.val(b),tp.cells.$textarea.get(0).selectionStart=tp.cells.$textarea.get(0).selectionEnd=tp.cells.$textarea.val().length,tp.table.set_table_changed());tp.cells.$textarea.focus();tp.cells.advanced_editor.close()}, 
     33close:function(){a("#advanced-editor").wpdialog("close");return!1},thickbox_size:function(){var b=a("#advanced-editor-content-add_media"),c;c=a(window).width();var d=720<c?720:c,e=a(window).height();b.length&&(c=b.attr("href"),a("body.admin-bar").length&&(e-=28),c=c.replace(/&width=[0-9]+/g,"").replace(/&height=[0-9]+/g,""),b.attr("href",c+("&width="+(d-80)+"&height="+(e-85))))}},checkboxes:{last_clicked:{"#edit-form-body":!1,"#edit-form-foot":!1},multi_select:function(b){if("undefined"==b.shiftKey)return!0; 
     34if(b.shiftKey){if(!tp.cells.checkboxes.last_clicked[b.data.parent])return!0;var c=a(b.data.parent).find(":checkbox"),d=c.index(tp.cells.checkboxes.last_clicked[b.data.parent]),e=c.index(this);d!=e&&c.slice(Math.min(d,e),Math.max(d,e)).prop("checked",a(this).prop("checked"))}tp.cells.checkboxes.last_clicked[b.data.parent]=this;return!0}}},content:{link:{add:function(){if(confirm(tablepress_strings.link_add))a("#edit-form-body").one("mousedown","textarea",function(){wpActiveEditor=this.id;a(window).one("mouseup", 
     35function(){wpLink.open();tp.table.set_table_changed()})})}},image:{add:function(){if(confirm(tablepress_strings.image_add))a("#edit-form-body").one("click","textarea",function(){wpActiveEditor=this.id;this.selectionStart=this.selectionEnd=this.value.length;var b=a("#image-add"),c=a(window).width(),c=720<c?720:c,d=a(window).height();a("body.admin-bar").length&&(d-=28);tb_show(b.text(),b.attr("href")+"&TB_iframe=true&height="+(d-85)+"&width="+(c-80),!1);a(this).blur()});return!1}},span:{add:function(b){if(confirm("#rowspan#"== 
     36b?tablepress_strings.rowspan_add:tablepress_strings.colspan_add))a("#edit-form-body").one("click","textarea",function(){var c=a(this),d=c.parent().index(),e=c.closest("tr").index();if("#rowspan#"==b){if(0==e){alert(tablepress_strings.no_rowspan_first_row);return}if(tp.table.head&&1==e){alert(tablepress_strings.no_rowspan_table_head);return}if(tp.table.foot&&tp.table.rows-1==e){alert(tablepress_strings.no_rowspan_table_foot);return}}else if("#colspan#"==b&&tp.table.no_data_columns_pre==d){alert(tablepress_strings.no_colspan_first_col); 
     37return}c.val(b);tp.table.set_table_changed()})}}},check:{table_id:function(b){37==b.which||39==b.which||(b=a(this),b.val(b.val().replace(/[^0-9a-zA-Z-_]/g,"")))},changes_saved:function(){if(tp.made_changes)return tablepress_strings.unsaved_changes_unload}},reindex:function(){var b,c=a("#edit-form-body").children(),d,e={};tp.table.rows=c.length;tp.table.columns=0<tp.table.rows?c.first().children().length-tp.table.no_data_columns_pre-tp.table.no_data_columns_post:0;c.each(function(c,h){b=a(h);b.find("textarea").val(function(b, 
     38c){return""==c||"="!=c.charAt(0)?c:c.replace(/([A-Z]+[0-9]+)(?::([A-Z]+[0-9]+))?/g,function(b,c,f){e.hasOwnProperty(c)||(d=a("#cell-"+c),e[c]=d.length?tp.columns.number_to_letter(d.parent().index()-tp.table.no_data_columns_pre+1)+(d.closest("tr").index()+1):c);b=e[c];"undefined"!=typeof f&&(e.hasOwnProperty(f)||(d=a("#cell-"+f),e[f]=d.length?tp.columns.number_to_letter(d.parent().index()-tp.table.no_data_columns_pre+1)+(d.closest("tr").index()+1):f),b+=":"+e[f]);return b})}).attr("name",function(a){return"table[data]["+ 
     39c+"]["+a+"]"});b.find(".move-handle").html(c+1)}).each(function(b,c){a(c).find("textarea").attr("id",function(a){return"cell-"+tp.columns.number_to_letter(a+1)+(b+1)})});a("#edit-form-head").find(".move-handle").html(function(a){return tp.columns.number_to_letter(a+1)});a("#number-rows").val(tp.table.rows);a("#number-columns").val(tp.table.columns);tp.table.set_table_changed()},save_changes:{trigger:function(b){a("#option-datatables-paginate").prop("checked")&&!/^[1-9][0-9]{0,4}$/.test(a("#option-datatables-paginate_entries").val())? 
     40(alert(tablepress_strings.num_pagination_entries_invalid),a("#option-datatables-paginate_entries").focus().select()):/[^A-Za-z0-9- _]/.test(a("#option-extra-css-classes").val())?(alert(tablepress_strings.extra_css_classes_invalid),a("#option-extra-css-classes").focus().select()):b.shiftKey?(tp.made_changes=!1,a("#tablepress-page").find("form").submit()):(a(this).closest("p").append('<span class="animation-saving spinner" title="'+tablepress_strings.saving_changes+'"/>'),a(".save-changes-button").prop("disabled", 
     41!0),a("body").addClass("wait"),a.post(ajaxurl,tp.table.prepare_ajax_request("tablepress_save_table","#nonce-edit-table"),function(){},"json").success(tp.save_changes.ajax_success).error(tp.save_changes.ajax_error))},ajax_success:function(a,c){"undefined"==typeof c||"success"!=c?tp.save_changes.error("AJAX call successful, but unclear status. Try again while holding down the &#8220;Shift&#8221; key."):"undefined"==typeof a||null==a||"-1"==a||"undefined"==typeof a.success||!0!==a.success?tp.save_changes.error("AJAX call successful, but unclear data. Try again while holding down the &#8220;Shift&#8221; key."): 
     42tp.save_changes.success(a)},ajax_error:function(a,c,d){tp.save_changes.error("AJAX call failed: "+c+" - "+d+". Try again while holding down the &#8220;Shift&#8221; key.")},success:function(b){tp.table.id!=b.table_id&&"pushState"in window.history&&null!==window.history.pushState&&window.history.pushState("","",window.location.href.replace(/table_id=[0-9a-zA-Z-_]+/gi,"table_id="+b.table_id));tp.table.id=tp.table.new_id=b.table_id;a("#table-id").val(tp.table.id);a("#table-new-id").val(tp.table.new_id); 
     43a(".table-shortcode").val("["+tablepress_options.shortcode+" id="+tp.table.new_id+" /]");a("#nonce-edit-table").val(b.new_edit_nonce);a("#nonce-preview-table").val(b.new_preview_nonce);var c=a(".show-preview-button");c.length&&c.attr("href",c.first().attr("href").replace(/item=[a-zA-Z0-9_-]+/g,"item="+b.table_id).replace(/&_wpnonce=[a-z0-9]+/ig,"&_wpnonce="+b.new_preview_nonce));a("#last-modified").text(b.last_modified);a("#last-editor").text(b.last_editor);tp.table.unset_table_changed();tp.save_changes.after_saving_dialog("success", 
     44tablepress_strings[b.message])},error:function(a){tp.save_changes.after_saving_dialog("error",a)},after_saving_dialog:function(b,c){var c="undefined"==typeof c?"":": "+c,d,e="save-changes-"+b;"success"==b?(e+=" updated",d=3E3):(e+=" error",d=6E3);a(".animation-saving").closest("p").after('<div class="'+e+'"><p><strong>'+tablepress_strings["save_changes_"+b]+c+"</strong></p></div>");a(".animation-saving").remove();a(".save-changes-"+b).delay(d).fadeOut(2E3,function(){a(this).remove()});a(".save-changes-button").prop("disabled", 
     45!1);a("body").removeClass("wait")}},init:function(){var b={click:{"#rows-insert":tp.rows.insert,"#columns-insert":tp.columns.insert,"#rows-remove":tp.rows.remove,"#columns-remove":tp.columns.remove,"#rows-hide":tp.rows.hide,"#columns-hide":tp.columns.hide,"#rows-unhide":tp.rows.unhide,"#columns-unhide":tp.columns.unhide,"#rows-append":tp.rows.append,"#columns-append":tp.columns.append,"#link-add":tp.content.link.add,"#image-add":tp.content.image.add,"#span-add-rowspan":function(){tp.content.span.add("#rowspan#")}, 
     46"#span-add-colspan":function(){tp.content.span.add("#colspan#")},".show-preview-button":tp.table.preview.trigger,".save-changes-button":tp.save_changes.trigger,".show-help-box":function(){a(this).next().wpdialog({title:a(this).attr("title"),height:400,width:300,modal:!0,dialogClass:"wp-dialog",resizable:!1})}},keyup:{"#table-new-id":tp.check.table_id},change:{"#option-table-head":tp.table.change_table_head,"#option-table-foot":tp.table.change_table_foot,"#option-use-datatables":tp.table.change_datatables, 
     47"#option-datatables-paginate":tp.table.change_datatables_pagination},blur:{"#table-new-id":tp.table.change_id}},c=a("#edit-form-body");a.each(b,function(b,c){a.each(c,function(c,e){a(c).on(b,e)})});a(window).on("beforeunload",tp.check.changes_saved);a("#option-table-head").change();a("#option-print-name").change(tp.table.change_print_name_description).change();a("#option-print-description").change(tp.table.change_print_name_description).change();c.one("change","textarea",tp.table.set_table_changed); 
     48a("#tablepress_edit-table-information, #tablepress_edit-table-options, #tablepress_edit-datatables-features").one("change","input, textarea, select",tp.table.set_table_changed);tablepress_options.cells_advanced_editor?(c.on("click","textarea",tp.cells.advanced_editor.keyopen),a("#advanced-editor-open").on("click",tp.cells.advanced_editor.buttonopen),a("#advanced-editor-confirm").on("click",tp.cells.advanced_editor.save),a("#advanced-editor-cancel").on("click",tp.cells.advanced_editor.close),a("#advanced-editor").wpdialog({autoOpen:!1, 
     49title:a("#advanced-editor-open").val(),width:600,modal:!0,dialogClass:"wp-dialog",resizable:!1})):a("#advanced-editor-open").hide();if(tablepress_options.cells_auto_grow)c.on("focus","textarea",tp.cells.autogrow);a("#edit-form-body").on("click","input:checkbox",{parent:"#edit-form-body"},tp.cells.checkboxes.multi_select);a("#edit-form-foot").on("click","input:checkbox",{parent:"#edit-form-foot"},tp.cells.checkboxes.multi_select);a("#edit-form-head").on("click",".sort-control",tp.rows.sort);a("#tablepress-page").find("form").on("submit", 
     50function(){a(this).find(".tablepress-postbox-table").find("input, select").prop("disabled",!1)});c.sortable({axis:"y",containment:a("#edit-form"),forceHelperSize:!0,handle:".move-handle",start:tp.rows.move.start,change:tp.rows.move.change,stop:tp.rows.move.stop,update:tp.reindex});a("#edit-form-head").sortable({axis:"x",items:".head",containment:"parent",forceHelperSize:!0,helper:"clone",handle:".move-handle",start:tp.columns.move.start,stop:tp.columns.move.stop,change:tp.columns.move.change,sort:tp.columns.move.sort}).disableSelection()}}; 
     51tp.init();window.send_to_editor=function(a){"undefined"!=typeof QTags?QTags.insertContent(a):document.getElementById(wpActiveEditor).value+=a;try{tb_remove()}catch(c){}tp.table.set_table_changed()}}); 
  • tablepress/trunk/admin/options.js

    r598765 r629752  
    3939        var use_custom_css = $(this).prop( 'checked' ); 
    4040        CM_custom_css.setOption( 'readOnly', ! use_custom_css ); 
    41         $( '#tablepress-page' ).find( '.CodeMirror-scroll' ).toggleClass( 'disabled', ! use_custom_css ); 
     41        $( '#tablepress-page' ).find( '.CodeMirror' ).toggleClass( 'disabled', ! use_custom_css ); 
    4242        $( '#option-use-custom-css-file' ).prop( 'disabled', ! use_custom_css ); 
    4343    } ).change(); 
  • tablepress/trunk/admin/options.min.js

    r598765 r629752  
    1 jQuery(document).ready(function(a){var c=CodeMirror.fromTextArea(document.getElementById("option-custom-css"),{mode:"css",indentUnit:2,tabSize:2,indentWithTabs:!0});a("#tablepress-page").find(".CodeMirror").one("click",function(){a(this).addClass("large")});a("#option-use-custom-css").on("change",function(){var b=a(this).prop("checked");c.setOption("readOnly",!b);a("#tablepress-page").find(".CodeMirror-scroll").toggleClass("disabled",!b);a("#option-use-custom-css-file").prop("disabled",!b)}).change(); 
    2 a("#tablepress-page").on("submit","form",function(){a(this).find("input, select, textarea").prop("disabled",!1)})}); 
     1jQuery(document).ready(function(a){var c=CodeMirror.fromTextArea(document.getElementById("option-custom-css"),{mode:"css",indentUnit:2,tabSize:2,indentWithTabs:!0});a("#tablepress-page").find(".CodeMirror").one("click",function(){a(this).addClass("large")});a("#option-use-custom-css").on("change",function(){var b=a(this).prop("checked");c.setOption("readOnly",!b);a("#tablepress-page").find(".CodeMirror").toggleClass("disabled",!b);a("#option-use-custom-css-file").prop("disabled",!b)}).change();a("#tablepress-page").on("submit", 
     2"form",function(){a(this).find("input, select, textarea").prop("disabled",!1)})}); 
  • tablepress/trunk/classes/class-controller.php

    r623199 r629752  
    8585            @set_time_limit( 300 ); 
    8686 
     87            // Add TablePress capabilities to the WP_Roles objects 
     88            if ( $this->model_options->get( 'plugin_options_db_version' ) < 12 ) 
     89                $this->model_options->add_access_capabilities(); 
     90 
    8791            if ( 0 == $this->model_options->get( 'first_activation' ) ) { 
    8892                // Save initial set of plugin options, and time of first activation of the plugin, on first activation 
  • tablepress/trunk/classes/class-import.php

    r623199 r629752  
    220220            $new_row = array(); 
    221221            foreach ( $row as $cell ) { 
    222                 $children = $cell->children(); 
    223                 if ( 0 == count( $children ) ) { 
    224                     $cell_content = (string) $cell; 
    225                 } else { 
    226                     $cell_content = ''; 
    227                     foreach ( $children as $child ) { 
    228                         $cell_content .= (string) $child->asXML(); 
    229                     } 
    230                 } 
    231                 $new_row[] = $cell_content; 
     222                if ( 1 === preg_match( '#<t(?:d|h).*?>(.*)</t(?:d|h)>#is', $cell->asXML(), $matches ) ) // get text between <td>...</td>, or <th>...</th>, possibly with attributes 
     223                    $new_row[] = $matches[1]; 
     224                else 
     225                    $new_row[] = ''; 
    232226            } 
    233227            $rows[] = $new_row; 
  • tablepress/trunk/classes/class-render.php

    r623199 r629752  
    271271 
    272272        // remove all whitespace characters 
    273         $expression = preg_replace( '#\s#', '', $expression ); 
     273        $expression = preg_replace( '#[\r\n\t ]#', '', $expression ); 
    274274 
    275275        // expand cell ranges (like A3:A6) to a list of single cells (like A3,A4,A5,A6) 
     
    282282 
    283283                if ( isset( $this->known_ranges[ $cell_range[0] ] ) ) { 
    284                     $expression = str_replace( $cell_range[0], $this->known_ranges[ $cell_range[0] ], $expression ); 
     284                    $expression = preg_replace( '#(?<![A-Z])' . preg_quote( $cell_range[0], '#' ) . '(?![0-9])#', $this->known_ranges[ $cell_range[0] ], $expression ); 
    285285                    continue; 
    286286                } 
     
    306306                $cell_list = implode( ',', $cell_list ); 
    307307 
    308                 $expression = str_replace( $cell_range[0], $cell_list, $expression ); 
     308                $expression = preg_replace( '#(?<![A-Z])' . preg_quote( $cell_range[0], '#' ) . '(?![0-9])#', $cell_list, $expression ); 
    309309                $this->known_ranges[ $cell_range[0] ] = $cell_list; 
    310310            } 
     
    326326 
    327327                if ( ! ( isset( $this->table['data'][$ref_row] ) && isset( $this->table['data'][$ref_row][$ref_col] ) ) ) 
    328                     return '!ERROR! Non-Existing Cell'; 
     328                    return '!ERROR! Non-existing Cell'; 
    329329 
    330330                $ref_parents = $parents; 
     
    332332 
    333333                $result = $this->table['data'][$ref_row][$ref_col] = $this->_evaluate_cell( $this->table['data'][$ref_row][$ref_col], $ref_parents ); 
     334                // Bail if there was an error already 
    334335                if ( false !== strpos( $result, '!ERROR!' ) ) 
    335336                    return $result; 
    336  
    337                 $expression = str_replace( $cell_reference[0], $result, $expression ); 
     337                // Bail if the cell does not result in a number (meaning it was a number or expression before being evaluated) 
     338                if ( ! is_numeric( $result ) ) 
     339                    return '!ERROR! ' . $cell_reference[0] . ' does not contain a number or expression'; 
     340 
     341                $expression = preg_replace( '#(?<![A-Z])' . preg_quote( $cell_reference[0], '#' ) . '(?![0-9])#', $result, $expression ); 
    338342            } 
    339343        } 
     
    506510            if ( strlen( $cell_content ) > 2 && "'=" == substr( $cell_content, 0, 2 ) ) 
    507511                $cell_content = substr( $cell_content, 1 ); 
    508             // @TODO: Maybe do this on the full HTML output, instead on each cell individually? 
    509             // @TODO: Maybe move this to after the colspan/rowspan checks in the next block? 
    510512            $cell_content = do_shortcode( $this->safe_output( $cell_content ) ); 
    511513            $cell_content = apply_filters( 'tablepress_cell_content', $cell_content, $this->table['id'], $row_idx + 1, $col_idx + 1 ); 
     
    602604     */ 
    603605    public function get_default_render_options() { 
     606        // Attention: Array keys have to be lower case, otherwise they won't match the Shortcode attributes, which will be passed in lowercase by WP 
    604607        return array( 
    605608            'id' => '', 
     
    623626            'datatables_filter' => null, 
    624627            'datatables_info' => null, 
    625             'datatables_scrollX' => null, 
     628            'datatables_scrollx' => null, 
     629            'datatables_scrolly' => false, 
    626630            'datatables_custom_commands' => null, 
    627631            'datatables_locale' => get_locale(), 
     
    662666    background: none; 
    663667    text-align: left; 
     668    vertical-align: top; 
    664669} 
    665670.tablepress tbody tr td, 
  • tablepress/trunk/classes/class-tablepress.php

    r623199 r629752  
    2828     * @const string 
    2929     */ 
    30     const version = '0.7-beta'; 
     30    const version = '0.8-beta'; 
    3131 
    3232    /** 
     
    3939     * @const int 
    4040     */ 
    41     const db_version = 10; 
     41    const db_version = 13; 
    4242 
    4343    /** 
     
    9595                || ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) 
    9696                || ( defined( 'DOING_CRON' ) && DOING_CRON ) ) { 
     97            return; 
     98        } 
     99 
     100        // check if minimum requirements are fulfilled, currently a stable WordPress 3.4 
     101        if ( version_compare( $GLOBALS['wp_version'], '3.4', '<' ) ) { 
     102            // show error notice to admins, if WP is not installed in the minimum required version, in which case TablePress will not work 
     103            if ( current_user_can( 'update_plugins' ) ) 
     104                add_action( 'admin_notices', array( 'TablePress', 'show_minimum_requirements_error_notice' ) ); 
     105            // and exit TablePress 
    97106            return; 
    98107        } 
     
    242251     * @return int $number Column number, 1-based 
    243252     */ 
    244     public function letter_to_number( $column ) { 
     253    public static function letter_to_number( $column ) { 
    245254        $column = strtoupper( $column ); 
    246255        $count = strlen( $column ); 
     
    262271     * @return string $column Column string 
    263272     */ 
    264     public function number_to_letter( $number ) { 
     273    public static function number_to_letter( $number ) { 
    265274        $column = ''; 
    266275        while ( $number > 0 ) { 
     
    279288     * @return string Nice looking string with the date and time 
    280289     */ 
    281     public function format_datetime( $datetime, $type = 'mysql', $separator = ' ' ) { 
     290    public static function format_datetime( $datetime, $type = 'mysql', $separator = ' ' ) { 
    282291        if ( 'mysql' == $type ) 
    283292            return mysql2date( get_option( 'date_format' ), $datetime ) . $separator . mysql2date( get_option( 'time_format' ), $datetime ); 
     
    292301     * @return string Nickname of the WP user with the $user_id 
    293302     */ 
    294     public function get_user_display_name( $user_id ) { 
     303    public static function get_user_display_name( $user_id ) { 
    295304        $user = get_userdata( $user_id ); 
    296305        return ( $user && isset( $user->display_name ) ) ? $user->display_name : ''; 
     
    365374    } 
    366375 
     376    /** 
     377     * Show an error notice to admins, if TablePress's minimum requirements are not reached 
     378     * 
     379     * @since 1.0.0 
     380     */ 
     381    public static function show_minimum_requirements_error_notice() { 
     382        // Message is not translated as it is shown on every admin screen, for which we don't want to load translations 
     383        echo '<div class="error"><p>' . 
     384            '<strong>Attention:</strong> ' . 
     385            'The installed version of WordPress is too old for the TablePress plugin! TablePress requires an up-to-date version! <strong>Please <a href="' . admin_url( 'update-core.php' ) . '">update your WordPress installation</a></strong>!' . 
     386            "</p></div>\n"; 
     387    } 
     388 
    367389} // class TablePress 
  • tablepress/trunk/classes/class-view.php

    r623199 r629752  
    369369            echo __( 'TablePress', 'tablepress' ) . '<span class="separator"></span>'; 
    370370            foreach ( $this->data['view_actions'] as $action => $entry ) { 
     371                // special case: Add a separator before the group that starts with "Plugin Options", for some spacing 
     372                if ( 'options' == $action ) 
     373                    echo '<span class="separator"></span><span class="separator"></span>'; 
     374 
    371375                if ( '' == $entry['nav_tab_title'] ) 
    372376                    continue; 
    373                 if ( ! current_user_can( $entry['min_access_cap'] ) ) 
     377                if ( ! current_user_can( $entry['required_cap'] ) ) 
    374378                    continue; 
    375  
    376                 // special case: Add separators before "Plugin Options" for some spacing 
    377                 if ( 'options' == $action ) 
    378                     echo '<span class="separator"></span><span class="separator"></span>'; 
    379379 
    380380                $url = esc_url( TablePress::url( array( 'action' => $action ) ) ); 
  • tablepress/trunk/controllers/controller-admin.php

    r623199 r629752  
    8888    public function add_admin_menu_entry() { 
    8989        // for all menu entries: 
    90         $min_access_cap = apply_filters( 'tablepress_min_access_cap', 'edit_pages' ); // @TODO: Make this a plugin option for usage here, below, and for the frontend edit link! 
    9190        $callback = array( $this, 'show_admin_page' ); 
    9291        $admin_menu_entry_name = apply_filters( 'tablepress_admin_menu_entry_name', 'TablePress' ); 
     
    9493        if ( $this->is_top_level_page ) { 
    9594            $this->init_i18n_support(); // done here as translated strings for admin menu are needed already 
    96             $this->init_view_actions(); 
     95            $this->init_view_actions(); // after init_i18n_support(), as it requires translation 
     96            $min_access_cap = $this->view_actions['list']['required_cap']; 
    9797 
    9898            $icon_url = plugins_url( 'admin/tablepress-icon-small.png', TABLEPRESS__FILE__ ); 
     
    115115                if ( 'list' != $action ) 
    116116                    $slug .= '_' . $action; 
    117                 $this->page_hooks[] = add_submenu_page( 'tablepress', sprintf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), $entry['page_title'], 'TablePress' ), $entry['admin_menu_title'], $entry['min_access_cap'], $slug, $callback ); 
     117                $this->page_hooks[] = add_submenu_page( 'tablepress', sprintf( __( '%1$s &lsaquo; %2$s', 'tablepress' ), $entry['page_title'], 'TablePress' ), $entry['admin_menu_title'], $entry['required_cap'], $slug, $callback ); 
    118118            } 
    119119        } else { 
     120            $this->init_view_actions(); // no translation necessary here 
     121            $min_access_cap = $this->view_actions['list']['required_cap']; 
    120122            $this->page_hooks[] = add_submenu_page( $this->parent_page, 'TablePress', $admin_menu_entry_name, $min_access_cap, 'tablepress', $callback ); 
    121123        } 
     
    211213     */ 
    212214    public function add_wp_admin_bar_new_content_menu_entry( $wp_admin_bar ) { 
     215        if ( ! current_user_can( 'tablepress_add_tables' ) ) 
     216            return; 
    213217        // @TODO: Translation might not work, as textdomain might not yet be loaded here (for submenu entries) 
    214218        // Might need $this->init_i18n_support(); here 
     
    242246     */ 
    243247    public function add_plugin_action_links( $links ) { 
    244         $links[] = '<a href="' . TablePress::url() . '" title="' . __( 'TablePress Plugin page', 'tablepress' ) . '">' . __( 'Plugin page', 'tablepress' ) . '</a>'; 
     248        if ( current_user_can( 'tablepress_list_tables' ) ) 
     249            $links[] = '<a href="' . TablePress::url() . '" title="' . __( 'TablePress Plugin page', 'tablepress' ) . '">' . __( 'Plugin page', 'tablepress' ) . '</a>'; 
    245250        return $links; 
    246251    } 
     
    284289 
    285290        // check if action is a supported action, and whether the user is allowed to access this screen 
    286         if ( ! isset( $this->view_actions[ $action ] ) || ! current_user_can( $this->view_actions[ $action ]['min_access_cap'] ) ) 
    287             wp_die( __('You do not have sufficient permissions to access this page.') ); 
     291        if ( ! isset( $this->view_actions[ $action ] ) || ! current_user_can( $this->view_actions[ $action ]['required_cap'] ) ) 
     292            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    288293 
    289294        // changes current screen ID and pagenow variable in JS, to enable automatic meta box JS handling 
     
    301306                $data['tables'] = $this->model_table->load_all(); 
    302307                $data['messages']['first_visit'] = $this->model_options->get( 'message_first_visit' ); 
    303                 $data['messages']['wp_table_reloaded_warning'] = is_plugin_active( 'wp-table-reloaded/wp-table-reloaded.php' ); // check if WP-Table Reloaded is activated 
     308                if ( current_user_can( 'tablepress_import_tables_wptr' ) ) 
     309                    $data['messages']['wp_table_reloaded_warning'] = is_plugin_active( 'wp-table-reloaded/wp-table-reloaded.php' ); // check if WP-Table Reloaded is activated 
     310                else 
     311                    $data['messages']['wp_table_reloaded_warning'] = false; 
    304312                $data['messages']['show_plugin_update'] = $this->model_options->get( 'message_plugin_update' ); 
    305313                $data['messages']['plugin_update_message'] = $this->model_options->get( 'message_plugin_update_content' ); 
     
    324332                    break; 
    325333                } 
    326                 $data['frontend_options']['use_default_css'] = $this->model_options->get( 'use_default_css' ); 
    327334                $data['frontend_options']['use_custom_css'] = $this->model_options->get( 'use_custom_css' ); 
    328335                $data['frontend_options']['use_custom_css_file'] = $this->model_options->get( 'use_custom_css_file' ); 
     
    346353                    if ( false === $data['table'] ) 
    347354                        TablePress::redirect( array( 'action' => 'list', 'message' => 'error_load_table' ) ); 
     355                    if ( ! current_user_can( 'tablepress_edit_table', $_GET['table_id'] ) ) 
     356                        wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    348357                } else { 
    349358                    TablePress::redirect( array( 'action' => 'list', 'message' => 'error_no_table' ) ); 
     
    459468     */ 
    460469    protected function maybe_show_donation_message() { 
     470        // Only show the message to plugin admins 
     471        if ( ! current_user_can( 'tablepress_edit_options' ) ) 
     472            return false; 
     473 
    461474        if ( ! $this->model_options->get( 'message_donation_nag' ) ) 
    462475            return false; 
     
    480493                'admin_menu_title' => __( 'All Tables', 'tablepress' ), 
    481494                'nav_tab_title' => __( 'All Tables', 'tablepress' ), 
    482                 'min_access_cap' => 'edit_pages' 
     495                'required_cap' => 'tablepress_list_tables' 
    483496            ), 
    484497            'add' => array( 
     
    487500                'admin_menu_title' => __( 'Add New Table', 'tablepress' ), 
    488501                'nav_tab_title' => __( 'Add New', 'tablepress' ), 
    489                 'min_access_cap' => 'edit_pages' 
     502                'required_cap' => 'tablepress_add_tables' 
    490503            ), 
    491504            'edit' => array( 
     
    494507                'admin_menu_title' => '', 
    495508                'nav_tab_title' => '', 
    496                 'min_access_cap' => 'edit_pages' 
     509                'required_cap' => 'tablepress_edit_tables' 
    497510            ), 
    498511            'import' => array( 
     
    501514                'admin_menu_title' => __( 'Import a Table', 'tablepress' ), 
    502515                'nav_tab_title' => __( 'Import', 'tablepress' ), 
    503                 'min_access_cap' => 'edit_pages' 
     516                'required_cap' => 'tablepress_import_tables' 
    504517            ), 
    505518            'export' => array( 
     
    508521                'admin_menu_title' => __( 'Export a Table', 'tablepress' ), 
    509522                'nav_tab_title' => __( 'Export', 'tablepress' ), 
    510                 'min_access_cap' => 'edit_pages' 
     523                'required_cap' => 'tablepress_export_tables' 
    511524            ), 
    512525            'options' => array( 
     
    515528                'admin_menu_title' => __( 'Plugin Options', 'tablepress' ), 
    516529                'nav_tab_title' => __( 'Plugin Options', 'tablepress' ), 
    517                 'min_access_cap' => 'edit_pages' 
     530                'required_cap' => 'tablepress_access_options_screen' 
    518531            ), 
    519532            'about' => array( 
     
    522535                'admin_menu_title' => __( 'About TablePress', 'tablepress' ), 
    523536                'nav_tab_title' => __( 'About', 'tablepress' ), 
    524                 'min_access_cap' => 'edit_pages' 
     537                'required_cap' => 'tablepress_access_about_screen' 
    525538            ) 
    526539        ); 
     
    565578            TablePress::redirect( array( 'action' => 'list', 'message' => 'error_bulk_action_invalid' ) ); 
    566579 
    567         // @TODO: caps check for selected bulk action 
    568  
    569580        if ( empty( $_POST['table'] ) || ! is_array( $_POST['table'] ) ) 
    570581            TablePress::redirect( array( 'action' => 'list', 'message' => 'error_no_selection' ) ); 
     
    577588            case 'copy': 
    578589                foreach ( $tables as $table_id ) { 
    579                     $copy_table_id = $this->model_table->copy( $table_id ); 
     590                    if ( current_user_can( 'tablepress_copy_table', $table_id ) ) 
     591                        $copy_table_id = $this->model_table->copy( $table_id ); 
     592                    else 
     593                        $copy_table_id = false; 
    580594                    if ( false === $copy_table_id ) 
    581595                        $no_success[] = $table_id; 
     
    583597                break; 
    584598            case 'export': 
     599                // Cap check is done on redirect target page 
    585600                // to export, redirect to "Export" screen, with selected table IDs 
    586601                $table_ids = implode( ',', $tables ); 
     
    589604            case 'delete': 
    590605                foreach ( $tables as $table_id ) { 
    591                     $deleted = $this->model_table->delete( $table_id ); 
     606                    if ( current_user_can( 'tablepress_delete_table', $table_id ) ) 
     607                        $deleted = $this->model_table->delete( $table_id ); 
     608                    else 
     609                        $deleted = false; 
    592610                    if ( false === $deleted ) 
    593611                        $no_success[] = $table_id; 
     
    629647        TablePress::check_nonce( 'edit', $edit_table['id'], 'nonce-edit-table' ); 
    630648 
     649        if ( ! current_user_can( 'tablepress_edit_table', $edit_table['id'] ) ) 
     650            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     651 
    631652        // Options array must exist, so that checkboxes can be evaluated 
    632653        if ( empty( $edit_table['options'] ) ) 
     
    662683 
    663684        // Change table ID 
    664         $id_changed = $this->model_table->change_table_id( $table['id'], $table['new_id'] ); 
     685        if ( current_user_can( 'tablepress_edit_table_id', $table['id'] ) ) 
     686            $id_changed = $this->model_table->change_table_id( $table['id'], $table['new_id'] ); 
     687        else 
     688            $id_changed = false; 
    665689        if ( $id_changed ) 
    666690            TablePress::redirect( array( 'action' => 'edit', 'table_id' => $table['new_id'], 'message' => 'success_save_success_id_change' ) ); 
     
    676700    public function handle_post_action_add() { 
    677701        TablePress::check_nonce( 'add' ); 
     702 
     703        if ( ! current_user_can( 'tablepress_add_tables' ) ) 
     704            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    678705 
    679706        if ( empty( $_POST['table'] ) || ! is_array( $_POST['table'] ) ) 
     
    724751        TablePress::check_nonce( 'options' ); 
    725752 
     753        if ( ! current_user_can( 'tablepress_access_options_screen' ) ) 
     754            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     755 
    726756        if ( empty( $_POST['options'] ) || ! is_array( $_POST['options'] ) ) 
    727757            TablePress::redirect( array( 'action' => 'options', 'message' => 'error_save' ) ); 
     
    744774                $new_options['plugin_language'] = $posted_options['plugin_language']; 
    745775        } 
    746         // Checkboxes 
    747         foreach ( array( 'use_default_css', 'use_custom_css', 'use_custom_css_file' ) as $checkbox ) { 
    748             $new_options[ $checkbox ] = ( isset( $posted_options[ $checkbox ] ) && 'true' === $posted_options[ $checkbox ] ); 
    749         } 
    750         if ( isset( $posted_options['custom_css'] ) ) { 
    751             if ( 1 === preg_match( '#<style.*?>(.*?)</style>#is', $posted_options['custom_css'], $matches ) ) 
    752                 $posted_options['custom_css'] = trim( $matches[1] ); // if found, take match as style to save 
    753             // Save "Custom CSS" to option 
    754             $new_options['custom_css'] = $posted_options['custom_css']; 
    755             // Maybe save it to file as well 
    756             $update_custom_css_file = false; 
    757             if ( $new_options['use_custom_css_file'] 
    758             && $new_options['custom_css'] !== $this->model_options->load_custom_css_from_file() ) { // only write to file, if CSS really changed 
    759                 $update_custom_css_file = true; 
    760                 // Set to false again. As it was set here, it will be set true again, if file saving succeeds 
    761                 $new_options['use_custom_css_file'] = false; 
     776 
     777        // Custom CSS can only be saved if the user is allowed to do so 
     778        $update_custom_css_file = false; 
     779        if ( current_user_can( 'tablepress_edit_options' ) ) { 
     780            // Checkboxes 
     781            foreach ( array( 'use_custom_css', 'use_custom_css_file' ) as $checkbox ) { 
     782                $new_options[ $checkbox ] = ( isset( $posted_options[ $checkbox ] ) && 'true' === $posted_options[ $checkbox ] ); 
     783            } 
     784            if ( isset( $posted_options['custom_css'] ) ) { 
     785                if ( 1 === preg_match( '#<style.*?>(.*?)</style>#is', $posted_options['custom_css'], $matches ) ) 
     786                    $posted_options['custom_css'] = trim( $matches[1] ); // if found, take match as style to save 
     787                // Save "Custom CSS" to option 
     788                $new_options['custom_css'] = $posted_options['custom_css']; 
     789                // Maybe save it to file as well 
     790                if ( $new_options['use_custom_css_file'] 
     791                && $new_options['custom_css'] !== $this->model_options->load_custom_css_from_file() ) { // only write to file, if CSS really changed 
     792                    $update_custom_css_file = true; 
     793                    // Set to false again. As it was set here, it will be set true again, if file saving succeeds 
     794                    $new_options['use_custom_css_file'] = false; 
     795                } 
    762796            } 
    763797        } 
     
    767801            $this->model_options->update( $new_options ); 
    768802 
    769         if ( $update_custom_css_file ) 
     803        if ( $update_custom_css_file ) // capability check is performed above 
    770804            TablePress::redirect( array( 'action' => 'options', 'item' => 'save_custom_css' ), true ); 
    771805 
     
    780814    public function handle_post_action_export() { 
    781815        TablePress::check_nonce( 'export' ); 
     816 
     817        if ( ! current_user_can( 'tablepress_export_tables' ) ) 
     818            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    782819 
    783820        if ( empty( $_POST['export'] ) || ! is_array( $_POST['export'] ) ) 
     
    808845        if ( ! $export_to_zip ) { 
    809846            // this is only possible for one table, so take the first 
     847            if ( ! current_user_can( 'tablepress_export_table', $tables[0] ) ) 
     848                wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    810849            $table = $this->model_table->load( $tables[0] ); 
    811850            if ( false === $table ) 
     
    828867 
    829868            foreach ( $tables as $table_id ) { 
    830                 $table = $this->model_table->load( $table_id ); 
     869                // don't export tables for which the user doesn't have the necessary export rights 
     870                if ( current_user_can( 'tablepress_export_table', $table_id ) ) 
     871                    $table = $this->model_table->load( $table_id ); 
     872                else 
     873                    $table = false; 
    831874                if ( false === $table ) 
    832                     break; // no export if table could not be loaded 
     875                    continue; // no export if table could not be loaded 
    833876                $export_data = $exporter->export_table( $table, $export['format'], $export['csv_delimiter'] ); 
    834877                $export_filename = sprintf( '%1$s-%2$s-%3$s.%4$s', $table['id'], $table['name'], date( 'Y-m-d' ), $export['format'] ); 
     
    852895        header( 'Content-Description: File Transfer' ); 
    853896        header( 'Content-Type: application/octet-stream' ); 
    854         header( 'Content-Disposition: attachment; filename="' . $download_filename . '"' ); 
     897        header( "Content-Disposition: attachment; filename=\"{$download_filename}\"" ); 
    855898        header( 'Content-Transfer-Encoding: binary' ); 
    856899        header( 'Expires: 0' ); 
     
    874917        TablePress::check_nonce( 'import' ); 
    875918 
     919        if ( ! current_user_can( 'tablepress_import_tables' ) ) 
     920            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     921 
    876922        if ( empty( $_POST['import'] ) || ! is_array( $_POST['import'] ) ) 
    877923            TablePress::redirect( array( 'action' => 'import', 'message' => 'error_import' ) ); 
     
    881927        // Determine if this is a regular import or an import from WP-Table Reloaded 
    882928        if ( isset( $_POST['submit_wp_table_reloaded_import'] ) && isset( $import['wp_table_reloaded'] ) && isset( $import['wp_table_reloaded']['source'] ) ) { 
     929            if ( ! current_user_can( 'tablepress_import_tables_wptr' ) ) 
     930                wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     931 
    883932            // Handle checkbox selections 
    884933            $import_tables = ( isset( $import['wp_table_reloaded']['tables'] ) && 'true' === $import['wp_table_reloaded']['tables'] ); 
     
    10531102            return false; 
    10541103 
     1104        // to be able to replace a table, editing that table must be allowed 
     1105        if ( false !== $replace_id && ! current_user_can( 'tablepress_edit_table', $replace_id ) ) 
     1106            return false; 
     1107 
    10551108        if ( false !== $replace_id ) { 
    10561109            // Load existing table from DB 
     
    13041357            return false; 
    13051358 
     1359        if ( ! current_user_can( 'tablepress_edit_options' ) ) 
     1360            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     1361 
    13061362        $imported_options = array(); 
    1307         if ( isset( $wp_table_reloaded_options['use_default_css'] ) ) 
    1308             $imported_options['use_default_css'] = (bool)$wp_table_reloaded_options['use_default_css']; 
    13091363        if ( isset( $wp_table_reloaded_options['use_custom_css'] ) ) 
    13101364            $imported_options['use_custom_css'] = (bool)$wp_table_reloaded_options['use_custom_css']; 
     
    13561410        TablePress::check_nonce( 'hide_message', $message_item ); 
    13571411 
     1412        if ( ! current_user_can( 'tablepress_list_tables' ) ) 
     1413            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     1414 
    13581415        $updated_options = array( "message_{$message_item}" => false ); 
    13591416        if ( 'plugin_update' == $message_item ) 
     
    13791436        if ( false === $table_id ) // nonce check should actually catch this already 
    13801437            TablePress::redirect( array( 'action' => $return, 'message' => 'error_delete', 'table_id' => $return_item ) ); 
     1438 
     1439        if ( ! current_user_can( 'tablepress_delete_table', $table_id ) ) 
     1440            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    13811441 
    13821442        $deleted = $this->model_table->delete( $table_id ); 
     
    14121472            TablePress::redirect( array( 'action' => $return, 'message' => 'error_copy', 'table_id' => $return_item ) ); 
    14131473 
     1474        if ( ! current_user_can( 'tablepress_copy_table', $table_id ) ) 
     1475            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
     1476 
    14141477        $copy_table_id = $this->model_table->copy( $table_id ); 
    14151478        if ( false === $copy_table_id ) 
     
    14401503        if ( false === $table_id ) // nonce check should actually catch this already 
    14411504            wp_die( __( 'The preview could not be loaded.', 'tablepress' ), __( 'Preview', 'tablepress' ) ); 
     1505 
     1506        if ( ! current_user_can( 'tablepress_preview_table', $table_id ) ) 
     1507            wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); 
    14421508 
    14431509        // Load existing table from DB 
     
    14861552        ); 
    14871553 
     1554        set_current_screen( 'tablepress_editor_button_thickbox' ); 
     1555 
    14881556        // Prepare, initialize, and render the view 
    14891557        $this->view = TablePress::load_view( 'editor_button_thickbox', $view_data ); 
  • tablepress/trunk/controllers/controller-admin_ajax.php

    r623199 r629752  
    5151        TablePress::check_nonce( 'hide_message', $message_item, '_wpnonce', true ); 
    5252 
    53         // @TODO Capability check! 
     53        if ( ! current_user_can( 'tablepress_list_tables' ) ) 
     54            wp_die( '-1' ); 
    5455 
    5556        $updated_options = array( "message_{$message_item}" => false ); 
     
    7677 
    7778        // ignore the request if the current user doesn't have sufficient permissions 
    78         // @TODO Capability check! 
     79        if ( ! current_user_can( 'tablepress_edit_table', $edit_table['id'] ) ) 
     80            wp_die( '-1' ); 
    7981 
    8082        // default response data: 
     
    115117 
    116118            // Change table ID 
    117             $id_changed = $this->model_table->change_table_id( $table['id'], $table['new_id'] ); 
     119            if ( current_user_can( 'tablepress_edit_table_id', $table['id'] ) ) 
     120                $id_changed = $this->model_table->change_table_id( $table['id'], $table['new_id'] ); 
     121            else 
     122                $id_changed = false; 
    118123            if ( $id_changed ) { 
    119124                $message = 'success_save_success_id_change'; 
     
    159164 
    160165        // ignore the request if the current user doesn't have sufficient permissions 
    161         // @TODO Capability check! 
     166        if ( ! current_user_can( 'tablepress_preview_table', $preview_table['id'] ) ) 
     167            wp_die( '-1' ); 
    162168 
    163169        // default response data: 
  • tablepress/trunk/controllers/controller-frontend.php

    r623199 r629752  
    3939 
    4040        // enqueue CSS files 
    41         if ( $this->model_options->get( 'use_default_css' ) || $this->model_options->get( 'use_custom_css' ) ) 
     41        if ( apply_filters( 'tablepress_use_default_css', true ) || $this->model_options->get( 'use_custom_css' ) ) 
    4242            add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_css' ) ); 
    4343 
     
    6565     */ 
    6666    public function init_shortcodes() { 
    67         // if WP-Table Reloaded is activated, remove it's Shortcodes, as these would otherwise be used instead of TablePress's Shortcodes 
     67        // if WP-Table Reloaded is activated, remove its Shortcodes and CSS, as these would otherwise be used instead of TablePress's Shortcodes 
    6868        include_once ABSPATH . 'wp-admin/includes/plugin.php'; 
    6969        if ( is_plugin_active( 'wp-table-reloaded/wp-table-reloaded.php' ) ) { 
    7070            remove_shortcode( 'table-info' ); 
    7171            remove_shortcode( 'table' ); 
    72         } 
    73         // Shortcode "table-info" needs to be declared before "table"! Otherwise it will not be recognized! 
     72            if ( isset( $GLOBALS['WP_Table_Reloaded_Frontend'] ) ) 
     73                remove_action( 'wp_head', array( $GLOBALS['WP_Table_Reloaded_Frontend'], 'add_frontend_css' ) ); 
     74        } 
     75        // Shortcode "table-info" needs to be declared before "table"! Otherwise it will not be recognized! (@TODO: Might no longer be the case since [22382] in WP 3.5.) 
    7476        add_shortcode( TablePress::$shortcode_info, array( $this, 'shortcode_table_info' ) ); 
    7577        add_shortcode( TablePress::$shortcode, array( $this, 'shortcode_table' ) ); 
     
    8385    public function enqueue_css() { 
    8486        // add "Default CSS" 
    85         if ( $this->model_options->get( 'use_default_css' ) ) { 
     87        $use_default_css = apply_filters( 'tablepress_use_default_css', true ); 
     88        if ( $use_default_css ) { 
    8689            $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; 
    8790            $default_css_url = plugins_url( "css/default{$suffix}.css", TABLEPRESS__FILE__ ); 
     
    101104                    $custom_css_url = apply_filters( 'tablepress_custom_css_url', $custom_css_url ); 
    102105                    $custom_css_dependencies = array(); 
    103                     if ( $this->model_options->get( 'use_default_css' ) ) 
     106                    if ( $use_default_css ) 
    104107                        $custom_css_dependencies[] = 'tablepress-default'; // if default CSS is desired, but also handled internally 
    105108                    $custom_css_version = apply_filters( 'tablepress_custom_css_version', $this->model_options->get( 'custom_css_version' ) ); 
     
    114117                if ( ! empty( $custom_css ) ) { 
    115118                    // wp_add_inline_style() requires a loaded CSS file, so we have to work around that if "Default CSS" is disabled 
    116                     if ( $this->model_options->get( 'use_default_css' ) ) 
     119                    if ( $use_default_css ) 
    117120                        wp_add_inline_style( 'tablepress-default', $custom_css ); // handle of the file to which the <style> shall be appended 
    118121                    else 
     
    166169            foreach ( $table_store['instances'] as $html_id => $js_options ) { 
    167170                $parameters = array(); 
     171 
     172                // Settle dependencies/conflicts between certain features 
     173                if ( false !== $js_options['datatables_scrolly'] ) // not necessarily a boolean! 
     174                    $js_options['datatables_paginate'] = false; // vertical scrolling and pagination don't work together 
     175                if ( ! $js_options['datatables_paginate'] ) 
     176                    $js_options['datatables_paginate_entries'] = false; // Pagination is required for the initial value to be set 
    168177 
    169178                // DataTables language/translation handling 
     
    190199                if ( ! $js_options['datatables_paginate'] ) 
    191200                    $parameters['bPaginate'] = '"bPaginate":false'; 
    192                 if ( $js_options['datatables_paginate'] && ! empty( $js_options['datatables_paginate_entries'] ) && 10 != $js_options['datatables_paginate_entries'] ) 
     201                if ( ! empty( $js_options['datatables_paginate_entries'] ) && 10 != $js_options['datatables_paginate_entries'] ) 
    193202                    $parameters['iDisplayLength'] = '"iDisplayLength":'. $js_options['datatables_paginate_entries']; 
    194203                if ( ! $js_options['datatables_lengthchange'] ) 
     
    198207                if ( ! $js_options['datatables_info'] ) 
    199208                    $parameters['bInfo'] = '"bInfo":false'; 
    200                 if ( $js_options['datatables_scrollX'] ) 
     209                if ( $js_options['datatables_scrollx'] ) 
    201210                    $parameters['sScrollX'] = '"sScrollX":"100%"'; 
     211                if ( false !== $js_options['datatables_scrolly'] ) { 
     212                    $parameters['sScrollY'] = "\"sScrollY\":\"{$js_options['datatables_scrolly']}\""; 
     213                    $parameters['bScrollCollapse'] = '"bScrollCollapse":true'; 
     214                } 
    202215                if ( ! empty( $js_options['datatables_custom_commands'] ) ) 
    203216                    $parameters['custom_commands'] = $js_options['datatables_custom_commands']; 
    204217 
    205218                $parameters = apply_filters( 'tablepress_datatables_parameters', $parameters, $table_id, $html_id, $js_options ); 
     219 
     220                // if "aaSorting", "bSortClasses", or "asStripeClasses" are set in "Custom Commands", remove their default value 
     221                if ( isset( $parameters['custom_commands'] ) ) { 
     222                    foreach ( array( 'aaSorting', 'bSortClasses', 'asStripeClasses' ) as $maybe_overwritten_parameter ) { 
     223                        if ( false !== strpos( $parameters['custom_commands'], $maybe_overwritten_parameter ) ) 
     224                            unset( $parameters[ $maybe_overwritten_parameter ] ); 
     225                    } 
     226                } 
     227 
    206228                $parameters = implode( ',', $parameters ); 
    207229                $parameters = ( ! empty( $parameters ) ) ? '{' . $parameters . '}' : ''; 
     
    303325        // generate "Edit Table" link 
    304326        $render_options['edit_table_url'] = ''; 
    305         /* 
    306         if ( is_user_logged_in() && apply_filters( 'tablepress_edit_link_below_table', true ) ) { 
    307             $user_group = $this->model_options->get( 'user_access_plugin' ); 
    308             $capabilities = array( 
    309                 'admin' => 'manage_options', 
    310                 'editor' => 'publish_pages', 
    311                 'author' => 'publish_posts', 
    312                 'contributor' => 'edit_posts' 
    313             ); 
    314             $min_capability = isset( $capabilities[ $user_group ] ) ? $capabilities[ $user_group ] : 'manage_options'; 
    315             $min_capability = apply_filters( 'tablepress_min_needed_capability', $min_capability ); 
    316  
    317             if ( current_user_can( $min_capability ) ) 
    318                 $render_options['edit_table_url'] = TablePress::url( array( 'action' => 'edit', 'table_id' => $table['id'] ) ); 
    319         } 
    320         */ 
    321         // @TODO: temporary for above: 
    322         if ( is_user_logged_in() && apply_filters( 'tablepress_edit_link_below_table', true ) && current_user_can( apply_filters( 'tablepress_min_access_cap', 'edit_pages' ) ) ) 
     327        if ( is_user_logged_in() && apply_filters( 'tablepress_edit_link_below_table', true ) && current_user_can( 'tablepress_edit_table', $table['id'] ) ) 
    323328            $render_options['edit_table_url'] = TablePress::url( array( 'action' => 'edit', 'table_id' => $table['id'] ) ); 
    324329 
     
    331336            foreach ( array( 'alternating_row_colors', 'datatables_sort', 'datatables_paginate', 
    332337                                'datatables_paginate', 'datatables_paginate_entries', 'datatables_lengthchange', 
    333                                 'datatables_filter', 'datatables_info', 'datatables_scrollX', 
     338                                'datatables_filter', 'datatables_info', 'datatables_scrollx', 'datatables_scrolly', 
    334339                                'datatables_locale', 'datatables_custom_commands' ) as $option ) { 
    335340                $js_options[ $option ] = $render_options[ $option ]; 
  • tablepress/trunk/css/default.css

    r623199 r629752  
    3131    background: none; 
    3232    text-align: left; 
     33    vertical-align: top; 
    3334} 
    3435 
    3536/* Vertical lines / borders */ 
    36 .tablepress tbody tr td, 
    37 .tablepress tfoot tr th { 
     37.tablepress tbody td, 
     38.tablepress tfoot th { 
    3839    border-top: 1px solid #dddddd; 
    3940} 
     
    4142    border-top: 0; 
    4243} 
    43 .tablepress thead tr th { 
     44.tablepress thead th { 
    4445    border-bottom: 1px solid #dddddd; 
    4546} 
     
    5152    font-weight: bold; 
    5253} 
    53 .tablepress tbody tr.odd td { 
     54.tablepress .odd td { 
    5455    background-color: #f9f9f9; 
    5556} 
    56 .tablepress tbody tr.even td { 
     57.tablepress .even td { 
    5758    background-color: #ffffff; 
    5859} 
     
    134135    margin-left: 10px; 
    135136} 
    136 .paginate_enabled_previous { background: url('../img/back_enabled.png') no-repeat center left; } 
    137 .paginate_enabled_previous:hover { background: url('../img/back_enabled_hover.png') no-repeat center left; } 
    138 .paginate_disabled_previous { background: url('../img/back_disabled.png') no-repeat center left; } 
    139 .paginate_enabled_next { background: url('../img/forward_enabled.png') no-repeat center right; } 
    140 .paginate_enabled_next:hover { background: url('../img/forward_enabled_hover.png') no-repeat center right; } 
    141 .paginate_disabled_next { background: url('../img/forward_disabled.png') no-repeat center right; } 
     137.paginate_enabled_previous { background: url(../img/back_enabled.png) no-repeat center left; } 
     138.paginate_enabled_previous:hover { background: url(../img/back_enabled_hover.png) no-repeat center left; } 
     139.paginate_disabled_previous { background: url(../img/back_disabled.png) no-repeat center left; } 
     140.paginate_enabled_next { background: url(../img/forward_enabled.png) no-repeat center right; } 
     141.paginate_enabled_next:hover { background: url(../img/forward_enabled_hover.png) no-repeat center right; } 
     142.paginate_disabled_next { background: url(../img/forward_disabled.png) no-repeat center right; } 
    142143 
    143144/* Full number pagination */ 
     
    152153.paging_full_numbers a.paginate_active { 
    153154    border: 1px solid #aaaaaa; 
    154     -webkit-border-radius: 5px; 
    155     -moz-border-radius: 5px; 
    156155    border-radius: 5px; 
    157156    padding: 2px 5px; 
     
    197196} 
    198197.dataTables_wrapper .sorting { 
    199     background-image: url('../img/both.gif'); 
     198    background-image: url(../img/both.gif); 
    200199} 
    201200.dataTables_wrapper .sorting:hover { 
     
    203202} 
    204203.dataTables_wrapper .sorting_asc { 
    205     background-image: url('../img/asc.gif'); 
     204    background-image: url(../img/asc.gif); 
    206205} 
    207206.dataTables_wrapper .sorting_desc { 
    208     background-image: url('../img/desc.gif'); 
     207    background-image: url(../img/desc.gif); 
    209208} 
    210209.dataTables_wrapper .sorting_asc, 
  • tablepress/trunk/css/default.min.css

    r623199 r629752  
    1 .tablepress-table-description{clear:both;display:block}.tablepress{border-collapse:collapse;border-spacing:0;width:100%;margin-bottom:1em;border:0}.tablepress th,.tablepress td{padding:8px;border:0;background:0;text-align:left}.tablepress tbody tr td,.tablepress tfoot tr th{border-top:1px solid #ddd}.tablepress tbody tr:first-child td{border-top:0}.tablepress thead tr th{border-bottom:1px solid #ddd}.tablepress thead th,.tablepress tfoot th{background-color:#d9edf7;font-weight:bold}.tablepress tbody tr.odd td{background-color:#f9f9f9}.tablepress tbody tr.even td{background-color:#fff}.tablepress .row-hover tr:hover td{background-color:#f3f3f3}.dataTables_wrapper{position:relative;clear:both;*zoom:1;margin-bottom:1em}.dataTables_wrapper .tablepress{clear:both;margin:0!important}.dataTables_length{float:left;white-space:nowrap}.dataTables_filter{float:right;text-align:right;white-space:nowrap}.dataTables_info{clear:both;float:left;margin-top:4px}.dataTables_paginate{float:right;text-align:right;margin-top:4px}.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next{float:left;cursor:pointer;*cursor:hand;color:#111!important}.paginate_disabled_previous:hover,.paginate_enabled_previous:hover,.paginate_disabled_next:hover,.paginate_enabled_next:hover{text-decoration:none!important}.paginate_disabled_previous:active,.paginate_enabled_previous:active,.paginate_disabled_next:active,.paginate_enabled_next:active{outline:0}.paginate_disabled_previous,.paginate_disabled_next{color:#666!important}.paginate_disabled_previous,.paginate_enabled_previous{padding-left:23px}.paginate_disabled_next,.paginate_enabled_next{padding-right:23px;margin-left:10px}.paginate_enabled_previous{background:url('../img/back_enabled.png') no-repeat center left}.paginate_enabled_previous:hover{background:url('../img/back_enabled_hover.png') no-repeat center left}.paginate_disabled_previous{background:url('../img/back_disabled.png') no-repeat center left}.paginate_enabled_next{background:url('../img/forward_enabled.png') no-repeat center right}.paginate_enabled_next:hover{background:url('../img/forward_enabled_hover.png') no-repeat center right}.paginate_disabled_next{background:url('../img/forward_disabled.png') no-repeat center right}.paging_full_numbers{height:22px;line-height:22px}.paging_full_numbers a:active{outline:0}.paging_full_numbers a:hover{text-decoration:none}.paging_full_numbers a.paginate_button,.paging_full_numbers a.paginate_active{border:1px solid #aaa;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:2px 5px;margin:0 3px;cursor:pointer;*cursor:hand;color:#333!important}.paging_full_numbers a.paginate_button{background-color:#ddd}.paging_full_numbers a.paginate_button:hover{background-color:#ccc;text-decoration:none!important}.paging_full_numbers a.paginate_active{background-color:#99b3ff}.dataTables_processing{display:none}.dataTables_scroll{clear:both}.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .sorting,.dataTables_wrapper .sorting_asc,.dataTables_wrapper .sorting_desc{padding-right:18px;cursor:pointer;*cursor:hand;background-repeat:no-repeat;background-position:center right}.dataTables_wrapper .sorting{background-image:url('../img/both.gif')}.dataTables_wrapper .sorting:hover{background-color:#049cdb}.dataTables_wrapper .sorting_asc{background-image:url('../img/asc.gif')}.dataTables_wrapper .sorting_desc{background-image:url('../img/desc.gif')}.dataTables_wrapper .sorting_asc,.dataTables_wrapper .sorting_desc{background-color:#049cdb}.dataTables_wrapper th:active{outline:0}.dataTables_wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}html[xmlns] .dataTables_wrapper{display:block}* html .dataTables_wrapper{height:1%}.dataTables_wrapper label input,.dataTables_wrapper label select{display:inline;margin:2px}.tablepress-rtl{direction:rtl;text-align:right}.dataTables_wrapper .tablepress-rtl .sorting,.dataTables_wrapper .tablepress-rtl .sorting_asc,.dataTables_wrapper .tablepress-rtl .sorting_desc{background-position:center left;padding-right:8px;padding-left:18px} 
     1.tablepress-table-description{clear:both;display:block}.tablepress{border-collapse:collapse;border-spacing:0;width:100%;margin-bottom:1em;border:0}.tablepress th,.tablepress td{padding:8px;border:0;background:0;text-align:left;vertical-align:top}.tablepress tbody td,.tablepress tfoot th{border-top:1px solid #ddd}.tablepress tbody tr:first-child td{border-top:0}.tablepress thead th{border-bottom:1px solid #ddd}.tablepress thead th,.tablepress tfoot th{background-color:#d9edf7;font-weight:bold}.tablepress .odd td{background-color:#f9f9f9}.tablepress .even td{background-color:#fff}.tablepress .row-hover tr:hover td{background-color:#f3f3f3}.dataTables_wrapper{position:relative;clear:both;*zoom:1;margin-bottom:1em}.dataTables_wrapper .tablepress{clear:both;margin:0!important}.dataTables_length{float:left;white-space:nowrap}.dataTables_filter{float:right;text-align:right;white-space:nowrap}.dataTables_info{clear:both;float:left;margin-top:4px}.dataTables_paginate{float:right;text-align:right;margin-top:4px}.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next{float:left;cursor:pointer;*cursor:hand;color:#111!important}.paginate_disabled_previous:hover,.paginate_enabled_previous:hover,.paginate_disabled_next:hover,.paginate_enabled_next:hover{text-decoration:none!important}.paginate_disabled_previous:active,.paginate_enabled_previous:active,.paginate_disabled_next:active,.paginate_enabled_next:active{outline:0}.paginate_disabled_previous,.paginate_disabled_next{color:#666!important}.paginate_disabled_previous,.paginate_enabled_previous{padding-left:23px}.paginate_disabled_next,.paginate_enabled_next{padding-right:23px;margin-left:10px}.paginate_enabled_previous{background:url(../img/back_enabled.png) no-repeat center left}.paginate_enabled_previous:hover{background:url(../img/back_enabled_hover.png) no-repeat center left}.paginate_disabled_previous{background:url(../img/back_disabled.png) no-repeat center left}.paginate_enabled_next{background:url(../img/forward_enabled.png) no-repeat center right}.paginate_enabled_next:hover{background:url(../img/forward_enabled_hover.png) no-repeat center right}.paginate_disabled_next{background:url(../img/forward_disabled.png) no-repeat center right}.paging_full_numbers{height:22px;line-height:22px}.paging_full_numbers a:active{outline:0}.paging_full_numbers a:hover{text-decoration:none}.paging_full_numbers a.paginate_button,.paging_full_numbers a.paginate_active{border:1px solid #aaa;border-radius:5px;padding:2px 5px;margin:0 3px;cursor:pointer;*cursor:hand;color:#333!important}.paging_full_numbers a.paginate_button{background-color:#ddd}.paging_full_numbers a.paginate_button:hover{background-color:#ccc;text-decoration:none!important}.paging_full_numbers a.paginate_active{background-color:#99b3ff}.dataTables_processing{display:none}.dataTables_scroll{clear:both}.dataTables_scrollBody{*margin-top:-1px;-webkit-overflow-scrolling:touch}.dataTables_wrapper .sorting,.dataTables_wrapper .sorting_asc,.dataTables_wrapper .sorting_desc{padding-right:18px;cursor:pointer;*cursor:hand;background-repeat:no-repeat;background-position:center right}.dataTables_wrapper .sorting{background-image:url(../img/both.gif)}.dataTables_wrapper .sorting:hover{background-color:#049cdb}.dataTables_wrapper .sorting_asc{background-image:url(../img/asc.gif)}.dataTables_wrapper .sorting_desc{background-image:url(../img/desc.gif)}.dataTables_wrapper .sorting_asc,.dataTables_wrapper .sorting_desc{background-color:#049cdb}.dataTables_wrapper th:active{outline:0}.dataTables_wrapper:after{content:".";display:block;clear:both;visibility:hidden;line-height:0;height:0}html[xmlns] .dataTables_wrapper{display:block}* html .dataTables_wrapper{height:1%}.dataTables_wrapper label input,.dataTables_wrapper label select{display:inline;margin:2px}.tablepress-rtl{direction:rtl;text-align:right}.dataTables_wrapper .tablepress-rtl .sorting,.dataTables_wrapper .tablepress-rtl .sorting_asc,.dataTables_wrapper .tablepress-rtl .sorting_desc{background-position:center left;padding-right:8px;padding-left:18px} 
  • tablepress/trunk/models/model-options.php

    r623199 r629752  
    3737        'message_plugin_update_content' => '', 
    3838        'message_donation_nag' => true, 
    39         'use_default_css' => true, 
    4039        'use_custom_css' => true, 
    4140        'use_custom_css_file' => true, 
     
    9594        ); 
    9695        $this->user_options = TablePress::load_class( 'TablePress_WP_User_Option', 'class-wp_user_option.php', 'classes', $params ); 
     96 
     97        // Filter to map Meta capabilities to Primitive Capabilities 
     98        add_filter( 'map_meta_cap', array( $this, 'map_tablepress_meta_caps' ), 10, 4 ); 
    9799    } 
    98100 
     
    202204 
    203205        $this->user_options->update( $user_options ); 
     206    } 
     207 
     208    /** 
     209     * Add default capabilities to "Administrator", "Editor", and "Author" roles 
     210     * 
     211     * @since 1.0.0 
     212     */ 
     213    public function add_access_capabilities() { 
     214        // Capabilities for all roles 
     215        $roles = array( 'administrator', 'editor', 'author' ); 
     216        foreach ( $roles as $role ) { 
     217            $role =& get_role( $role ); 
     218            if ( empty( $role ) ) 
     219                continue; 
     220 
     221            // from get_post_type_capabilities() 
     222            $role->add_cap( 'tablepress_edit_tables' ); 
     223            // $role->add_cap( 'tablepress_edit_others_tables' ); 
     224            $role->add_cap( 'tablepress_delete_tables' ); 
     225            // $role->add_cap( 'tablepress_delete_others_tables' ); 
     226 
     227            // custom capabilities() 
     228            $role->add_cap( 'tablepress_list_tables' ); 
     229            $role->add_cap( 'tablepress_add_tables' ); 
     230            $role->add_cap( 'tablepress_copy_tables' ); 
     231            $role->add_cap( 'tablepress_import_tables' ); 
     232            $role->add_cap( 'tablepress_export_tables' ); 
     233            $role->add_cap( 'tablepress_access_options_screen' ); 
     234            $role->add_cap( 'tablepress_access_about_screen' ); 
     235        } 
     236 
     237        // Capabilities for single roles 
     238        $role =& get_role( 'administrator' ); 
     239        if ( ! empty( $role ) ) { 
     240            $role->add_cap( 'tablepress_import_tables_wptr' ); 
     241            $role->add_cap( 'tablepress_edit_options' ); 
     242        } 
     243    } 
     244 
     245    /** 
     246     * Map TablePress meta capabilities to primitive capabilities 
     247     * 
     248     * @since 1.0.0 
     249     * 
     250     * @param array $caps Current set of primitive caps 
     251     * @param string $cap Meta cap that is to be checked/mapped 
     252     * @param int $user_id User ID for which meta cap is to be checked 
     253     * @param array $args Arguments for the check, here e.g. the table ID 
     254     * @return bool 
     255     */ 
     256    public function map_tablepress_meta_caps( $caps, $cap, $user_id, $args ) { 
     257        if ( ! in_array( $cap, array( 'tablepress_edit_table', 'tablepress_edit_table_id', 'tablepress_copy_table', 'tablepress_delete_table', 'tablepress_export_table', 'tablepress_preview_table' ) ) ) 
     258            return $caps; 
     259 
     260        // $user = get_userdata( $user_id ); 
     261        // $username = $user->user_login); 
     262        // $table_id = ( ! empty( $args ) ) ? $args[0] : false; 
     263 
     264        // reset current set of primitive caps 
     265        $caps = array(); 
     266 
     267        switch ( $cap ) { 
     268            case 'tablepress_edit_table': 
     269                $caps[] = 'tablepress_edit_tables'; 
     270                break; 
     271            case 'tablepress_edit_table_id': 
     272                $caps[] = 'tablepress_edit_tables'; 
     273                break; 
     274            case 'tablepress_copy_table': 
     275                $caps[] = 'tablepress_copy_tables'; 
     276                break; 
     277            case 'tablepress_delete_table': 
     278                $caps[] = 'tablepress_delete_tables'; 
     279                break; 
     280            case 'tablepress_export_table': 
     281                $caps[] = 'tablepress_export_tables'; 
     282                break; 
     283            case 'tablepress_preview_table': 
     284                $caps[] = 'tablepress_edit_tables'; 
     285                break; 
     286            default: 
     287                // something went wrong; deny access to be on the safe side 
     288                $caps[] = 'do_not_allow'; 
     289                break; 
     290        } 
     291 
     292        $caps = apply_filters( 'tablepress_map_meta_caps', $caps, $cap, $user_id, $args ); 
     293 
     294        return $caps; 
    204295    } 
    205296 
  • tablepress/trunk/models/model-post.php

    r623199 r629752  
    5656            'query_var' => false, 
    5757            'rewrite' => false, 
     58            'capability_type' => 'tablepress_table', // this ensures, that WP's regular CPT UI respects our capabilities 
     59            'map_meta_cap' => false, // integrated WP mapping does not fit our needs, therefore use our own in a filter 
    5860            'supports' => array( 'title', 'editor', 'excerpt', 'revisions' ), 
    5961            'can_export' => true 
     
    9092        $post = array_merge( $default_post, $post ); 
    9193        $post = add_magic_quotes( $post ); // WP expects everything to be slashed 
     94 
     95        // remove balanceTags() from sanitize_post(), as it can destroy the JSON when messing with HTML 
     96        remove_filter( 'content_save_pre', 'balanceTags', 50 ); 
     97        remove_filter( 'excerpt_save_pre', 'balanceTags', 50 ); 
     98 
    9299        $post_id = wp_insert_post( $post, false ); // false means: no WP_Error object on error, but int 0 
     100 
     101        // re-add balanceTags() to sanitize_post() 
     102        add_filter( 'content_save_pre', 'balanceTags', 50 ); 
     103        add_filter( 'excerpt_save_pre', 'balanceTags', 50 ); 
     104 
    93105        return $post_id; 
    94106    } 
     
    121133        $post = array_merge( $default_post, $post ); 
    122134        $post = add_magic_quotes( $post ); // WP expects everything to be slashed 
     135 
     136        // remove balanceTags() from sanitize_post(), as it can destroy the JSON when messing with HTML 
     137        remove_filter( 'content_save_pre', 'balanceTags', 50 ); 
     138        remove_filter( 'excerpt_save_pre', 'balanceTags', 50 ); 
     139 
    123140        $post_id = wp_update_post( $post ); 
     141 
     142        // re-add balanceTags() to sanitize_post() 
     143        add_filter( 'content_save_pre', 'balanceTags', 50 ); 
     144        add_filter( 'excerpt_save_pre', 'balanceTags', 50 ); 
     145 
    124146        return $post_id; 
    125147    } 
  • tablepress/trunk/models/model-table.php

    r623199 r629752  
    152152        ); 
    153153 
     154        // Check if JSON could be decoded 
     155        if ( is_null( $table['data'] ) ) { 
     156            // set a single cell as the default 
     157            $table['data'] = array( array( 'The internal data of this table is corrupted!' ) ); 
     158            // mark table as broken 
     159            $table['name'] = '[ERROR] ' . $table['name']; 
     160            $table['description'] = "[ERROR] THE TABLE DATA IS CORRUPTED!  DO NOT EDIT THIS TABLE NOW!\nInstead, please ask for support at http://wordpress.org/support/plugin/tablepress\n\n" . $table['description']; 
     161        } 
     162 
    154163        return $table; 
    155164    } 
     
    293302            $table['name'] = __( '(no name)', 'tablepress' ); 
    294303        $table['name'] = sprintf( __( 'Copy of %s', 'tablepress' ), $table['name'] ); 
     304 
     305        // Set Last Editor to user who copied 
     306        $table['options']['last_editor'] = get_current_user_id(); 
    295307 
    296308        // Merge this data into an empty table template 
  • tablepress/trunk/readme.txt

    r623199 r629752  
    2121 
    2222= Supporting future development = 
    23 If you like the TablePress plugin, please rate it here in the WordPress Plugin Directory, support it with your [donation](http://tablepress.org/donate/), or [flattr it](https://flattr.com/thing/783658/TablePress). Thank you! 
     23If you like the TablePress plugin, please rate and review it here in the WordPress Plugin Directory, support it with your [donation](http://tablepress.org/donate/), or [flattr it](https://flattr.com/thing/783658/TablePress). Thank you! 
    2424 
    2525= Migration from WP-Table Reloaded = 
     
    6060 
    6161In short: WordPress 3.4 or higher, while the latest version of WordPress is always recommended. 
     62 
     63TablePress 1.0 will require WordPress 3.5! 
    6264 
    6365= Languages and Localization? = 
  • tablepress/trunk/tablepress.php

    r623199 r629752  
    1212Plugin URI: http://tablepress.org/ 
    1313Description: TablePress enables you to create and manage tables in your posts and pages, without having to write HTML code, and it adds valuable functions for your visitors. 
    14 Version: 0.7-beta 
     14Version: 0.8-beta 
    1515Author: Tobias Bäthge 
    1616Author URI: http://tobias.baethge.com/ 
  • tablepress/trunk/views/view-about.php

    r623199 r629752  
    121121    <br /> 
    122122        <?php printf( __( 'If you like the plugin, <a href="%s"><strong>giving a donation</strong></a> is recommended.', 'tablepress' ), 'http://tablepress.org/donate/' ); ?> 
    123         <?php printf( __( 'Please rate the plugin in the <a href="%s">WordPress Plugin Directory</a>.', 'tablepress' ), 'http://wordpress.org/extend/plugins/tablepress/' ); ?> 
     123        <?php printf( __( 'Please rate and review the plugin in the <a href="%s">WordPress Plugin Directory</a>.', 'tablepress' ), 'http://wordpress.org/support/view/plugin-reviews/tablepress' ); ?> 
    124124    <br /> 
    125125        <?php _e( 'Donations and good ratings encourage me to further develop the plugin and to provide countless hours of support. Any amount is appreciated! Thanks!', 'tablepress' ); ?> 
     
    168168            <br />&middot; ZIP support: <?php echo $data['zip_support_available'] ? 'yes' : 'no'; ?> 
    169169            <br />&middot; WP Memory Limit: <?php echo WP_MEMORY_LIMIT; ?> 
     170            <br />&middot; Magic Quotes: <?php echo get_magic_quotes_gpc() ? 'on' : 'off'; ?> 
    170171        </p> 
    171172        <?php 
  • tablepress/trunk/views/view-edit.php

    r623199 r629752  
    4848        } 
    4949 
    50         // do this here to get CSS into <head> 
    51         wp_enqueue_style( 'wp-jquery-ui-dialog' ); 
    52         add_action( 'admin_footer', array( $this, 'dequeue_media_upload_js' ), 2 ); 
     50        wp_enqueue_style( 'wp-jquery-ui-dialog' ); // do this here to get CSS into <head> 
     51        add_action( 'admin_footer', array( $this, 'dequeue_media_upload_js' ), 2 ); // remove default media-upload.js, in favor of own code 
    5352        add_thickbox(); 
     53 
     54        // Use modified version of wpLink, instead of default version (changes "Title" to "Link Text") 
     55        wp_deregister_script( 'wplink' ); 
     56        $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; 
     57        // See wp-includes/script-loader.php for default parameters 
     58        wp_register_script( 'wplink', plugins_url( "admin/tp_wplink{$suffix}.js", TABLEPRESS__FILE__ ), array( 'jquery', 'wpdialogs' ), TablePress::version, true ); 
     59        wp_localize_script( 'wplink', 'wpLinkL10n', array( 
     60            'title' => __('Insert/edit link'), 
     61            'update' => __('Update'), 
     62            'save' => __('Add Link'), 
     63            'noTitle' => __('(no title)'), 
     64            'noMatchesFound' => __('No matches found.'), 
     65            'link_text' => __( 'Link Text', 'tablepress' ) // Previous strings are default strings, this is the string that the modified tp_wplink.js inserts 
     66        ) ); 
     67 
    5468        $this->admin_page->enqueue_style( 'edit' ); 
    5569        $this->admin_page->enqueue_script( 'edit', array( 'jquery', 'jquery-ui-sortable', 'json2' ), array( 
     
    7488                'colspan_add' => __( 'To combine cells within a row, click into the cell to the right of the cell that has the content the combined cells shall have.', 'tablepress' ), 
    7589                'link_add' => __( 'Please click into the cell that you want to add a link to.', 'tablepress' ) . "\n" . 
    76                                 __( 'You can then enter the link URL or choose an existing page or post.', 'tablepress' ) . "\n" . 
    77                                 __( 'After the link HTML code is inserted, type the link text, for which the cursor will already be in the correct position.', 'tablepress' ), 
     90                                __( 'You can then enter the Link URL and Text or choose an existing page or post.', 'tablepress' ), 
    7891                'image_add' => __( 'Please click into the cell that you want to add an image to.', 'tablepress' ) . "\n" . 
    7992                                __( 'The Media Library will open, where you can select or upload the desired image or enter the image URL.', 'tablepress' ) . "\n" . 
     
    89102                'ays_change_table_id' => __( 'Do you really want to change the Table ID? All Shortcodes for this table in your pages and posts will have to be adjusted!', 'tablepress' ), 
    90103                'extra_css_classes_invalid' => __( 'The entered value in the field &#8220;Extra CSS classes&#8221; is invalid.', 'tablepress' ), 
     104                'num_pagination_entries_invalid' => __( 'The entered value in the field &#8220;Pagination Entries&#8221; is not a number.', 'tablepress' ), 
    91105                'sort_asc' => __( 'Sort ascending', 'tablepress' ), 
    92106                'sort_desc' => __( 'Sort descending', 'tablepress' ), 
     
    214228            $column_class = ' column-hidden'; 
    215229        $column = TablePress::number_to_letter( $col_idx + 1 ); 
    216         echo "\t\t\t<th class=\"head{$column_class}\"><span class=\"sort-control sort-desc\" title=\"" . __( 'Sort descending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"sort-control sort-asc\" title=\"" . __( 'Sort ascending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"move-handle\">{$column}</span></th>\n"; 
     230        echo "\t\t\t<th class=\"head{$column_class}\"><span class=\"sort-control sort-desc hide-if-no-js\" title=\"" . __( 'Sort descending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"sort-control sort-asc hide-if-no-js\" title=\"" . __( 'Sort ascending', 'tablepress' ) . "\"><span class=\"sorting-indicator\"></span></span><span class=\"move-handle\">{$column}</span></th>\n"; 
    217231    } 
    218232?> 
     
    283297<tbody> 
    284298    <tr class="bottom-border"> 
    285         <td> 
     299        <td class="column-1"> 
    286300            <input type="button" class="button" id="link-add" value="<?php _e( 'Insert Link', 'tablepress' ); ?>" /> 
    287301            <a href="<?php echo $media_library_url; ?>" class="button" id="image-add"><?php _e( 'Insert Image', 'tablepress' ); ?></a> 
    288302            <input type="button" class="button" id="advanced-editor-open" value="<?php _e( 'Advanced Editor', 'tablepress' ); ?>" /> 
    289303        </td> 
    290         <td> 
     304        <td class="column-2"> 
    291305            <?php _e( 'Combine cells', 'tablepress' ); ?>:&nbsp; 
    292306            <input type="button" class="button" id="span-add-rowspan" value="<?php _e( 'in a column (rowspan)', 'tablepress' ); ?>" /> 
     
    305319    </tr> 
    306320    <tr class="top-border"> 
    307         <td> 
     321        <td class="column-1"> 
    308322            <?php _e( 'Selected rows', 'tablepress' ); ?>:&nbsp; 
    309323            <input type="button" class="button" id="rows-hide" value="<?php _e( 'Hide', 'tablepress' ); ?>" /> 
    310324            <input type="button" class="button" id="rows-unhide" value="<?php _e( 'Show', 'tablepress' ); ?>" /> 
    311325        </td> 
    312         <td> 
     326        <td class="column-2"> 
    313327            <?php _e( 'Selected columns', 'tablepress' ); ?>:&nbsp; 
    314328            <input type="button" class="button" id="columns-hide" value="<?php _e( 'Hide', 'tablepress' ); ?>" /> 
     
    317331    </tr> 
    318332    <tr class="bottom-border"> 
    319         <td> 
     333        <td class="column-1"> 
    320334            <?php _e( 'Selected rows', 'tablepress' ); ?>:&nbsp; 
    321335            <input type="button" class="button" id="rows-insert" value="<?php _e( 'Insert', 'tablepress' ); ?>" /> 
    322336            <input type="button" class="button" id="rows-remove" value="<?php _e( 'Delete', 'tablepress' ); ?>" /> 
    323337        </td> 
    324         <td> 
     338        <td class="column-2"> 
    325339            <?php _e( 'Selected columns', 'tablepress' ); ?>:&nbsp; 
    326340            <input type="button" class="button" id="columns-insert" value="<?php _e( 'Insert', 'tablepress' ); ?>" /> 
     
    329343    </tr> 
    330344    <tr class="top-border"> 
    331         <td> 
     345        <td class="column-1"> 
    332346            <?php printf( __( 'Add %s row(s)', 'tablepress' ), '<input type="number" id="rows-append-number" class="small-text numbers-only" title="' . __( 'This field must contain a positive number.', 'tablepress' ) . '" value="1" min="1" max="99999" maxlength="5" required />' ); ?>&nbsp;<input type="button" class="button" id="rows-append" value="<?php _e( 'Add', 'tablepress' ); ?>" /> 
    333347        </td> 
    334         <td> 
     348        <td class="column-2"> 
    335349            <?php printf( __( 'Add %s column(s)', 'tablepress' ), '<input type="number" id="columns-append-number" class="small-text numbers-only" title="' . __( 'This field must contain a positive number.', 'tablepress' ) . '" value="1" min="1" max="99999" maxlength="5" required />' ); ?>&nbsp;<input type="button" class="button" id="columns-append" value="<?php _e( 'Add', 'tablepress' ); ?>" /> 
    336350        </td> 
     
    348362    public function textbox_buttons( $data, $box ) { 
    349363        $preview_url = TablePress::url( array( 'action' => 'preview_table', 'item' => $data['table']['id'], 'return' => 'edit', 'return_item' => $data['table']['id'] ), true, 'admin-post.php' ); 
     364 
     365        echo '<p class="submit">'; 
     366        if ( current_user_can( 'tablepress_preview_table', $data['table']['id'] ) ) 
     367            echo '<a href="' . $preview_url . '" class="button button-large show-preview-button" target="_blank">' . __( 'Preview', 'tablepress' ) . '</a>'; 
    350368        ?> 
    351             <p class="submit"> 
    352                 <a href="<?php echo $preview_url; ?>" class="button button-large show-preview-button" target="_blank"><?php _e( 'Preview', 'tablepress' ); ?></a> 
    353                 <input type="button" class="button button-primary button-large save-changes-button hide-if-no-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
    354                 <input type="submit" class="button button-primary button-large hide-if-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
    355             </p> 
     369            <input type="button" class="button button-primary button-large save-changes-button hide-if-no-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
     370            <input type="submit" class="button button-primary button-large hide-if-js" value="<?php _e( 'Save Changes', 'tablepress' ); ?>" /> 
    356371        <?php 
     372        echo '</p>'; 
    357373    } 
    358374 
     
    363379     */ 
    364380    public function textbox_other_actions( $data, $box ) { 
    365         ?> 
    366             <p class="submit"> 
    367                 <?php _e( 'Other Actions', 'tablepress' ); ?>:&nbsp; 
    368                 <a href="<?php echo TablePress::url( array( 'action' => 'delete_table', 'item' => $data['table']['id'], 'return' => 'edit', 'return_item' => $data['table']['id'] ), true, 'admin-post.php' ); ?>" class="button delete-link"><?php _e( 'Delete Table', 'tablepress' ); ?></a> 
    369                 <a href="<?php echo TablePress::url( array( 'action' => 'export', 'table_id' => $data['table']['id'] ) ); ?>" class="button"><?php _e( 'Export Table', 'tablepress' ); ?></a> 
    370             </p> 
    371         <?php 
     381        $user_can_delete_table = current_user_can( 'tablepress_delete_table', $data['table']['id'] ); 
     382        $user_can_export_table = current_user_can( 'tablepress_export_table', $data['table']['id'] ); 
     383 
     384        if ( ! $user_can_delete_table && ! $user_can_export_table ) 
     385            return; 
     386 
     387        echo '<p class="submit">'; 
     388        echo __( 'Other Actions', 'tablepress' ) . ':&nbsp;'; 
     389        if ( $user_can_delete_table ) 
     390            echo '<a href="' . TablePress::url( array( 'action' => 'delete_table', 'item' => $data['table']['id'], 'return' => 'edit', 'return_item' => $data['table']['id'] ), true, 'admin-post.php' ) . '" class="button delete-link">' . __( 'Delete Table', 'tablepress' ) . '</a> '; 
     391        if ( $user_can_export_table ) 
     392            echo '<a href="' . TablePress::url( array( 'action' => 'export', 'table_id' => $data['table']['id'] ) ) . '" class="button">' . __( 'Export Table', 'tablepress' ) . '</a>'; 
     393        echo '</p>'; 
    372394    } 
    373395 
     
    382404    <div id="advanced-editor"> 
    383405    <?php 
    384         wp_editor( '', 'advanced-editor-content', array( 
     406        $wp_editor_options = array( 
    385407            'textarea_rows' => 10, 
    386408            'tinymce' => false, 
     
    388410                'buttons' => 'strong,em,link,del,ins,img,code,spell,close' 
    389411            ) 
    390         ) ); 
     412        ); 
     413        // temporarily disable "Add Media" button in Advanced Editor for WP 3.5 
     414        if ( version_compare( $GLOBALS['wp_version'], '3.4.99', '>' ) ) 
     415            $wp_editor_options['media_buttons'] = false; 
     416        wp_editor( '', 'advanced-editor-content', $wp_editor_options ); 
    391417    ?> 
    392418    <div class="submitbox"> 
     
    483509        <th class="column-1" scope="row" style="vertical-align: top;"><?php _e( 'Pagination', 'tablepress' ); ?>:</th> 
    484510        <td class="column-2"><label for="option-datatables-paginate"><input type="checkbox" id="option-datatables-paginate" name="table[options][datatables_paginate]" value="true"<?php checked( $options['datatables_paginate'] ); ?> /> <?php _e( 'Enable pagination of the table (viewing only a certain number of rows at a time) by the visitor.', 'tablepress' ); ?></label><br /> 
    485         <label for="option-datatables-paginate_entries"><input type="checkbox" style="visibility: hidden;" <?php // Dummy checkbox for space alignment ?>/> <?php printf( __( 'Show %s rows per page.', 'tablepress' ), '<input type="number" id="option-datatables-paginate_entries" name="table[options][datatables_paginate_entries]" value="' . $options['datatables_paginate_entries'] . '" min="1" max="99999" maxlength="5" />' ); ?></label></td> 
     511        <label for="option-datatables-paginate_entries"><input type="checkbox" style="visibility: hidden;" <?php // Dummy checkbox for space alignment ?>/> <?php printf( __( 'Show %s rows per page.', 'tablepress' ), '<input type="number" id="option-datatables-paginate_entries" name="table[options][datatables_paginate_entries]" value="' . $options['datatables_paginate_entries'] . '" min="1" max="99999" maxlength="5" required />' ); ?></label></td> 
    486512    </tr> 
    487513    <tr class="no-border"> 
  • tablepress/trunk/views/view-editor_button_thickbox.php

    r623199 r629752  
    5353        $this->data = $data; 
    5454 
    55         set_current_screen( 'tablepress_editor_button_thickbox' ); 
    56  
    5755        $this->wp_list_table = new TablePress_Editor_Button_Thickbox_List_Table(); 
    5856        $this->wp_list_table->set_items( $this->data['tables'] ); 
     
    7876 
    7977#icon-tablepress { 
    80     background: transparent url( '<?php echo plugins_url( 'admin/tablepress-icon.png', TABLEPRESS__FILE__ ); ?>' ) no-repeat; 
    81 } 
    82 /* Retina images */ 
    83 @media only screen and (-webkit-min-device-pixel-ratio: 1.5) { 
     78    background: transparent url(<?php echo plugins_url( 'admin/tablepress-icon.png', TABLEPRESS__FILE__ ); ?>) no-repeat; 
     79} 
     80/* HiDPI images */ 
     81@media print, 
     82 (-o-min-device-pixel-ratio: 5/4), 
     83 (-webkit-min-device-pixel-ratio: 1.25), 
     84 (min-resolution: 120dpi) { 
    8485    /* Screen icon */ 
    8586    #icon-tablepress { 
    86         background-image: url( '<?php echo plugins_url( 'admin/tablepress-icon-2x.png', TABLEPRESS__FILE__ ); ?>' ); 
     87        background-image: url(<?php echo plugins_url( 'admin/tablepress-icon-2x.png', TABLEPRESS__FILE__ ); ?>); 
    8788        background-size: 36px 36px; 
    8889    } 
     
    112113    padding: 0; 
    113114    font-weight: bold; 
     115    -webkit-box-shadow: none; 
     116    box-shadow: none; 
    114117} 
    115118#tablepress-page .table-shortcode { 
     
    192195            'plural'    => 'tablepress-editor-button-list', // plural name of the listed records 
    193196            'ajax'      => false,                           // does this list table support AJAX? 
    194             'screen'    => convert_to_screen( 'tablepress_editor_button_thickbox' ) 
     197            'screen'    => get_current_screen()             // WP_Screen object 
    195198        ) ); 
    196199    } 
  • tablepress/trunk/views/view-export.php

    r623199 r629752  
    116116            <?php 
    117117                foreach ( $data['tables'] as $table ) { 
     118                    if ( ! current_user_can( 'tablepress_export_table', $table['id'] ) ) 
     119                        continue; 
    118120                    if ( '' == trim( $table['name'] ) ) 
    119121                        $table['name'] = __( '(no name)', 'tablepress' ); 
  • tablepress/trunk/views/view-import.php

    r623199 r629752  
    6767        $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); 
    6868        $this->add_meta_box( 'import-form', __( 'Import Tables', 'tablepress' ), array( $this, 'postbox_import_form' ), 'normal' ); 
    69         $this->add_meta_box( 'import-wp-table-reloaded', __( 'Import from WP-Table Reloaded', 'tablepress' ), array( $this, 'postbox_wp_table_reloaded_import' ), 'additional' ); 
     69        if ( current_user_can( 'tablepress_import_tables_wptr' ) ) 
     70            $this->add_meta_box( 'import-wp-table-reloaded', __( 'Import from WP-Table Reloaded', 'tablepress' ), array( $this, 'postbox_wp_table_reloaded_import' ), 'additional' ); 
    7071    } 
    7172 
     
    172173            <?php 
    173174                foreach ( $data['tables'] as $table ) { 
     175                    if ( ! current_user_can( 'tablepress_edit_table', $table['id'] ) ) 
     176                        continue; 
    174177                    if ( '' == trim( $table['name'] ) ) 
    175178                        $table['name'] = __( '(no name)', 'tablepress' ); 
  • tablepress/trunk/views/view-list.php

    r623199 r629752  
    295295     */ 
    296296    public function __construct() { 
     297        $screen = get_current_screen(); 
     298 
     299        // Hide "Last Modified By" column by default 
     300        if ( false === get_user_option( 'manage' . $screen->id . 'columnshidden' ) ) 
     301            update_user_option( get_current_user_id(), 'manage' . $screen->id . 'columnshidden', array( 'table_last_modified_by' ), true ); 
     302 
    297303        parent::__construct( array( 
    298304            'singular'  => 'tablepress-table',      // singular name of the listed records 
    299305            'plural'    => 'tablepress-all-tables', // plural name of the listed records 
    300             'ajax'      => false                    // does this list table support AJAX? 
     306            'ajax'      => false,                   // does this list table support AJAX? 
     307            'screen'    => $screen                  // WP_Screen object 
    301308        ) ); 
    302309    } 
     
    336343    public function get_columns() { 
    337344        $columns = array( 
    338             'cb' => $this->has_items() ? '<input type="checkbox" class="hide-if-no-js" />' : '', // checkbox for "Select all", but only if there are items in the table 
     345            'cb' => $this->has_items() ? '<input type="checkbox" />' : '', // checkbox for "Select all", but only if there are items in the table 
    339346            'table_id' => __( 'ID', 'tablepress' ), 
    340347            'table_name' => __( 'Table Name', 'tablepress' ), // just "name" is special in WP, which is why we prefix every entry here, to be safe! 
    341348            'table_description' => __( 'Description', 'tablepress' ), 
    342349            'table_author' => __( 'Author', 'tablepress' ), 
     350            'table_last_modified_by' => __( 'Last Modified By', 'tablepress' ), 
    343351            'table_last_modified' => __( 'Last Modified', 'tablepress' ) 
    344352        ); 
     
    360368 
    361369        $sortable_columns = array( 
    362             'table_id' => array( 'id', true ), //true means its already sorted 
     370            'table_id' => array( 'id', true ), // true means its already sorted 
    363371            'table_name' => array( 'name', false ), 
    364372            'table_description' => array( 'description', false ), 
    365373            'table_author' => array( 'author', false ), 
     374            'table_last_modified_by' => array( 'last_modified_by', false ), 
    366375            'table_last_modified' => array( 'last_modified', false ) 
    367376        ); 
     
    378387     */ 
    379388    protected function column_cb( $item ) { 
    380         return '<input type="checkbox" name="table[]" value="' . esc_attr( $item['id'] ) . '" />'; 
     389        $user_can_copy_table = current_user_can( 'tablepress_copy_table', $item['id'] ); 
     390        $user_can_delete_table = current_user_can( 'tablepress_delete_table', $item['id'] ); 
     391        $user_can_export_table = current_user_can( 'tablepress_export_table', $item['id'] ); 
     392 
     393        if ( $user_can_copy_table || $user_can_delete_table || $user_can_export_table ) 
     394            return '<input type="checkbox" name="table[]" value="' . esc_attr( $item['id'] ) . '" />'; 
     395        else 
     396            return ''; 
    381397    } 
    382398 
     
    402418     */ 
    403419    protected function column_table_name( $item ) { 
     420        $user_can_edit_table = current_user_can( 'tablepress_edit_table', $item['id'] ); 
     421        $user_can_copy_table = current_user_can( 'tablepress_copy_table', $item['id'] ); 
     422        $user_can_delete_table = current_user_can( 'tablepress_delete_table', $item['id'] ); 
     423        $user_can_export_table = current_user_can( 'tablepress_export_table', $item['id'] ); 
     424        $user_can_preview_table = current_user_can( 'tablepress_preview_table', $item['id'] ); 
     425 
    404426        $edit_url = TablePress::url( array( 'action' => 'edit', 'table_id' => $item['id'] ) ); 
    405427        $copy_url = TablePress::url( array( 'action' => 'copy_table', 'item' => $item['id'], 'return' => 'list', 'return_item' => $item['id'] ), true, 'admin-post.php' ); 
     
    407429        $delete_url = TablePress::url( array( 'action' => 'delete_table', 'item' => $item['id'], 'return' => 'list', 'return_item' => $item['id'] ), true, 'admin-post.php' ); 
    408430        $preview_url = TablePress::url( array( 'action' => 'preview_table', 'item' => $item['id'], 'return' => 'list', 'return_item' => $item['id'] ), true, 'admin-post.php' ); 
     431 
    409432        if ( '' == trim( $item['name'] ) ) 
    410433            $item['name'] = __( '(no name)', 'tablepress' ); 
    411434 
    412         $row_text = '<strong><a title="' . sprintf ( __( 'Edit &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ) . '" class="row-title" href="' . $edit_url . '">' . esc_html( $item['name'] ) . '</a></strong>'; 
    413         $row_actions = array( 
    414             'edit' => sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $edit_url, sprintf ( __( 'Edit &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Edit', 'tablepress' ) ), 
    415             'shortcode hide-if-no-js' => sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', '#', '[' . TablePress::$shortcode . ' id=' . esc_attr( $item['id'] ) . ' /]', __( 'Show Shortcode', 'tablepress' ) ), 
    416             'copy' => sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $copy_url, sprintf ( __( 'Copy &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Copy', 'tablepress' ) ), 
    417             'export' => sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $export_url, sprintf ( __( 'Export &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Export', 'tablepress' ) ), 
    418             'delete' => sprintf( '<a href="%1$s" title="%2$s" class="delete-link">%3$s</a>', $delete_url, sprintf ( __( 'Delete &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Delete', 'tablepress' ) ), 
    419             'table-preview' => sprintf( '<a href="%1$s" title="%2$s" target="_blank">%3$s</a>', $preview_url, sprintf ( __( 'Show a preview of &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Preview', 'tablepress' ) ) 
    420         ); 
     435        if ( $user_can_edit_table ) 
     436            $row_text = '<strong><a title="' . sprintf ( __( 'Edit &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ) . '" class="row-title" href="' . $edit_url . '">' . esc_html( $item['name'] ) . '</a></strong>'; 
     437        else 
     438            $row_text = '<strong>' . esc_html( $item['name'] ) . '</strong>'; 
     439 
     440        $row_actions = array(); 
     441        if ( $user_can_edit_table ) 
     442            $row_actions['edit'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $edit_url, sprintf ( __( 'Edit &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Edit', 'tablepress' ) ); 
     443        $row_actions['shortcode hide-if-no-js'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', '#', '[' . TablePress::$shortcode . ' id=' . esc_attr( $item['id'] ) . ' /]', __( 'Show Shortcode', 'tablepress' ) ); 
     444        if ( $user_can_copy_table ) 
     445            $row_actions['copy'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $copy_url, sprintf ( __( 'Copy &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Copy', 'tablepress' ) ); 
     446        if ( $user_can_export_table ) 
     447            $row_actions['export'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $export_url, sprintf ( __( 'Export &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Export', 'tablepress' ) ); 
     448        if ( $user_can_delete_table ) 
     449            $row_actions['delete'] = sprintf( '<a href="%1$s" title="%2$s" class="delete-link">%3$s</a>', $delete_url, sprintf ( __( 'Delete &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Delete', 'tablepress' ) ); 
     450        if ( $user_can_preview_table ) 
     451            $row_actions['table-preview'] = sprintf( '<a href="%1$s" title="%2$s" target="_blank">%3$s</a>', $preview_url, sprintf ( __( 'Show a preview of &#8220;%s&#8221;', 'tablepress' ), esc_attr( $item['name'] ) ), __( 'Preview', 'tablepress' ) ); 
    421452 
    422453        return $row_text . $this->row_actions( $row_actions ); 
     
    447478    protected function column_table_author( $item ) { 
    448479        return TablePress::get_user_display_name( $item['author'] ); 
     480    } 
     481 
     482    /** 
     483     * Render a cell in the "last_modified_by" column 
     484     * 
     485     * @since 1.0.0 
     486     * 
     487     * @param array $item Data item for the current row 
     488     * @return string HTML content of the cell 
     489     */ 
     490    protected function column_table_last_modified_by( $item ) { 
     491        return TablePress::get_user_display_name( $item['options']['last_editor'] ); 
    449492    } 
    450493 
     
    478521     */ 
    479522    public function get_bulk_actions() { 
    480         $bulk_actions = array( 
    481             'copy' => __( 'Copy', 'tablepress' ), 
    482             'export' => __( 'Export', 'tablepress' ), 
    483             'delete' => __( 'Delete', 'tablepress' ) 
    484         ); 
     523        $bulk_actions = array(); 
     524 
     525        if ( current_user_can( 'tablepress_copy_tables' ) ) 
     526            $bulk_actions['copy'] = __( 'Copy', 'tablepress' ); 
     527        if ( current_user_can( 'tablepress_export_tables' ) ) 
     528            $bulk_actions['export'] = __( 'Export', 'tablepress' ); 
     529        if ( current_user_can( 'tablepress_delete_tables' ) ) 
     530            $bulk_actions['delete'] = __( 'Delete', 'tablepress' ); 
     531 
    485532        return $bulk_actions; 
    486533    } 
     
    527574        _e( 'No tables found.', 'tablepress' ); 
    528575        if ( 0 === $this->items_count ) { 
     576            $user_can_add_tables = current_user_can( 'tablepress_add_tables' ); 
     577            $user_can_import_tables = current_user_can( 'tablepress_import_tables' ); 
     578 
    529579            $add_url = TablePress::url( array( 'action' => 'add' ) ); 
    530580            $import_url = TablePress::url( array( 'action' => 'import' ) ); 
    531             echo ' ' . sprintf( __( 'You should <a href="%s">add</a> or <a href="%s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url ); 
     581 
     582            if ( $user_can_add_tables && $user_can_import_tables ) 
     583                echo ' ' . sprintf( __( 'You should <a href="%s">add</a> or <a href="%s">import</a> a table to get started!', 'tablepress' ), $add_url, $import_url ); 
     584            elseif ( $user_can_add_tables ) 
     585                echo ' ' . sprintf( __( 'You should <a href="%s">add</a> a table to get started!', 'tablepress' ), $add_url ); 
     586            elseif ( $user_can_import_tables ) 
     587                echo ' ' . sprintf( __( 'You should <a href="%s">import</a> a table to get started!', 'tablepress' ), $import_url ); 
    532588        } 
    533589    } 
     
    576632        || false !== stripos( $item['description'], $term ) 
    577633        || false !== stripos( TablePress::get_user_display_name( $item['author'] ), $term ) 
     634        || false !== stripos( TablePress::get_user_display_name( $item['options']['last_editor'] ), $term ) 
    578635        || false !== stripos( TablePress::format_datetime( $item['last_modified'], 'mysql', ' ' ), $term ) 
    579636        || false !== stripos( json_encode( $item['data'] ), $term ) ) 
     
    595652        global $orderby, $order; 
    596653 
    597         if ( $item_a[$orderby] == $item_b[$orderby] ) 
    598             return 0; 
     654        if ( 'last_modified_by' != $orderby ) { 
     655            if ( $item_a[$orderby] == $item_b[$orderby] ) 
     656                return 0; 
     657        } else { 
     658            if ( $item_a['options']['last_editor'] == $item_b['options']['last_editor'] ) 
     659                return 0; 
     660        } 
    599661 
    600662        // certain fields require some extra work before being sortable 
     
    608670                $result = strnatcasecmp( TablePress::get_user_display_name( $item_a['author'] ), TablePress::get_user_display_name( $item_b['author'] ) ); 
    609671                break; 
     672            case 'last_modified_by': 
     673                // Get the actual last editor name, plain value is just the user ID 
     674                $result = strnatcasecmp( TablePress::get_user_display_name( $item_a['options']['last_editor'] ), TablePress::get_user_display_name( $item_b['options']['last_editor'] ) ); 
     675                break; 
    610676            default: 
    611677                // other fields (ID, name, description) are sorted as strings 
  • tablepress/trunk/views/view-options.php

    r623199 r629752  
    5757 
    5858        $this->add_text_box( 'head', array( $this, 'textbox_head' ), 'normal' ); 
    59         $this->add_meta_box( 'frontend-options', __( 'Frontend Options', 'tablepress' ), array( $this, 'postbox_frontend_options' ), 'normal' ); 
     59        if ( current_user_can( 'tablepress_edit_options' ) ) 
     60            $this->add_meta_box( 'frontend-options', __( 'Frontend Options', 'tablepress' ), array( $this, 'postbox_frontend_options' ), 'normal' ); 
    6061        $this->add_meta_box( 'user-options', __( 'User Options', 'tablepress' ), array( $this, 'postbox_user_options' ), 'normal' ); 
    6162        $this->data['submit_button_caption'] = __( 'Save Changes', 'tablepress' ); 
     
    7475        </p> 
    7576        <p> 
    76             <?php _e( 'Frontend Options influence the styling of tables in pages, posts, or text widgets, by defining which CSS code shall be loaded.', 'tablepress' ); ?> 
    77         <br /> 
    78             <?php _e( 'In the User Options, every TablePress user can choose the position of the plugin in the WordPress admin menu, and the desired plugin language.', 'tablepress' ); ?> 
    79             <?php // _e( 'Administrators have access to further Admin Options, e.g. to control which user groups are allowed to use TablePress.', 'tablepress' ); ?></p> 
     77            <?php 
     78                if ( current_user_can( 'tablepress_edit_options' ) ) { 
     79                    _e( 'Frontend Options influence the styling of tables in pages, posts, or text widgets, by defining which CSS code shall be loaded.', 'tablepress' ); 
     80                    echo '<br />'; 
     81                } 
     82                _e( 'In the User Options, every TablePress user can choose the position of the plugin in his WordPress admin menu, and his desired plugin language.', 'tablepress' ); 
     83            ?> 
     84        </p> 
    8085        <?php 
    8186    } 
     
    9095<table class="tablepress-postbox-table fixed"> 
    9196<tbody> 
    92     <tr class="bottom-border"> 
    93         <th class="column-1" scope="row"><?php _e( 'Default CSS', 'tablepress' ); ?>:</th> 
    94         <td class="column-2"><label for="option-use-default-css"><input type="checkbox" id="option-use-default-css" name="options[use_default_css]" value="true"<?php checked( $data['frontend_options']['use_default_css'] ); ?> /> <?php _e( 'Load the default table styling.', 'tablepress' ); ?> <?php _e( '<span class="description">(recommended)</span>', 'tablepress' ); ?></label> 
    95         </td> 
    96     </tr> 
    97     <tr class="top-border"> 
     97    <tr> 
    9898        <th class="column-1" scope="row"><?php _e( 'Custom CSS', 'tablepress' ); ?>:</th> 
    9999        <td class="column-2"><label for="option-use-custom-css"><input type="checkbox" id="option-use-custom-css" name="options[use_custom_css]" value="true"<?php checked( $data['frontend_options']['use_custom_css'] ); ?> /> <?php _e( 'Load these &#8220;Custom CSS&#8221; commands to influence the table styling:', 'tablepress' ); ?></label> 
     
    157157    <tr class="bottom-border"> 
    158158        <th class="column-1" scope="row"><label for="option-admin-menu-parent-page"><?php _e( 'Admin menu entry', 'tablepress' ); ?>:</label></th> 
    159         <td class="column-2"><?php printf( __( 'TablePress shall be shown in this section of the admin menu: %s', 'tablepress' ), $select_box ); ?></td> 
     159        <td class="column-2"><?php printf( __( 'TablePress shall be shown in this section of my admin menu: %s', 'tablepress' ), $select_box ); ?></td> 
    160160    </tr> 
    161161        <?php 
     
    170170    <tr class="top-border"> 
    171171        <th class="column-1" scope="row"><label for="option-plugin-language"><?php _e( 'Plugin Language', 'tablepress' ); ?>:</label></th> 
    172         <td class="column-2"><?php printf( __( 'TablePress shall be shown in this language: %s', 'tablepress' ), $select_box ); ?></td> 
     172        <td class="column-2"><?php printf( __( 'I want to use TablePress in this language: %s', 'tablepress' ), $select_box ); ?></td> 
    173173    </tr> 
    174174</tbody> 
Note: See TracChangeset for help on using the changeset viewer.