Version Description
- ADDED:
- Line height can now be customised along with font size
- AJAX method for highlighting Crayon using ajaxurl. See http://aramk.com/crayon/adding-crayon-to-posts-in-wordpress-programmatically/.
- Ability to capture code tags as inline Crayons
- Terminal theme
- FIXED:
- Expanding code issues to do with position and dimensions
- Toolbar font-size and line height improvements
- Now settings which affect capturing trigger a refresh of crayon posts when modified
- Added message about emailing in submit window of theme editor
- Border is now drawn inside so right border won't clip from theme CSS
- Comments were not detected to contain Crayons unless edited in wp-admin
- Highlighting improvements for variables and entities
Download this release
Release Info
Developer | akarmenia |
Plugin | Crayon Syntax Highlighter |
Version | 2.1.3 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.1.3
- crayon_formatter.class.php +11 -7
- crayon_settings.class.php +13 -1
- crayon_settings_wp.class.php +47 -23
- crayon_wp.class.php +31 -6
- css/crayon_style.css +160 -128
- js/crayon.js +67 -90
- js/crayon_admin.js +3 -3
- langs/default/default.txt +2 -2
- langs/js/js.txt +2 -2
- langs/js/reserved.txt +1 -0
- langs/php/php.txt +1 -1
- readme.txt +22 -2
- themes/classic/classic.css +1 -1
- themes/terminal/terminal.css +174 -0
- util/theme-editor/theme_editor.js +3 -5
- util/theme-editor/theme_editor.php +1 -1
crayon_formatter.class.php
CHANGED
@@ -109,13 +109,17 @@ class CrayonFormatter {
|
|
109 |
// Determine font size
|
110 |
// TODO improve logic
|
111 |
if ($hl->setting_val(CrayonSettings::FONT_SIZE_ENABLE)) {
|
112 |
-
|
113 |
-
$
|
|
|
|
|
|
|
114 |
$toolbar_height = $font_size * 1.5 . 'px !important;';
|
115 |
-
$info_height = $font_size * 1.
|
116 |
|
117 |
-
$font_style .= "font-size: $font_size line-height: $
|
118 |
-
|
|
|
119 |
|
120 |
if ($hl->is_inline()) {
|
121 |
$font_style .= "font-size: $font_size";
|
@@ -127,7 +131,7 @@ class CrayonFormatter {
|
|
127 |
} else if (!$hl->is_inline()) {
|
128 |
if (($font_size = CrayonGlobalSettings::get(CrayonSettings::FONT_SIZE)) !== FALSE) {
|
129 |
$font_size = $font_size->def() . 'px !important;';
|
130 |
-
|
131 |
}
|
132 |
}
|
133 |
|
@@ -331,7 +335,7 @@ class CrayonFormatter {
|
|
331 |
$buttons = $print_plus.$buttons_str.$print_lang;
|
332 |
$toolbar = '
|
333 |
<div class="crayon-toolbar" data-settings="'.$toolbar_settings.'" style="'.$toolbar_style.'">'.$print_title.'
|
334 |
-
<div class="crayon-tools">'.$buttons.'</div></div>
|
335 |
<div class="crayon-info" style="'.$info_style.'"></div>';
|
336 |
|
337 |
} else {
|
109 |
// Determine font size
|
110 |
// TODO improve logic
|
111 |
if ($hl->setting_val(CrayonSettings::FONT_SIZE_ENABLE)) {
|
112 |
+
$_font_size = $hl->setting_val(CrayonSettings::FONT_SIZE);
|
113 |
+
$font_size = $_font_size . 'px !important;';
|
114 |
+
$_line_height = $hl->setting_val(CrayonSettings::LINE_HEIGHT);
|
115 |
+
// Don't allow line height to be less than font size
|
116 |
+
$line_height = ($_line_height > $_font_size ? $_line_height : $_font_size) . 'px !important;';
|
117 |
$toolbar_height = $font_size * 1.5 . 'px !important;';
|
118 |
+
$info_height = $font_size * 1.4 . 'px !important;';
|
119 |
|
120 |
+
$font_style .= "font-size: $font_size line-height: $line_height";
|
121 |
+
$toolbar_style .= "font-size: $font_size";
|
122 |
+
$line_style .= "height: $line_height";
|
123 |
|
124 |
if ($hl->is_inline()) {
|
125 |
$font_style .= "font-size: $font_size";
|
131 |
} else if (!$hl->is_inline()) {
|
132 |
if (($font_size = CrayonGlobalSettings::get(CrayonSettings::FONT_SIZE)) !== FALSE) {
|
133 |
$font_size = $font_size->def() . 'px !important;';
|
134 |
+
$line_height = ($font_size * 1.4) . 'px !important;';
|
135 |
}
|
136 |
}
|
137 |
|
335 |
$buttons = $print_plus.$buttons_str.$print_lang;
|
336 |
$toolbar = '
|
337 |
<div class="crayon-toolbar" data-settings="'.$toolbar_settings.'" style="'.$toolbar_style.'">'.$print_title.'
|
338 |
+
<div class="crayon-tools" style="'.$toolbar_style.'">'.$buttons.'</div></div>
|
339 |
<div class="crayon-info" style="'.$info_style.'"></div>';
|
340 |
|
341 |
} else {
|
crayon_settings.class.php
CHANGED
@@ -26,6 +26,7 @@ class CrayonSettings {
|
|
26 |
const FONT = 'font';
|
27 |
const FONT_SIZE_ENABLE = 'font-size-enable';
|
28 |
const FONT_SIZE = 'font-size';
|
|
|
29 |
const PREVIEW = 'preview';
|
30 |
const HEIGHT_SET = 'height-set';
|
31 |
const HEIGHT_MODE = 'height-mode';
|
@@ -90,6 +91,7 @@ class CrayonSettings {
|
|
90 |
const SAFE_ENQUEUE = 'safe-enqueue';
|
91 |
const INLINE_TAG = 'inline-tag';
|
92 |
const INLINE_TAG_CAPTURE = 'inline-tag-capture';
|
|
|
93 |
const INLINE_MARGIN = 'inline-margin';
|
94 |
const INLINE_WRAP = 'inline-wrap';
|
95 |
const BACKQUOTE = 'backquote';
|
@@ -153,7 +155,8 @@ class CrayonSettings {
|
|
153 |
new CrayonSetting(self::THEME, CrayonThemes::DEFAULT_THEME),
|
154 |
new CrayonSetting(self::FONT, CrayonFonts::DEFAULT_FONT),
|
155 |
new CrayonSetting(self::FONT_SIZE_ENABLE, TRUE),
|
156 |
-
new CrayonSetting(self::FONT_SIZE, 12),
|
|
|
157 |
new CrayonSetting(self::PREVIEW, TRUE),
|
158 |
new CrayonSetting(self::HEIGHT_SET, FALSE),
|
159 |
new CrayonSetting(self::HEIGHT_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))),
|
@@ -219,6 +222,7 @@ class CrayonSettings {
|
|
219 |
new CrayonSetting(self::SAFE_ENQUEUE, TRUE),
|
220 |
new CrayonSetting(self::INLINE_TAG, TRUE),
|
221 |
new CrayonSetting(self::INLINE_TAG_CAPTURE, FALSE),
|
|
|
222 |
new CrayonSetting(self::INLINE_MARGIN, 5),
|
223 |
new CrayonSetting(self::INLINE_WRAP, TRUE),
|
224 |
new CrayonSetting(self::BACKQUOTE, TRUE),
|
@@ -430,6 +434,10 @@ class CrayonSettings {
|
|
430 |
$value = 1;
|
431 |
}
|
432 |
break;
|
|
|
|
|
|
|
|
|
433 |
case CrayonSettings::THEME:
|
434 |
$value = strtolower($value);
|
435 |
// XXX validate settings here
|
@@ -577,6 +585,10 @@ class CrayonGlobalSettings {
|
|
577 |
return self::$global->val_str($name);
|
578 |
}
|
579 |
|
|
|
|
|
|
|
|
|
580 |
public static function set($name, $value = NULL, $replace = FALSE) {
|
581 |
self::init();
|
582 |
self::$global->set($name, $value, $replace);
|
26 |
const FONT = 'font';
|
27 |
const FONT_SIZE_ENABLE = 'font-size-enable';
|
28 |
const FONT_SIZE = 'font-size';
|
29 |
+
const LINE_HEIGHT = 'line-height';
|
30 |
const PREVIEW = 'preview';
|
31 |
const HEIGHT_SET = 'height-set';
|
32 |
const HEIGHT_MODE = 'height-mode';
|
91 |
const SAFE_ENQUEUE = 'safe-enqueue';
|
92 |
const INLINE_TAG = 'inline-tag';
|
93 |
const INLINE_TAG_CAPTURE = 'inline-tag-capture';
|
94 |
+
const INLINE_CODE_TAG_CAPTURE = 'inline-code-tag-capture';
|
95 |
const INLINE_MARGIN = 'inline-margin';
|
96 |
const INLINE_WRAP = 'inline-wrap';
|
97 |
const BACKQUOTE = 'backquote';
|
155 |
new CrayonSetting(self::THEME, CrayonThemes::DEFAULT_THEME),
|
156 |
new CrayonSetting(self::FONT, CrayonFonts::DEFAULT_FONT),
|
157 |
new CrayonSetting(self::FONT_SIZE_ENABLE, TRUE),
|
158 |
+
new CrayonSetting(self::FONT_SIZE, 12),
|
159 |
+
new CrayonSetting(self::LINE_HEIGHT, 15),
|
160 |
new CrayonSetting(self::PREVIEW, TRUE),
|
161 |
new CrayonSetting(self::HEIGHT_SET, FALSE),
|
162 |
new CrayonSetting(self::HEIGHT_MODE, array(crayon__('Max'), crayon__('Min'), crayon__('Static'))),
|
222 |
new CrayonSetting(self::SAFE_ENQUEUE, TRUE),
|
223 |
new CrayonSetting(self::INLINE_TAG, TRUE),
|
224 |
new CrayonSetting(self::INLINE_TAG_CAPTURE, FALSE),
|
225 |
+
new CrayonSetting(self::INLINE_CODE_TAG_CAPTURE, FALSE),
|
226 |
new CrayonSetting(self::INLINE_MARGIN, 5),
|
227 |
new CrayonSetting(self::INLINE_WRAP, TRUE),
|
228 |
new CrayonSetting(self::BACKQUOTE, TRUE),
|
434 |
$value = 1;
|
435 |
}
|
436 |
break;
|
437 |
+
case CrayonSettings::LINE_HEIGHT:
|
438 |
+
$font_size = CrayonGlobalSettings::val(CrayonSettings::FONT_SIZE);
|
439 |
+
$value = $value >= $font_size ? $value : $font_size;
|
440 |
+
break;
|
441 |
case CrayonSettings::THEME:
|
442 |
$value = strtolower($value);
|
443 |
// XXX validate settings here
|
585 |
return self::$global->val_str($name);
|
586 |
}
|
587 |
|
588 |
+
public static function has_changed($input, $setting, $value) {
|
589 |
+
return $input == $setting && $value != CrayonGlobalSettings::val($setting);
|
590 |
+
}
|
591 |
+
|
592 |
public static function set($name, $value = NULL, $replace = FALSE) {
|
593 |
self::init();
|
594 |
self::$global->set($name, $value, $replace);
|
crayon_settings_wp.class.php
CHANGED
@@ -42,6 +42,7 @@ class CrayonSettingsWP {
|
|
42 |
const LOG_EMAIL_ADMIN = 'log_email_admin';
|
43 |
const LOG_EMAIL_DEV = 'log_email_dev';
|
44 |
const SAMPLE_CODE = 'sample-code';
|
|
|
45 |
|
46 |
private function __construct() {
|
47 |
}
|
@@ -182,7 +183,6 @@ class CrayonSettingsWP {
|
|
182 |
});
|
183 |
</script>
|
184 |
|
185 |
-
|
186 |
<div id="crayon-main-wrap" class="wrap">
|
187 |
|
188 |
<div id="icon-options-general" class="icon32">
|
@@ -206,14 +206,15 @@ class CrayonSettingsWP {
|
|
206 |
<input type="submit" name="submit" id="submit" class="button-primary"
|
207 |
value="<?php
|
208 |
crayon_e('Save Changes');
|
209 |
-
?>"
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
|
|
217 |
</p>
|
218 |
</form>
|
219 |
</div>
|
@@ -512,6 +513,7 @@ class CrayonSettingsWP {
|
|
512 |
// Validates all the settings passed from the form in $inputs
|
513 |
|
514 |
public static function settings_validate($inputs) {
|
|
|
515 |
// Load current settings from db
|
516 |
self::load_settings(TRUE);
|
517 |
|
@@ -544,20 +546,10 @@ class CrayonSettingsWP {
|
|
544 |
}
|
545 |
|
546 |
// Clear the cache
|
547 |
-
if (array_key_exists(
|
548 |
self::clear_cache();
|
549 |
}
|
550 |
|
551 |
-
// Validate inputs
|
552 |
-
foreach ($inputs as $input => $value) {
|
553 |
-
// Convert all array setting values to ints
|
554 |
-
$inputs[$input] = CrayonSettings::validate($input, $value);
|
555 |
-
// Clear cache when changed
|
556 |
-
if ($input == CrayonSettings::CACHE && $value != CrayonGlobalSettings::val(CrayonSettings::CACHE)) {
|
557 |
-
self::clear_cache();
|
558 |
-
}
|
559 |
-
}
|
560 |
-
|
561 |
// If settings don't exist in input, set them to default
|
562 |
$global_settings = CrayonSettings::get_defaults();
|
563 |
|
@@ -587,6 +579,35 @@ class CrayonSettingsWP {
|
|
587 |
}
|
588 |
}
|
589 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
590 |
return $inputs;
|
591 |
}
|
592 |
|
@@ -750,7 +771,7 @@ class CrayonSettingsWP {
|
|
750 |
public static function toolbar() {
|
751 |
echo '<div id="crayon-section-toolbar" class="crayon-hide-inline">';
|
752 |
self::span(crayon__('Display the Toolbar') . ' ');
|
753 |
-
|
754 |
echo '<div id="crayon-subsection-toolbar">';
|
755 |
self::checkbox(array(CrayonSettings::TOOLBAR_OVERLAY, crayon__('Overlay the toolbar on code rather than push it down when possible')));
|
756 |
self::checkbox(array(CrayonSettings::TOOLBAR_HIDE, crayon__('Toggle the toolbar on single click when it is overlayed')));
|
@@ -1015,10 +1036,12 @@ class Human {
|
|
1015 |
$fonts_array = CrayonResources::fonts()->get_array();
|
1016 |
self::dropdown(CrayonSettings::FONT, FALSE, TRUE, TRUE, $fonts_array);
|
1017 |
echo '<span class="crayon-span-5"></span>';
|
1018 |
-
echo '<a href="http://bit.ly/Yr2Xv6" target="_blank">', crayon__('Add More')
|
1019 |
echo '<span class="crayon-span-10"></span>';
|
1020 |
self::checkbox(array(CrayonSettings::FONT_SIZE_ENABLE, crayon__('Custom Font Size') . ' '), FALSE);
|
1021 |
self::textbox(array('id' => CrayonSettings::FONT_SIZE, 'size' => 2));
|
|
|
|
|
1022 |
echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span></br>';
|
1023 |
if ((!CrayonResources::fonts()->is_loaded($db_font) || !CrayonResources::fonts()->exists($db_font))) {
|
1024 |
// Default font doesn't actually exist as a file, it means do not override default theme font
|
@@ -1068,6 +1091,7 @@ class Human {
|
|
1068 |
public static function tags() {
|
1069 |
self::checkbox(array(CrayonSettings::INLINE_TAG, crayon__('Capture Inline Tags') . self::help_button('http://bit.ly/yFafFL')));
|
1070 |
self::checkbox(array(CrayonSettings::INLINE_WRAP, crayon__('Wrap Inline Tags') . self::help_button('http://bit.ly/yFafFL')));
|
|
|
1071 |
self::checkbox(array(CrayonSettings::BACKQUOTE, crayon__('Capture `backquotes` as <code>') . self::help_button('http://bit.ly/yFafFL')));
|
1072 |
self::checkbox(array(CrayonSettings::CAPTURE_PRE, crayon__('Capture <pre> tags as Crayons') . self::help_button('http://bit.ly/rRZuzk')));
|
1073 |
|
@@ -1108,7 +1132,7 @@ class Human {
|
|
1108 |
public static function misc() {
|
1109 |
echo crayon__('Clear the cache used to store remote code requests'), ': ';
|
1110 |
self::dropdown(CrayonSettings::CACHE, false);
|
1111 |
-
echo '<input type="submit" id="
|
1112 |
self::checkbox(array(CrayonSettings::EFFICIENT_ENQUEUE, crayon__('Attempt to load Crayon\'s CSS and JavaScript only when needed') . self::help_button('http://aramk.com/?p=660')));
|
1113 |
self::checkbox(array(CrayonSettings::SAFE_ENQUEUE, crayon__('Disable enqueuing for page templates that may contain The Loop.') . self::help_button('http://bit.ly/AcWRNY')));
|
1114 |
self::checkbox(array(CrayonSettings::COMMENTS, crayon__('Allow Crayons inside comments')));
|
42 |
const LOG_EMAIL_ADMIN = 'log_email_admin';
|
43 |
const LOG_EMAIL_DEV = 'log_email_dev';
|
44 |
const SAMPLE_CODE = 'sample-code';
|
45 |
+
const CACHE_CLEAR = 'crayon-cache-clear';
|
46 |
|
47 |
private function __construct() {
|
48 |
}
|
183 |
});
|
184 |
</script>
|
185 |
|
|
|
186 |
<div id="crayon-main-wrap" class="wrap">
|
187 |
|
188 |
<div id="icon-options-general" class="icon32">
|
206 |
<input type="submit" name="submit" id="submit" class="button-primary"
|
207 |
value="<?php
|
208 |
crayon_e('Save Changes');
|
209 |
+
?>"/><span style="width:10px; height: 5px; float:left;"></span><input type="submit"
|
210 |
+
name="<?php
|
211 |
+
echo self::OPTIONS;
|
212 |
+
?>[reset]"
|
213 |
+
id="reset"
|
214 |
+
class="button-primary"
|
215 |
+
value="<?php
|
216 |
+
crayon_e('Reset Settings');
|
217 |
+
?>"/>
|
218 |
</p>
|
219 |
</form>
|
220 |
</div>
|
513 |
// Validates all the settings passed from the form in $inputs
|
514 |
|
515 |
public static function settings_validate($inputs) {
|
516 |
+
|
517 |
// Load current settings from db
|
518 |
self::load_settings(TRUE);
|
519 |
|
546 |
}
|
547 |
|
548 |
// Clear the cache
|
549 |
+
if (array_key_exists(self::CACHE_CLEAR, $_POST)) {
|
550 |
self::clear_cache();
|
551 |
}
|
552 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
553 |
// If settings don't exist in input, set them to default
|
554 |
$global_settings = CrayonSettings::get_defaults();
|
555 |
|
579 |
}
|
580 |
}
|
581 |
|
582 |
+
$refresh = array(
|
583 |
+
// These should trigger a refresh of which posts contain crayons, since they affect capturing
|
584 |
+
CrayonSettings::INLINE_TAG => TRUE,
|
585 |
+
CrayonSettings::INLINE_TAG_CAPTURE => TRUE,
|
586 |
+
CrayonSettings::INLINE_CODE_TAG_CAPTURE => TRUE,
|
587 |
+
CrayonSettings::BACKQUOTE => TRUE,
|
588 |
+
CrayonSettings::CAPTURE_PRE => TRUE,
|
589 |
+
CrayonSettings::CAPTURE_MINI_TAG => TRUE,
|
590 |
+
CrayonSettings::PLAIN_TAG => TRUE
|
591 |
+
);
|
592 |
+
|
593 |
+
|
594 |
+
// Validate inputs
|
595 |
+
foreach ($inputs as $input => $value) {
|
596 |
+
// Convert all array setting values to ints
|
597 |
+
$inputs[$input] = $value = CrayonSettings::validate($input, $value);
|
598 |
+
// Clear cache when changed
|
599 |
+
if (CrayonGlobalSettings::has_changed($input, CrayonSettings::CACHE, $value)) {
|
600 |
+
self::clear_cache();
|
601 |
+
}
|
602 |
+
if (isset($refresh[$input])) {
|
603 |
+
if (CrayonGlobalSettings::has_changed($input, $input, $value)) {
|
604 |
+
// Needs to take place, in case it refresh depends on changed value
|
605 |
+
CrayonGlobalSettings::set($input, $value);
|
606 |
+
CrayonWP::refresh_posts();
|
607 |
+
}
|
608 |
+
}
|
609 |
+
}
|
610 |
+
|
611 |
return $inputs;
|
612 |
}
|
613 |
|
771 |
public static function toolbar() {
|
772 |
echo '<div id="crayon-section-toolbar" class="crayon-hide-inline">';
|
773 |
self::span(crayon__('Display the Toolbar') . ' ');
|
774 |
+
self::dropdown(CrayonSettings::TOOLBAR);
|
775 |
echo '<div id="crayon-subsection-toolbar">';
|
776 |
self::checkbox(array(CrayonSettings::TOOLBAR_OVERLAY, crayon__('Overlay the toolbar on code rather than push it down when possible')));
|
777 |
self::checkbox(array(CrayonSettings::TOOLBAR_HIDE, crayon__('Toggle the toolbar on single click when it is overlayed')));
|
1036 |
$fonts_array = CrayonResources::fonts()->get_array();
|
1037 |
self::dropdown(CrayonSettings::FONT, FALSE, TRUE, TRUE, $fonts_array);
|
1038 |
echo '<span class="crayon-span-5"></span>';
|
1039 |
+
echo '<a href="http://bit.ly/Yr2Xv6" target="_blank">', crayon__('Add More'), '</a>';
|
1040 |
echo '<span class="crayon-span-10"></span>';
|
1041 |
self::checkbox(array(CrayonSettings::FONT_SIZE_ENABLE, crayon__('Custom Font Size') . ' '), FALSE);
|
1042 |
self::textbox(array('id' => CrayonSettings::FONT_SIZE, 'size' => 2));
|
1043 |
+
echo '<span class="crayon-span-margin">', crayon__('Pixels'), ', ', crayon__('Line Height'), ' </span>';
|
1044 |
+
self::textbox(array('id' => CrayonSettings::LINE_HEIGHT, 'size' => 2));
|
1045 |
echo '<span class="crayon-span-margin">', crayon__('Pixels'), '</span></br>';
|
1046 |
if ((!CrayonResources::fonts()->is_loaded($db_font) || !CrayonResources::fonts()->exists($db_font))) {
|
1047 |
// Default font doesn't actually exist as a file, it means do not override default theme font
|
1091 |
public static function tags() {
|
1092 |
self::checkbox(array(CrayonSettings::INLINE_TAG, crayon__('Capture Inline Tags') . self::help_button('http://bit.ly/yFafFL')));
|
1093 |
self::checkbox(array(CrayonSettings::INLINE_WRAP, crayon__('Wrap Inline Tags') . self::help_button('http://bit.ly/yFafFL')));
|
1094 |
+
self::checkbox(array(CrayonSettings::INLINE_CODE_TAG_CAPTURE, crayon__('Capture <code> as Inline Tags') . self::help_button('http://bit.ly/yFafFL')));
|
1095 |
self::checkbox(array(CrayonSettings::BACKQUOTE, crayon__('Capture `backquotes` as <code>') . self::help_button('http://bit.ly/yFafFL')));
|
1096 |
self::checkbox(array(CrayonSettings::CAPTURE_PRE, crayon__('Capture <pre> tags as Crayons') . self::help_button('http://bit.ly/rRZuzk')));
|
1097 |
|
1132 |
public static function misc() {
|
1133 |
echo crayon__('Clear the cache used to store remote code requests'), ': ';
|
1134 |
self::dropdown(CrayonSettings::CACHE, false);
|
1135 |
+
echo '<input type="submit" id="', self::CACHE_CLEAR, '" name="', self::CACHE_CLEAR, '" class="button-secondary" value="', crayon__('Clear Now'), '" /><br/>';
|
1136 |
self::checkbox(array(CrayonSettings::EFFICIENT_ENQUEUE, crayon__('Attempt to load Crayon\'s CSS and JavaScript only when needed') . self::help_button('http://aramk.com/?p=660')));
|
1137 |
self::checkbox(array(CrayonSettings::SAFE_ENQUEUE, crayon__('Disable enqueuing for page templates that may contain The Loop.') . self::help_button('http://bit.ly/AcWRNY')));
|
1138 |
self::checkbox(array(CrayonSettings::COMMENTS, crayon__('Allow Crayons inside comments')));
|
crayon_wp.class.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://aramk.com/projects/crayon-syntax-highlighter
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
|
6 |
-
Version: 2.1.
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://aramk.com/
|
9 |
Text Domain: crayon-syntax-highlighter
|
@@ -191,6 +191,12 @@ class CrayonWP {
|
|
191 |
public static function highlight($code) {
|
192 |
$captures = CrayonWP::capture_crayons(0, $code);
|
193 |
$the_captures = $captures['capture'];
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
$the_content = $captures['content'];
|
195 |
foreach ($the_captures as $id => $capture) {
|
196 |
$atts = $capture['atts'];
|
@@ -207,6 +213,19 @@ class CrayonWP {
|
|
207 |
return $the_content;
|
208 |
}
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
/* Uses the main query */
|
211 |
public static function wp() {
|
212 |
CrayonLog::debug('wp (global)');
|
@@ -248,11 +267,15 @@ class CrayonWP {
|
|
248 |
$wp_content = preg_replace('#(?<!\$)\[\s*(' . self::$alias_regex . ')\b([^\]]*)/\s*\](?!\$)#msi', '[crayon lang="\1" \2 /]', $wp_content);
|
249 |
}
|
250 |
|
251 |
-
// Convert inline {php}{/php} tags to crayon tags, if needed
|
252 |
if ((CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::INLINE_TAG]) {
|
253 |
if (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)) {
|
|
|
254 |
$wp_content = preg_replace('#(?<!\$)\{\s*(' . self::$alias_regex . ')\b([^\}]*)\}(.*?)\{/(?:\1)\}(?!\$)#msi', '[crayon lang="\1" inline="true" \2]\3[/crayon]', $wp_content);
|
255 |
}
|
|
|
|
|
|
|
|
|
256 |
// Convert <span class="crayon-inline"> tags to inline crayon tags
|
257 |
$wp_content = preg_replace_callback('#(?<!\$)<\s*span([^>]*)\bclass\s*=\s*(["\'])(.*?)\2([^>]*)>(.*?)<\s*/\s*span\s*>#msi', 'CrayonWP::span_tag', $wp_content);
|
258 |
}
|
@@ -907,6 +930,8 @@ class CrayonWP {
|
|
907 |
public static function init_ajax() {
|
908 |
add_action('wp_ajax_crayon-tag-editor', 'CrayonTagEditorWP::content');
|
909 |
add_action('wp_ajax_nopriv_crayon-tag-editor', 'CrayonTagEditorWP::content');
|
|
|
|
|
910 |
if (is_admin()) {
|
911 |
add_action('wp_ajax_crayon-ajax', 'CrayonWP::ajax');
|
912 |
add_action('wp_ajax_crayon-theme-editor', 'CrayonThemeEditorWP::content');
|
@@ -1248,10 +1273,10 @@ if (defined('ABSPATH')) {
|
|
1248 |
// For marking a post as containing a Crayon
|
1249 |
add_action('update_post', 'CrayonWP::save_post', 10, 2);
|
1250 |
add_action('save_post', 'CrayonWP::save_post', 10, 2);
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
}
|
1256 |
add_filter('init', 'CrayonWP::init_ajax');
|
1257 |
}
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://aramk.com/projects/crayon-syntax-highlighter
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text.
|
6 |
+
Version: 2.1.3
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://aramk.com/
|
9 |
Text Domain: crayon-syntax-highlighter
|
191 |
public static function highlight($code) {
|
192 |
$captures = CrayonWP::capture_crayons(0, $code);
|
193 |
$the_captures = $captures['capture'];
|
194 |
+
if (count($the_captures) == 0) {
|
195 |
+
// Nothing captured, so wrap in a pre and try again
|
196 |
+
$code = '<pre>' . $code . '</pre>';
|
197 |
+
$captures = CrayonWP::capture_crayons(0, $code);
|
198 |
+
$the_captures = $captures['capture'];
|
199 |
+
}
|
200 |
$the_content = $captures['content'];
|
201 |
foreach ($the_captures as $id => $capture) {
|
202 |
$atts = $capture['atts'];
|
213 |
return $the_content;
|
214 |
}
|
215 |
|
216 |
+
public static function ajax_highlight() {
|
217 |
+
$code = isset($_POST['code']) ? $_POST['code'] : null;
|
218 |
+
if (!$code) {
|
219 |
+
$code = isset($_GET['code']) ? $_GET['code'] : null;
|
220 |
+
}
|
221 |
+
if ($code) {
|
222 |
+
echo self::highlight($code);
|
223 |
+
} else {
|
224 |
+
echo "No code specified.";
|
225 |
+
}
|
226 |
+
exit();
|
227 |
+
}
|
228 |
+
|
229 |
/* Uses the main query */
|
230 |
public static function wp() {
|
231 |
CrayonLog::debug('wp (global)');
|
267 |
$wp_content = preg_replace('#(?<!\$)\[\s*(' . self::$alias_regex . ')\b([^\]]*)/\s*\](?!\$)#msi', '[crayon lang="\1" \2 /]', $wp_content);
|
268 |
}
|
269 |
|
|
|
270 |
if ((CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG) || $skip_setting_check) && $in_flag[CrayonSettings::INLINE_TAG]) {
|
271 |
if (CrayonGlobalSettings::val(CrayonSettings::INLINE_TAG_CAPTURE)) {
|
272 |
+
// Convert inline {php}{/php} tags to crayon tags, if needed
|
273 |
$wp_content = preg_replace('#(?<!\$)\{\s*(' . self::$alias_regex . ')\b([^\}]*)\}(.*?)\{/(?:\1)\}(?!\$)#msi', '[crayon lang="\1" inline="true" \2]\3[/crayon]', $wp_content);
|
274 |
}
|
275 |
+
// Convert <code> to inline tags
|
276 |
+
if (CrayonGlobalSettings::val(CrayonSettings::INLINE_CODE_TAG_CAPTURE)) {
|
277 |
+
$wp_content = preg_replace('#<(\s*code\b)([^>]*)>(.*?)</\1[^>]*>#msi', '[crayon inline="true" \2]\3[/crayon]', $wp_content);
|
278 |
+
}
|
279 |
// Convert <span class="crayon-inline"> tags to inline crayon tags
|
280 |
$wp_content = preg_replace_callback('#(?<!\$)<\s*span([^>]*)\bclass\s*=\s*(["\'])(.*?)\2([^>]*)>(.*?)<\s*/\s*span\s*>#msi', 'CrayonWP::span_tag', $wp_content);
|
281 |
}
|
930 |
public static function init_ajax() {
|
931 |
add_action('wp_ajax_crayon-tag-editor', 'CrayonTagEditorWP::content');
|
932 |
add_action('wp_ajax_nopriv_crayon-tag-editor', 'CrayonTagEditorWP::content');
|
933 |
+
add_action('wp_ajax_crayon-highlight', 'CrayonWP::ajax_highlight');
|
934 |
+
add_action('wp_ajax_nopriv_crayon-highlight', 'CrayonWP::ajax_highlight');
|
935 |
if (is_admin()) {
|
936 |
add_action('wp_ajax_crayon-ajax', 'CrayonWP::ajax');
|
937 |
add_action('wp_ajax_crayon-theme-editor', 'CrayonThemeEditorWP::content');
|
1273 |
// For marking a post as containing a Crayon
|
1274 |
add_action('update_post', 'CrayonWP::save_post', 10, 2);
|
1275 |
add_action('save_post', 'CrayonWP::save_post', 10, 2);
|
1276 |
+
}
|
1277 |
+
if (CrayonGlobalSettings::val(CrayonSettings::COMMENTS)) {
|
1278 |
+
add_action('comment_post', 'CrayonWP::save_comment', 10, 2);
|
1279 |
+
add_action('edit_comment', 'CrayonWP::save_comment', 10, 2);
|
1280 |
}
|
1281 |
add_filter('init', 'CrayonWP::init_ajax');
|
1282 |
}
|
css/crayon_style.css
CHANGED
@@ -17,19 +17,22 @@ coloring etc.
|
|
17 |
position: relative !important;
|
18 |
direction: ltr;
|
19 |
text-align: left;
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
.crayon-syntax div {
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
margin: 0px;
|
28 |
text-align: left;
|
29 |
}
|
30 |
|
31 |
.crayon-syntax.crayon-loading {
|
32 |
-
|
33 |
}
|
34 |
|
35 |
.crayon-syntax,
|
@@ -44,8 +47,8 @@ coloring etc.
|
|
44 |
|
45 |
.crayon-syntax .crayon-main,
|
46 |
.crayon-syntax .crayon-plain {
|
47 |
-
|
48 |
-
|
49 |
overflow: auto;
|
50 |
}
|
51 |
|
@@ -58,27 +61,27 @@ coloring etc.
|
|
58 |
}
|
59 |
|
60 |
.crayon-syntax-inline {
|
61 |
-
|
62 |
-
|
63 |
}
|
64 |
|
65 |
.crayon-syntax .crayon-table {
|
66 |
border: none !important;
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
}
|
76 |
|
77 |
.crayon-syntax .crayon-table td,
|
78 |
.crayon-syntax .crayon-table tr {
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
vertical-align: top !important;
|
83 |
margin: 0 !important;
|
84 |
}
|
@@ -88,25 +91,28 @@ coloring etc.
|
|
88 |
}
|
89 |
|
90 |
.crayon-plain-tag {
|
91 |
-
|
92 |
}
|
|
|
93 |
/* End General ===================== */
|
94 |
|
95 |
/* Popup ========================= */
|
96 |
.crayon-popup {
|
97 |
-
|
98 |
}
|
99 |
|
100 |
.crayon-popup .crayon-plain {
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
}
|
|
|
107 |
.crayon-popup-window {
|
108 |
-
|
109 |
}
|
|
|
110 |
/* End Popup ========================= */
|
111 |
|
112 |
/* Line Numbers ==================== */
|
@@ -115,6 +121,7 @@ coloring etc.
|
|
115 |
padding: 0 5px;
|
116 |
margin: 0px;
|
117 |
}
|
|
|
118 |
/* End Line Numbers ================ */
|
119 |
|
120 |
/* Toolbar & Info ================== */
|
@@ -123,19 +130,21 @@ coloring etc.
|
|
123 |
overflow: hidden;
|
124 |
z-index: 4;
|
125 |
}
|
|
|
126 |
.crayon-syntax .crayon-info {
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
}
|
|
|
136 |
.crayon-syntax .crayon-info div {
|
137 |
-
|
138 |
-
|
139 |
}
|
140 |
|
141 |
.crayon-syntax .crayon-toolbar,
|
@@ -146,14 +155,14 @@ coloring etc.
|
|
146 |
}
|
147 |
|
148 |
.crayon-syntax .crayon-toolbar span {
|
149 |
-
|
150 |
}
|
151 |
|
152 |
.crayon-syntax .crayon-toolbar .crayon-button {
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
/*height: 16px;*/
|
158 |
line-height: 15px;
|
159 |
/*padding: 0px 2px !important;*/
|
@@ -167,27 +176,28 @@ coloring etc.
|
|
167 |
.crayon-toolbar .crayon-button,
|
168 |
.crayon-toolbar .crayon-button:hover,
|
169 |
.crayon-toolbar .crayon-button.crayon-pressed:hover {
|
170 |
-
|
171 |
}
|
|
|
172 |
.crayon-toolbar .crayon-button.crayon-pressed,
|
173 |
.crayon-toolbar .crayon-button:active,
|
174 |
.crayon-toolbar .crayon-button.crayon-pressed:active {
|
175 |
-
|
176 |
}
|
177 |
|
178 |
/* Plain Button */
|
179 |
.crayon-toolbar .crayon-button.crayon-plain-button {
|
180 |
-
|
181 |
}
|
182 |
|
183 |
/* Wrap Button */
|
184 |
.crayon-toolbar .crayon-button.crayon-wrap-button {
|
185 |
-
|
186 |
}
|
187 |
|
188 |
/* Expand Button */
|
189 |
.crayon-toolbar .crayon-button.crayon-expand-button {
|
190 |
-
|
191 |
}
|
192 |
|
193 |
/* Click to Expand */
|
@@ -198,32 +208,32 @@ coloring etc.
|
|
198 |
|
199 |
/* Copy Button */
|
200 |
.crayon-toolbar .crayon-button.crayon-copy-button {
|
201 |
-
|
202 |
}
|
203 |
|
204 |
/* Popup Button */
|
205 |
.crayon-toolbar .crayon-button.crayon-popup-button {
|
206 |
-
|
207 |
}
|
208 |
|
209 |
/* Nums Button */
|
210 |
.crayon-toolbar .crayon-button.crayon-nums-button {
|
211 |
-
|
212 |
}
|
213 |
|
214 |
/* Plus Sign */
|
215 |
.crayon-syntax .crayon-toolbar .crayon-mixed-highlight {
|
216 |
-
|
217 |
-
/* background-position: center;*/
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
}
|
223 |
|
224 |
/* Language */
|
225 |
.crayon-syntax .crayon-toolbar .crayon-language {
|
226 |
-
|
227 |
}
|
228 |
|
229 |
/* Tools */
|
@@ -231,54 +241,62 @@ coloring etc.
|
|
231 |
padding-right: 2px !important;
|
232 |
}*/
|
233 |
|
234 |
-
.crayon-syntax .crayon-title
|
|
|
235 |
float: left;
|
236 |
}
|
|
|
237 |
/* End Toolbar ===================== */
|
238 |
|
239 |
/* Scrollbar ======================= */
|
240 |
.crayon-main::-webkit-scrollbar,
|
241 |
.crayon-plain::-webkit-scrollbar {
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
}
|
|
|
247 |
.crayon-main::-webkit-scrollbar-thumb,
|
248 |
.crayon-plain::-webkit-scrollbar-thumb {
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
}
|
|
|
257 |
.crayon-main::-webkit-scrollbar-button,
|
258 |
.crayon-plain::-webkit-scrollbar-button {
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
}
|
|
|
263 |
.crayon-main::-webkit-scrollbar-track,
|
264 |
.crayon-plain::-webkit-scrollbar-track {
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
}
|
|
|
272 |
.crayon-main::-webkit-scrollbar-corner,
|
273 |
.crayon-plain::-webkit-scrollbar-corner {
|
274 |
-
|
275 |
}
|
|
|
276 |
.crayon-main::-webkit-scrollbar-thumb:hover,
|
277 |
.crayon-plain::-webkit-scrollbar-thumb:hover {
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
}
|
|
|
282 |
/* End Scrollbar =================== */
|
283 |
|
284 |
/* Code ============================ */
|
@@ -293,31 +311,33 @@ coloring etc.
|
|
293 |
}
|
294 |
|
295 |
.crayon-syntax .crayon-line {
|
296 |
-
padding: 0 5px;
|
297 |
}
|
298 |
|
299 |
.crayon-syntax.crayon-wrapped .crayon-line {
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
}
|
304 |
|
305 |
.crayon-syntax-inline .crayon-pre,
|
306 |
.crayon-syntax-inline pre {
|
307 |
-
|
308 |
}
|
309 |
|
310 |
.crayon-syntax-inline-nowrap .crayon-pre,
|
311 |
.crayon-syntax-inline-nowrap pre {
|
312 |
-
|
313 |
}
|
314 |
|
315 |
/* Default Font */
|
316 |
.crayon-syntax /*,
|
317 |
-
.crayon-syntax **/
|
|
|
318 |
font-family: Monaco, 'MonacoRegular', 'Courier New', monospace;
|
319 |
font-weight: 500;
|
320 |
}
|
|
|
321 |
/*
|
322 |
|
323 |
This has been disabled to allow more flexibility in changing font sizes.
|
@@ -331,30 +351,31 @@ This has been disabled to allow more flexibility in changing font sizes.
|
|
331 |
}
|
332 |
*/
|
333 |
.crayon-syntax.crayon-wrapped .crayon-line {
|
334 |
-
/* min-height: 15px;*/
|
335 |
-
|
336 |
}
|
337 |
|
338 |
.crayon-syntax .crayon-num,
|
339 |
.crayon-syntax .crayon-pre .crayon-line,
|
340 |
.crayon-syntax .crayon-toolbar *,
|
341 |
.crayon-syntax .crayon-pre * {
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
|
|
346 |
}
|
347 |
|
348 |
.crayon-syntax .crayon-pre .crayon-line span {
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
}
|
353 |
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
}
|
358 |
|
359 |
.crayon-syntax .crayon-toolbar .crayon-tools {
|
360 |
position: absolute;
|
@@ -366,8 +387,13 @@ This has been disabled to allow more flexibility in changing font sizes.
|
|
366 |
margin: 0 !important;
|
367 |
}
|
368 |
|
|
|
|
|
|
|
|
|
369 |
.crayon-placeholder {
|
370 |
width: 100% !important;
|
|
|
371 |
}
|
372 |
|
373 |
.crayon-toolbar-visible .crayon-toolbar {
|
@@ -383,60 +409,66 @@ This has been disabled to allow more flexibility in changing font sizes.
|
|
383 |
}
|
384 |
|
385 |
.crayon-syntax .crayon-plain-wrap {
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
}
|
390 |
|
391 |
.crayon-syntax .crayon-plain {
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
background: #FFF;
|
413 |
}
|
414 |
|
415 |
.crayon-wrapped .crayon-plain {
|
416 |
-
|
417 |
}
|
418 |
|
419 |
.bbp-body .crayon-syntax {
|
420 |
-
|
421 |
}
|
|
|
422 |
/* End Code ======================== */
|
423 |
|
424 |
/* Minimize ================= */
|
425 |
.crayon-minimized .crayon-toolbar {
|
426 |
cursor: pointer;
|
427 |
}
|
|
|
428 |
.crayon-minimized .crayon-plain-wrap,
|
429 |
.crayon-minimized .crayon-main,
|
430 |
.crayon-minimized .crayon-toolbar .crayon-tools * {
|
431 |
display: none !important;
|
432 |
}
|
|
|
433 |
.crayon-minimized .crayon-toolbar .crayon-tools .crayon-minimize {
|
434 |
display: block !important;
|
435 |
}
|
|
|
436 |
.crayon-minimized .crayon-toolbar {
|
437 |
position: relative !important;
|
438 |
}
|
|
|
439 |
.crayon-syntax.crayon-minimized .crayon-toolbar {
|
440 |
border-bottom: none !important;
|
441 |
}
|
|
|
442 |
/* End Minimize ============= */
|
17 |
position: relative !important;
|
18 |
direction: ltr;
|
19 |
text-align: left;
|
20 |
+
box-sizing: border-box;
|
21 |
+
-moz-box-sizing: border-box;
|
22 |
+
-webkit-box-sizing: border-box;
|
23 |
}
|
24 |
|
25 |
.crayon-syntax div {
|
26 |
+
/* Need !important? */
|
27 |
+
background: none;
|
28 |
+
border: none;
|
29 |
+
padding: 0px;
|
30 |
margin: 0px;
|
31 |
text-align: left;
|
32 |
}
|
33 |
|
34 |
.crayon-syntax.crayon-loading {
|
35 |
+
visibility: hidden;
|
36 |
}
|
37 |
|
38 |
.crayon-syntax,
|
47 |
|
48 |
.crayon-syntax .crayon-main,
|
49 |
.crayon-syntax .crayon-plain {
|
50 |
+
/* TODO a bug in IE8 causes max-height and overflow:auto to set max-height = height
|
51 |
+
http://edskes.net/ie8overflowandexpandingboxbugs.htm */
|
52 |
overflow: auto;
|
53 |
}
|
54 |
|
61 |
}
|
62 |
|
63 |
.crayon-syntax-inline {
|
64 |
+
margin: 0 2px;
|
65 |
+
padding: 0 2px;
|
66 |
}
|
67 |
|
68 |
.crayon-syntax .crayon-table {
|
69 |
border: none !important;
|
70 |
+
background: none !important;
|
71 |
+
padding: 0px !important;
|
72 |
+
margin-top: 0px !important;
|
73 |
+
margin-right: 0px !important;
|
74 |
+
margin-bottom: 0px !important;
|
75 |
+
width: auto !important;
|
76 |
+
border-spacing: 0 !important;
|
77 |
+
border-collapse: collapse !important;
|
78 |
}
|
79 |
|
80 |
.crayon-syntax .crayon-table td,
|
81 |
.crayon-syntax .crayon-table tr {
|
82 |
+
padding: 0 !important;
|
83 |
+
border: none !important;
|
84 |
+
background: none;
|
85 |
vertical-align: top !important;
|
86 |
margin: 0 !important;
|
87 |
}
|
91 |
}
|
92 |
|
93 |
.crayon-plain-tag {
|
94 |
+
margin-bottom: 12px;
|
95 |
}
|
96 |
+
|
97 |
/* End General ===================== */
|
98 |
|
99 |
/* Popup ========================= */
|
100 |
.crayon-popup {
|
101 |
+
|
102 |
}
|
103 |
|
104 |
.crayon-popup .crayon-plain {
|
105 |
+
display: block !important;
|
106 |
+
width: 100% !important;
|
107 |
+
height: 100% !important;
|
108 |
+
opacity: 100 !important;
|
109 |
+
position: relative !important;
|
110 |
}
|
111 |
+
|
112 |
.crayon-popup-window {
|
113 |
+
background: #fff;
|
114 |
}
|
115 |
+
|
116 |
/* End Popup ========================= */
|
117 |
|
118 |
/* Line Numbers ==================== */
|
121 |
padding: 0 5px;
|
122 |
margin: 0px;
|
123 |
}
|
124 |
+
|
125 |
/* End Line Numbers ================ */
|
126 |
|
127 |
/* Toolbar & Info ================== */
|
130 |
overflow: hidden;
|
131 |
z-index: 4;
|
132 |
}
|
133 |
+
|
134 |
.crayon-syntax .crayon-info {
|
135 |
+
position: absolute;
|
136 |
+
overflow: hidden;
|
137 |
+
display: none;
|
138 |
+
z-index: 3;
|
139 |
+
padding: 0px;
|
140 |
+
/* Must be able to expand! */
|
141 |
+
min-height: 18px;
|
142 |
+
line-height: 18px;
|
143 |
}
|
144 |
+
|
145 |
.crayon-syntax .crayon-info div {
|
146 |
+
padding: 2px !important;
|
147 |
+
text-align: center;
|
148 |
}
|
149 |
|
150 |
.crayon-syntax .crayon-toolbar,
|
155 |
}
|
156 |
|
157 |
.crayon-syntax .crayon-toolbar span {
|
158 |
+
padding: 0 4px !important;
|
159 |
}
|
160 |
|
161 |
.crayon-syntax .crayon-toolbar .crayon-button {
|
162 |
+
display: inline;
|
163 |
+
float: left !important;
|
164 |
+
width: 24px;
|
165 |
+
background-repeat: no-repeat;
|
166 |
/*height: 16px;*/
|
167 |
line-height: 15px;
|
168 |
/*padding: 0px 2px !important;*/
|
176 |
.crayon-toolbar .crayon-button,
|
177 |
.crayon-toolbar .crayon-button:hover,
|
178 |
.crayon-toolbar .crayon-button.crayon-pressed:hover {
|
179 |
+
background-position: 0px center;
|
180 |
}
|
181 |
+
|
182 |
.crayon-toolbar .crayon-button.crayon-pressed,
|
183 |
.crayon-toolbar .crayon-button:active,
|
184 |
.crayon-toolbar .crayon-button.crayon-pressed:active {
|
185 |
+
background-position: -24px center;
|
186 |
}
|
187 |
|
188 |
/* Plain Button */
|
189 |
.crayon-toolbar .crayon-button.crayon-plain-button {
|
190 |
+
background-image: url('images/toolbar/plain.png');
|
191 |
}
|
192 |
|
193 |
/* Wrap Button */
|
194 |
.crayon-toolbar .crayon-button.crayon-wrap-button {
|
195 |
+
background-image: url('images/toolbar/wrap.png');
|
196 |
}
|
197 |
|
198 |
/* Expand Button */
|
199 |
.crayon-toolbar .crayon-button.crayon-expand-button {
|
200 |
+
background-image: url('images/toolbar/expand.png');
|
201 |
}
|
202 |
|
203 |
/* Click to Expand */
|
208 |
|
209 |
/* Copy Button */
|
210 |
.crayon-toolbar .crayon-button.crayon-copy-button {
|
211 |
+
background-image: url('images/toolbar/copy.png');
|
212 |
}
|
213 |
|
214 |
/* Popup Button */
|
215 |
.crayon-toolbar .crayon-button.crayon-popup-button {
|
216 |
+
background-image: url('images/toolbar/popup.png');
|
217 |
}
|
218 |
|
219 |
/* Nums Button */
|
220 |
.crayon-toolbar .crayon-button.crayon-nums-button {
|
221 |
+
background-image: url('images/toolbar/nums.png');
|
222 |
}
|
223 |
|
224 |
/* Plus Sign */
|
225 |
.crayon-syntax .crayon-toolbar .crayon-mixed-highlight {
|
226 |
+
background-image: url('images/toolbar/plus.png');
|
227 |
+
/* background-position: center;*/
|
228 |
+
background-position: 0px center;
|
229 |
+
background-repeat: no-repeat;
|
230 |
+
float: left;
|
231 |
+
min-width: 15px;
|
232 |
}
|
233 |
|
234 |
/* Language */
|
235 |
.crayon-syntax .crayon-toolbar .crayon-language {
|
236 |
+
padding-right: 8px !important;
|
237 |
}
|
238 |
|
239 |
/* Tools */
|
241 |
padding-right: 2px !important;
|
242 |
}*/
|
243 |
|
244 |
+
.crayon-syntax .crayon-title,
|
245 |
+
.crayon-syntax .crayon-language {
|
246 |
float: left;
|
247 |
}
|
248 |
+
|
249 |
/* End Toolbar ===================== */
|
250 |
|
251 |
/* Scrollbar ======================= */
|
252 |
.crayon-main::-webkit-scrollbar,
|
253 |
.crayon-plain::-webkit-scrollbar {
|
254 |
+
height: 6px;
|
255 |
+
overflow: visible;
|
256 |
+
width: 6px;
|
257 |
+
background: #EEE;
|
258 |
}
|
259 |
+
|
260 |
.crayon-main::-webkit-scrollbar-thumb,
|
261 |
.crayon-plain::-webkit-scrollbar-thumb {
|
262 |
+
background-color: #CCC;
|
263 |
+
background-clip: padding-box;
|
264 |
+
border: 1px solid #AAA;
|
265 |
+
box-shadow: inset 0 0 2px #999;
|
266 |
+
min-height: 8px;
|
267 |
+
padding: 0;
|
268 |
+
border-width: 1px;
|
269 |
}
|
270 |
+
|
271 |
.crayon-main::-webkit-scrollbar-button,
|
272 |
.crayon-plain::-webkit-scrollbar-button {
|
273 |
+
height: 0;
|
274 |
+
width: 0;
|
275 |
+
padding: 0px;
|
276 |
}
|
277 |
+
|
278 |
.crayon-main::-webkit-scrollbar-track,
|
279 |
.crayon-plain::-webkit-scrollbar-track {
|
280 |
+
background-clip: padding-box;
|
281 |
+
border: solid transparent;
|
282 |
+
border-width: 0 0 0 4px;
|
283 |
+
border: 1px solid #BBB;
|
284 |
+
border-right: none;
|
285 |
+
border-bottom: none;
|
286 |
}
|
287 |
+
|
288 |
.crayon-main::-webkit-scrollbar-corner,
|
289 |
.crayon-plain::-webkit-scrollbar-corner {
|
290 |
+
background: #EEE;
|
291 |
}
|
292 |
+
|
293 |
.crayon-main::-webkit-scrollbar-thumb:hover,
|
294 |
.crayon-plain::-webkit-scrollbar-thumb:hover {
|
295 |
+
background: #AAA;
|
296 |
+
border: 1px solid #777;
|
297 |
+
box-shadow: inset 0 0 2px #777;
|
298 |
}
|
299 |
+
|
300 |
/* End Scrollbar =================== */
|
301 |
|
302 |
/* Code ============================ */
|
311 |
}
|
312 |
|
313 |
.crayon-syntax .crayon-line {
|
314 |
+
padding: 0 5px;
|
315 |
}
|
316 |
|
317 |
.crayon-syntax.crayon-wrapped .crayon-line {
|
318 |
+
/* width: 500px !important; */
|
319 |
+
white-space: pre-wrap !important;
|
320 |
+
/* word-wrap:break-word !important;*/
|
321 |
}
|
322 |
|
323 |
.crayon-syntax-inline .crayon-pre,
|
324 |
.crayon-syntax-inline pre {
|
325 |
+
white-space: normal;
|
326 |
}
|
327 |
|
328 |
.crayon-syntax-inline-nowrap .crayon-pre,
|
329 |
.crayon-syntax-inline-nowrap pre {
|
330 |
+
white-space: pre;
|
331 |
}
|
332 |
|
333 |
/* Default Font */
|
334 |
.crayon-syntax /*,
|
335 |
+
.crayon-syntax **/
|
336 |
+
{
|
337 |
font-family: Monaco, 'MonacoRegular', 'Courier New', monospace;
|
338 |
font-weight: 500;
|
339 |
}
|
340 |
+
|
341 |
/*
|
342 |
|
343 |
This has been disabled to allow more flexibility in changing font sizes.
|
351 |
}
|
352 |
*/
|
353 |
.crayon-syntax.crayon-wrapped .crayon-line {
|
354 |
+
/* min-height: 15px;*/
|
355 |
+
height: auto;
|
356 |
}
|
357 |
|
358 |
.crayon-syntax .crayon-num,
|
359 |
.crayon-syntax .crayon-pre .crayon-line,
|
360 |
.crayon-syntax .crayon-toolbar *,
|
361 |
.crayon-syntax .crayon-pre * {
|
362 |
+
font-family: inherit;
|
363 |
+
font-size: inherit !important;
|
364 |
+
line-height: inherit !important;
|
365 |
+
font-weight: inherit !important;
|
366 |
+
height: inherit !important;
|
367 |
}
|
368 |
|
369 |
.crayon-syntax .crayon-pre .crayon-line span {
|
370 |
+
display: inline-block;
|
371 |
+
*display: inline;
|
372 |
+
zoom: 1;
|
373 |
}
|
374 |
|
375 |
+
/*.crayon-syntax .crayon-toolbar .crayon-tools,*/
|
376 |
+
/*.crayon-syntax .crayon-toolbar .crayon-tools * {*/
|
377 |
+
/*height: inherit !important;*/
|
378 |
+
/*}*/
|
379 |
|
380 |
.crayon-syntax .crayon-toolbar .crayon-tools {
|
381 |
position: absolute;
|
387 |
margin: 0 !important;
|
388 |
}
|
389 |
|
390 |
+
.crayon-syntax.crayon-expanded .crayon-main {
|
391 |
+
overflow: hidden !important;
|
392 |
+
}
|
393 |
+
|
394 |
.crayon-placeholder {
|
395 |
width: 100% !important;
|
396 |
+
/*background: red;*/
|
397 |
}
|
398 |
|
399 |
.crayon-toolbar-visible .crayon-toolbar {
|
409 |
}
|
410 |
|
411 |
.crayon-syntax .crayon-plain-wrap {
|
412 |
+
height: auto !important;
|
413 |
+
padding: 0 !important;
|
414 |
+
margin: 0 !important;
|
415 |
}
|
416 |
|
417 |
.crayon-syntax .crayon-plain {
|
418 |
+
width: 100%;
|
419 |
+
height: 100%;
|
420 |
+
position: absolute;
|
421 |
+
opacity: 0;
|
422 |
+
padding: 0 5px;
|
423 |
+
margin: 0px;
|
424 |
+
border: none;
|
425 |
+
box-sizing: border-box;
|
426 |
+
-webkit-box-sizing: border-box;
|
427 |
+
-moz-box-sizing: border-box;
|
428 |
+
box-shadow: none;
|
429 |
+
border-radius: 0px;
|
430 |
+
-webkit-box-shadow: none;
|
431 |
+
-moz-box-shadow: none;
|
432 |
+
/*white-space: pre-wrap;*/
|
433 |
+
white-space: pre;
|
434 |
+
word-wrap: normal;
|
435 |
+
overflow: auto;
|
436 |
+
resize: none;
|
437 |
+
color: #000;
|
438 |
background: #FFF;
|
439 |
}
|
440 |
|
441 |
.crayon-wrapped .crayon-plain {
|
442 |
+
white-space: pre-wrap;
|
443 |
}
|
444 |
|
445 |
.bbp-body .crayon-syntax {
|
446 |
+
clear: none !important;
|
447 |
}
|
448 |
+
|
449 |
/* End Code ======================== */
|
450 |
|
451 |
/* Minimize ================= */
|
452 |
.crayon-minimized .crayon-toolbar {
|
453 |
cursor: pointer;
|
454 |
}
|
455 |
+
|
456 |
.crayon-minimized .crayon-plain-wrap,
|
457 |
.crayon-minimized .crayon-main,
|
458 |
.crayon-minimized .crayon-toolbar .crayon-tools * {
|
459 |
display: none !important;
|
460 |
}
|
461 |
+
|
462 |
.crayon-minimized .crayon-toolbar .crayon-tools .crayon-minimize {
|
463 |
display: block !important;
|
464 |
}
|
465 |
+
|
466 |
.crayon-minimized .crayon-toolbar {
|
467 |
position: relative !important;
|
468 |
}
|
469 |
+
|
470 |
.crayon-syntax.crayon-minimized .crayon-toolbar {
|
471 |
border-bottom: none !important;
|
472 |
}
|
473 |
+
|
474 |
/* End Minimize ============= */
|
js/crayon.js
CHANGED
@@ -158,7 +158,7 @@
|
|
158 |
|
159 |
// XXX Remember CSS dimensions
|
160 |
var mainStyle = main.style();
|
161 |
-
crayons[uid].
|
162 |
'height': mainStyle && mainStyle.height || '',
|
163 |
'max-height': mainStyle && mainStyle.maxHeight || '',
|
164 |
'min-height': mainStyle && mainStyle.minHeight || '',
|
@@ -166,6 +166,7 @@
|
|
166 |
'max-width': mainStyle && mainStyle.maxWidth || '',
|
167 |
'min-width': mainStyle && mainStyle.minWidth || ''
|
168 |
};
|
|
|
169 |
|
170 |
var load_timer;
|
171 |
var i = 0;
|
@@ -205,7 +206,7 @@
|
|
205 |
|
206 |
if (typeof crayons[uid].expanded == 'undefined') {
|
207 |
// Determine if we should enable code expanding toggling
|
208 |
-
if (Math.abs(crayons[uid].main.
|
209 |
crayons[uid].expandButton.hide();
|
210 |
} else {
|
211 |
crayons[uid].expandButton.show();
|
@@ -213,9 +214,9 @@
|
|
213 |
}
|
214 |
|
215 |
// TODO If width has changed or timeout, stop timer
|
216 |
-
if (/*last_num_width != nums.
|
217 |
clearInterval(load_timer);
|
218 |
-
//
|
219 |
crayons[uid].loading = false;
|
220 |
}
|
221 |
i++;
|
@@ -272,19 +273,20 @@
|
|
272 |
|
273 |
plain.css('opacity', 0);
|
274 |
|
275 |
-
crayons[uid].
|
|
|
276 |
crayons[uid].toolbarMouseover = false;
|
277 |
// If a toolbar with mouseover was found
|
278 |
if (toolbar.filter('[data-settings~="mouseover"]').length != 0 && !touchscreen) {
|
279 |
crayons[uid].toolbarMouseover = true;
|
280 |
-
crayons[uid].
|
281 |
|
282 |
-
toolbar.css('margin-top', '-' + toolbar.
|
283 |
toolbar.hide();
|
284 |
// Overlay the toolbar if needed, only if doing so will not hide the
|
285 |
// whole code!
|
286 |
if (toolbar.filter('[data-settings~="overlay"]').length != 0
|
287 |
-
&&
|
288 |
toolbar.css('position', 'absolute');
|
289 |
toolbar.css('z-index', 2);
|
290 |
// Hide on single click when overlayed
|
@@ -346,19 +348,17 @@
|
|
346 |
|
347 |
// Scrollbar show events
|
348 |
var expand = c.filter('[data-settings~="expand"]').length != 0;
|
349 |
-
//
|
350 |
if (!touchscreen && c.filter('[data-settings~="scroll-mouseover"]').length != 0) {
|
351 |
// Disable on touchscreen devices and when set to mouseover
|
352 |
main.css('overflow', 'hidden');
|
353 |
plain.css('overflow', 'hidden');
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
});
|
361 |
-
}
|
362 |
}
|
363 |
|
364 |
if (expand) {
|
@@ -538,7 +538,7 @@
|
|
538 |
|
539 |
if (isSlideHidden(info) && show) {
|
540 |
info.html('<div>' + text + '</div>');
|
541 |
-
info.css('margin-top', -info.
|
542 |
info.show();
|
543 |
crayonSlide(uid, info, true);
|
544 |
setTimeout(function () {
|
@@ -565,7 +565,7 @@
|
|
565 |
};
|
566 |
|
567 |
var isSlideHidden = function (object) {
|
568 |
-
var object_neg_height = '-' + object.
|
569 |
if (object.css('margin-top') == object_neg_height || object.css('display') == 'none') {
|
570 |
return true;
|
571 |
} else {
|
@@ -579,7 +579,7 @@
|
|
579 |
callback(uid, object);
|
580 |
}
|
581 |
}
|
582 |
-
var objectNegHeight = '-' + object.
|
583 |
|
584 |
if (typeof show == 'undefined') {
|
585 |
if (isSlideHidden(object)) {
|
@@ -715,7 +715,7 @@
|
|
715 |
if (crayons[uid].table.is(':animated')) {
|
716 |
return false;
|
717 |
}
|
718 |
-
var numsWidth = Math.round(crayons[uid].nums_content.
|
719 |
var negWidth = '-' + numsWidth + 'px';
|
720 |
|
721 |
// Force hiding
|
@@ -747,8 +747,8 @@
|
|
747 |
|
748 |
// Stop jerking animation from scrollbar appearing for a split second due to
|
749 |
// change in width. Prevents scrollbar disappearing if already visible.
|
750 |
-
h_scroll_visible = (crayons[uid].table.
|
751 |
-
v_scroll_visible = (crayons[uid].table.
|
752 |
if (!h_scroll_visible && !v_scroll_visible) {
|
753 |
crayons[uid].main.css('overflow', 'hidden');
|
754 |
}
|
@@ -895,24 +895,42 @@
|
|
895 |
}
|
896 |
|
897 |
crayonSlide(uid, toolbar, show, animTime, hideDelay, function () {
|
898 |
-
crayons[uid].
|
899 |
});
|
900 |
};
|
901 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
902 |
var initSize = function (uid) {
|
903 |
if (typeof crayons[uid].initialSize == 'undefined') {
|
904 |
// Shared for scrollbars and expanding
|
905 |
-
crayons[uid].
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
}
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
crayons[uid].
|
|
|
|
|
|
|
|
|
916 |
}
|
917 |
};
|
918 |
|
@@ -930,37 +948,17 @@
|
|
930 |
if (expand) {
|
931 |
if (typeof crayons[uid].expanded == 'undefined') {
|
932 |
initSize(uid);
|
933 |
-
initPosition(uid);
|
934 |
-
crayons[uid].finalSize = {width: crayons[uid].table.width(), height: crayons[uid].table.height()};
|
935 |
-
// If toolbar is always showing, make room for it
|
936 |
-
if (crayons[uid].toolbarMouseover == false) {
|
937 |
-
crayons[uid].finalSize.height += crayons[uid].toolbar.height();
|
938 |
-
}
|
939 |
-
// Ensure we don't shrink
|
940 |
-
crayons[uid].finalSize.width = CrayonUtil.setMin(crayons[uid].finalSize.width, crayons[uid].initialSize.width);
|
941 |
-
crayons[uid].finalSize.height = CrayonUtil.setMin(crayons[uid].finalSize.height, crayons[uid].initialSize.height);
|
942 |
-
crayons[uid].diffSize = {
|
943 |
-
width: crayons[uid].finalSize.width - crayons[uid].initialSize.width,
|
944 |
-
height: crayons[uid].finalSize.height - crayons[uid].initialSize.height
|
945 |
-
};
|
946 |
crayons[uid].expandTime = CrayonUtil.setRange(crayons[uid].diffSize.width / 3, 300, 800);
|
947 |
crayons[uid].expanded = false;
|
948 |
-
|
949 |
-
var placeHolderSize = crayons[uid].finalSize;
|
950 |
-
placeHolderSize.height += crayons[uid].toolbar.height();
|
951 |
crayons[uid].placeholder = $('<div></div>');
|
952 |
crayons[uid].placeholder.addClass(CRAYON_PLACEHOLDER);
|
953 |
crayons[uid].placeholder.css(placeHolderSize);
|
954 |
-
// crayon[uid].placeholder.hide();
|
955 |
crayons[uid].before(crayons[uid].placeholder);
|
|
|
956 |
$(window).bind('resize', placeholderResize);
|
957 |
}
|
958 |
|
959 |
-
var initialSize = crayons[uid].initialSize;
|
960 |
-
var initialPosition = crayons[uid].initialPosition;
|
961 |
-
var diffSize = crayons[uid].diffSize;
|
962 |
-
var finalSize = crayons[uid].finalSize;
|
963 |
-
|
964 |
var expandHeight = {
|
965 |
'height': 'auto',
|
966 |
'min-height': 'none',
|
@@ -972,17 +970,17 @@
|
|
972 |
'max-width': 'none'
|
973 |
};
|
974 |
|
975 |
-
crayons[uid].
|
976 |
crayons[uid].css({
|
977 |
'min-width': 'none',
|
978 |
'max-width': 'none'
|
979 |
});
|
980 |
var newSize = {
|
981 |
-
width:
|
982 |
};
|
983 |
-
if (
|
984 |
-
newSize.height =
|
985 |
-
crayons[uid].
|
986 |
}
|
987 |
|
988 |
main.css(expandHeight);
|
@@ -996,20 +994,10 @@
|
|
996 |
|
997 |
crayons[uid].placeholder.show();
|
998 |
$('body').prepend(crayons[uid]);
|
999 |
-
//crayon[uid].css(initialPosition);
|
1000 |
-
// $(window).bind('resize', placeholderResize);
|
1001 |
-
// var i = 0;
|
1002 |
-
// var timer = setInterval(function () {
|
1003 |
-
// placeholderResize();
|
1004 |
-
// i++;
|
1005 |
-
// if (i >= 5) {
|
1006 |
-
// clearInterval(timer);
|
1007 |
-
// }
|
1008 |
-
// }, 50);
|
1009 |
crayons[uid].addClass(CRAYON_EXPANDED);
|
1010 |
placeholderResize();
|
1011 |
} else {
|
1012 |
-
var initialSize = crayons[uid].
|
1013 |
var delay = crayons[uid].toolbar_delay;
|
1014 |
if (initialSize) {
|
1015 |
crayons[uid].stop(true);
|
@@ -1019,7 +1007,7 @@
|
|
1019 |
var newSize = {
|
1020 |
width: initialSize.width
|
1021 |
};
|
1022 |
-
if (crayons[uid].
|
1023 |
newSize.height = initialSize.height;
|
1024 |
}
|
1025 |
crayons[uid].animate(newSize, animt(crayons[uid].expandTime, uid), function () {
|
@@ -1030,12 +1018,9 @@
|
|
1030 |
expandFinish(uid);
|
1031 |
}, delay);
|
1032 |
}
|
1033 |
-
|
1034 |
crayons[uid].placeholder.hide();
|
1035 |
crayons[uid].placeholder.before(crayons[uid]);
|
1036 |
crayons[uid].css({left: 'auto', top: 'auto'});
|
1037 |
-
//$(window).unbind('resize', crayon[uid].placeholderResize);
|
1038 |
-
|
1039 |
crayons[uid].removeClass(CRAYON_EXPANDED);
|
1040 |
}
|
1041 |
|
@@ -1048,7 +1033,7 @@
|
|
1048 |
var placeholderResize = function () {
|
1049 |
for (uid in crayons) {
|
1050 |
if (crayons[uid].hasClass(CRAYON_EXPANDED)) {
|
1051 |
-
crayons[uid].css(crayons[uid].placeholder.
|
1052 |
}
|
1053 |
}
|
1054 |
};
|
@@ -1066,18 +1051,14 @@
|
|
1066 |
if (typeof crayons[uid] == 'undefined') {
|
1067 |
return makeUID(uid);
|
1068 |
}
|
1069 |
-
if (typeof show == 'undefined') {
|
1070 |
return;
|
1071 |
}
|
1072 |
|
1073 |
var main = crayons[uid].main;
|
1074 |
var plain = crayons[uid].plain;
|
1075 |
|
1076 |
-
initSize(uid);
|
1077 |
-
|
1078 |
if (show) {
|
1079 |
-
// main.height(main.height());
|
1080 |
-
// plain.height(plain.height());
|
1081 |
// Show scrollbars
|
1082 |
main.css('overflow', 'auto');
|
1083 |
plain.css('overflow', 'auto');
|
@@ -1096,10 +1077,6 @@
|
|
1096 |
crayons[uid].left = visible.scrollLeft();
|
1097 |
main.css('overflow', 'hidden');
|
1098 |
plain.css('overflow', 'hidden');
|
1099 |
-
|
1100 |
-
if (!crayons[uid].expanded) {
|
1101 |
-
restoreDimensions(uid);
|
1102 |
-
}
|
1103 |
}
|
1104 |
// Register that overflow has changed
|
1105 |
crayons[uid].scrollChanged = true;
|
@@ -1119,7 +1096,7 @@
|
|
1119 |
var restoreDimensions = function (uid) {
|
1120 |
// Restore dimensions
|
1121 |
var main = crayons[uid].main;
|
1122 |
-
var mainStyle = crayons[uid].
|
1123 |
main.css(mainStyle);
|
1124 |
// Width styles also apply to crayon
|
1125 |
crayons[uid].css('height', 'auto');
|
@@ -1130,7 +1107,7 @@
|
|
1130 |
|
1131 |
var reconsileDimensions = function (uid) {
|
1132 |
// Reconsile dimensions
|
1133 |
-
crayons[uid].plain.
|
1134 |
};
|
1135 |
|
1136 |
var reconsileLines = function (uid) {
|
@@ -1140,7 +1117,7 @@
|
|
1140 |
var height = null;
|
1141 |
if (crayons[uid].wrapped) {
|
1142 |
line.css('height', '');
|
1143 |
-
height = line.
|
1144 |
height = height ? height : '';
|
1145 |
// TODO toolbar should overlay title if needed
|
1146 |
} else {
|
158 |
|
159 |
// XXX Remember CSS dimensions
|
160 |
var mainStyle = main.style();
|
161 |
+
crayons[uid].mainStyle = {
|
162 |
'height': mainStyle && mainStyle.height || '',
|
163 |
'max-height': mainStyle && mainStyle.maxHeight || '',
|
164 |
'min-height': mainStyle && mainStyle.minHeight || '',
|
166 |
'max-width': mainStyle && mainStyle.maxWidth || '',
|
167 |
'min-width': mainStyle && mainStyle.minWidth || ''
|
168 |
};
|
169 |
+
crayons[uid].mainHeightAuto = crayons[uid].mainStyle.height == '' && crayons[uid].mainStyle['max-height'] == '';
|
170 |
|
171 |
var load_timer;
|
172 |
var i = 0;
|
206 |
|
207 |
if (typeof crayons[uid].expanded == 'undefined') {
|
208 |
// Determine if we should enable code expanding toggling
|
209 |
+
if (Math.abs(crayons[uid].main.outerWidth() - crayons[uid].table.outerWidth()) < 10) {
|
210 |
crayons[uid].expandButton.hide();
|
211 |
} else {
|
212 |
crayons[uid].expandButton.show();
|
214 |
}
|
215 |
|
216 |
// TODO If width has changed or timeout, stop timer
|
217 |
+
if (/*last_num_width != nums.outerWidth() ||*/ i == 5) {
|
218 |
clearInterval(load_timer);
|
219 |
+
//crayons[uid].removeClass(CRAYON_LOADING);
|
220 |
crayons[uid].loading = false;
|
221 |
}
|
222 |
i++;
|
273 |
|
274 |
plain.css('opacity', 0);
|
275 |
|
276 |
+
crayons[uid].toolbarVisible = true;
|
277 |
+
crayons[uid].hasOneLine = table.outerHeight() < toolbar.outerHeight() * 2;
|
278 |
crayons[uid].toolbarMouseover = false;
|
279 |
// If a toolbar with mouseover was found
|
280 |
if (toolbar.filter('[data-settings~="mouseover"]').length != 0 && !touchscreen) {
|
281 |
crayons[uid].toolbarMouseover = true;
|
282 |
+
crayons[uid].toolbarVisible = false;
|
283 |
|
284 |
+
toolbar.css('margin-top', '-' + toolbar.outerHeight() + 'px');
|
285 |
toolbar.hide();
|
286 |
// Overlay the toolbar if needed, only if doing so will not hide the
|
287 |
// whole code!
|
288 |
if (toolbar.filter('[data-settings~="overlay"]').length != 0
|
289 |
+
&& !crayons[uid].hasOneLine) {
|
290 |
toolbar.css('position', 'absolute');
|
291 |
toolbar.css('z-index', 2);
|
292 |
// Hide on single click when overlayed
|
348 |
|
349 |
// Scrollbar show events
|
350 |
var expand = c.filter('[data-settings~="expand"]').length != 0;
|
351 |
+
// crayons[uid].mouse_expand = expand;
|
352 |
if (!touchscreen && c.filter('[data-settings~="scroll-mouseover"]').length != 0) {
|
353 |
// Disable on touchscreen devices and when set to mouseover
|
354 |
main.css('overflow', 'hidden');
|
355 |
plain.css('overflow', 'hidden');
|
356 |
+
c.mouseenter(function () {
|
357 |
+
toggle_scroll(uid, true, expand);
|
358 |
+
})
|
359 |
+
.mouseleave(function () {
|
360 |
+
toggle_scroll(uid, false, expand);
|
361 |
+
});
|
|
|
|
|
362 |
}
|
363 |
|
364 |
if (expand) {
|
538 |
|
539 |
if (isSlideHidden(info) && show) {
|
540 |
info.html('<div>' + text + '</div>');
|
541 |
+
info.css('margin-top', -info.outerHeight());
|
542 |
info.show();
|
543 |
crayonSlide(uid, info, true);
|
544 |
setTimeout(function () {
|
565 |
};
|
566 |
|
567 |
var isSlideHidden = function (object) {
|
568 |
+
var object_neg_height = '-' + object.outerHeight() + 'px';
|
569 |
if (object.css('margin-top') == object_neg_height || object.css('display') == 'none') {
|
570 |
return true;
|
571 |
} else {
|
579 |
callback(uid, object);
|
580 |
}
|
581 |
}
|
582 |
+
var objectNegHeight = '-' + object.outerHeight() + 'px';
|
583 |
|
584 |
if (typeof show == 'undefined') {
|
585 |
if (isSlideHidden(object)) {
|
715 |
if (crayons[uid].table.is(':animated')) {
|
716 |
return false;
|
717 |
}
|
718 |
+
var numsWidth = Math.round(crayons[uid].nums_content.outerWidth() + 1);
|
719 |
var negWidth = '-' + numsWidth + 'px';
|
720 |
|
721 |
// Force hiding
|
747 |
|
748 |
// Stop jerking animation from scrollbar appearing for a split second due to
|
749 |
// change in width. Prevents scrollbar disappearing if already visible.
|
750 |
+
var h_scroll_visible = (crayons[uid].table.outerWidth() + pxToInt(crayons[uid].table.css('margin-left')) > crayons[uid].main.outerWidth());
|
751 |
+
var v_scroll_visible = (crayons[uid].table.outerHeight() > crayons[uid].main.outerHeight());
|
752 |
if (!h_scroll_visible && !v_scroll_visible) {
|
753 |
crayons[uid].main.css('overflow', 'hidden');
|
754 |
}
|
895 |
}
|
896 |
|
897 |
crayonSlide(uid, toolbar, show, animTime, hideDelay, function () {
|
898 |
+
crayons[uid].toolbarVisible = show;
|
899 |
});
|
900 |
};
|
901 |
|
902 |
+
var addSize = function (orig, add) {
|
903 |
+
var copy = $.extend({}, orig);
|
904 |
+
copy.width += add.width;
|
905 |
+
copy.height += add.height;
|
906 |
+
return copy;
|
907 |
+
};
|
908 |
+
|
909 |
+
var minusSize = function (orig, minus) {
|
910 |
+
var copy = $.extend({}, orig);
|
911 |
+
copy.width -= minus.width;
|
912 |
+
copy.height -= minus.height;
|
913 |
+
return copy;
|
914 |
+
};
|
915 |
+
|
916 |
var initSize = function (uid) {
|
917 |
if (typeof crayons[uid].initialSize == 'undefined') {
|
918 |
// Shared for scrollbars and expanding
|
919 |
+
crayons[uid].toolbarHeight = crayons[uid].toolbar.outerHeight();
|
920 |
+
crayons[uid].innerSize = {width: crayons[uid].width(), height: crayons[uid].height()};
|
921 |
+
crayons[uid].outerSize = {width: crayons[uid].outerWidth(), height: crayons[uid].outerHeight()};
|
922 |
+
crayons[uid].borderSize = minusSize(crayons[uid].outerSize, crayons[uid].innerSize);
|
923 |
+
crayons[uid].initialSize = {width: crayons[uid].main.outerWidth(), height: crayons[uid].main.outerHeight()};
|
924 |
+
crayons[uid].initialSize.height += crayons[uid].toolbarHeight;
|
925 |
+
crayons[uid].initialOuterSize = addSize(crayons[uid].initialSize, crayons[uid].borderSize);
|
926 |
+
crayons[uid].finalSize = {width: crayons[uid].table.outerWidth(), height: crayons[uid].table.outerHeight()};
|
927 |
+
crayons[uid].finalSize.height += crayons[uid].toolbarHeight;
|
928 |
+
// Ensure we don't shrink
|
929 |
+
crayons[uid].finalSize.width = CrayonUtil.setMin(crayons[uid].finalSize.width, crayons[uid].initialSize.width);
|
930 |
+
crayons[uid].finalSize.height = CrayonUtil.setMin(crayons[uid].finalSize.height, crayons[uid].initialSize.height);
|
931 |
+
crayons[uid].diffSize = minusSize(crayons[uid].finalSize, crayons[uid].initialSize);
|
932 |
+
crayons[uid].finalOuterSize = addSize(crayons[uid].finalSize, crayons[uid].borderSize);
|
933 |
+
crayons[uid].initialSize.height += crayons[uid].toolbar.outerHeight();
|
934 |
}
|
935 |
};
|
936 |
|
948 |
if (expand) {
|
949 |
if (typeof crayons[uid].expanded == 'undefined') {
|
950 |
initSize(uid);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
951 |
crayons[uid].expandTime = CrayonUtil.setRange(crayons[uid].diffSize.width / 3, 300, 800);
|
952 |
crayons[uid].expanded = false;
|
953 |
+
var placeHolderSize = crayons[uid].finalOuterSize;
|
|
|
|
|
954 |
crayons[uid].placeholder = $('<div></div>');
|
955 |
crayons[uid].placeholder.addClass(CRAYON_PLACEHOLDER);
|
956 |
crayons[uid].placeholder.css(placeHolderSize);
|
|
|
957 |
crayons[uid].before(crayons[uid].placeholder);
|
958 |
+
crayons[uid].placeholder.css('margin', crayons[uid].css('margin'));
|
959 |
$(window).bind('resize', placeholderResize);
|
960 |
}
|
961 |
|
|
|
|
|
|
|
|
|
|
|
962 |
var expandHeight = {
|
963 |
'height': 'auto',
|
964 |
'min-height': 'none',
|
970 |
'max-width': 'none'
|
971 |
};
|
972 |
|
973 |
+
crayons[uid].outerWidth(crayons[uid].outerWidth());
|
974 |
crayons[uid].css({
|
975 |
'min-width': 'none',
|
976 |
'max-width': 'none'
|
977 |
});
|
978 |
var newSize = {
|
979 |
+
width: crayons[uid].finalOuterSize.width
|
980 |
};
|
981 |
+
if (!crayons[uid].mainHeightAuto && !crayons[uid].hasOneLine) {
|
982 |
+
newSize.height = crayons[uid].finalOuterSize.height;
|
983 |
+
crayons[uid].outerHeight(crayons[uid].outerHeight());
|
984 |
}
|
985 |
|
986 |
main.css(expandHeight);
|
994 |
|
995 |
crayons[uid].placeholder.show();
|
996 |
$('body').prepend(crayons[uid]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
997 |
crayons[uid].addClass(CRAYON_EXPANDED);
|
998 |
placeholderResize();
|
999 |
} else {
|
1000 |
+
var initialSize = crayons[uid].initialOuterSize;
|
1001 |
var delay = crayons[uid].toolbar_delay;
|
1002 |
if (initialSize) {
|
1003 |
crayons[uid].stop(true);
|
1007 |
var newSize = {
|
1008 |
width: initialSize.width
|
1009 |
};
|
1010 |
+
if (!crayons[uid].mainHeightAuto && !crayons[uid].hasOneLine) {
|
1011 |
newSize.height = initialSize.height;
|
1012 |
}
|
1013 |
crayons[uid].animate(newSize, animt(crayons[uid].expandTime, uid), function () {
|
1018 |
expandFinish(uid);
|
1019 |
}, delay);
|
1020 |
}
|
|
|
1021 |
crayons[uid].placeholder.hide();
|
1022 |
crayons[uid].placeholder.before(crayons[uid]);
|
1023 |
crayons[uid].css({left: 'auto', top: 'auto'});
|
|
|
|
|
1024 |
crayons[uid].removeClass(CRAYON_EXPANDED);
|
1025 |
}
|
1026 |
|
1033 |
var placeholderResize = function () {
|
1034 |
for (uid in crayons) {
|
1035 |
if (crayons[uid].hasClass(CRAYON_EXPANDED)) {
|
1036 |
+
crayons[uid].css(crayons[uid].placeholder.offset());
|
1037 |
}
|
1038 |
}
|
1039 |
};
|
1051 |
if (typeof crayons[uid] == 'undefined') {
|
1052 |
return makeUID(uid);
|
1053 |
}
|
1054 |
+
if (typeof show == 'undefined' || expand || crayons[uid].expanded) {
|
1055 |
return;
|
1056 |
}
|
1057 |
|
1058 |
var main = crayons[uid].main;
|
1059 |
var plain = crayons[uid].plain;
|
1060 |
|
|
|
|
|
1061 |
if (show) {
|
|
|
|
|
1062 |
// Show scrollbars
|
1063 |
main.css('overflow', 'auto');
|
1064 |
plain.css('overflow', 'auto');
|
1077 |
crayons[uid].left = visible.scrollLeft();
|
1078 |
main.css('overflow', 'hidden');
|
1079 |
plain.css('overflow', 'hidden');
|
|
|
|
|
|
|
|
|
1080 |
}
|
1081 |
// Register that overflow has changed
|
1082 |
crayons[uid].scrollChanged = true;
|
1096 |
var restoreDimensions = function (uid) {
|
1097 |
// Restore dimensions
|
1098 |
var main = crayons[uid].main;
|
1099 |
+
var mainStyle = crayons[uid].mainStyle;
|
1100 |
main.css(mainStyle);
|
1101 |
// Width styles also apply to crayon
|
1102 |
crayons[uid].css('height', 'auto');
|
1107 |
|
1108 |
var reconsileDimensions = function (uid) {
|
1109 |
// Reconsile dimensions
|
1110 |
+
crayons[uid].plain.outerHeight(crayons[uid].main.outerHeight());
|
1111 |
};
|
1112 |
|
1113 |
var reconsileLines = function (uid) {
|
1117 |
var height = null;
|
1118 |
if (crayons[uid].wrapped) {
|
1119 |
line.css('height', '');
|
1120 |
+
height = line.outerHeight();
|
1121 |
height = height ? height : '';
|
1122 |
// TODO toolbar should overlay title if needed
|
1123 |
} else {
|
js/crayon_admin.js
CHANGED
@@ -531,14 +531,14 @@
|
|
531 |
base.createDialog(args);
|
532 |
};
|
533 |
|
534 |
-
base.createDialog = function (args) {
|
535 |
var defaultArgs = {
|
536 |
yesLabel: strings.yes,
|
537 |
noLabel: strings.no,
|
538 |
title: strings.confirm
|
539 |
};
|
540 |
args = $.extend(defaultArgs, args);
|
541 |
-
var options = {
|
542 |
modal: true, title: args.title, zIndex: 10000, autoOpen: true,
|
543 |
width: 'auto', resizable: false,
|
544 |
buttons: {
|
@@ -548,7 +548,7 @@
|
|
548 |
close: function (event, ui) {
|
549 |
$(this).remove();
|
550 |
}
|
551 |
-
};
|
552 |
options.buttons[args.yesLabel] = function () {
|
553 |
if (args.yes) {
|
554 |
args.yes();
|
531 |
base.createDialog(args);
|
532 |
};
|
533 |
|
534 |
+
base.createDialog = function (args, options) {
|
535 |
var defaultArgs = {
|
536 |
yesLabel: strings.yes,
|
537 |
noLabel: strings.no,
|
538 |
title: strings.confirm
|
539 |
};
|
540 |
args = $.extend(defaultArgs, args);
|
541 |
+
var options = $.extend({
|
542 |
modal: true, title: args.title, zIndex: 10000, autoOpen: true,
|
543 |
width: 'auto', resizable: false,
|
544 |
buttons: {
|
548 |
close: function (event, ui) {
|
549 |
$(this).remove();
|
550 |
}
|
551 |
+
}, options);
|
552 |
options.buttons[args.yesLabel] = function () {
|
553 |
if (args.yes) {
|
554 |
args.yes();
|
langs/default/default.txt
CHANGED
@@ -16,11 +16,11 @@
|
|
16 |
MODIFIER \b(?alt:modifier.txt)\b
|
17 |
|
18 |
# func() | func { | (Type) Var
|
19 |
-
ENTITY (\b[a-z_]\w*\b(?=\s*\([^\)]*\)))|((?<!\.)(\b[a-z_]\w*\b)(?=[^}
|
20 |
# C variants only: String *
|
21 |
POINTER_TYPE:ENTITY (\b[a-z_]\w*\s*\*)
|
22 |
|
23 |
-
VARIABLE ((
|
24 |
IDENTIFIER \b[A-Za-z_]\w*\b
|
25 |
CONSTANT (?<!\w)[0-9][\.\w]*
|
26 |
OPERATOR (?alt:operator.txt)
|
16 |
MODIFIER \b(?alt:modifier.txt)\b
|
17 |
|
18 |
# func() | func { | (Type) Var
|
19 |
+
ENTITY (\b[a-z_]\w*\b(?=\s*\([^\)]*\)))|((?<!\.)(\b[a-z_]\w*\b)(?=[^}=|,.:;"'\)]*{))|(\b[a-z_]\w+\b\s+(?=\b[a-z_]\w+\b))
|
20 |
# C variants only: String *
|
21 |
POINTER_TYPE:ENTITY (\b[a-z_]\w*\s*\*)
|
22 |
|
23 |
+
VARIABLE (([A-Za-z_]\w*(?=\s*[=\[\.])))
|
24 |
IDENTIFIER \b[A-Za-z_]\w*\b
|
25 |
CONSTANT (?<!\w)[0-9][\.\w]*
|
26 |
OPERATOR (?alt:operator.txt)
|
langs/js/js.txt
CHANGED
@@ -16,8 +16,8 @@
|
|
16 |
|
17 |
# For the <script> tag
|
18 |
ATT_STR:STRING (((?<!\\)".*?(?<!\\)")|((?<!\\)'.*?(?<!\\)'))
|
19 |
-
TAG
|
20 |
-
ATTR:ENTITY [\w-]+(?=\s*=\s*["'])
|
21 |
|
22 |
ENTITY (?default)
|
23 |
VARIABLE (?default)|\b\s*[A-Za-z_]\w*\s*\:
|
16 |
|
17 |
# For the <script> tag
|
18 |
ATT_STR:STRING (((?<!\\)".*?(?<!\\)")|((?<!\\)'.*?(?<!\\)'))
|
19 |
+
TAG </?\s*script\s*>?
|
20 |
+
ATTR:ENTITY [\w-]+(?=\s*=\s*["'])
|
21 |
|
22 |
ENTITY (?default)
|
23 |
VARIABLE (?default)|\b\s*[A-Za-z_]\w*\s*\:
|
langs/js/reserved.txt
CHANGED
@@ -100,6 +100,7 @@ scroll
|
|
100 |
typeof
|
101 |
window
|
102 |
opener
|
|
|
103 |
escape
|
104 |
length
|
105 |
Option
|
100 |
typeof
|
101 |
window
|
102 |
opener
|
103 |
+
delete
|
104 |
escape
|
105 |
length
|
106 |
Option
|
langs/php/php.txt
CHANGED
@@ -8,7 +8,7 @@
|
|
8 |
COMMENT (?default)|(\#.*?$)
|
9 |
STRING (?default)|(<<<EOT.*?^EOT)
|
10 |
|
11 |
-
TAG <\?php|<\?|\?>
|
12 |
CONSTRUCT:KEYWORD \b(?alt:construct.txt)\b
|
13 |
STATEMENT (?default)
|
14 |
RESERVED (?default)
|
8 |
COMMENT (?default)|(\#.*?$)
|
9 |
STRING (?default)|(<<<EOT.*?^EOT)
|
10 |
|
11 |
+
TAG <\?php\b|<\?|\?>
|
12 |
CONSTRUCT:KEYWORD \b(?alt:construct.txt)\b
|
13 |
STATEMENT (?default)
|
14 |
RESERVED (?default)
|
readme.txt
CHANGED
@@ -49,7 +49,7 @@ It also supports some neat features like:
|
|
49 |
* Local directory to search for local files
|
50 |
* File extension detection
|
51 |
* Live Preview in settings
|
52 |
-
* Dimensions, margins, alignment
|
53 |
* Extensive error logging
|
54 |
|
55 |
**Links**
|
@@ -153,6 +153,8 @@ These are helpful for discovering new features.
|
|
153 |
|
154 |
A handful of articles from others written about Crayon, thanks guys!
|
155 |
|
|
|
|
|
156 |
* <a href="http://www.wordpressthemeshq.net/5-best-syntax-highlighter-plugins-for-wordpress/" target="_blank">5 Best Syntax Highlighter Plugins for WordPress</a>
|
157 |
* <a href="http://amecylia.com/how-to-post-source-code-wordpress/" target="_blank">How To Post Source Code In Wordpress</a>
|
158 |
* <a href="http://icrunched.co/top-5-syntax-highlighter-wordpress-plugins/" target="_blank">Top 5 Syntax Highlighter WordPress Plugins</a>
|
@@ -181,8 +183,11 @@ A handful of articles from others written about Crayon, thanks guys!
|
|
181 |
|
182 |
**Donations**
|
183 |
|
184 |
-
Thanks to all those who donate to
|
185 |
|
|
|
|
|
|
|
186 |
* Raam Dev, (http://raamdev.com/), USA
|
187 |
* Scot Ranney, (http://scotsscripts.com/), USA
|
188 |
* Nico Hartung, (http://www.loggn.de/), Germany
|
@@ -238,6 +243,21 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
|
|
238 |
|
239 |
== Changelog ==
|
240 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
= 2.1.2 =
|
242 |
* ADDED:
|
243 |
* R language
|
49 |
* Local directory to search for local files
|
50 |
* File extension detection
|
51 |
* Live Preview in settings
|
52 |
+
* Dimensions, margins, alignment, font-size, line-height, float
|
53 |
* Extensive error logging
|
54 |
|
55 |
**Links**
|
153 |
|
154 |
A handful of articles from others written about Crayon, thanks guys!
|
155 |
|
156 |
+
* <a href="http://www.jjpro.net/2013/01/13/how-to-post-source-code-on-wordpress-2/" target="_blank">How to post source code on WordPress</a>
|
157 |
+
* <a href="http://www.emanueleferonato.com/2013/02/01/syntax-highlighter-switched-to-crayon/" target="_blank">Syntax highlighter switched to Crayon</a>
|
158 |
* <a href="http://www.wordpressthemeshq.net/5-best-syntax-highlighter-plugins-for-wordpress/" target="_blank">5 Best Syntax Highlighter Plugins for WordPress</a>
|
159 |
* <a href="http://amecylia.com/how-to-post-source-code-wordpress/" target="_blank">How To Post Source Code In Wordpress</a>
|
160 |
* <a href="http://icrunched.co/top-5-syntax-highlighter-wordpress-plugins/" target="_blank">Top 5 Syntax Highlighter WordPress Plugins</a>
|
183 |
|
184 |
**Donations**
|
185 |
|
186 |
+
Thanks to all those who donate to the project:
|
187 |
|
188 |
+
* Anthony Steiner, (http://steinerd.com/), US
|
189 |
+
* Alexander Harvey, (http://alexharvey.eu/), UK
|
190 |
+
* Minhazul Haque Shawon, Cyprus
|
191 |
* Raam Dev, (http://raamdev.com/), USA
|
192 |
* Scot Ranney, (http://scotsscripts.com/), USA
|
193 |
* Nico Hartung, (http://www.loggn.de/), Germany
|
243 |
|
244 |
== Changelog ==
|
245 |
|
246 |
+
= 2.1.3 =
|
247 |
+
* ADDED:
|
248 |
+
* Line height can now be customised along with font size
|
249 |
+
* AJAX method for highlighting Crayon using ajaxurl. See http://aramk.com/crayon/adding-crayon-to-posts-in-wordpress-programmatically/.
|
250 |
+
* Ability to capture code tags as inline Crayons
|
251 |
+
* Terminal theme
|
252 |
+
* FIXED:
|
253 |
+
* Expanding code issues to do with position and dimensions
|
254 |
+
* Toolbar font-size and line height improvements
|
255 |
+
* Now settings which affect capturing trigger a refresh of crayon posts when modified
|
256 |
+
* Added message about emailing in submit window of theme editor
|
257 |
+
* Border is now drawn inside so right border won't clip from theme CSS
|
258 |
+
* Comments were not detected to contain Crayons unless edited in wp-admin
|
259 |
+
* Highlighting improvements for variables and entities
|
260 |
+
|
261 |
= 2.1.2 =
|
262 |
* ADDED:
|
263 |
* R language
|
themes/classic/classic.css
CHANGED
@@ -92,7 +92,7 @@ URL: http://aramk.com/
|
|
92 |
color: #999 !important;
|
93 |
}
|
94 |
.crayon-theme-classic .crayon-button {
|
95 |
-
background-color:
|
96 |
}
|
97 |
.crayon-theme-classic .crayon-button:hover {
|
98 |
background-color: #EEE;
|
92 |
color: #999 !important;
|
93 |
}
|
94 |
.crayon-theme-classic .crayon-button {
|
95 |
+
background-color: #DDD;
|
96 |
}
|
97 |
.crayon-theme-classic .crayon-button:hover {
|
98 |
background-color: #EEE;
|
themes/terminal/terminal.css
ADDED
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Name: Terminal
|
3 |
+
Description: Looks like a terminal.
|
4 |
+
Version: 1.0
|
5 |
+
Author: Aram Kocharyan
|
6 |
+
URL: http://aramk.com/
|
7 |
+
*/
|
8 |
+
.crayon-theme-terminal {
|
9 |
+
border-width: 1px !important;
|
10 |
+
border-color: #999 !important;
|
11 |
+
border-style: solid !important;
|
12 |
+
text-shadow: none !important;
|
13 |
+
background: #1b3400 !important;
|
14 |
+
}
|
15 |
+
.crayon-theme-terminal-inline {
|
16 |
+
border-width: 1px !important;
|
17 |
+
border-color: #ddd !important;
|
18 |
+
border-style: solid !important;
|
19 |
+
background: #1b3400 !important;
|
20 |
+
}
|
21 |
+
.crayon-theme-terminal .crayon-table .crayon-nums {
|
22 |
+
background: #286900 !important;
|
23 |
+
color: #97cf32 !important;
|
24 |
+
border-right-color: #55a800 !important;
|
25 |
+
border-right-width: 2 !important;
|
26 |
+
border-right-style: solid !important;
|
27 |
+
}
|
28 |
+
.crayon-theme-terminal *::selection {
|
29 |
+
background: transparent !important;
|
30 |
+
}
|
31 |
+
.crayon-theme-terminal .crayon-code *::selection {
|
32 |
+
background: #ddeeff !important;
|
33 |
+
color: #316ba5 !important;
|
34 |
+
}
|
35 |
+
.crayon-theme-terminal .crayon-striped-line {
|
36 |
+
background: #1a4100 !important;
|
37 |
+
}
|
38 |
+
.crayon-theme-terminal .crayon-striped-num {
|
39 |
+
background: #478100 !important;
|
40 |
+
color: #97cf32 !important;
|
41 |
+
}
|
42 |
+
.crayon-theme-terminal .crayon-marked-line {
|
43 |
+
background: #2e5a00 !important;
|
44 |
+
border-width: 1px !important;
|
45 |
+
border-color: #667f00 !important;
|
46 |
+
}
|
47 |
+
.crayon-theme-terminal .crayon-marked-num {
|
48 |
+
color: #97cf32 !important;
|
49 |
+
background: #2f5f00 !important;
|
50 |
+
border-width: 1px !important;
|
51 |
+
border-color: #5999d9 !important;
|
52 |
+
}
|
53 |
+
.crayon-theme-terminal .crayon-marked-line.crayon-striped-line {
|
54 |
+
background: #4a6500 !important;
|
55 |
+
}
|
56 |
+
.crayon-theme-terminal .crayon-marked-num.crayon-striped-num {
|
57 |
+
background: #567d00 !important;
|
58 |
+
color: #97cf32 !important;
|
59 |
+
}
|
60 |
+
.crayon-theme-terminal .crayon-marked-line.crayon-top {
|
61 |
+
border-top-style: solid !important;
|
62 |
+
}
|
63 |
+
.crayon-theme-terminal .crayon-marked-num.crayon-top {
|
64 |
+
border-top-style: solid !important;
|
65 |
+
}
|
66 |
+
.crayon-theme-terminal .crayon-marked-line.crayon-bottom {
|
67 |
+
border-bottom-style: solid !important;
|
68 |
+
}
|
69 |
+
.crayon-theme-terminal .crayon-marked-num.crayon-bottom {
|
70 |
+
border-bottom-style: solid !important;
|
71 |
+
}
|
72 |
+
.crayon-theme-terminal .crayon-info {
|
73 |
+
background: #faf9d7 !important;
|
74 |
+
border-bottom-width: 1px !important;
|
75 |
+
border-bottom-color: #b1af5e !important;
|
76 |
+
border-bottom-style: solid !important;
|
77 |
+
color: #7e7d34 !important;
|
78 |
+
}
|
79 |
+
.crayon-theme-terminal .crayon-toolbar {
|
80 |
+
background: #375e00 !important;
|
81 |
+
border-bottom-width: 1px !important;
|
82 |
+
border-bottom-color: #779700 !important;
|
83 |
+
border-bottom-style: solid !important;
|
84 |
+
}
|
85 |
+
.crayon-theme-terminal .crayon-toolbar > div {
|
86 |
+
float: left !important;
|
87 |
+
}
|
88 |
+
.crayon-theme-terminal .crayon-toolbar .crayon-tools {
|
89 |
+
float: right !important;
|
90 |
+
}
|
91 |
+
.crayon-theme-terminal .crayon-title {
|
92 |
+
color: #87ca00 !important;
|
93 |
+
}
|
94 |
+
.crayon-theme-terminal .crayon-language {
|
95 |
+
color: #999 !important;
|
96 |
+
}
|
97 |
+
.crayon-theme-terminal .crayon-button {
|
98 |
+
background-color: #669900 !important;
|
99 |
+
}
|
100 |
+
.crayon-theme-terminal .crayon-button:hover {
|
101 |
+
background-color: #76b800 !important;
|
102 |
+
color: #666;
|
103 |
+
}
|
104 |
+
.crayon-theme-terminal .crayon-button.crayon-pressed:hover {
|
105 |
+
background-color: #76b800 !important;
|
106 |
+
color: #666;
|
107 |
+
}
|
108 |
+
.crayon-theme-terminal .crayon-button.crayon-pressed {
|
109 |
+
background-color: #4e7a00 !important;
|
110 |
+
color: #FFF;
|
111 |
+
}
|
112 |
+
.crayon-theme-terminal .crayon-button.crayon-pressed:active {
|
113 |
+
background-color: #4e7a00 !important;
|
114 |
+
color: #FFF;
|
115 |
+
}
|
116 |
+
.crayon-theme-terminal .crayon-button:active {
|
117 |
+
background-color: #4e7a00 !important;
|
118 |
+
color: #FFF;
|
119 |
+
}
|
120 |
+
.crayon-theme-terminal .crayon-pre .c {
|
121 |
+
color: #ff9b00 !important;
|
122 |
+
}
|
123 |
+
.crayon-theme-terminal .crayon-pre .s {
|
124 |
+
color: #3ec700 !important;
|
125 |
+
}
|
126 |
+
.crayon-theme-terminal .crayon-pre .p {
|
127 |
+
color: #caaf00 !important;
|
128 |
+
}
|
129 |
+
.crayon-theme-terminal .crayon-pre .ta {
|
130 |
+
color: #ffdd00 !important;
|
131 |
+
}
|
132 |
+
.crayon-theme-terminal .crayon-pre .k {
|
133 |
+
color: #95e100 !important;
|
134 |
+
}
|
135 |
+
.crayon-theme-terminal .crayon-pre .st {
|
136 |
+
color: #95e100 !important;
|
137 |
+
}
|
138 |
+
.crayon-theme-terminal .crayon-pre .r {
|
139 |
+
color: #95e100 !important;
|
140 |
+
}
|
141 |
+
.crayon-theme-terminal .crayon-pre .t {
|
142 |
+
color: #95e100 !important;
|
143 |
+
}
|
144 |
+
.crayon-theme-terminal .crayon-pre .m {
|
145 |
+
color: #95e100 !important;
|
146 |
+
}
|
147 |
+
.crayon-theme-terminal .crayon-pre .i {
|
148 |
+
color: #ffffff !important;
|
149 |
+
}
|
150 |
+
.crayon-theme-terminal .crayon-pre .e {
|
151 |
+
color: #e7ff5e !important;
|
152 |
+
}
|
153 |
+
.crayon-theme-terminal .crayon-pre .v {
|
154 |
+
color: #ffffff !important;
|
155 |
+
}
|
156 |
+
.crayon-theme-terminal .crayon-pre .cn {
|
157 |
+
color: #e7ffb9 !important;
|
158 |
+
}
|
159 |
+
.crayon-theme-terminal .crayon-pre .o {
|
160 |
+
color: #95e100 !important;
|
161 |
+
}
|
162 |
+
.crayon-theme-terminal .crayon-pre .sy {
|
163 |
+
color: #c9c9c9 !important;
|
164 |
+
}
|
165 |
+
.crayon-theme-terminal .crayon-pre .n {
|
166 |
+
color: #d4ff8e !important;
|
167 |
+
font-style: italic !important;
|
168 |
+
}
|
169 |
+
.crayon-theme-terminal .crayon-pre .f {
|
170 |
+
color: #639f00 !important;
|
171 |
+
}
|
172 |
+
.crayon-theme-terminal .crayon-pre .h {
|
173 |
+
color: #ffffff !important;
|
174 |
+
}
|
util/theme-editor/theme_editor.js
CHANGED
@@ -476,13 +476,14 @@
|
|
476 |
}
|
477 |
}
|
478 |
}, args);
|
479 |
-
args.html = '<table class="field-table">';
|
480 |
if (args.desc) {
|
481 |
args.html += '<tr><td colspan="2">' + args.desc + '</td></tr>';
|
482 |
}
|
483 |
args.html += '<tr><td>' + args.text + ':</td><td>' + base.createInput('prompt-text') + '</td></tr>';
|
484 |
args.html += '</table>';
|
485 |
-
|
|
|
486 |
};
|
487 |
|
488 |
base.initUI = function () {
|
@@ -521,7 +522,6 @@
|
|
521 |
args.open = function (e, color) {
|
522 |
$('.ui-colorpicker-dialog .ui-button').addClass('button-primary');
|
523 |
if (colorPickerPos) {
|
524 |
-
console.log('colorPickerPos', colorPickerPos);
|
525 |
var picker = $('.ui-colorpicker-dialog:visible');
|
526 |
picker.css('left', colorPickerPos.left);
|
527 |
// picker.css('top', colorPickerPos.top);
|
@@ -579,10 +579,8 @@
|
|
579 |
};
|
580 |
|
581 |
base.colorPickerMove = function (picker) {
|
582 |
-
console.log('picker', picker);
|
583 |
if (picker) {
|
584 |
colorPickerPos = {left: picker.css('left'), top: picker.css('top')};
|
585 |
-
console.log('colorPickerPos', colorPickerPos);
|
586 |
}
|
587 |
};
|
588 |
|
476 |
}
|
477 |
}
|
478 |
}, args);
|
479 |
+
args.html = '<table class="field-table crayon-prompt-' + base.nameToID(args.title) + '">';
|
480 |
if (args.desc) {
|
481 |
args.html += '<tr><td colspan="2">' + args.desc + '</td></tr>';
|
482 |
}
|
483 |
args.html += '<tr><td>' + args.text + ':</td><td>' + base.createInput('prompt-text') + '</td></tr>';
|
484 |
args.html += '</table>';
|
485 |
+
var options = {width: '400px'};
|
486 |
+
admin.createDialog(args, options);
|
487 |
};
|
488 |
|
489 |
base.initUI = function () {
|
522 |
args.open = function (e, color) {
|
523 |
$('.ui-colorpicker-dialog .ui-button').addClass('button-primary');
|
524 |
if (colorPickerPos) {
|
|
|
525 |
var picker = $('.ui-colorpicker-dialog:visible');
|
526 |
picker.css('left', colorPickerPos.left);
|
527 |
// picker.css('top', colorPickerPos.top);
|
579 |
};
|
580 |
|
581 |
base.colorPickerMove = function (picker) {
|
|
|
582 |
if (picker) {
|
583 |
colorPickerPos = {left: picker.css('left'), top: picker.css('top')};
|
|
|
584 |
}
|
585 |
};
|
586 |
|
util/theme-editor/theme_editor.php
CHANGED
@@ -204,7 +204,7 @@ class CrayonThemeEditorWP {
|
|
204 |
'editingTheme' => crayon__("Editing Theme: %s"),
|
205 |
'creatingTheme' => crayon__("Creating Theme: %s"),
|
206 |
'submit' => crayon__("Submit Your Theme"),
|
207 |
-
'submitText' => crayon__("Submit your User Theme for inclusion as a Stock Theme in Crayon!"),
|
208 |
'message' => crayon__("Message"),
|
209 |
'submitMessage' => crayon__("Please include this theme in Crayon!"),
|
210 |
'submitSucceed' => crayon__("Submit was successful."),
|
204 |
'editingTheme' => crayon__("Editing Theme: %s"),
|
205 |
'creatingTheme' => crayon__("Creating Theme: %s"),
|
206 |
'submit' => crayon__("Submit Your Theme"),
|
207 |
+
'submitText' => crayon__("Submit your User Theme for inclusion as a Stock Theme in Crayon! This will email me your theme - make sure it's considerably different from the stock themes :)"),
|
208 |
'message' => crayon__("Message"),
|
209 |
'submitMessage' => crayon__("Please include this theme in Crayon!"),
|
210 |
'submitSucceed' => crayon__("Submit was successful."),
|