Version Description
- Added the ability to open the Crayon in an external window
Download this release
Release Info
Developer | akarmenia |
Plugin | Crayon Syntax Highlighter |
Version | 1.3.3 |
Comparing to | |
See all releases |
Code changes from version 1.3.2 to 1.3.3
- crayon_formatter.class.php +4 -2
- crayon_settings.class.php +2 -0
- crayon_settings_wp.class.php +2 -0
- crayon_wp.class.php +2 -1
- css/images/toolbar/popup_dark.png +0 -0
- css/images/toolbar/popup_light.png +0 -0
- css/style.css +23 -0
- global.php +1 -0
- js/crayon.js +43 -6
- js/crayon_admin.js +1 -1
- js/jquery.popup.js +95 -0
- js/test.html +31 -0
- readme.txt +4 -1
crayon_formatter.class.php
CHANGED
@@ -190,8 +190,10 @@ class CrayonFormatter {
|
|
190 |
$print_plain_button = '<a href="#" class="crayon-plain-button crayon-button" title="Toggle Plain Code" onclick="toggle_plain(\'' . $uid . '\'); return false;"></a>';
|
191 |
$print_copy_button = !$touch && $hl->setting_val(CrayonSettings::PLAIN) && $hl->setting_val(CrayonSettings::COPY) ?
|
192 |
'<a href="#" class="crayon-copy-button crayon-button" title="Copy Plain Code" onclick="copy_plain(\'' . $uid . '\'); return false;"></a>' : '';
|
|
|
|
|
193 |
} else {
|
194 |
-
$print_plain = $plain_settings = $print_plain_button = $print_copy_button = '';
|
195 |
}
|
196 |
if ($hl->setting_val(CrayonSettings::NUMS_TOGGLE)) {
|
197 |
$print_nums_button = '<a href="#" class="crayon-nums-button crayon-button" title="Toggle Line Numbers" onclick="toggle_nums(\'' . $uid . '\'); return false;"></a>';
|
@@ -203,7 +205,7 @@ class CrayonFormatter {
|
|
203 |
|
204 |
$toolbar = '
|
205 |
<div class="crayon-toolbar" settings="'.$toolbar_settings.'">'.$print_title.'
|
206 |
-
<div class="crayon-tools">'.$print_nums_button.$print_copy_button.$print_plain_button.$print_lang.'</div>
|
207 |
</div><div>'.$print_plain.'</div>'.'<div class="crayon-info"></div>';
|
208 |
|
209 |
|
190 |
$print_plain_button = '<a href="#" class="crayon-plain-button crayon-button" title="Toggle Plain Code" onclick="toggle_plain(\'' . $uid . '\'); return false;"></a>';
|
191 |
$print_copy_button = !$touch && $hl->setting_val(CrayonSettings::PLAIN) && $hl->setting_val(CrayonSettings::COPY) ?
|
192 |
'<a href="#" class="crayon-copy-button crayon-button" title="Copy Plain Code" onclick="copy_plain(\'' . $uid . '\'); return false;"></a>' : '';
|
193 |
+
$print_popup_button = !$touch && $hl->setting_val(CrayonSettings::POPUP) ?
|
194 |
+
'<a href="#" class="crayon-popup-button crayon-button" title="Open Code in Window" onclick="return false;"></a>' : '';
|
195 |
} else {
|
196 |
+
$print_plain = $plain_settings = $print_plain_button = $print_copy_button = $print_popup_button = '';
|
197 |
}
|
198 |
if ($hl->setting_val(CrayonSettings::NUMS_TOGGLE)) {
|
199 |
$print_nums_button = '<a href="#" class="crayon-nums-button crayon-button" title="Toggle Line Numbers" onclick="toggle_nums(\'' . $uid . '\'); return false;"></a>';
|
205 |
|
206 |
$toolbar = '
|
207 |
<div class="crayon-toolbar" settings="'.$toolbar_settings.'">'.$print_title.'
|
208 |
+
<div class="crayon-tools">'.$print_nums_button.$print_copy_button.$print_popup_button.$print_plain_button.$print_lang.'</div>
|
209 |
</div><div>'.$print_plain.'</div>'.'<div class="crayon-info"></div>';
|
210 |
|
211 |
|
crayon_settings.class.php
CHANGED
@@ -42,6 +42,7 @@ class CrayonSettings {
|
|
42 |
const TOOLBAR_HIDE = 'toolbar-hide';
|
43 |
const TOOLBAR_DELAY = 'toolbar-delay';
|
44 |
const COPY = 'copy';
|
|
|
45 |
const SHOW_LANG = 'show-lang';
|
46 |
const SHOW_TITLE = 'show-title';
|
47 |
const STRIPED = 'striped';
|
@@ -119,6 +120,7 @@ class CrayonSettings {
|
|
119 |
new CrayonSetting(self::TOOLBAR_HIDE, TRUE),
|
120 |
new CrayonSetting(self::TOOLBAR_DELAY, TRUE),
|
121 |
new CrayonSetting(self::COPY, TRUE),
|
|
|
122 |
new CrayonSetting(self::SHOW_LANG, array('When Found', 'Always', 'Never')),
|
123 |
new CrayonSetting(self::SHOW_TITLE, TRUE),
|
124 |
new CrayonSetting(self::STRIPED, TRUE),
|
42 |
const TOOLBAR_HIDE = 'toolbar-hide';
|
43 |
const TOOLBAR_DELAY = 'toolbar-delay';
|
44 |
const COPY = 'copy';
|
45 |
+
const POPUP = 'POPUP';
|
46 |
const SHOW_LANG = 'show-lang';
|
47 |
const SHOW_TITLE = 'show-title';
|
48 |
const STRIPED = 'striped';
|
120 |
new CrayonSetting(self::TOOLBAR_HIDE, TRUE),
|
121 |
new CrayonSetting(self::TOOLBAR_DELAY, TRUE),
|
122 |
new CrayonSetting(self::COPY, TRUE),
|
123 |
+
new CrayonSetting(self::POPUP, TRUE),
|
124 |
new CrayonSetting(self::SHOW_LANG, array('When Found', 'Always', 'Never')),
|
125 |
new CrayonSetting(self::SHOW_TITLE, TRUE),
|
126 |
new CrayonSetting(self::STRIPED, TRUE),
|
crayon_settings_wp.class.php
CHANGED
@@ -50,6 +50,7 @@ class CrayonSettingsWP {
|
|
50 |
public static function admin_scripts() {
|
51 |
global $CRAYON_VERSION;
|
52 |
wp_enqueue_script('crayon_jquery', plugins_url(CRAYON_JQUERY, __FILE__), array(), $CRAYON_VERSION);
|
|
|
53 |
wp_enqueue_script('crayon_admin_js', plugins_url(CRAYON_JS_ADMIN, __FILE__), array('crayon_jquery'), $CRAYON_VERSION);
|
54 |
wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS, __FILE__), array('crayon_jquery'), $CRAYON_VERSION);
|
55 |
}
|
@@ -464,6 +465,7 @@ class CrayonSettingsWP {
|
|
464 |
echo '<span id="crayon-copy-check">';
|
465 |
self::checkbox(array(CrayonSettings::COPY, 'Enable code copy/paste'));
|
466 |
echo '</span>';
|
|
|
467 |
echo 'Display scrollbars (when needed): ';
|
468 |
self::dropdown(CrayonSettings::SCROLL);
|
469 |
echo 'Tab size in spaces: ';
|
50 |
public static function admin_scripts() {
|
51 |
global $CRAYON_VERSION;
|
52 |
wp_enqueue_script('crayon_jquery', plugins_url(CRAYON_JQUERY, __FILE__), array(), $CRAYON_VERSION);
|
53 |
+
wp_enqueue_script('crayon_jquery_popup', plugins_url(CRAYON_JQUERY_POPUP, __FILE__), array(crayon_jquery), $CRAYON_VERSION);
|
54 |
wp_enqueue_script('crayon_admin_js', plugins_url(CRAYON_JS_ADMIN, __FILE__), array('crayon_jquery'), $CRAYON_VERSION);
|
55 |
wp_enqueue_script('crayon_js', plugins_url(CRAYON_JS, __FILE__), array('crayon_jquery'), $CRAYON_VERSION);
|
56 |
}
|
465 |
echo '<span id="crayon-copy-check">';
|
466 |
self::checkbox(array(CrayonSettings::COPY, 'Enable code copy/paste'));
|
467 |
echo '</span>';
|
468 |
+
self::checkbox(array(CrayonSettings::POPUP, 'Enable opening code in a window'));
|
469 |
echo 'Display scrollbars (when needed): ';
|
470 |
self::dropdown(CrayonSettings::SCROLL);
|
471 |
echo 'Tab size in spaces: ';
|
crayon_wp.class.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text. <a href="options-general.php?page=crayon_settings">View Settings.</a>
|
6 |
-
Version: 1.3.
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
License: GPL2
|
@@ -193,6 +193,7 @@ class CrayonWP {
|
|
193 |
wp_enqueue_style('crayon-style', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
|
194 |
wp_enqueue_script('crayon-jquery', plugins_url(CRAYON_JQUERY, __FILE__), array(), $CRAYON_VERSION);
|
195 |
wp_enqueue_script('crayon-js', plugins_url(CRAYON_JS, __FILE__), array('crayon-jquery'), $CRAYON_VERSION);
|
|
|
196 |
self::$included = TRUE;
|
197 |
}
|
198 |
|
3 |
Plugin Name: Crayon Syntax Highlighter
|
4 |
Plugin URI: http://ak.net84.net/
|
5 |
Description: Supports multiple languages, themes, highlighting from a URL, local file or post text. <a href="options-general.php?page=crayon_settings">View Settings.</a>
|
6 |
+
Version: 1.3.3
|
7 |
Author: Aram Kocharyan
|
8 |
Author URI: http://ak.net84.net/
|
9 |
License: GPL2
|
193 |
wp_enqueue_style('crayon-style', plugins_url(CRAYON_STYLE, __FILE__), array(), $CRAYON_VERSION);
|
194 |
wp_enqueue_script('crayon-jquery', plugins_url(CRAYON_JQUERY, __FILE__), array(), $CRAYON_VERSION);
|
195 |
wp_enqueue_script('crayon-js', plugins_url(CRAYON_JS, __FILE__), array('crayon-jquery'), $CRAYON_VERSION);
|
196 |
+
wp_enqueue_script('crayon-jquery-popup', plugins_url(CRAYON_JQUERY_POPUP, __FILE__), array('crayon-jquery'), $CRAYON_VERSION);
|
197 |
self::$included = TRUE;
|
198 |
}
|
199 |
|
css/images/toolbar/popup_dark.png
ADDED
Binary file
|
css/images/toolbar/popup_light.png
ADDED
Binary file
|
css/style.css
CHANGED
@@ -43,6 +43,15 @@ coloring etc.
|
|
43 |
overflow: auto;
|
44 |
}
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
.crayon-syntax,
|
47 |
.crayon-syntax .crayon-main,
|
48 |
.crayon-syntax .crayon-plain,
|
@@ -154,6 +163,20 @@ coloring etc.
|
|
154 |
background-image: url('images/toolbar/copy_dark.png');
|
155 |
}
|
156 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
/* Nums Button */
|
158 |
.crayon-syntax .crayon-toolbar a.crayon-button.crayon-nums-button:link {
|
159 |
background-image: url('images/toolbar/nums_dark.png');
|
43 |
overflow: auto;
|
44 |
}
|
45 |
|
46 |
+
.crayon-popup {
|
47 |
+
position: static !important;
|
48 |
+
}
|
49 |
+
|
50 |
+
.crayon-popup .crayon-main {
|
51 |
+
width: 100% !important;
|
52 |
+
height: auto !important;
|
53 |
+
}
|
54 |
+
|
55 |
.crayon-syntax,
|
56 |
.crayon-syntax .crayon-main,
|
57 |
.crayon-syntax .crayon-plain,
|
163 |
background-image: url('images/toolbar/copy_dark.png');
|
164 |
}
|
165 |
|
166 |
+
/* Popup Button */
|
167 |
+
.crayon-syntax .crayon-toolbar a.crayon-button.crayon-popup-button:link {
|
168 |
+
background-image: url('images/toolbar/popup_dark.png');
|
169 |
+
background-position: center;
|
170 |
+
background-repeat: no-repeat;
|
171 |
+
}
|
172 |
+
.crayon-syntax .crayon-toolbar a.crayon-button.crayon-popup-button:hover,
|
173 |
+
.crayon-syntax .crayon-toolbar a.crayon-button.crayon-popup-button.crayon-pressed {
|
174 |
+
background-image: url('images/toolbar/popup_light.png');
|
175 |
+
}
|
176 |
+
.crayon-syntax .crayon-toolbar a.crayon-button.crayon-popup-button:active {
|
177 |
+
background-image: url('images/toolbar/popup_dark.png');
|
178 |
+
}
|
179 |
+
|
180 |
/* Nums Button */
|
181 |
.crayon-syntax .crayon-toolbar a.crayon-button.crayon-nums-button:link {
|
182 |
background-image: url('images/toolbar/nums_dark.png');
|
global.php
CHANGED
@@ -51,6 +51,7 @@ define('CRAYON_README_FILE', CRAYON_ROOT_PATH . 'readme.txt');
|
|
51 |
define('CRAYON_LANG_EXT', CRAYON_LANG_PATH . 'extensions.txt');
|
52 |
define('CRAYON_HELP_FILE', CRAYON_UTIL_PATH . 'help.htm');
|
53 |
define('CRAYON_JQUERY', CRAYON_JS_DIR . 'jquery-1.5.min.js');
|
|
|
54 |
define('CRAYON_JS', CRAYON_JS_DIR . 'crayon.js');
|
55 |
define('CRAYON_JS_ADMIN', CRAYON_JS_DIR . 'crayon_admin.js');
|
56 |
define('CRAYON_STYLE', CRAYON_CSS_DIR . 'style.css');
|
51 |
define('CRAYON_LANG_EXT', CRAYON_LANG_PATH . 'extensions.txt');
|
52 |
define('CRAYON_HELP_FILE', CRAYON_UTIL_PATH . 'help.htm');
|
53 |
define('CRAYON_JQUERY', CRAYON_JS_DIR . 'jquery-1.5.min.js');
|
54 |
+
define('CRAYON_JQUERY_POPUP', CRAYON_JS_DIR . 'jquery.popup.js');
|
55 |
define('CRAYON_JS', CRAYON_JS_DIR . 'crayon.js');
|
56 |
define('CRAYON_JS_ADMIN', CRAYON_JS_DIR . 'crayon_admin.js');
|
57 |
define('CRAYON_STYLE', CRAYON_CSS_DIR . 'style.css');
|
js/crayon.js
CHANGED
@@ -6,12 +6,6 @@ var ON = true;
|
|
6 |
var OFF = false;
|
7 |
var DEBUG = true;
|
8 |
|
9 |
-
function crayon_log(string) {
|
10 |
-
if (typeof console != 'undefined' && DEBUG) {
|
11 |
-
console.log(string);
|
12 |
-
}
|
13 |
-
}
|
14 |
-
|
15 |
// jQuery
|
16 |
|
17 |
jQuery.noConflict();
|
@@ -30,6 +24,7 @@ var CRAYON_CODE = '.crayon-code';
|
|
30 |
var CRAYON_NUMS = '.crayon-nums';
|
31 |
var CRAYON_NUMS_CONTENT = '.crayon-nums-content';
|
32 |
var CRAYON_NUMS_BUTTON = '.crayon-nums-button';
|
|
|
33 |
|
34 |
jQuery(document).ready(function() {
|
35 |
init();
|
@@ -53,6 +48,7 @@ function init() {
|
|
53 |
var nums = jQuery(this).find(CRAYON_NUMS);
|
54 |
var nums_content = jQuery(this).find(CRAYON_NUMS_CONTENT);
|
55 |
var nums_button = jQuery(this).find(CRAYON_NUMS_BUTTON);
|
|
|
56 |
// Register the objects
|
57 |
make_uid(uid);
|
58 |
crayon[uid] = jQuery(this);
|
@@ -66,6 +62,7 @@ function init() {
|
|
66 |
crayon[uid].nums = nums;
|
67 |
crayon[uid].nums_content = nums_content;
|
68 |
crayon[uid].nums_button = nums_button;
|
|
|
69 |
crayon[uid].nums_visible = true;
|
70 |
crayon[uid].plain_visible = false;
|
71 |
|
@@ -129,6 +126,21 @@ function init() {
|
|
129 |
plain.click(function() { crayon_info(uid, '', false); });
|
130 |
info.click(function() { crayon_info(uid, '', false); });
|
131 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
plain.css('opacity', 0);
|
134 |
crayon.toolbar_neg_height = '-' + toolbar.height() + 'px';
|
@@ -201,6 +213,31 @@ function make_uid(uid) {
|
|
201 |
return false;
|
202 |
}
|
203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
function copy_plain(uid, hover) {
|
205 |
if (typeof crayon[uid] == 'undefined') {
|
206 |
return make_uid(uid);
|
6 |
var OFF = false;
|
7 |
var DEBUG = true;
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
// jQuery
|
10 |
|
11 |
jQuery.noConflict();
|
24 |
var CRAYON_NUMS = '.crayon-nums';
|
25 |
var CRAYON_NUMS_CONTENT = '.crayon-nums-content';
|
26 |
var CRAYON_NUMS_BUTTON = '.crayon-nums-button';
|
27 |
+
var CRAYON_POPUP_BUTTON = '.crayon-popup-button';
|
28 |
|
29 |
jQuery(document).ready(function() {
|
30 |
init();
|
48 |
var nums = jQuery(this).find(CRAYON_NUMS);
|
49 |
var nums_content = jQuery(this).find(CRAYON_NUMS_CONTENT);
|
50 |
var nums_button = jQuery(this).find(CRAYON_NUMS_BUTTON);
|
51 |
+
var popup_button = jQuery(this).find(CRAYON_POPUP_BUTTON);
|
52 |
// Register the objects
|
53 |
make_uid(uid);
|
54 |
crayon[uid] = jQuery(this);
|
62 |
crayon[uid].nums = nums;
|
63 |
crayon[uid].nums_content = nums_content;
|
64 |
crayon[uid].nums_button = nums_button;
|
65 |
+
crayon[uid].popup_button = popup_button;
|
66 |
crayon[uid].nums_visible = true;
|
67 |
crayon[uid].plain_visible = false;
|
68 |
|
126 |
plain.click(function() { crayon_info(uid, '', false); });
|
127 |
info.click(function() { crayon_info(uid, '', false); });
|
128 |
}
|
129 |
+
|
130 |
+
// Used for code popup
|
131 |
+
crayon[uid].popup_settings = popupWindow(popup_button, {
|
132 |
+
height:screen.height - 200,
|
133 |
+
width:screen.width - 100,
|
134 |
+
top:75,
|
135 |
+
left:50,
|
136 |
+
scrollbars:1,
|
137 |
+
windowURL:'http://www.google.com/',
|
138 |
+
data:'THIS IS COOL', // Data overrides URL
|
139 |
+
}, function() {
|
140 |
+
code_popup(uid);
|
141 |
+
}, function() {
|
142 |
+
//alert('after');
|
143 |
+
});
|
144 |
|
145 |
plain.css('opacity', 0);
|
146 |
crayon.toolbar_neg_height = '-' + toolbar.height() + 'px';
|
213 |
return false;
|
214 |
}
|
215 |
|
216 |
+
function code_popup(uid) {
|
217 |
+
if (typeof crayon[uid] == 'undefined') {
|
218 |
+
return make_uid(uid);
|
219 |
+
}
|
220 |
+
var settings = crayon[uid].popup_settings;
|
221 |
+
settings.data = get_all_css() + '<body style="padding:0; margin:0;"><div class="' + crayon[uid].attr('class') + ' crayon-popup">' + get_jquery_str(crayon[uid].main) + '</div></body>';
|
222 |
+
if (typeof settings == 'undefined') {
|
223 |
+
return;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
function get_jquery_str(object) {
|
228 |
+
return jQuery('<div>').append(object.clone()).remove().html();
|
229 |
+
}
|
230 |
+
|
231 |
+
// Get all CSS on the page as a string
|
232 |
+
function get_all_css() {
|
233 |
+
var css_str = ''
|
234 |
+
css = jQuery('link[rel="stylesheet"]').each(function() {
|
235 |
+
var string = get_jquery_str(jQuery(this));
|
236 |
+
css_str += string;
|
237 |
+
});
|
238 |
+
return css_str;
|
239 |
+
}
|
240 |
+
|
241 |
function copy_plain(uid, hover) {
|
242 |
if (typeof crayon[uid] == 'undefined') {
|
243 |
return make_uid(uid);
|
js/crayon_admin.js
CHANGED
@@ -24,7 +24,7 @@ function crayon_escape(string) {
|
|
24 |
}
|
25 |
|
26 |
jQuery(document).ready(function() {
|
27 |
-
crayon_log('admin loaded');
|
28 |
admin_init();
|
29 |
});
|
30 |
|
24 |
}
|
25 |
|
26 |
jQuery(document).ready(function() {
|
27 |
+
//crayon_log('admin loaded');
|
28 |
admin_init();
|
29 |
});
|
30 |
|
js/jquery.popup.js
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
// Default Settings
|
2 |
+
jqueryPopup = Object();
|
3 |
+
jqueryPopup.defaultSettings = {
|
4 |
+
centerBrowser:0, // center window over browser window? {1 (YES) or 0 (NO)}. overrides top and left
|
5 |
+
centerScreen:0, // center window over entire screen? {1 (YES) or 0 (NO)}. overrides top and left
|
6 |
+
height:500, // sets the height in pixels of the window.
|
7 |
+
left:0, // left position when the window appears.
|
8 |
+
location:0, // determines whether the address bar is displayed {1 (YES) or 0 (NO)}.
|
9 |
+
menubar:0, // determines whether the menu bar is displayed {1 (YES) or 0 (NO)}.
|
10 |
+
resizable:0, // whether the window can be resized {1 (YES) or 0 (NO)}. Can also be overloaded using resizable.
|
11 |
+
scrollbars:0, // determines whether scrollbars appear on the window {1 (YES) or 0 (NO)}.
|
12 |
+
status:0, // whether a status line appears at the bottom of the window {1 (YES) or 0 (NO)}.
|
13 |
+
width:500, // sets the width in pixels of the window.
|
14 |
+
windowName:null, // name of window set from the name attribute of the element that invokes the click
|
15 |
+
windowURL:null, // url used for the popup
|
16 |
+
top:0, // top position when the window appears.
|
17 |
+
toolbar:0, // determines whether a toolbar (includes the forward and back buttons) is displayed {1 (YES) or 0 (NO)}.
|
18 |
+
data:null,
|
19 |
+
event:'click'
|
20 |
+
};
|
21 |
+
|
22 |
+
function popupWindow(object, instanceSettings, beforeCallback, afterCallback) {
|
23 |
+
beforeCallback = typeof beforeCallback !== 'undefined' ? beforeCallback : null;
|
24 |
+
afterCallback = typeof afterCallback !== 'undefined' ? afterCallback : null;
|
25 |
+
|
26 |
+
if (typeof object == 'string') {
|
27 |
+
object = jQuery(object);
|
28 |
+
}
|
29 |
+
if (!(object instanceof jQuery)) {
|
30 |
+
return false;
|
31 |
+
}
|
32 |
+
var settings = jQuery.extend({}, jqueryPopup.defaultSettings, instanceSettings || {});
|
33 |
+
object.handler = jQuery(object).bind(settings.event, function() {
|
34 |
+
|
35 |
+
if (beforeCallback) {
|
36 |
+
beforeCallback();
|
37 |
+
}
|
38 |
+
|
39 |
+
var windowFeatures = 'height=' + settings.height +
|
40 |
+
',width=' + settings.width +
|
41 |
+
',toolbar=' + settings.toolbar +
|
42 |
+
',scrollbars=' + settings.scrollbars +
|
43 |
+
',status=' + settings.status +
|
44 |
+
',resizable=' + settings.resizable +
|
45 |
+
',location=' + settings.location +
|
46 |
+
',menuBar=' + settings.menubar;
|
47 |
+
|
48 |
+
settings.windowName = settings.windowName || this.name;
|
49 |
+
settings.windowURL = settings.windowURL || ( jQuery(this).attr('href') == '#' ? '' : this.href);
|
50 |
+
|
51 |
+
var centeredY,centeredX;
|
52 |
+
|
53 |
+
var win = null;
|
54 |
+
if (settings.centerBrowser) {
|
55 |
+
|
56 |
+
if (jQuery.browser.msie) {//hacked together for IE browsers
|
57 |
+
centeredY = (window.screenTop - 120) + ((((document.documentElement.clientHeight + 120)/2) - (settings.height/2)));
|
58 |
+
centeredX = window.screenLeft + ((((document.body.offsetWidth + 20)/2) - (settings.width/2)));
|
59 |
+
} else {
|
60 |
+
centeredY = window.screenY + (((window.outerHeight/2) - (settings.height/2)));
|
61 |
+
centeredX = window.screenX + (((window.outerWidth/2) - (settings.width/2)));
|
62 |
+
}
|
63 |
+
win = window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY);
|
64 |
+
} else if (settings.centerScreen) {
|
65 |
+
centeredY = (screen.height - settings.height)/2;
|
66 |
+
centeredX = (screen.width - settings.width)/2;
|
67 |
+
win = window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + centeredX +',top=' + centeredY);
|
68 |
+
} else {
|
69 |
+
win = window.open(settings.windowURL, settings.windowName, windowFeatures+',left=' + settings.left +',top=' + settings.top)
|
70 |
+
}
|
71 |
+
if (win != null) {
|
72 |
+
win.focus();
|
73 |
+
if (settings.data) {
|
74 |
+
win.document.write(settings.data);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
if (afterCallback) {
|
79 |
+
afterCallback();
|
80 |
+
}
|
81 |
+
});
|
82 |
+
return settings;
|
83 |
+
}
|
84 |
+
|
85 |
+
function popdownWindow(object, event) {
|
86 |
+
if (typeof event == 'undefined') {
|
87 |
+
event = 'click';
|
88 |
+
}
|
89 |
+
object = jQuery(object);
|
90 |
+
if (!(object instanceof jQuery)) {
|
91 |
+
return false;
|
92 |
+
}
|
93 |
+
object.unbind(event, object.handler);
|
94 |
+
}
|
95 |
+
|
js/test.html
ADDED
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<script type="text/javascript" src="http://localhost/crayon/wp-content/plugins/crayon-syntax-highlighter/js/jquery.popup.js"></script>
|
2 |
+
<script type="text/javascript" src="http://localhost/crayon/wp-content/plugins/crayon-syntax-highlighter/js/jquery-1.5.min.js"></script>
|
3 |
+
<!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>-->
|
4 |
+
<a href="#" class="example1demo" onclick="return false;">open popup</a>
|
5 |
+
|
6 |
+
<script type="text/javascript">
|
7 |
+
|
8 |
+
$(window).ready(function() {
|
9 |
+
// Bind the popup, multiple calls allowed
|
10 |
+
// '.example1demo' is also fine
|
11 |
+
settings = popupWindow($('.example1demo'), {
|
12 |
+
height:screen.height - 200,
|
13 |
+
width:screen.width - 100,
|
14 |
+
top:75,
|
15 |
+
left:50,
|
16 |
+
windowURL:'http://www.google.com/',
|
17 |
+
data:'THIS IS COOL', // Data overrides URL
|
18 |
+
}, function() {
|
19 |
+
//alert('before');
|
20 |
+
}, function() {
|
21 |
+
//alert('after');
|
22 |
+
});
|
23 |
+
|
24 |
+
// Redefine settings anywhere
|
25 |
+
settings.data = '<strong>THIS</strong> IS COOLER';
|
26 |
+
|
27 |
+
// Unbind the popup for all calls
|
28 |
+
//popdownWindow('.example1demo');
|
29 |
+
});
|
30 |
+
|
31 |
+
</script>
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://ak.net84.net/
|
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
-
Stable tag: 1.3.
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, highlighting from a URL, local file or post text.
|
10 |
|
@@ -44,6 +44,9 @@ Contact me at http://twitter.com/crayonsyntax or crayon.syntax@gmail.com.
|
|
44 |
|
45 |
== Changelog ==
|
46 |
|
|
|
|
|
|
|
47 |
= 1.3.2 =
|
48 |
* Added missing copy icon
|
49 |
|
4 |
Tags: syntax highlighter, syntax, highlighter, highlighting, crayon, code highlighter
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.3
|
7 |
+
Stable tag: 1.3.3
|
8 |
|
9 |
Syntax Highlighter supporting multiple languages, themes, highlighting from a URL, local file or post text.
|
10 |
|
44 |
|
45 |
== Changelog ==
|
46 |
|
47 |
+
= 1.3.3 =
|
48 |
+
* Added the ability to open the Crayon in an external window
|
49 |
+
|
50 |
= 1.3.2 =
|
51 |
* Added missing copy icon
|
52 |
|