Set eol-style to native.
git-svn-id: http://svn.automattic.com/wordpress/trunk@4747 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
189f061cd8
commit
132569c301
|
@ -1,397 +1,397 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function kubrick_head() {
|
function kubrick_head() {
|
||||||
$head = "<style type='text/css'>\n<!--";
|
$head = "<style type='text/css'>\n<!--";
|
||||||
$output = '';
|
$output = '';
|
||||||
if ( kubrick_header_image() ) {
|
if ( kubrick_header_image() ) {
|
||||||
$url = kubrick_header_image_url() ;
|
$url = kubrick_header_image_url() ;
|
||||||
$output .= "#header { background: url('$url') no-repeat bottom center; }\n";
|
$output .= "#header { background: url('$url') no-repeat bottom center; }\n";
|
||||||
}
|
}
|
||||||
if ( false !== ( $color = kubrick_header_color() ) ) {
|
if ( false !== ( $color = kubrick_header_color() ) ) {
|
||||||
$output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
|
$output .= "#headerimg h1 a, #headerimg h1 a:visited, #headerimg .description { color: $color; }\n";
|
||||||
}
|
}
|
||||||
if ( false !== ( $display = kubrick_header_display() ) ) {
|
if ( false !== ( $display = kubrick_header_display() ) ) {
|
||||||
$output .= "#headerimg { display: $display }\n";
|
$output .= "#headerimg { display: $display }\n";
|
||||||
}
|
}
|
||||||
$foot = "--></style>\n";
|
$foot = "--></style>\n";
|
||||||
if ( '' != $output )
|
if ( '' != $output )
|
||||||
echo $head . $output . $foot;
|
echo $head . $output . $foot;
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('wp_head', 'kubrick_head');
|
add_action('wp_head', 'kubrick_head');
|
||||||
|
|
||||||
function kubrick_header_image() {
|
function kubrick_header_image() {
|
||||||
return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
|
return apply_filters('kubrick_header_image', get_option('kubrick_header_image'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_upper_color() {
|
function kubrick_upper_color() {
|
||||||
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
||||||
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
||||||
return $q['upper'];
|
return $q['upper'];
|
||||||
} else
|
} else
|
||||||
return '69aee7';
|
return '69aee7';
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_lower_color() {
|
function kubrick_lower_color() {
|
||||||
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
if ( strstr( $url = kubrick_header_image_url(), 'header-img.php?' ) ) {
|
||||||
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
parse_str(substr($url, strpos($url, '?') + 1), $q);
|
||||||
return $q['lower'];
|
return $q['lower'];
|
||||||
} else
|
} else
|
||||||
return '4180b6';
|
return '4180b6';
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_header_image_url() {
|
function kubrick_header_image_url() {
|
||||||
if ( $image = kubrick_header_image() )
|
if ( $image = kubrick_header_image() )
|
||||||
$url = get_template_directory_uri() . '/images/' . $image;
|
$url = get_template_directory_uri() . '/images/' . $image;
|
||||||
else
|
else
|
||||||
$url = get_template_directory_uri() . '/images/kubrickheader.jpg';
|
$url = get_template_directory_uri() . '/images/kubrickheader.jpg';
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_header_color() {
|
function kubrick_header_color() {
|
||||||
return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
|
return apply_filters('kubrick_header_color', get_option('kubrick_header_color'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_header_color_string() {
|
function kubrick_header_color_string() {
|
||||||
$color = kubrick_header_color();
|
$color = kubrick_header_color();
|
||||||
if ( false === $color )
|
if ( false === $color )
|
||||||
return 'white';
|
return 'white';
|
||||||
|
|
||||||
return $color;
|
return $color;
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_header_display() {
|
function kubrick_header_display() {
|
||||||
return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
|
return apply_filters('kubrick_header_display', get_option('kubrick_header_display'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_header_display_string() {
|
function kubrick_header_display_string() {
|
||||||
$display = kubrick_header_display();
|
$display = kubrick_header_display();
|
||||||
return $display ? $display : 'inline';
|
return $display ? $display : 'inline';
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action('admin_menu', 'kubrick_add_theme_page');
|
add_action('admin_menu', 'kubrick_add_theme_page');
|
||||||
|
|
||||||
function kubrick_add_theme_page() {
|
function kubrick_add_theme_page() {
|
||||||
if ( $_GET['page'] == basename(__FILE__) ) {
|
if ( $_GET['page'] == basename(__FILE__) ) {
|
||||||
if ( 'save' == $_REQUEST['action'] ) {
|
if ( 'save' == $_REQUEST['action'] ) {
|
||||||
if ( isset($_REQUEST['njform']) ) {
|
if ( isset($_REQUEST['njform']) ) {
|
||||||
if ( isset($_REQUEST['defaults']) ) {
|
if ( isset($_REQUEST['defaults']) ) {
|
||||||
delete_option('kubrick_header_image');
|
delete_option('kubrick_header_image');
|
||||||
delete_option('kubrick_header_color');
|
delete_option('kubrick_header_color');
|
||||||
delete_option('kubrick_header_display');
|
delete_option('kubrick_header_display');
|
||||||
} else {
|
} else {
|
||||||
if ( '' == $_REQUEST['njfontcolor'] )
|
if ( '' == $_REQUEST['njfontcolor'] )
|
||||||
delete_option('kubrick_header_color');
|
delete_option('kubrick_header_color');
|
||||||
else
|
else
|
||||||
update_option('kubrick_header_color', $_REQUEST['njfontcolor']);
|
update_option('kubrick_header_color', $_REQUEST['njfontcolor']);
|
||||||
|
|
||||||
if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
|
if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
|
||||||
$uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
|
$uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
|
||||||
$lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
|
$lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
|
||||||
update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
|
update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($_REQUEST['toggledisplay']) ) {
|
if ( isset($_REQUEST['toggledisplay']) ) {
|
||||||
if ( false === get_option('kubrick_header_display') )
|
if ( false === get_option('kubrick_header_display') )
|
||||||
update_option('kubrick_header_display', 'none');
|
update_option('kubrick_header_display', 'none');
|
||||||
else
|
else
|
||||||
delete_option('kubrick_header_display');
|
delete_option('kubrick_header_display');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if ( isset($_REQUEST['headerimage']) ) {
|
if ( isset($_REQUEST['headerimage']) ) {
|
||||||
if ( '' == $_REQUEST['headerimage'] )
|
if ( '' == $_REQUEST['headerimage'] )
|
||||||
delete_option('kubrick_header_image');
|
delete_option('kubrick_header_image');
|
||||||
else
|
else
|
||||||
update_option('kubrick_header_image', $_REQUEST['headerimage']);
|
update_option('kubrick_header_image', $_REQUEST['headerimage']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($_REQUEST['fontcolor']) ) {
|
if ( isset($_REQUEST['fontcolor']) ) {
|
||||||
if ( '' == $_REQUEST['fontcolor'] )
|
if ( '' == $_REQUEST['fontcolor'] )
|
||||||
delete_option('kubrick_header_color');
|
delete_option('kubrick_header_color');
|
||||||
else
|
else
|
||||||
update_option('kubrick_header_color', $_REQUEST['fontcolor']);
|
update_option('kubrick_header_color', $_REQUEST['fontcolor']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset($_REQUEST['fontdisplay']) ) {
|
if ( isset($_REQUEST['fontdisplay']) ) {
|
||||||
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
|
if ( '' == $_REQUEST['fontdisplay'] || 'inline' == $_REQUEST['fontdisplay'] )
|
||||||
delete_option('kubrick_header_display');
|
delete_option('kubrick_header_display');
|
||||||
else
|
else
|
||||||
update_option('kubrick_header_display', 'none');
|
update_option('kubrick_header_display', 'none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//print_r($_REQUEST);
|
//print_r($_REQUEST);
|
||||||
wp_redirect("themes.php?page=functions.php&saved=true");
|
wp_redirect("themes.php?page=functions.php&saved=true");
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
add_action('admin_head', 'kubrick_theme_page_head');
|
add_action('admin_head', 'kubrick_theme_page_head');
|
||||||
}
|
}
|
||||||
add_theme_page('Customize Header', 'Header Image and Color', 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
|
add_theme_page('Customize Header', 'Header Image and Color', 'edit_themes', basename(__FILE__), 'kubrick_theme_page');
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_theme_page_head() {
|
function kubrick_theme_page_head() {
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
|
<script type="text/javascript" src="../wp-includes/js/colorpicker.js"></script>
|
||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
function pickColor(color) {
|
function pickColor(color) {
|
||||||
ColorPicker_targetInput.value = color;
|
ColorPicker_targetInput.value = color;
|
||||||
kUpdate(ColorPicker_targetInput.id);
|
kUpdate(ColorPicker_targetInput.id);
|
||||||
}
|
}
|
||||||
function PopupWindow_populate(contents) {
|
function PopupWindow_populate(contents) {
|
||||||
contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" value="Close Color Picker" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
|
contents += '<br /><p style="text-align:center;margin-top:0px;"><input type="button" value="Close Color Picker" onclick="cp.hidePopup(\'prettyplease\')"></input></p>';
|
||||||
this.contents = contents;
|
this.contents = contents;
|
||||||
this.populated = false;
|
this.populated = false;
|
||||||
}
|
}
|
||||||
function PopupWindow_hidePopup(magicword) {
|
function PopupWindow_hidePopup(magicword) {
|
||||||
if ( magicword != 'prettyplease' )
|
if ( magicword != 'prettyplease' )
|
||||||
return false;
|
return false;
|
||||||
if (this.divName != null) {
|
if (this.divName != null) {
|
||||||
if (this.use_gebi) {
|
if (this.use_gebi) {
|
||||||
document.getElementById(this.divName).style.visibility = "hidden";
|
document.getElementById(this.divName).style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
else if (this.use_css) {
|
else if (this.use_css) {
|
||||||
document.all[this.divName].style.visibility = "hidden";
|
document.all[this.divName].style.visibility = "hidden";
|
||||||
}
|
}
|
||||||
else if (this.use_layers) {
|
else if (this.use_layers) {
|
||||||
document.layers[this.divName].visibility = "hidden";
|
document.layers[this.divName].visibility = "hidden";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.popupWindow && !this.popupWindow.closed) {
|
if (this.popupWindow && !this.popupWindow.closed) {
|
||||||
this.popupWindow.close();
|
this.popupWindow.close();
|
||||||
this.popupWindow = null;
|
this.popupWindow = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
function colorSelect(t,p) {
|
function colorSelect(t,p) {
|
||||||
if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
|
if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" )
|
||||||
cp.hidePopup('prettyplease');
|
cp.hidePopup('prettyplease');
|
||||||
else {
|
else {
|
||||||
cp.p = p;
|
cp.p = p;
|
||||||
cp.select(t,p);
|
cp.select(t,p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function PopupWindow_setSize(width,height) {
|
function PopupWindow_setSize(width,height) {
|
||||||
this.width = 162;
|
this.width = 162;
|
||||||
this.height = 210;
|
this.height = 210;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cp = new ColorPicker();
|
var cp = new ColorPicker();
|
||||||
function advUpdate(val, obj) {
|
function advUpdate(val, obj) {
|
||||||
document.getElementById(obj).value = val;
|
document.getElementById(obj).value = val;
|
||||||
kUpdate(obj);
|
kUpdate(obj);
|
||||||
}
|
}
|
||||||
function kUpdate(oid) {
|
function kUpdate(oid) {
|
||||||
if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
|
if ( 'uppercolor' == oid || 'lowercolor' == oid ) {
|
||||||
uc = document.getElementById('uppercolor').value.replace('#', '');
|
uc = document.getElementById('uppercolor').value.replace('#', '');
|
||||||
lc = document.getElementById('lowercolor').value.replace('#', '');
|
lc = document.getElementById('lowercolor').value.replace('#', '');
|
||||||
hi = document.getElementById('headerimage');
|
hi = document.getElementById('headerimage');
|
||||||
hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
|
hi.value = 'header-img.php?upper='+uc+'&lower='+lc;
|
||||||
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
|
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/'+hi.value+'") center no-repeat';
|
||||||
document.getElementById('advuppercolor').value = '#'+uc;
|
document.getElementById('advuppercolor').value = '#'+uc;
|
||||||
document.getElementById('advlowercolor').value = '#'+lc;
|
document.getElementById('advlowercolor').value = '#'+lc;
|
||||||
}
|
}
|
||||||
if ( 'fontcolor' == oid ) {
|
if ( 'fontcolor' == oid ) {
|
||||||
document.getElementById('header').style.color = document.getElementById('fontcolor').value;
|
document.getElementById('header').style.color = document.getElementById('fontcolor').value;
|
||||||
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
|
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value;
|
||||||
}
|
}
|
||||||
if ( 'fontdisplay' == oid ) {
|
if ( 'fontdisplay' == oid ) {
|
||||||
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
|
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function toggleDisplay() {
|
function toggleDisplay() {
|
||||||
td = document.getElementById('fontdisplay');
|
td = document.getElementById('fontdisplay');
|
||||||
td.value = ( td.value == 'none' ) ? 'inline' : 'none';
|
td.value = ( td.value == 'none' ) ? 'inline' : 'none';
|
||||||
kUpdate('fontdisplay');
|
kUpdate('fontdisplay');
|
||||||
}
|
}
|
||||||
function toggleAdvanced() {
|
function toggleAdvanced() {
|
||||||
a = document.getElementById('jsAdvanced');
|
a = document.getElementById('jsAdvanced');
|
||||||
if ( a.style.display == 'none' )
|
if ( a.style.display == 'none' )
|
||||||
a.style.display = 'block';
|
a.style.display = 'block';
|
||||||
else
|
else
|
||||||
a.style.display = 'none';
|
a.style.display = 'none';
|
||||||
}
|
}
|
||||||
function kDefaults() {
|
function kDefaults() {
|
||||||
document.getElementById('headerimage').value = '';
|
document.getElementById('headerimage').value = '';
|
||||||
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
|
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7';
|
||||||
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
|
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#4180b6';
|
||||||
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg") center no-repeat';
|
document.getElementById('header').style.background = 'url("<?php echo get_template_directory_uri(); ?>/images/kubrickheader.jpg") center no-repeat';
|
||||||
document.getElementById('header').style.color = '#FFFFFF';
|
document.getElementById('header').style.color = '#FFFFFF';
|
||||||
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
|
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '';
|
||||||
document.getElementById('fontdisplay').value = 'inline';
|
document.getElementById('fontdisplay').value = 'inline';
|
||||||
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
|
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
|
||||||
}
|
}
|
||||||
function kRevert() {
|
function kRevert() {
|
||||||
document.getElementById('headerimage').value = '<?php echo kubrick_header_image(); ?>';
|
document.getElementById('headerimage').value = '<?php echo kubrick_header_image(); ?>';
|
||||||
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo kubrick_upper_color(); ?>';
|
document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo kubrick_upper_color(); ?>';
|
||||||
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo kubrick_lower_color(); ?>';
|
document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo kubrick_lower_color(); ?>';
|
||||||
document.getElementById('header').style.background = 'url("<?php echo kubrick_header_image_url(); ?>") center no-repeat';
|
document.getElementById('header').style.background = 'url("<?php echo kubrick_header_image_url(); ?>") center no-repeat';
|
||||||
document.getElementById('header').style.color = '';
|
document.getElementById('header').style.color = '';
|
||||||
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo kubrick_header_color_string(); ?>';
|
document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo kubrick_header_color_string(); ?>';
|
||||||
document.getElementById('fontdisplay').value = '<?php echo kubrick_header_display_string(); ?>';
|
document.getElementById('fontdisplay').value = '<?php echo kubrick_header_display_string(); ?>';
|
||||||
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
|
document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value;
|
||||||
}
|
}
|
||||||
function kInit() {
|
function kInit() {
|
||||||
document.getElementById('jsForm').style.display = 'block';
|
document.getElementById('jsForm').style.display = 'block';
|
||||||
document.getElementById('nonJsForm').style.display = 'none';
|
document.getElementById('nonJsForm').style.display = 'none';
|
||||||
}
|
}
|
||||||
addLoadEvent(kInit);
|
addLoadEvent(kInit);
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
<style type='text/css'>
|
<style type='text/css'>
|
||||||
#headwrap {
|
#headwrap {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
#kubrick-header {
|
#kubrick-header {
|
||||||
font-size: 80%;
|
font-size: 80%;
|
||||||
}
|
}
|
||||||
#kubrick-header .hibrowser {
|
#kubrick-header .hibrowser {
|
||||||
width: 780px;
|
width: 780px;
|
||||||
height: 260px;
|
height: 260px;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
#kubrick-header #hitarget {
|
#kubrick-header #hitarget {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
#kubrick-header #header h1 {
|
#kubrick-header #header h1 {
|
||||||
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 4em;
|
font-size: 4em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding-top: 70px;
|
padding-top: 70px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#kubrick-header #header .description {
|
#kubrick-header #header .description {
|
||||||
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
|
||||||
font-size: 1.2em;
|
font-size: 1.2em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
#kubrick-header #header {
|
#kubrick-header #header {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: <?php echo kubrick_header_color_string(); ?>;
|
color: <?php echo kubrick_header_color_string(); ?>;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
|
background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat;
|
||||||
}
|
}
|
||||||
#kubrick-header #headerimg {
|
#kubrick-header #headerimg {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
height: 200px;
|
height: 200px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: <?php echo kubrick_header_display_string(); ?>;
|
display: <?php echo kubrick_header_display_string(); ?>;
|
||||||
}
|
}
|
||||||
#jsForm {
|
#jsForm {
|
||||||
display: none;
|
display: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
#jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
|
#jsForm input.submit, #jsForm input.button, #jsAdvanced input.button {
|
||||||
padding: 0px;
|
padding: 0px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
}
|
}
|
||||||
#advanced {
|
#advanced {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 620px;
|
width: 620px;
|
||||||
}
|
}
|
||||||
html>body #advanced {
|
html>body #advanced {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
margin-left: -380px;
|
margin-left: -380px;
|
||||||
}
|
}
|
||||||
#jsAdvanced {
|
#jsAdvanced {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
#nonJsForm {
|
#nonJsForm {
|
||||||
position: relative;
|
position: relative;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
margin-left: -370px;
|
margin-left: -370px;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
}
|
}
|
||||||
#nonJsForm label {
|
#nonJsForm label {
|
||||||
padding-top: 6px;
|
padding-top: 6px;
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
float: left;
|
float: left;
|
||||||
width: 100px;
|
width: 100px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
.defbutton {
|
.defbutton {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.zerosize {
|
.zerosize {
|
||||||
width: 0px;
|
width: 0px;
|
||||||
height: 0px;
|
height: 0px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
#colorPickerDiv a, #colorPickerDiv a:hover {
|
#colorPickerDiv a, #colorPickerDiv a:hover {
|
||||||
padding: 1px;
|
padding: 1px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
border-bottom: 0px;
|
border-bottom: 0px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
function kubrick_theme_page() {
|
function kubrick_theme_page() {
|
||||||
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>Options saved.</strong></p></div>';
|
if ( $_REQUEST['saved'] ) echo '<div id="message" class="updated fade"><p><strong>Options saved.</strong></p></div>';
|
||||||
?>
|
?>
|
||||||
<div class='wrap'>
|
<div class='wrap'>
|
||||||
<div id="kubrick-header">
|
<div id="kubrick-header">
|
||||||
<h2>Header Image and Color</h2>
|
<h2>Header Image and Color</h2>
|
||||||
<div id="headwrap">
|
<div id="headwrap">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="headerimg">
|
<div id="headerimg">
|
||||||
<h1><?php bloginfo('name'); ?></h1>
|
<h1><?php bloginfo('name'); ?></h1>
|
||||||
<div class="description"><?php bloginfo('description'); ?></div>
|
<div class="description"><?php bloginfo('description'); ?></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div id="nonJsForm">
|
<div id="nonJsForm">
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<div class="zerosize"><input type="submit" name="defaultsubmit" value="Save" /></div>
|
<div class="zerosize"><input type="submit" name="defaultsubmit" value="Save" /></div>
|
||||||
<label for="njfontcolor">Font Color:</label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo kubrick_header_color(); ?>" /> Any CSS color (<code>red</code> or <code>#FF0000</code> or <code>rgb(255, 0, 0)</code>)<br />
|
<label for="njfontcolor">Font Color:</label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo kubrick_header_color(); ?>" /> Any CSS color (<code>red</code> or <code>#FF0000</code> or <code>rgb(255, 0, 0)</code>)<br />
|
||||||
<label for="njuppercolor">Upper Color:</label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo kubrick_upper_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
|
<label for="njuppercolor">Upper Color:</label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo kubrick_upper_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
|
||||||
<label for="njlowercolor">Lower Color:</label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo kubrick_lower_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
|
<label for="njlowercolor">Lower Color:</label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo kubrick_lower_color(); ?>" /> HEX only (<code>#FF0000</code> or <code>#F00</code>)<br />
|
||||||
<input type="hidden" name="hi" id="hi" value="<?php echo kubrick_header_image(); ?>" />
|
<input type="hidden" name="hi" id="hi" value="<?php echo kubrick_header_image(); ?>" />
|
||||||
<input type="submit" name="toggledisplay" id="toggledisplay" value="Toggle Text" />
|
<input type="submit" name="toggledisplay" id="toggledisplay" value="Toggle Text" />
|
||||||
<input type="submit" name="defaults" value="Use Defaults" />
|
<input type="submit" name="defaults" value="Use Defaults" />
|
||||||
<input type="submit" class="defbutton" name="submitform" value=" Save " />
|
<input type="submit" class="defbutton" name="submitform" value=" Save " />
|
||||||
<input type="hidden" name="action" value="save" />
|
<input type="hidden" name="action" value="save" />
|
||||||
<input type="hidden" name="njform" value="true" />
|
<input type="hidden" name="njform" value="true" />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div id="jsForm">
|
<div id="jsForm">
|
||||||
<form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
<form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo $_SERVER['REQUEST_URI']; ?>">
|
||||||
<input type="button" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="Font Color"></input>
|
<input type="button" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="Font Color"></input>
|
||||||
<input type="button" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="Upper Color"></input>
|
<input type="button" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="Upper Color"></input>
|
||||||
<input type="button" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="Lower Color"></input>
|
<input type="button" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="Lower Color"></input>
|
||||||
<input type="button" name="revert" value="Revert" onclick="kRevert()" />
|
<input type="button" name="revert" value="Revert" onclick="kRevert()" />
|
||||||
<input type="button" value="Advanced" onclick="toggleAdvanced()" />
|
<input type="button" value="Advanced" onclick="toggleAdvanced()" />
|
||||||
<input type="hidden" name="action" value="save" />
|
<input type="hidden" name="action" value="save" />
|
||||||
<input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo kubrick_header_display(); ?>" />
|
<input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo kubrick_header_display(); ?>" />
|
||||||
<input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo kubrick_header_color(); ?>" />
|
<input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo kubrick_header_color(); ?>" />
|
||||||
<input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo kubrick_upper_color(); ?>" />
|
<input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo kubrick_upper_color(); ?>" />
|
||||||
<input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo kubrick_lower_color(); ?>" />
|
<input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo kubrick_lower_color(); ?>" />
|
||||||
<input type="hidden" name="headerimage" id="headerimage" value="<?php echo kubrick_header_image(); ?>" />
|
<input type="hidden" name="headerimage" id="headerimage" value="<?php echo kubrick_header_image(); ?>" />
|
||||||
<p class="submit"><input type="submit" name="submitform" class="defbutton" value="<?php _e('Update Header »'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
|
<p class="submit"><input type="submit" name="submitform" class="defbutton" value="<?php _e('Update Header »'); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
|
||||||
</form>
|
</form>
|
||||||
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
|
<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
|
||||||
<div id="advanced">
|
<div id="advanced">
|
||||||
<form id="jsAdvanced" style="display:none;" action="">
|
<form id="jsAdvanced" style="display:none;" action="">
|
||||||
<label for="advfontcolor">Font Color (CSS): </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo kubrick_header_color(); ?>" /><br />
|
<label for="advfontcolor">Font Color (CSS): </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo kubrick_header_color(); ?>" /><br />
|
||||||
<label for="advuppercolor">Upper Color (HEX): </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo kubrick_upper_color(); ?>" /><br />
|
<label for="advuppercolor">Upper Color (HEX): </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo kubrick_upper_color(); ?>" /><br />
|
||||||
<label for="advlowercolor">Lower Color (HEX): </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo kubrick_lower_color(); ?>" /><br />
|
<label for="advlowercolor">Lower Color (HEX): </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo kubrick_lower_color(); ?>" /><br />
|
||||||
<input type="button" name="default" value="Select Default Colors" onclick="kDefaults()" /><br />
|
<input type="button" name="default" value="Select Default Colors" onclick="kDefaults()" /><br />
|
||||||
<input type="button" onclick="toggleDisplay();return false;" name="pick" id="pick" value="Toggle Text Display"></input><br />
|
<input type="button" onclick="toggleDisplay();return false;" name="pick" id="pick" value="Toggle Text Display"></input><br />
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
// UK lang variables
|
// UK lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
bold_desc : 'Bold (Ctrl+B)',
|
bold_desc : 'Bold (Ctrl+B)',
|
||||||
italic_desc : 'Italic (Ctrl+I)',
|
italic_desc : 'Italic (Ctrl+I)',
|
||||||
underline_desc : 'Underline (Ctrl+U)',
|
underline_desc : 'Underline (Ctrl+U)',
|
||||||
striketrough_desc : 'Strikethrough',
|
striketrough_desc : 'Strikethrough',
|
||||||
justifyleft_desc : 'Align left',
|
justifyleft_desc : 'Align left',
|
||||||
justifycenter_desc : 'Align center',
|
justifycenter_desc : 'Align center',
|
||||||
justifyright_desc : 'Align right',
|
justifyright_desc : 'Align right',
|
||||||
justifyfull_desc : 'Align full',
|
justifyfull_desc : 'Align full',
|
||||||
bullist_desc : 'Unordered list',
|
bullist_desc : 'Unordered list',
|
||||||
numlist_desc : 'Ordered list',
|
numlist_desc : 'Ordered list',
|
||||||
outdent_desc : 'Outdent',
|
outdent_desc : 'Outdent',
|
||||||
indent_desc : 'Indent',
|
indent_desc : 'Indent',
|
||||||
undo_desc : 'Undo (Ctrl+Z)',
|
undo_desc : 'Undo (Ctrl+Z)',
|
||||||
redo_desc : 'Redo (Ctrl+Y)',
|
redo_desc : 'Redo (Ctrl+Y)',
|
||||||
link_desc : 'Insert/edit link',
|
link_desc : 'Insert/edit link',
|
||||||
unlink_desc : 'Unlink',
|
unlink_desc : 'Unlink',
|
||||||
image_desc : 'Insert/edit image',
|
image_desc : 'Insert/edit image',
|
||||||
cleanup_desc : 'Cleanup messy code',
|
cleanup_desc : 'Cleanup messy code',
|
||||||
focus_alert : 'A editor instance must be focused before using this command.',
|
focus_alert : 'A editor instance must be focused before using this command.',
|
||||||
edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
|
edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
|
||||||
insert_link_title : 'Insert/edit link',
|
insert_link_title : 'Insert/edit link',
|
||||||
insert : 'Insert',
|
insert : 'Insert',
|
||||||
update : 'Update',
|
update : 'Update',
|
||||||
cancel : 'Cancel',
|
cancel : 'Cancel',
|
||||||
insert_link_url : 'Link URL',
|
insert_link_url : 'Link URL',
|
||||||
insert_link_target : 'Target',
|
insert_link_target : 'Target',
|
||||||
insert_link_target_same : 'Open link in the same window',
|
insert_link_target_same : 'Open link in the same window',
|
||||||
insert_link_target_blank : 'Open link in a new window',
|
insert_link_target_blank : 'Open link in a new window',
|
||||||
insert_image_title : 'Insert/edit image',
|
insert_image_title : 'Insert/edit image',
|
||||||
insert_image_src : 'Image URL',
|
insert_image_src : 'Image URL',
|
||||||
insert_image_alt : 'Image description',
|
insert_image_alt : 'Image description',
|
||||||
help_desc : 'Help',
|
help_desc : 'Help',
|
||||||
bold_img : "bold.gif",
|
bold_img : "bold.gif",
|
||||||
italic_img : "italic.gif",
|
italic_img : "italic.gif",
|
||||||
underline_img : "underline.gif",
|
underline_img : "underline.gif",
|
||||||
clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
|
clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
|
||||||
popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
|
popup_blocked : 'Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,46 +1,46 @@
|
||||||
/**
|
/**
|
||||||
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
|
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Import plugin specific language pack */
|
/* Import plugin specific language pack */
|
||||||
tinyMCE.importPluginLanguagePack('autosave');
|
tinyMCE.importPluginLanguagePack('autosave');
|
||||||
|
|
||||||
var TinyMCE_AutoSavePlugin = {
|
var TinyMCE_AutoSavePlugin = {
|
||||||
getInfo : function() {
|
getInfo : function() {
|
||||||
return {
|
return {
|
||||||
longname : 'Auto save',
|
longname : 'Auto save',
|
||||||
author : 'Moxiecode Systems AB',
|
author : 'Moxiecode Systems AB',
|
||||||
authorurl : 'http://tinymce.moxiecode.com',
|
authorurl : 'http://tinymce.moxiecode.com',
|
||||||
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
|
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
|
||||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
// Private plugin internal methods
|
// Private plugin internal methods
|
||||||
|
|
||||||
_beforeUnloadHandler : function() {
|
_beforeUnloadHandler : function() {
|
||||||
var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
|
var n, inst, anyDirty = false, msg = tinyMCE.getLang("lang_autosave_unload_msg");
|
||||||
|
|
||||||
if (tinyMCE.getParam("fullscreen_is_enabled"))
|
if (tinyMCE.getParam("fullscreen_is_enabled"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (n in tinyMCE.instances) {
|
for (n in tinyMCE.instances) {
|
||||||
inst = tinyMCE.instances[n];
|
inst = tinyMCE.instances[n];
|
||||||
|
|
||||||
if (!tinyMCE.isInstance(inst))
|
if (!tinyMCE.isInstance(inst))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (inst.isDirty())
|
if (inst.isDirty())
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
|
window.onbeforeunload = TinyMCE_AutoSavePlugin._beforeUnloadHandler;
|
||||||
|
|
||||||
tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);
|
tinyMCE.addPlugin("autosave", TinyMCE_AutoSavePlugin);
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
/* Import plugin specific language pack */
|
/* Import plugin specific language pack */
|
||||||
tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
|
tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
|
||||||
|
|
||||||
function TinyMCE_autosave_getInfo() {
|
function TinyMCE_autosave_getInfo() {
|
||||||
return {
|
return {
|
||||||
longname : 'Auto save',
|
longname : 'Auto save',
|
||||||
author : 'Moxiecode Systems',
|
author : 'Moxiecode Systems',
|
||||||
authorurl : 'http://tinymce.moxiecode.com',
|
authorurl : 'http://tinymce.moxiecode.com',
|
||||||
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
|
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',
|
||||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function TinyMCE_autosave_beforeUnloadHandler() {
|
function TinyMCE_autosave_beforeUnloadHandler() {
|
||||||
var msg = tinyMCE.getLang("lang_autosave_unload_msg");
|
var msg = tinyMCE.getLang("lang_autosave_unload_msg");
|
||||||
|
|
||||||
var anyDirty = false;
|
var anyDirty = false;
|
||||||
for (var n in tinyMCE.instances) {
|
for (var n in tinyMCE.instances) {
|
||||||
var inst = tinyMCE.instances[n];
|
var inst = tinyMCE.instances[n];
|
||||||
if (!tinyMCE.isInstance(inst))
|
if (!tinyMCE.isInstance(inst))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (inst.isDirty())
|
if (inst.isDirty())
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
|
window.onbeforeunload = TinyMCE_autosave_beforeUnloadHandler;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// EN lang variables
|
// EN lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
|
autosave_unload_msg : 'The changes you made will be lost if you navigate away from this page.'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,90 +1,90 @@
|
||||||
/**
|
/**
|
||||||
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
|
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Import plugin specific language pack */
|
/* Import plugin specific language pack */
|
||||||
tinyMCE.importPluginLanguagePack('directionality');
|
tinyMCE.importPluginLanguagePack('directionality');
|
||||||
|
|
||||||
var TinyMCE_DirectionalityPlugin = {
|
var TinyMCE_DirectionalityPlugin = {
|
||||||
getInfo : function() {
|
getInfo : function() {
|
||||||
return {
|
return {
|
||||||
longname : 'Directionality',
|
longname : 'Directionality',
|
||||||
author : 'Moxiecode Systems AB',
|
author : 'Moxiecode Systems AB',
|
||||||
authorurl : 'http://tinymce.moxiecode.com',
|
authorurl : 'http://tinymce.moxiecode.com',
|
||||||
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
|
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_directionality.html',
|
||||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
getControlHTML : function(cn) {
|
getControlHTML : function(cn) {
|
||||||
switch (cn) {
|
switch (cn) {
|
||||||
case "ltr":
|
case "ltr":
|
||||||
return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR');
|
return tinyMCE.getButtonHTML(cn, 'lang_directionality_ltr_desc', '{$pluginurl}/images/ltr.gif', 'mceDirectionLTR');
|
||||||
|
|
||||||
case "rtl":
|
case "rtl":
|
||||||
return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL');
|
return tinyMCE.getButtonHTML(cn, 'lang_directionality_rtl_desc', '{$pluginurl}/images/rtl.gif', 'mceDirectionRTL');
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
},
|
},
|
||||||
|
|
||||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||||
// Handle commands
|
// Handle commands
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "mceDirectionLTR":
|
case "mceDirectionLTR":
|
||||||
var inst = tinyMCE.getInstanceById(editor_id);
|
var inst = tinyMCE.getInstanceById(editor_id);
|
||||||
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
|
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
|
||||||
|
|
||||||
if (elm)
|
if (elm)
|
||||||
elm.setAttribute("dir", "ltr");
|
elm.setAttribute("dir", "ltr");
|
||||||
|
|
||||||
tinyMCE.triggerNodeChange(false);
|
tinyMCE.triggerNodeChange(false);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "mceDirectionRTL":
|
case "mceDirectionRTL":
|
||||||
var inst = tinyMCE.getInstanceById(editor_id);
|
var inst = tinyMCE.getInstanceById(editor_id);
|
||||||
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
|
var elm = tinyMCE.getParentElement(inst.getFocusElement(), "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
|
||||||
|
|
||||||
if (elm)
|
if (elm)
|
||||||
elm.setAttribute("dir", "rtl");
|
elm.setAttribute("dir", "rtl");
|
||||||
|
|
||||||
tinyMCE.triggerNodeChange(false);
|
tinyMCE.triggerNodeChange(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass to next handler in chain
|
// Pass to next handler in chain
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
|
handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
|
||||||
function getAttrib(elm, name) {
|
function getAttrib(elm, name) {
|
||||||
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
return elm.getAttribute(name) ? elm.getAttribute(name) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node == null)
|
if (node == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
|
var elm = tinyMCE.getParentElement(node, "p,div,td,h1,h2,h3,h4,h5,h6,pre,address");
|
||||||
if (!elm) {
|
if (!elm) {
|
||||||
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled');
|
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonDisabled');
|
||||||
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled');
|
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonDisabled');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal');
|
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonNormal');
|
||||||
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal');
|
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonNormal');
|
||||||
|
|
||||||
var dir = getAttrib(elm, "dir");
|
var dir = getAttrib(elm, "dir");
|
||||||
if (dir == "ltr" || dir == "")
|
if (dir == "ltr" || dir == "")
|
||||||
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected');
|
tinyMCE.switchClass(editor_id + '_ltr', 'mceButtonSelected');
|
||||||
else
|
else
|
||||||
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected');
|
tinyMCE.switchClass(editor_id + '_rtl', 'mceButtonSelected');
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin);
|
tinyMCE.addPlugin("directionality", TinyMCE_DirectionalityPlugin);
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// UK lang variables
|
// UK lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
directionality_ltr_desc : 'Direction left to right (Alt-.)',
|
directionality_ltr_desc : 'Direction left to right (Alt-.)',
|
||||||
directionality_rtl_desc : 'Direction right to left (Alt-,)'
|
directionality_rtl_desc : 'Direction right to left (Alt-,)'
|
||||||
});
|
});
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,453 +1,453 @@
|
||||||
/**
|
/**
|
||||||
* $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
|
* $Id: mcwindows.js 18 2006-06-29 14:11:23Z spocke $
|
||||||
*
|
*
|
||||||
* Moxiecode DHTML Windows script.
|
* Moxiecode DHTML Windows script.
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Windows handler
|
// Windows handler
|
||||||
function MCWindows() {
|
function MCWindows() {
|
||||||
this.settings = new Array();
|
this.settings = new Array();
|
||||||
this.windows = new Array();
|
this.windows = new Array();
|
||||||
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
|
||||||
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
|
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
|
||||||
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
|
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
|
||||||
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
|
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
|
||||||
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
|
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
|
||||||
this.action = "none";
|
this.action = "none";
|
||||||
this.selectedWindow = null;
|
this.selectedWindow = null;
|
||||||
this.zindex = 100;
|
this.zindex = 100;
|
||||||
this.mouseDownScreenX = 0;
|
this.mouseDownScreenX = 0;
|
||||||
this.mouseDownScreenY = 0;
|
this.mouseDownScreenY = 0;
|
||||||
this.mouseDownLayerX = 0;
|
this.mouseDownLayerX = 0;
|
||||||
this.mouseDownLayerY = 0;
|
this.mouseDownLayerY = 0;
|
||||||
this.mouseDownWidth = 0;
|
this.mouseDownWidth = 0;
|
||||||
this.mouseDownHeight = 0;
|
this.mouseDownHeight = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.init = function(settings) {
|
MCWindows.prototype.init = function(settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
||||||
if (this.isMSIE)
|
if (this.isMSIE)
|
||||||
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
|
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
|
||||||
else
|
else
|
||||||
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
|
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
|
||||||
|
|
||||||
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
|
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.getParam = function(name, default_value) {
|
MCWindows.prototype.getParam = function(name, default_value) {
|
||||||
var value = null;
|
var value = null;
|
||||||
|
|
||||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||||
|
|
||||||
// Fix bool values
|
// Fix bool values
|
||||||
if (value == "true" || value == "false")
|
if (value == "true" || value == "false")
|
||||||
return (value == "true");
|
return (value == "true");
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.eventDispatcher = function(e) {
|
MCWindows.prototype.eventDispatcher = function(e) {
|
||||||
e = typeof(e) == "undefined" ? window.event : e;
|
e = typeof(e) == "undefined" ? window.event : e;
|
||||||
|
|
||||||
if (mcWindows.selectedWindow == null)
|
if (mcWindows.selectedWindow == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Switch focus
|
// Switch focus
|
||||||
if (mcWindows.isGecko && e.type == "mousedown") {
|
if (mcWindows.isGecko && e.type == "mousedown") {
|
||||||
var elm = e.currentTarget;
|
var elm = e.currentTarget;
|
||||||
|
|
||||||
for (var n in mcWindows.windows) {
|
for (var n in mcWindows.windows) {
|
||||||
var win = mcWindows.windows[n];
|
var win = mcWindows.windows[n];
|
||||||
if (typeof(win) == 'function')
|
if (typeof(win) == 'function')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (win.headElement == elm || win.resizeElement == elm) {
|
if (win.headElement == elm || win.resizeElement == elm) {
|
||||||
win.focus();
|
win.focus();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case "mousemove":
|
case "mousemove":
|
||||||
mcWindows.selectedWindow.onMouseMove(e);
|
mcWindows.selectedWindow.onMouseMove(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "mouseup":
|
case "mouseup":
|
||||||
mcWindows.selectedWindow.onMouseUp(e);
|
mcWindows.selectedWindow.onMouseUp(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "mousedown":
|
case "mousedown":
|
||||||
mcWindows.selectedWindow.onMouseDown(e);
|
mcWindows.selectedWindow.onMouseDown(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "focus":
|
case "focus":
|
||||||
mcWindows.selectedWindow.onFocus(e);
|
mcWindows.selectedWindow.onFocus(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MCWindows.prototype.addEvent = function(obj, name, handler) {
|
MCWindows.prototype.addEvent = function(obj, name, handler) {
|
||||||
if (this.isMSIE)
|
if (this.isMSIE)
|
||||||
obj.attachEvent("on" + name, handler);
|
obj.attachEvent("on" + name, handler);
|
||||||
else
|
else
|
||||||
obj.addEventListener(name, handler, true);
|
obj.addEventListener(name, handler, true);
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.cancelEvent = function(e) {
|
MCWindows.prototype.cancelEvent = function(e) {
|
||||||
if (this.isMSIE) {
|
if (this.isMSIE) {
|
||||||
e.returnValue = false;
|
e.returnValue = false;
|
||||||
e.cancelBubble = true;
|
e.cancelBubble = true;
|
||||||
} else
|
} else
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.parseFeatures = function(opts) {
|
MCWindows.prototype.parseFeatures = function(opts) {
|
||||||
// Cleanup the options
|
// Cleanup the options
|
||||||
opts = opts.toLowerCase();
|
opts = opts.toLowerCase();
|
||||||
opts = opts.replace(/;/g, ",");
|
opts = opts.replace(/;/g, ",");
|
||||||
opts = opts.replace(/[^0-9a-z=,]/g, "");
|
opts = opts.replace(/[^0-9a-z=,]/g, "");
|
||||||
|
|
||||||
var optionChunks = opts.split(',');
|
var optionChunks = opts.split(',');
|
||||||
var options = new Array();
|
var options = new Array();
|
||||||
|
|
||||||
options['left'] = 10;
|
options['left'] = 10;
|
||||||
options['top'] = 10;
|
options['top'] = 10;
|
||||||
options['width'] = 300;
|
options['width'] = 300;
|
||||||
options['height'] = 300;
|
options['height'] = 300;
|
||||||
options['resizable'] = true;
|
options['resizable'] = true;
|
||||||
options['minimizable'] = true;
|
options['minimizable'] = true;
|
||||||
options['maximizable'] = true;
|
options['maximizable'] = true;
|
||||||
options['close'] = true;
|
options['close'] = true;
|
||||||
options['movable'] = true;
|
options['movable'] = true;
|
||||||
|
|
||||||
if (opts == "")
|
if (opts == "")
|
||||||
return options;
|
return options;
|
||||||
|
|
||||||
for (var i=0; i<optionChunks.length; i++) {
|
for (var i=0; i<optionChunks.length; i++) {
|
||||||
var parts = optionChunks[i].split('=');
|
var parts = optionChunks[i].split('=');
|
||||||
|
|
||||||
if (parts.length == 2)
|
if (parts.length == 2)
|
||||||
options[parts[0]] = parts[1];
|
options[parts[0]] = parts[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return options;
|
return options;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.open = function(url, name, features) {
|
MCWindows.prototype.open = function(url, name, features) {
|
||||||
var win = new MCWindow();
|
var win = new MCWindow();
|
||||||
var winDiv, html = "", id;
|
var winDiv, html = "", id;
|
||||||
|
|
||||||
features = this.parseFeatures(features);
|
features = this.parseFeatures(features);
|
||||||
|
|
||||||
// Create div
|
// Create div
|
||||||
id = "mcWindow_" + name;
|
id = "mcWindow_" + name;
|
||||||
|
|
||||||
width = parseInt(features['width']);
|
width = parseInt(features['width']);
|
||||||
height = parseInt(features['height'])-12-19;
|
height = parseInt(features['height'])-12-19;
|
||||||
|
|
||||||
if (this.isMSIE)
|
if (this.isMSIE)
|
||||||
width -= 2;
|
width -= 2;
|
||||||
|
|
||||||
// Setup first part of window
|
// Setup first part of window
|
||||||
win.id = id;
|
win.id = id;
|
||||||
win.url = url;
|
win.url = url;
|
||||||
win.name = name;
|
win.name = name;
|
||||||
win.features = features;
|
win.features = features;
|
||||||
this.windows[name] = win;
|
this.windows[name] = win;
|
||||||
|
|
||||||
iframeWidth = width;
|
iframeWidth = width;
|
||||||
iframeHeight = height;
|
iframeHeight = height;
|
||||||
|
|
||||||
// Create inner content
|
// Create inner content
|
||||||
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
|
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
|
||||||
html += '<html>';
|
html += '<html>';
|
||||||
html += '<head>';
|
html += '<head>';
|
||||||
html += '<title>Wrapper iframe</title>';
|
html += '<title>Wrapper iframe</title>';
|
||||||
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
|
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
|
||||||
html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
|
html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
|
||||||
html += '</head>';
|
html += '</head>';
|
||||||
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
|
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
|
||||||
|
|
||||||
html += '<div id="' + id + '_container" class="mceWindow">';
|
html += '<div id="' + id + '_container" class="mceWindow">';
|
||||||
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
|
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
|
||||||
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
|
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
|
||||||
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
|
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
|
||||||
html += ' <div class="mceWindowHeadTools">';
|
html += ' <div class="mceWindowHeadTools">';
|
||||||
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
|
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
|
||||||
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
|
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
|
||||||
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
|
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
|
||||||
html += ' </div>';
|
html += ' </div>';
|
||||||
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
|
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
|
||||||
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
|
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
|
||||||
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
|
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
|
||||||
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
|
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '</body>';
|
html += '</body>';
|
||||||
html += '</html>';
|
html += '</html>';
|
||||||
|
|
||||||
// Create iframe
|
// Create iframe
|
||||||
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
|
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Gets called when wrapper iframe is initialized
|
// Gets called when wrapper iframe is initialized
|
||||||
MCWindows.prototype.onLoad = function(name) {
|
MCWindows.prototype.onLoad = function(name) {
|
||||||
var win = mcWindows.windows[name];
|
var win = mcWindows.windows[name];
|
||||||
var id = "mcWindow_" + name;
|
var id = "mcWindow_" + name;
|
||||||
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
|
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
|
||||||
var wrapperDoc = window.frames[id + "_iframe"].document;
|
var wrapperDoc = window.frames[id + "_iframe"].document;
|
||||||
var doc = window.frames[id + "_iframe"].document;
|
var doc = window.frames[id + "_iframe"].document;
|
||||||
var winDiv = document.getElementById("mcWindow_" + name + "_div");
|
var winDiv = document.getElementById("mcWindow_" + name + "_div");
|
||||||
var realIframe = window.frames[id + "_iframe"].frames[0];
|
var realIframe = window.frames[id + "_iframe"].frames[0];
|
||||||
|
|
||||||
// Set window data
|
// Set window data
|
||||||
win.id = "mcWindow_" + name + "_iframe";
|
win.id = "mcWindow_" + name + "_iframe";
|
||||||
win.winElement = winDiv;
|
win.winElement = winDiv;
|
||||||
win.bodyElement = doc.getElementById(id + '_body');
|
win.bodyElement = doc.getElementById(id + '_body');
|
||||||
win.iframeElement = doc.getElementById(id + '_iframe');
|
win.iframeElement = doc.getElementById(id + '_iframe');
|
||||||
win.headElement = doc.getElementById(id + '_head');
|
win.headElement = doc.getElementById(id + '_head');
|
||||||
win.titleElement = doc.getElementById(id + '_title');
|
win.titleElement = doc.getElementById(id + '_title');
|
||||||
win.resizeElement = doc.getElementById(id + '_resize');
|
win.resizeElement = doc.getElementById(id + '_resize');
|
||||||
win.containerElement = doc.getElementById(id + '_container');
|
win.containerElement = doc.getElementById(id + '_container');
|
||||||
win.left = win.features['left'];
|
win.left = win.features['left'];
|
||||||
win.top = win.features['top'];
|
win.top = win.features['top'];
|
||||||
win.frame = window.frames[id + '_iframe'].frames[0];
|
win.frame = window.frames[id + '_iframe'].frames[0];
|
||||||
win.wrapperFrame = window.frames[id + '_iframe'];
|
win.wrapperFrame = window.frames[id + '_iframe'];
|
||||||
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
|
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
|
||||||
|
|
||||||
// Add event handlers
|
// Add event handlers
|
||||||
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
|
||||||
|
|
||||||
if (mcWindows.isMSIE) {
|
if (mcWindows.isMSIE) {
|
||||||
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
|
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
|
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
|
||||||
} else {
|
} else {
|
||||||
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
|
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
|
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
|
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i=0; i<window.frames.length; i++) {
|
for (var i=0; i<window.frames.length; i++) {
|
||||||
if (!window.frames[i]._hasMouseHandlers) {
|
if (!window.frames[i]._hasMouseHandlers) {
|
||||||
if (mcWindows.isMSIE) {
|
if (mcWindows.isMSIE) {
|
||||||
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
|
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
|
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
|
||||||
} else {
|
} else {
|
||||||
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
|
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
|
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
window.frames[i]._hasMouseHandlers = true;
|
window.frames[i]._hasMouseHandlers = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mcWindows.isMSIE) {
|
if (mcWindows.isMSIE) {
|
||||||
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
|
||||||
} else {
|
} else {
|
||||||
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
|
||||||
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
|
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.selectedWindow = win;
|
this.selectedWindow = win;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
|
MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
|
||||||
var iframe = document.createElement("iframe");
|
var iframe = document.createElement("iframe");
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
|
|
||||||
width = parseInt(width);
|
width = parseInt(width);
|
||||||
height = parseInt(height)+1;
|
height = parseInt(height)+1;
|
||||||
|
|
||||||
// Create wrapper div
|
// Create wrapper div
|
||||||
div.setAttribute("id", id_prefix + "_div");
|
div.setAttribute("id", id_prefix + "_div");
|
||||||
div.setAttribute("width", width);
|
div.setAttribute("width", width);
|
||||||
div.setAttribute("height", (height));
|
div.setAttribute("height", (height));
|
||||||
div.style.position = "absolute";
|
div.style.position = "absolute";
|
||||||
div.style.left = left + "px";
|
div.style.left = left + "px";
|
||||||
div.style.top = top + "px";
|
div.style.top = top + "px";
|
||||||
div.style.width = width + "px";
|
div.style.width = width + "px";
|
||||||
div.style.height = (height) + "px";
|
div.style.height = (height) + "px";
|
||||||
div.style.backgroundColor = "white";
|
div.style.backgroundColor = "white";
|
||||||
div.style.display = "none";
|
div.style.display = "none";
|
||||||
|
|
||||||
if (this.isGecko) {
|
if (this.isGecko) {
|
||||||
iframeWidth = width + 2;
|
iframeWidth = width + 2;
|
||||||
iframeHeight = height + 2;
|
iframeHeight = height + 2;
|
||||||
} else {
|
} else {
|
||||||
iframeWidth = width;
|
iframeWidth = width;
|
||||||
iframeHeight = height + 1;
|
iframeHeight = height + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create iframe
|
// Create iframe
|
||||||
iframe.setAttribute("id", id_prefix + "_iframe");
|
iframe.setAttribute("id", id_prefix + "_iframe");
|
||||||
iframe.setAttribute("name", id_prefix + "_iframe");
|
iframe.setAttribute("name", id_prefix + "_iframe");
|
||||||
iframe.setAttribute("border", "0");
|
iframe.setAttribute("border", "0");
|
||||||
iframe.setAttribute("frameBorder", "0");
|
iframe.setAttribute("frameBorder", "0");
|
||||||
iframe.setAttribute("marginWidth", "0");
|
iframe.setAttribute("marginWidth", "0");
|
||||||
iframe.setAttribute("marginHeight", "0");
|
iframe.setAttribute("marginHeight", "0");
|
||||||
iframe.setAttribute("leftMargin", "0");
|
iframe.setAttribute("leftMargin", "0");
|
||||||
iframe.setAttribute("topMargin", "0");
|
iframe.setAttribute("topMargin", "0");
|
||||||
iframe.setAttribute("width", iframeWidth);
|
iframe.setAttribute("width", iframeWidth);
|
||||||
iframe.setAttribute("height", iframeHeight);
|
iframe.setAttribute("height", iframeHeight);
|
||||||
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
|
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
|
||||||
// iframe.setAttribute("allowtransparency", "false");
|
// iframe.setAttribute("allowtransparency", "false");
|
||||||
iframe.setAttribute("scrolling", "no");
|
iframe.setAttribute("scrolling", "no");
|
||||||
iframe.style.width = iframeWidth + "px";
|
iframe.style.width = iframeWidth + "px";
|
||||||
iframe.style.height = iframeHeight + "px";
|
iframe.style.height = iframeHeight + "px";
|
||||||
iframe.style.backgroundColor = "white";
|
iframe.style.backgroundColor = "white";
|
||||||
div.appendChild(iframe);
|
div.appendChild(iframe);
|
||||||
|
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
|
|
||||||
// Fixed MSIE 5.0 issue
|
// Fixed MSIE 5.0 issue
|
||||||
div.innerHTML = div.innerHTML;
|
div.innerHTML = div.innerHTML;
|
||||||
|
|
||||||
if (this.isSafari) {
|
if (this.isSafari) {
|
||||||
// Give Safari some time to setup
|
// Give Safari some time to setup
|
||||||
window.setTimeout(function() {
|
window.setTimeout(function() {
|
||||||
doc = window.frames[id_prefix + '_iframe'].document;
|
doc = window.frames[id_prefix + '_iframe'].document;
|
||||||
doc.open();
|
doc.open();
|
||||||
doc.write(html);
|
doc.write(html);
|
||||||
doc.close();
|
doc.close();
|
||||||
}, 10);
|
}, 10);
|
||||||
} else {
|
} else {
|
||||||
doc = window.frames[id_prefix + '_iframe'].window.document
|
doc = window.frames[id_prefix + '_iframe'].window.document
|
||||||
doc.open();
|
doc.open();
|
||||||
doc.write(html);
|
doc.write(html);
|
||||||
doc.close();
|
doc.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
div.style.display = "block";
|
div.style.display = "block";
|
||||||
|
|
||||||
return div;
|
return div;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Window instance
|
// Window instance
|
||||||
function MCWindow() {
|
function MCWindow() {
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.focus = function() {
|
MCWindow.prototype.focus = function() {
|
||||||
this.winElement.style.zIndex = mcWindows.zindex++;
|
this.winElement.style.zIndex = mcWindows.zindex++;
|
||||||
mcWindows.selectedWindow = this;
|
mcWindows.selectedWindow = this;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.minimize = function() {
|
MCWindow.prototype.minimize = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.maximize = function() {
|
MCWindow.prototype.maximize = function() {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.startResize = function() {
|
MCWindow.prototype.startResize = function() {
|
||||||
mcWindows.action = "resize";
|
mcWindows.action = "resize";
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.startMove = function(e) {
|
MCWindow.prototype.startMove = function(e) {
|
||||||
mcWindows.action = "move";
|
mcWindows.action = "move";
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.close = function() {
|
MCWindow.prototype.close = function() {
|
||||||
document.body.removeChild(this.winElement);
|
document.body.removeChild(this.winElement);
|
||||||
mcWindows.windows[this.name] = null;
|
mcWindows.windows[this.name] = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.onMouseMove = function(e) {
|
MCWindow.prototype.onMouseMove = function(e) {
|
||||||
var scrollX = 0;//this.doc.body.scrollLeft;
|
var scrollX = 0;//this.doc.body.scrollLeft;
|
||||||
var scrollY = 0;//this.doc.body.scrollTop;
|
var scrollY = 0;//this.doc.body.scrollTop;
|
||||||
|
|
||||||
// Calculate real X, Y
|
// Calculate real X, Y
|
||||||
var dx = e.screenX - mcWindows.mouseDownScreenX;
|
var dx = e.screenX - mcWindows.mouseDownScreenX;
|
||||||
var dy = e.screenY - mcWindows.mouseDownScreenY;
|
var dy = e.screenY - mcWindows.mouseDownScreenY;
|
||||||
|
|
||||||
switch (mcWindows.action) {
|
switch (mcWindows.action) {
|
||||||
case "resize":
|
case "resize":
|
||||||
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
|
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
|
||||||
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
|
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
|
||||||
|
|
||||||
width = width < 100 ? 100 : width;
|
width = width < 100 ? 100 : width;
|
||||||
height = height < 100 ? 100 : height;
|
height = height < 100 ? 100 : height;
|
||||||
|
|
||||||
this.wrapperIFrameElement.style.width = width+2;
|
this.wrapperIFrameElement.style.width = width+2;
|
||||||
this.wrapperIFrameElement.style.height = height+2;
|
this.wrapperIFrameElement.style.height = height+2;
|
||||||
this.wrapperIFrameElement.width = width+2;
|
this.wrapperIFrameElement.width = width+2;
|
||||||
this.wrapperIFrameElement.height = height+2;
|
this.wrapperIFrameElement.height = height+2;
|
||||||
this.winElement.style.width = width;
|
this.winElement.style.width = width;
|
||||||
this.winElement.style.height = height;
|
this.winElement.style.height = height;
|
||||||
|
|
||||||
height = height-12-19;
|
height = height-12-19;
|
||||||
|
|
||||||
this.containerElement.style.width = width;
|
this.containerElement.style.width = width;
|
||||||
|
|
||||||
this.iframeElement.style.width = width;
|
this.iframeElement.style.width = width;
|
||||||
this.iframeElement.style.height = height;
|
this.iframeElement.style.height = height;
|
||||||
this.bodyElement.style.width = width;
|
this.bodyElement.style.width = width;
|
||||||
this.bodyElement.style.height = height;
|
this.bodyElement.style.height = height;
|
||||||
this.headElement.style.width = width;
|
this.headElement.style.width = width;
|
||||||
//this.statusElement.style.width = width;
|
//this.statusElement.style.width = width;
|
||||||
|
|
||||||
mcWindows.cancelEvent(e);
|
mcWindows.cancelEvent(e);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "move":
|
case "move":
|
||||||
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
|
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
|
||||||
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
|
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
|
||||||
this.winElement.style.left = this.left + "px";
|
this.winElement.style.left = this.left + "px";
|
||||||
this.winElement.style.top = this.top + "px";
|
this.winElement.style.top = this.top + "px";
|
||||||
|
|
||||||
mcWindows.cancelEvent(e);
|
mcWindows.cancelEvent(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.onMouseUp = function(e) {
|
MCWindow.prototype.onMouseUp = function(e) {
|
||||||
mcWindows.action = "none";
|
mcWindows.action = "none";
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.onFocus = function(e) {
|
MCWindow.prototype.onFocus = function(e) {
|
||||||
// Gecko only handler
|
// Gecko only handler
|
||||||
var winRef = e.currentTarget;
|
var winRef = e.currentTarget;
|
||||||
|
|
||||||
for (var n in mcWindows.windows) {
|
for (var n in mcWindows.windows) {
|
||||||
var win = mcWindows.windows[n];
|
var win = mcWindows.windows[n];
|
||||||
if (typeof(win) == 'function')
|
if (typeof(win) == 'function')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (winRef.name == win.id) {
|
if (winRef.name == win.id) {
|
||||||
win.focus();
|
win.focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MCWindow.prototype.onMouseDown = function(e) {
|
MCWindow.prototype.onMouseDown = function(e) {
|
||||||
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
|
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
|
||||||
|
|
||||||
var scrollX = 0;//this.doc.body.scrollLeft;
|
var scrollX = 0;//this.doc.body.scrollLeft;
|
||||||
var scrollY = 0;//this.doc.body.scrollTop;
|
var scrollY = 0;//this.doc.body.scrollTop;
|
||||||
|
|
||||||
mcWindows.mouseDownScreenX = e.screenX;
|
mcWindows.mouseDownScreenX = e.screenX;
|
||||||
mcWindows.mouseDownScreenY = e.screenY;
|
mcWindows.mouseDownScreenY = e.screenY;
|
||||||
mcWindows.mouseDownLayerX = this.left;
|
mcWindows.mouseDownLayerX = this.left;
|
||||||
mcWindows.mouseDownLayerY = this.top;
|
mcWindows.mouseDownLayerY = this.top;
|
||||||
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
|
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
|
||||||
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
|
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
|
||||||
|
|
||||||
if (elm == this.resizeElement.firstChild)
|
if (elm == this.resizeElement.firstChild)
|
||||||
this.startResize(e);
|
this.startResize(e);
|
||||||
else
|
else
|
||||||
this.startMove(e);
|
this.startMove(e);
|
||||||
|
|
||||||
mcWindows.cancelEvent(e);
|
mcWindows.cancelEvent(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Global instance
|
// Global instance
|
||||||
var mcWindows = new MCWindows();
|
var mcWindows = new MCWindows();
|
||||||
|
|
|
@ -1,385 +1,385 @@
|
||||||
/**
|
/**
|
||||||
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
|
* $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Import plugin specific language pack */
|
/* Import plugin specific language pack */
|
||||||
tinyMCE.importPluginLanguagePack('paste');
|
tinyMCE.importPluginLanguagePack('paste');
|
||||||
|
|
||||||
var TinyMCE_PastePlugin = {
|
var TinyMCE_PastePlugin = {
|
||||||
getInfo : function() {
|
getInfo : function() {
|
||||||
return {
|
return {
|
||||||
longname : 'Paste text/word',
|
longname : 'Paste text/word',
|
||||||
author : 'Moxiecode Systems AB',
|
author : 'Moxiecode Systems AB',
|
||||||
authorurl : 'http://tinymce.moxiecode.com',
|
authorurl : 'http://tinymce.moxiecode.com',
|
||||||
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',
|
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_paste.html',
|
||||||
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
initInstance : function(inst) {
|
initInstance : function(inst) {
|
||||||
if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
|
if (tinyMCE.isMSIE && tinyMCE.getParam("paste_auto_cleanup_on_paste", false))
|
||||||
tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
|
tinyMCE.addEvent(inst.getBody(), "paste", TinyMCE_PastePlugin._handlePasteEvent);
|
||||||
},
|
},
|
||||||
|
|
||||||
getControlHTML : function(cn) {
|
getControlHTML : function(cn) {
|
||||||
switch (cn) {
|
switch (cn) {
|
||||||
case "pastetext":
|
case "pastetext":
|
||||||
return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
|
return tinyMCE.getButtonHTML(cn, 'lang_paste_text_desc', '{$pluginurl}/images/pastetext.gif', 'mcePasteText', true);
|
||||||
|
|
||||||
case "pasteword":
|
case "pasteword":
|
||||||
return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
|
return tinyMCE.getButtonHTML(cn, 'lang_paste_word_desc', '{$pluginurl}/images/pasteword.gif', 'mcePasteWord', true);
|
||||||
|
|
||||||
case "selectall":
|
case "selectall":
|
||||||
return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
|
return tinyMCE.getButtonHTML(cn, 'lang_selectall_desc', '{$pluginurl}/images/selectall.gif', 'mceSelectAll', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
|
|
||||||
execCommand : function(editor_id, element, command, user_interface, value) {
|
execCommand : function(editor_id, element, command, user_interface, value) {
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "mcePasteText":
|
case "mcePasteText":
|
||||||
if (user_interface) {
|
if (user_interface) {
|
||||||
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
|
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false))
|
||||||
TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true);
|
TinyMCE_PastePlugin._insertText(clipboardData.getData("Text"), true);
|
||||||
else {
|
else {
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
|
template['file'] = '../../plugins/paste/pastetext.htm'; // Relative to theme
|
||||||
template['width'] = 450;
|
template['width'] = 450;
|
||||||
template['height'] = 400;
|
template['height'] = 400;
|
||||||
var plain_text = "";
|
var plain_text = "";
|
||||||
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
|
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
|
TinyMCE_PastePlugin._insertText(value['html'], value['linebreaks']);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "mcePasteWord":
|
case "mcePasteWord":
|
||||||
if (user_interface) {
|
if (user_interface) {
|
||||||
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
|
if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && !tinyMCE.getParam('paste_use_dialog', false)) {
|
||||||
TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML());
|
TinyMCE_PastePlugin._insertWordContent(TinyMCE_PastePlugin._clipboardHTML());
|
||||||
} else {
|
} else {
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
|
template['file'] = '../../plugins/paste/pasteword.htm'; // Relative to theme
|
||||||
template['width'] = 450;
|
template['width'] = 450;
|
||||||
template['height'] = 400;
|
template['height'] = 400;
|
||||||
var plain_text = "";
|
var plain_text = "";
|
||||||
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
|
tinyMCE.openWindow(template, {editor_id : editor_id, plain_text: plain_text, resizable : "yes", scrollbars : "no", inline : "yes", mceDo : 'insert'});
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
TinyMCE_PastePlugin._insertWordContent(value);
|
TinyMCE_PastePlugin._insertWordContent(value);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "mceSelectAll":
|
case "mceSelectAll":
|
||||||
tinyMCE.execInstanceCommand(editor_id, 'selectall');
|
tinyMCE.execInstanceCommand(editor_id, 'selectall');
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass to next handler in chain
|
// Pass to next handler in chain
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Private plugin internal methods
|
// Private plugin internal methods
|
||||||
|
|
||||||
_handlePasteEvent : function(e) {
|
_handlePasteEvent : function(e) {
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case "paste":
|
case "paste":
|
||||||
var html = TinyMCE_PastePlugin._clipboardHTML();
|
var html = TinyMCE_PastePlugin._clipboardHTML();
|
||||||
var r, inst = tinyMCE.selectedInstance;
|
var r, inst = tinyMCE.selectedInstance;
|
||||||
|
|
||||||
// Removes italic, strong etc, the if was needed due to bug #1437114
|
// Removes italic, strong etc, the if was needed due to bug #1437114
|
||||||
if (inst && (r = inst.getRng()) && r.text.length > 0)
|
if (inst && (r = inst.getRng()) && r.text.length > 0)
|
||||||
tinyMCE.execCommand('delete');
|
tinyMCE.execCommand('delete');
|
||||||
|
|
||||||
if (html && html.length > 0)
|
if (html && html.length > 0)
|
||||||
tinyMCE.execCommand('mcePasteWord', false, html);
|
tinyMCE.execCommand('mcePasteWord', false, html);
|
||||||
|
|
||||||
tinyMCE.cancelEvent(e);
|
tinyMCE.cancelEvent(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
_insertText : function(content, bLinebreaks) {
|
_insertText : function(content, bLinebreaks) {
|
||||||
if (content && content.length > 0) {
|
if (content && content.length > 0) {
|
||||||
if (bLinebreaks) {
|
if (bLinebreaks) {
|
||||||
// Special paragraph treatment
|
// Special paragraph treatment
|
||||||
if (tinyMCE.getParam("paste_create_paragraphs", true)) {
|
if (tinyMCE.getParam("paste_create_paragraphs", true)) {
|
||||||
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
||||||
for (var i=0; i<rl.length; i+=2)
|
for (var i=0; i<rl.length; i+=2)
|
||||||
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
||||||
|
|
||||||
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
|
content = tinyMCE.regexpReplace(content, "\r\n\r\n", "</p><p>", "gi");
|
||||||
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
|
content = tinyMCE.regexpReplace(content, "\r\r", "</p><p>", "gi");
|
||||||
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
|
content = tinyMCE.regexpReplace(content, "\n\n", "</p><p>", "gi");
|
||||||
|
|
||||||
// Has paragraphs
|
// Has paragraphs
|
||||||
if ((pos = content.indexOf('</p><p>')) != -1) {
|
if ((pos = content.indexOf('</p><p>')) != -1) {
|
||||||
tinyMCE.execCommand("Delete");
|
tinyMCE.execCommand("Delete");
|
||||||
|
|
||||||
var node = tinyMCE.selectedInstance.getFocusElement();
|
var node = tinyMCE.selectedInstance.getFocusElement();
|
||||||
|
|
||||||
// Get list of elements to break
|
// Get list of elements to break
|
||||||
var breakElms = new Array();
|
var breakElms = new Array();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (node.nodeType == 1) {
|
if (node.nodeType == 1) {
|
||||||
// Don't break tables and break at body
|
// Don't break tables and break at body
|
||||||
if (node.nodeName == "TD" || node.nodeName == "BODY")
|
if (node.nodeName == "TD" || node.nodeName == "BODY")
|
||||||
break;
|
break;
|
||||||
|
|
||||||
breakElms[breakElms.length] = node;
|
breakElms[breakElms.length] = node;
|
||||||
}
|
}
|
||||||
} while(node = node.parentNode);
|
} while(node = node.parentNode);
|
||||||
|
|
||||||
var before = "", after = "</p>";
|
var before = "", after = "</p>";
|
||||||
before += content.substring(0, pos);
|
before += content.substring(0, pos);
|
||||||
|
|
||||||
for (var i=0; i<breakElms.length; i++) {
|
for (var i=0; i<breakElms.length; i++) {
|
||||||
before += "</" + breakElms[i].nodeName + ">";
|
before += "</" + breakElms[i].nodeName + ">";
|
||||||
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
|
after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
|
||||||
}
|
}
|
||||||
|
|
||||||
before += "<p>";
|
before += "<p>";
|
||||||
content = before + content.substring(pos+7) + after;
|
content = before + content.substring(pos+7) + after;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tinyMCE.getParam("paste_create_linebreaks", true)) {
|
if (tinyMCE.getParam("paste_create_linebreaks", true)) {
|
||||||
content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
|
content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
|
||||||
content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
|
content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
|
||||||
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
|
content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyMCE.execCommand("mceInsertRawHTML", false, content);
|
tinyMCE.execCommand("mceInsertRawHTML", false, content);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_insertWordContent : function(content) {
|
_insertWordContent : function(content) {
|
||||||
if (content && content.length > 0) {
|
if (content && content.length > 0) {
|
||||||
// Cleanup Word content
|
// Cleanup Word content
|
||||||
var bull = String.fromCharCode(8226);
|
var bull = String.fromCharCode(8226);
|
||||||
var middot = String.fromCharCode(183);
|
var middot = String.fromCharCode(183);
|
||||||
var cb;
|
var cb;
|
||||||
|
|
||||||
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
|
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
|
||||||
content = eval(cb + "('before', content)");
|
content = eval(cb + "('before', content)");
|
||||||
|
|
||||||
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
var rl = tinyMCE.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
|
||||||
for (var i=0; i<rl.length; i+=2)
|
for (var i=0; i<rl.length; i+=2)
|
||||||
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
|
||||||
|
|
||||||
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
|
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
|
||||||
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
|
content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
|
||||||
}
|
}
|
||||||
|
|
||||||
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
|
content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
|
||||||
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
|
content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
|
||||||
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
|
content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
|
||||||
content = content.replace(/<o:p><\/o:p>/gi, "");
|
content = content.replace(/<o:p><\/o:p>/gi, "");
|
||||||
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
|
content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
|
||||||
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
|
content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
|
||||||
|
|
||||||
if (tinyMCE.getParam("paste_remove_spans", true))
|
if (tinyMCE.getParam("paste_remove_spans", true))
|
||||||
content = content.replace(/<\/?span[^>]*>/gi, "");
|
content = content.replace(/<\/?span[^>]*>/gi, "");
|
||||||
|
|
||||||
if (tinyMCE.getParam("paste_remove_styles", true))
|
if (tinyMCE.getParam("paste_remove_styles", true))
|
||||||
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
|
content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
|
||||||
|
|
||||||
content = content.replace(/<\/?font[^>]*>/gi, "");
|
content = content.replace(/<\/?font[^>]*>/gi, "");
|
||||||
|
|
||||||
// Strips class attributes.
|
// Strips class attributes.
|
||||||
switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
|
switch (tinyMCE.getParam("paste_strip_class_attributes", "all")) {
|
||||||
case "all":
|
case "all":
|
||||||
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
|
content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "mso":
|
case "mso":
|
||||||
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
|
content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
|
content = content.replace(new RegExp('href="?' + TinyMCE_PastePlugin._reEscape("" + document.location) + '', 'gi'), 'href="' + tinyMCE.settings['document_base_url']);
|
||||||
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
|
content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
|
||||||
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
|
content = content.replace(/<\\?\?xml[^>]*>/gi, "");
|
||||||
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
|
content = content.replace(/<\/?\w+:[^>]*>/gi, "");
|
||||||
content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks
|
content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks
|
||||||
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
|
content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
|
||||||
|
|
||||||
// content = content.replace(/\/? */gi, "");
|
// content = content.replace(/\/? */gi, "");
|
||||||
// content = content.replace(/<p> <\/p>/gi, '');
|
// content = content.replace(/<p> <\/p>/gi, '');
|
||||||
|
|
||||||
if (!tinyMCE.settings['force_p_newlines']) {
|
if (!tinyMCE.settings['force_p_newlines']) {
|
||||||
content = content.replace('', '' ,'gi');
|
content = content.replace('', '' ,'gi');
|
||||||
content = content.replace('</p>', '<br /><br />' ,'gi');
|
content = content.replace('</p>', '<br /><br />' ,'gi');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
|
if (!tinyMCE.isMSIE && !tinyMCE.settings['force_p_newlines']) {
|
||||||
content = content.replace(/<\/?p[^>]*>/gi, "");
|
content = content.replace(/<\/?p[^>]*>/gi, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
content = content.replace(/<\/?div[^>]*>/gi, "");
|
content = content.replace(/<\/?div[^>]*>/gi, "");
|
||||||
|
|
||||||
// Convert all middlot lists to UL lists
|
// Convert all middlot lists to UL lists
|
||||||
if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
|
if (tinyMCE.getParam("paste_convert_middot_lists", true)) {
|
||||||
var div = document.createElement("div");
|
var div = document.createElement("div");
|
||||||
div.innerHTML = content;
|
div.innerHTML = content;
|
||||||
|
|
||||||
// Convert all middot paragraphs to li elements
|
// Convert all middot paragraphs to li elements
|
||||||
var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
|
var className = tinyMCE.getParam("paste_unindented_list_class", "unIndentedList");
|
||||||
|
|
||||||
while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
|
while (TinyMCE_PastePlugin._convertMiddots(div, "--list--")) ; // bull
|
||||||
while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
|
while (TinyMCE_PastePlugin._convertMiddots(div, middot, className)) ; // Middot
|
||||||
while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
|
while (TinyMCE_PastePlugin._convertMiddots(div, bull)) ; // bull
|
||||||
|
|
||||||
content = div.innerHTML;
|
content = div.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Replace all headers with strong and fix some other issues
|
// Replace all headers with strong and fix some other issues
|
||||||
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
|
if (tinyMCE.getParam("paste_convert_headers_to_strong", false)) {
|
||||||
content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>');
|
content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>');
|
||||||
content = content.replace(/<h[1-6]>/gi, '<p><b>');
|
content = content.replace(/<h[1-6]>/gi, '<p><b>');
|
||||||
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
|
content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
|
||||||
content = content.replace(/<b> <\/b>/gi, '<b> </b>');
|
content = content.replace(/<b> <\/b>/gi, '<b> </b>');
|
||||||
content = content.replace(/^( )*/gi, '');
|
content = content.replace(/^( )*/gi, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
content = content.replace(/--list--/gi, ""); // Remove --list--
|
content = content.replace(/--list--/gi, ""); // Remove --list--
|
||||||
|
|
||||||
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
|
if ((cb = tinyMCE.getParam("paste_insert_word_content_callback", "")) != "")
|
||||||
content = eval(cb + "('after', content)");
|
content = eval(cb + "('after', content)");
|
||||||
|
|
||||||
// Insert cleaned content
|
// Insert cleaned content
|
||||||
tinyMCE.execCommand("mceInsertContent", false, content);
|
tinyMCE.execCommand("mceInsertContent", false, content);
|
||||||
|
|
||||||
if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
|
if (tinyMCE.getParam('paste_force_cleanup_wordpaste', true))
|
||||||
window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
|
window.setTimeout('tinyMCE.execCommand("mceCleanup");', 1); // Do normal cleanup detached from this thread
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_reEscape : function(s) {
|
_reEscape : function(s) {
|
||||||
var l = "?.\\*[](){}+^$:";
|
var l = "?.\\*[](){}+^$:";
|
||||||
var o = "";
|
var o = "";
|
||||||
|
|
||||||
for (var i=0; i<s.length; i++) {
|
for (var i=0; i<s.length; i++) {
|
||||||
var c = s.charAt(i);
|
var c = s.charAt(i);
|
||||||
|
|
||||||
if (l.indexOf(c) != -1)
|
if (l.indexOf(c) != -1)
|
||||||
o += '\\' + c;
|
o += '\\' + c;
|
||||||
else
|
else
|
||||||
o += c;
|
o += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
},
|
},
|
||||||
|
|
||||||
_convertMiddots : function(div, search, class_name) {
|
_convertMiddots : function(div, search, class_name) {
|
||||||
var mdot = String.fromCharCode(183);
|
var mdot = String.fromCharCode(183);
|
||||||
var bull = String.fromCharCode(8226);
|
var bull = String.fromCharCode(8226);
|
||||||
|
|
||||||
var nodes = div.getElementsByTagName("p");
|
var nodes = div.getElementsByTagName("p");
|
||||||
var prevul;
|
var prevul;
|
||||||
for (var i=0; i<nodes.length; i++) {
|
for (var i=0; i<nodes.length; i++) {
|
||||||
var p = nodes[i];
|
var p = nodes[i];
|
||||||
|
|
||||||
// Is middot
|
// Is middot
|
||||||
if (p.innerHTML.indexOf(search) == 0) {
|
if (p.innerHTML.indexOf(search) == 0) {
|
||||||
var ul = document.createElement("ul");
|
var ul = document.createElement("ul");
|
||||||
|
|
||||||
if (class_name)
|
if (class_name)
|
||||||
ul.className = class_name;
|
ul.className = class_name;
|
||||||
|
|
||||||
// Add the first one
|
// Add the first one
|
||||||
var li = document.createElement("li");
|
var li = document.createElement("li");
|
||||||
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
||||||
ul.appendChild(li);
|
ul.appendChild(li);
|
||||||
|
|
||||||
// Add the rest
|
// Add the rest
|
||||||
var np = p.nextSibling;
|
var np = p.nextSibling;
|
||||||
while (np) {
|
while (np) {
|
||||||
// If the node is whitespace, then
|
// If the node is whitespace, then
|
||||||
// ignore it and continue on.
|
// ignore it and continue on.
|
||||||
if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
|
if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
|
||||||
np = np.nextSibling;
|
np = np.nextSibling;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search == mdot) {
|
if (search == mdot) {
|
||||||
if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) {
|
if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) {
|
||||||
// Second level of nesting
|
// Second level of nesting
|
||||||
if (!prevul) {
|
if (!prevul) {
|
||||||
prevul = ul;
|
prevul = ul;
|
||||||
ul = document.createElement("ul");
|
ul = document.createElement("ul");
|
||||||
prevul.appendChild(ul);
|
prevul.appendChild(ul);
|
||||||
}
|
}
|
||||||
np.innerHTML = np.innerHTML.replace(/^o/, '');
|
np.innerHTML = np.innerHTML.replace(/^o/, '');
|
||||||
} else {
|
} else {
|
||||||
// Pop the stack if we're going back up to the first level
|
// Pop the stack if we're going back up to the first level
|
||||||
if (prevul) {
|
if (prevul) {
|
||||||
ul = prevul;
|
ul = prevul;
|
||||||
prevul = null;
|
prevul = null;
|
||||||
}
|
}
|
||||||
// Not element or middot paragraph
|
// Not element or middot paragraph
|
||||||
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Not element or middot paragraph
|
// Not element or middot paragraph
|
||||||
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var cp = np.nextSibling;
|
var cp = np.nextSibling;
|
||||||
var li = document.createElement("li");
|
var li = document.createElement("li");
|
||||||
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
|
||||||
np.parentNode.removeChild(np);
|
np.parentNode.removeChild(np);
|
||||||
ul.appendChild(li);
|
ul.appendChild(li);
|
||||||
np = cp;
|
np = cp;
|
||||||
}
|
}
|
||||||
|
|
||||||
p.parentNode.replaceChild(ul, p);
|
p.parentNode.replaceChild(ul, p);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
_clipboardHTML : function() {
|
_clipboardHTML : function() {
|
||||||
var div = document.getElementById('_TinyMCE_clipboardHTML');
|
var div = document.getElementById('_TinyMCE_clipboardHTML');
|
||||||
|
|
||||||
if (!div) {
|
if (!div) {
|
||||||
var div = document.createElement('DIV');
|
var div = document.createElement('DIV');
|
||||||
div.id = '_TinyMCE_clipboardHTML';
|
div.id = '_TinyMCE_clipboardHTML';
|
||||||
|
|
||||||
with (div.style) {
|
with (div.style) {
|
||||||
visibility = 'hidden';
|
visibility = 'hidden';
|
||||||
overflow = 'hidden';
|
overflow = 'hidden';
|
||||||
position = 'absolute';
|
position = 'absolute';
|
||||||
width = 1;
|
width = 1;
|
||||||
height = 1;
|
height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.innerHTML = '';
|
div.innerHTML = '';
|
||||||
var rng = document.body.createTextRange();
|
var rng = document.body.createTextRange();
|
||||||
rng.moveToElementText(div);
|
rng.moveToElementText(div);
|
||||||
rng.execCommand('Paste');
|
rng.execCommand('Paste');
|
||||||
var html = div.innerHTML;
|
var html = div.innerHTML;
|
||||||
div.innerHTML = '';
|
div.innerHTML = '';
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);
|
tinyMCE.addPlugin("paste", TinyMCE_PastePlugin);
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
function saveContent() {
|
function saveContent() {
|
||||||
if (document.forms[0].htmlSource.value == '') {
|
if (document.forms[0].htmlSource.value == '') {
|
||||||
tinyMCEPopup.close();
|
tinyMCEPopup.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyMCEPopup.execCommand('mcePasteText', false, {
|
tinyMCEPopup.execCommand('mcePasteText', false, {
|
||||||
html : document.forms[0].htmlSource.value,
|
html : document.forms[0].htmlSource.value,
|
||||||
linebreaks : document.forms[0].linebreaks.checked
|
linebreaks : document.forms[0].linebreaks.checked
|
||||||
});
|
});
|
||||||
|
|
||||||
tinyMCEPopup.close();
|
tinyMCEPopup.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadInit() {
|
function onLoadInit() {
|
||||||
tinyMCEPopup.resizeToInnerSize();
|
tinyMCEPopup.resizeToInnerSize();
|
||||||
|
|
||||||
// Remove Gecko spellchecking
|
// Remove Gecko spellchecking
|
||||||
if (tinyMCE.isGecko)
|
if (tinyMCE.isGecko)
|
||||||
document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
|
document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
|
||||||
|
|
||||||
resizeInputs();
|
resizeInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||||
|
|
||||||
function resizeInputs() {
|
function resizeInputs() {
|
||||||
if (!tinyMCE.isMSIE) {
|
if (!tinyMCE.isMSIE) {
|
||||||
wHeight = self.innerHeight-80;
|
wHeight = self.innerHeight-80;
|
||||||
wWidth = self.innerWidth-17;
|
wWidth = self.innerWidth-17;
|
||||||
} else {
|
} else {
|
||||||
wHeight = document.body.clientHeight-80;
|
wHeight = document.body.clientHeight-80;
|
||||||
wWidth = document.body.clientWidth-17;
|
wWidth = document.body.clientWidth-17;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
|
document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
|
||||||
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
|
document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,52 +1,52 @@
|
||||||
function saveContent() {
|
function saveContent() {
|
||||||
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
|
var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
|
||||||
|
|
||||||
if (html == ''){
|
if (html == ''){
|
||||||
tinyMCEPopup.close();
|
tinyMCEPopup.close();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyMCEPopup.execCommand('mcePasteWord', false, html);
|
tinyMCEPopup.execCommand('mcePasteWord', false, html);
|
||||||
tinyMCEPopup.close();
|
tinyMCEPopup.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLoadInit() {
|
function onLoadInit() {
|
||||||
tinyMCEPopup.resizeToInnerSize();
|
tinyMCEPopup.resizeToInnerSize();
|
||||||
|
|
||||||
// Fix for endless reloading in FF
|
// Fix for endless reloading in FF
|
||||||
window.setTimeout('createIFrame();', 10);
|
window.setTimeout('createIFrame();', 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createIFrame() {
|
function createIFrame() {
|
||||||
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
|
document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
|
||||||
|
|
||||||
function initIframe(doc) {
|
function initIframe(doc) {
|
||||||
var dir = tinyMCE.selectedInstance.settings['directionality'];
|
var dir = tinyMCE.selectedInstance.settings['directionality'];
|
||||||
|
|
||||||
doc.body.dir = dir;
|
doc.body.dir = dir;
|
||||||
|
|
||||||
// Remove Gecko spellchecking
|
// Remove Gecko spellchecking
|
||||||
if (tinyMCE.isGecko)
|
if (tinyMCE.isGecko)
|
||||||
doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
|
doc.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
|
||||||
|
|
||||||
resizeInputs();
|
resizeInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeInputs() {
|
function resizeInputs() {
|
||||||
if (!tinyMCE.isMSIE) {
|
if (!tinyMCE.isMSIE) {
|
||||||
wHeight = self.innerHeight - 80;
|
wHeight = self.innerHeight - 80;
|
||||||
wWidth = self.innerWidth - 18;
|
wWidth = self.innerWidth - 18;
|
||||||
} else {
|
} else {
|
||||||
wHeight = document.body.clientHeight - 80;
|
wHeight = document.body.clientHeight - 80;
|
||||||
wWidth = document.body.clientWidth - 18;
|
wWidth = document.body.clientWidth - 18;
|
||||||
}
|
}
|
||||||
|
|
||||||
var elm = document.getElementById('frmData');
|
var elm = document.getElementById('frmData');
|
||||||
if (elm) {
|
if (elm) {
|
||||||
elm.style.height = Math.abs(wHeight) + 'px';
|
elm.style.height = Math.abs(wHeight) + 'px';
|
||||||
elm.style.width = Math.abs(wWidth) + 'px';
|
elm.style.width = Math.abs(wWidth) + 'px';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// UK lang variables
|
// UK lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
paste_text_desc : 'Paste as Plain Text',
|
paste_text_desc : 'Paste as Plain Text',
|
||||||
paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
|
paste_text_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
|
||||||
paste_text_linebreaks : 'Keep linebreaks',
|
paste_text_linebreaks : 'Keep linebreaks',
|
||||||
paste_word_desc : 'Paste from Word',
|
paste_word_desc : 'Paste from Word',
|
||||||
paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
|
paste_word_title : 'Use CTRL+V on your keyboard to paste the text into the window.',
|
||||||
selectall_desc : 'Select All'
|
selectall_desc : 'Select All'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,73 +1,73 @@
|
||||||
<?php
|
<?php
|
||||||
/* *
|
/* *
|
||||||
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
||||||
*
|
*
|
||||||
* Copyright © 2006 Moxiecode Systems AB
|
* Copyright © 2006 Moxiecode Systems AB
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("HttpClient.class.php");
|
require_once("HttpClient.class.php");
|
||||||
|
|
||||||
class TinyGoogleSpell {
|
class TinyGoogleSpell {
|
||||||
var $lang;
|
var $lang;
|
||||||
|
|
||||||
function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
function TinyGoogleSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
||||||
$this->lang = $lang;
|
$this->lang = $lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns array with bad words or false if failed.
|
// Returns array with bad words or false if failed.
|
||||||
function checkWords($word_array) {
|
function checkWords($word_array) {
|
||||||
$words = array();
|
$words = array();
|
||||||
$wordstr = implode(' ', $word_array);
|
$wordstr = implode(' ', $word_array);
|
||||||
|
|
||||||
$matches = $this->_getMatches($wordstr);
|
$matches = $this->_getMatches($wordstr);
|
||||||
|
|
||||||
for ($i=0; $i<count($matches); $i++)
|
for ($i=0; $i<count($matches); $i++)
|
||||||
$words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
|
$words[] = substr($wordstr, $matches[$i][1], $matches[$i][2]);
|
||||||
|
|
||||||
return $words;
|
return $words;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns array with suggestions or false if failed.
|
// Returns array with suggestions or false if failed.
|
||||||
function getSuggestion($word) {
|
function getSuggestion($word) {
|
||||||
$sug = array();
|
$sug = array();
|
||||||
|
|
||||||
$matches = $this->_getMatches($word);
|
$matches = $this->_getMatches($word);
|
||||||
|
|
||||||
if (count($matches) > 0)
|
if (count($matches) > 0)
|
||||||
$sug = explode("\t", $matches[0][4]);
|
$sug = explode("\t", $matches[0][4]);
|
||||||
|
|
||||||
return $sug;
|
return $sug;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _getMatches($word_list) {
|
function _getMatches($word_list) {
|
||||||
$xml = "";
|
$xml = "";
|
||||||
|
|
||||||
// Setup HTTP Client
|
// Setup HTTP Client
|
||||||
$client = new HttpClient('www.google.com');
|
$client = new HttpClient('www.google.com');
|
||||||
$client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
|
$client->setUserAgent('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR');
|
||||||
$client->setHandleRedirects(false);
|
$client->setHandleRedirects(false);
|
||||||
$client->setDebug(false);
|
$client->setDebug(false);
|
||||||
|
|
||||||
// Setup XML request
|
// Setup XML request
|
||||||
$xml .= '<?xml version="1.0" encoding="utf-8" ?>';
|
$xml .= '<?xml version="1.0" encoding="utf-8" ?>';
|
||||||
$xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
|
$xml .= '<spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1">';
|
||||||
$xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
|
$xml .= '<text>' . htmlentities($word_list) . '</text></spellrequest>';
|
||||||
|
|
||||||
// Execute HTTP Post to Google
|
// Execute HTTP Post to Google
|
||||||
if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
|
if (!$client->post('/tbproxy/spell?lang=' . $this->lang, $xml)) {
|
||||||
$this->errorMsg[] = 'An error occurred: ' . $client->getError();
|
$this->errorMsg[] = 'An error occurred: ' . $client->getError();
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab and parse content
|
// Grab and parse content
|
||||||
$xml = $client->getContent();
|
$xml = $client->getContent();
|
||||||
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
|
preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
|
||||||
|
|
||||||
return $matches;
|
return $matches;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup classname, should be the same as the name of the spellchecker class
|
// Setup classname, should be the same as the name of the spellchecker class
|
||||||
$spellCheckerConfig['class'] = "TinyGoogleSpell";
|
$spellCheckerConfig['class'] = "TinyGoogleSpell";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,64 +1,64 @@
|
||||||
<?php
|
<?php
|
||||||
/* *
|
/* *
|
||||||
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
||||||
*
|
*
|
||||||
* Copyright © 2006 Moxiecode Systems AB
|
* Copyright © 2006 Moxiecode Systems AB
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class TinyPSpell {
|
class TinyPSpell {
|
||||||
var $lang;
|
var $lang;
|
||||||
var $mode;
|
var $mode;
|
||||||
var $string;
|
var $string;
|
||||||
var $plink;
|
var $plink;
|
||||||
var $errorMsg;
|
var $errorMsg;
|
||||||
|
|
||||||
var $jargon;
|
var $jargon;
|
||||||
var $spelling;
|
var $spelling;
|
||||||
var $encoding;
|
var $encoding;
|
||||||
|
|
||||||
function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
||||||
$this->lang = $lang;
|
$this->lang = $lang;
|
||||||
$this->mode = $mode;
|
$this->mode = $mode;
|
||||||
$this->plink = false;
|
$this->plink = false;
|
||||||
$this->errorMsg = array();
|
$this->errorMsg = array();
|
||||||
|
|
||||||
if (!function_exists("pspell_new")) {
|
if (!function_exists("pspell_new")) {
|
||||||
$this->errorMsg[] = "PSpell not found.";
|
$this->errorMsg[] = "PSpell not found.";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
|
$this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns array with bad words or false if failed.
|
// Returns array with bad words or false if failed.
|
||||||
function checkWords($wordArray) {
|
function checkWords($wordArray) {
|
||||||
if (!$this->plink) {
|
if (!$this->plink) {
|
||||||
$this->errorMsg[] = "No PSpell link found for checkWords.";
|
$this->errorMsg[] = "No PSpell link found for checkWords.";
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$wordError = array();
|
$wordError = array();
|
||||||
foreach($wordArray as $word) {
|
foreach($wordArray as $word) {
|
||||||
if(!pspell_check($this->plink, trim($word)))
|
if(!pspell_check($this->plink, trim($word)))
|
||||||
$wordError[] = $word;
|
$wordError[] = $word;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $wordError;
|
return $wordError;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns array with suggestions or false if failed.
|
// Returns array with suggestions or false if failed.
|
||||||
function getSuggestion($word) {
|
function getSuggestion($word) {
|
||||||
if (!$this->plink) {
|
if (!$this->plink) {
|
||||||
$this->errorMsg[] = "No PSpell link found for getSuggestion.";
|
$this->errorMsg[] = "No PSpell link found for getSuggestion.";
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
return pspell_suggest($this->plink, $word);
|
return pspell_suggest($this->plink, $word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup classname, should be the same as the name of the spellchecker class
|
// Setup classname, should be the same as the name of the spellchecker class
|
||||||
$spellCheckerConfig['class'] = "TinyPspell";
|
$spellCheckerConfig['class'] = "TinyPspell";
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,102 +1,102 @@
|
||||||
<?php
|
<?php
|
||||||
/* *
|
/* *
|
||||||
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
* Tiny Spelling Interface for TinyMCE Spell Checking.
|
||||||
*
|
*
|
||||||
* Copyright © 2006 Moxiecode Systems AB
|
* Copyright © 2006 Moxiecode Systems AB
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class TinyPspellShell {
|
class TinyPspellShell {
|
||||||
var $lang;
|
var $lang;
|
||||||
var $mode;
|
var $mode;
|
||||||
var $string;
|
var $string;
|
||||||
var $error;
|
var $error;
|
||||||
var $errorMsg;
|
var $errorMsg;
|
||||||
|
|
||||||
var $cmd;
|
var $cmd;
|
||||||
var $tmpfile;
|
var $tmpfile;
|
||||||
|
|
||||||
var $jargon;
|
var $jargon;
|
||||||
var $spelling;
|
var $spelling;
|
||||||
var $encoding;
|
var $encoding;
|
||||||
|
|
||||||
function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
|
||||||
$this->lang = $lang;
|
$this->lang = $lang;
|
||||||
$this->mode = $mode;
|
$this->mode = $mode;
|
||||||
$this->error = false;
|
$this->error = false;
|
||||||
$this->errorMsg = array();
|
$this->errorMsg = array();
|
||||||
|
|
||||||
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
|
$this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
|
||||||
$this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
|
$this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns array with bad words or false if failed.
|
// Returns array with bad words or false if failed.
|
||||||
function checkWords($wordArray) {
|
function checkWords($wordArray) {
|
||||||
if ($fh = fopen($this->tmpfile, "w")) {
|
if ($fh = fopen($this->tmpfile, "w")) {
|
||||||
fwrite($fh, "!\n");
|
fwrite($fh, "!\n");
|
||||||
foreach($wordArray as $key => $value)
|
foreach($wordArray as $key => $value)
|
||||||
fwrite($fh, "^" . $value . "\n");
|
fwrite($fh, "^" . $value . "\n");
|
||||||
|
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
} else {
|
} else {
|
||||||
$this->errorMsg[] = "PSpell not found.";
|
$this->errorMsg[] = "PSpell not found.";
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = shell_exec($this->cmd);
|
$data = shell_exec($this->cmd);
|
||||||
@unlink($this->tmpfile);
|
@unlink($this->tmpfile);
|
||||||
$returnData = array();
|
$returnData = array();
|
||||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
|
||||||
foreach($dataArr as $dstr) {
|
foreach($dataArr as $dstr) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
|
|
||||||
// Skip this line.
|
// Skip this line.
|
||||||
if (strpos($dstr, "@") === 0)
|
if (strpos($dstr, "@") === 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
|
preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
|
||||||
|
|
||||||
if (!empty($matches[1]))
|
if (!empty($matches[1]))
|
||||||
$returnData[] = $matches[1];
|
$returnData[] = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $returnData;
|
return $returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns array with suggestions or false if failed.
|
// Returns array with suggestions or false if failed.
|
||||||
function getSuggestion($word) {
|
function getSuggestion($word) {
|
||||||
if ($fh = fopen($this->tmpfile, "w")) {
|
if ($fh = fopen($this->tmpfile, "w")) {
|
||||||
fwrite($fh, "!\n");
|
fwrite($fh, "!\n");
|
||||||
fwrite($fh, "^$word\n");
|
fwrite($fh, "^$word\n");
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
} else
|
} else
|
||||||
wp_die("Error opening tmp file.");
|
wp_die("Error opening tmp file.");
|
||||||
|
|
||||||
$data = shell_exec($this->cmd);
|
$data = shell_exec($this->cmd);
|
||||||
@unlink($this->tmpfile);
|
@unlink($this->tmpfile);
|
||||||
$returnData = array();
|
$returnData = array();
|
||||||
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
$dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
|
|
||||||
foreach($dataArr as $dstr) {
|
foreach($dataArr as $dstr) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
|
|
||||||
// Skip this line.
|
// Skip this line.
|
||||||
if (strpos($dstr, "@") === 0)
|
if (strpos($dstr, "@") === 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
|
preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
|
||||||
|
|
||||||
if (!empty($matches[1])) {
|
if (!empty($matches[1])) {
|
||||||
// For some reason, the exec version seems to add commas?
|
// For some reason, the exec version seems to add commas?
|
||||||
$returnData[] = str_replace(",", "", $matches[1]);
|
$returnData[] = str_replace(",", "", $matches[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $returnData;
|
return $returnData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup classname, should be the same as the name of the spellchecker class
|
// Setup classname, should be the same as the name of the spellchecker class
|
||||||
$spellCheckerConfig['class'] = "TinyPspellShell";
|
$spellCheckerConfig['class'] = "TinyPspellShell";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,29 +1,29 @@
|
||||||
<?php
|
<?php
|
||||||
$spellCheckerConfig = array();
|
$spellCheckerConfig = array();
|
||||||
|
|
||||||
// General settings
|
// General settings
|
||||||
$spellCheckerConfig['enabled'] = true;
|
$spellCheckerConfig['enabled'] = true;
|
||||||
|
|
||||||
// Pspell shell specific settings
|
// Pspell shell specific settings
|
||||||
$spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
|
$spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell';
|
||||||
$spellCheckerConfig['tinypspellshell.tmp'] = '/tmp/tinyspell/0';
|
$spellCheckerConfig['tinypspellshell.tmp'] = '/tmp/tinyspell/0';
|
||||||
|
|
||||||
// Default settings
|
// Default settings
|
||||||
$spellCheckerConfig['default.language'] = 'en';
|
$spellCheckerConfig['default.language'] = 'en';
|
||||||
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
|
$spellCheckerConfig['default.mode'] = PSPELL_FAST;
|
||||||
|
|
||||||
// Normaly not required to configure
|
// Normaly not required to configure
|
||||||
$spellCheckerConfig['default.spelling'] = "";
|
$spellCheckerConfig['default.spelling'] = "";
|
||||||
$spellCheckerConfig['default.jargon'] = "";
|
$spellCheckerConfig['default.jargon'] = "";
|
||||||
$spellCheckerConfig['default.encoding'] = "";
|
$spellCheckerConfig['default.encoding'] = "";
|
||||||
|
|
||||||
// Spellchecker class use
|
// Spellchecker class use
|
||||||
if ( function_exists('pspell_new') )
|
if ( function_exists('pspell_new') )
|
||||||
require_once("classes/TinyPspell.class.php"); // Internal PHP version
|
require_once("classes/TinyPspell.class.php"); // Internal PHP version
|
||||||
|
|
||||||
elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
|
elseif ( file_exists($spellCheckerConfig['tinypspellshell.aspell']) )
|
||||||
require_once("classes/TinyPspellShell.class.php"); // Command line pspell
|
require_once("classes/TinyPspellShell.class.php"); // Command line pspell
|
||||||
|
|
||||||
else
|
else
|
||||||
require_once("classes/TinyGoogleSpell.class.php"); // Google web service
|
require_once("classes/TinyGoogleSpell.class.php"); // Google web service
|
||||||
?>
|
?>
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,14 +1,14 @@
|
||||||
// UK lang variables
|
// UK lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('spellchecker',{
|
tinyMCE.addToLang('spellchecker',{
|
||||||
desc : 'Toggle spellchecker',
|
desc : 'Toggle spellchecker',
|
||||||
menu : 'Spellchecker settings',
|
menu : 'Spellchecker settings',
|
||||||
ignore_word : 'Ignore word',
|
ignore_word : 'Ignore word',
|
||||||
ignore_words : 'Ignore all',
|
ignore_words : 'Ignore all',
|
||||||
langs : 'Languages',
|
langs : 'Languages',
|
||||||
wait : 'Please wait...',
|
wait : 'Please wait...',
|
||||||
swait : 'Spellchecking, please wait...',
|
swait : 'Spellchecking, please wait...',
|
||||||
sug : 'Suggestions',
|
sug : 'Suggestions',
|
||||||
no_sug : 'No suggestions',
|
no_sug : 'No suggestions',
|
||||||
no_mpell : 'No misspellings found.'
|
no_mpell : 'No misspellings found.'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,133 +1,133 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* $RCSfile: tinyspell.php,v $
|
* $RCSfile: tinyspell.php,v $
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.1 $
|
||||||
* $Date: 2006/03/14 17:33:47 $
|
* $Date: 2006/03/14 17:33:47 $
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once("config.php");
|
require_once("config.php");
|
||||||
|
|
||||||
$id = sanitize($_POST['id'], "loose");
|
$id = sanitize($_POST['id'], "loose");
|
||||||
|
|
||||||
if (!$spellCheckerConfig['enabled']) {
|
if (!$spellCheckerConfig['enabled']) {
|
||||||
header('Content-type: text/xml; charset=utf-8');
|
header('Content-type: text/xml; charset=utf-8');
|
||||||
echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
|
echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Basic config
|
// Basic config
|
||||||
$defaultLanguage = $spellCheckerConfig['default.language'];
|
$defaultLanguage = $spellCheckerConfig['default.language'];
|
||||||
$defaultMode = $spellCheckerConfig['default.mode'];
|
$defaultMode = $spellCheckerConfig['default.mode'];
|
||||||
|
|
||||||
// Normaly not required to configure
|
// Normaly not required to configure
|
||||||
$defaultSpelling = $spellCheckerConfig['default.spelling'];
|
$defaultSpelling = $spellCheckerConfig['default.spelling'];
|
||||||
$defaultJargon = $spellCheckerConfig['default.jargon'];
|
$defaultJargon = $spellCheckerConfig['default.jargon'];
|
||||||
$defaultEncoding = $spellCheckerConfig['default.encoding'];
|
$defaultEncoding = $spellCheckerConfig['default.encoding'];
|
||||||
$outputType = "xml"; // Do not change
|
$outputType = "xml"; // Do not change
|
||||||
|
|
||||||
// Get input parameters.
|
// Get input parameters.
|
||||||
|
|
||||||
$check = $_POST['check'];
|
$check = $_POST['check'];
|
||||||
$cmd = sanitize($_POST['cmd']);
|
$cmd = sanitize($_POST['cmd']);
|
||||||
$lang = sanitize($_POST['lang'], "strict");
|
$lang = sanitize($_POST['lang'], "strict");
|
||||||
$mode = sanitize($_POST['mode'], "strict");
|
$mode = sanitize($_POST['mode'], "strict");
|
||||||
$spelling = sanitize($_POST['spelling'], "strict");
|
$spelling = sanitize($_POST['spelling'], "strict");
|
||||||
$jargon = sanitize($_POST['jargon'], "strict");
|
$jargon = sanitize($_POST['jargon'], "strict");
|
||||||
$encoding = sanitize($_POST['encoding'], "strict");
|
$encoding = sanitize($_POST['encoding'], "strict");
|
||||||
$sg = sanitize($_POST['sg'], "bool");
|
$sg = sanitize($_POST['sg'], "bool");
|
||||||
$words = array();
|
$words = array();
|
||||||
|
|
||||||
$validRequest = true;
|
$validRequest = true;
|
||||||
|
|
||||||
if (empty($check))
|
if (empty($check))
|
||||||
$validRequest = false;
|
$validRequest = false;
|
||||||
|
|
||||||
if (empty($lang))
|
if (empty($lang))
|
||||||
$lang = $defaultLanguage;
|
$lang = $defaultLanguage;
|
||||||
|
|
||||||
if (empty($mode))
|
if (empty($mode))
|
||||||
$mode = $defaultMode;
|
$mode = $defaultMode;
|
||||||
|
|
||||||
if (empty($spelling))
|
if (empty($spelling))
|
||||||
$spelling = $defaultSpelling;
|
$spelling = $defaultSpelling;
|
||||||
|
|
||||||
if (empty($jargon))
|
if (empty($jargon))
|
||||||
$jargon = $defaultJargon;
|
$jargon = $defaultJargon;
|
||||||
|
|
||||||
if (empty($encoding))
|
if (empty($encoding))
|
||||||
$encoding = $defaultEncoding;
|
$encoding = $defaultEncoding;
|
||||||
|
|
||||||
function sanitize($str, $type="strict") {
|
function sanitize($str, $type="strict") {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case "strict":
|
case "strict":
|
||||||
$str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
|
$str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
|
||||||
break;
|
break;
|
||||||
case "loose":
|
case "loose":
|
||||||
$str = preg_replace("/</i", ">", $str);
|
$str = preg_replace("/</i", ">", $str);
|
||||||
$str = preg_replace("/>/i", "<", $str);
|
$str = preg_replace("/>/i", "<", $str);
|
||||||
break;
|
break;
|
||||||
case "bool":
|
case "bool":
|
||||||
if ($str == "true" || $str == true)
|
if ($str == "true" || $str == true)
|
||||||
$str = true;
|
$str = true;
|
||||||
else
|
else
|
||||||
$str = false;
|
$str = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
|
$tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
|
||||||
|
|
||||||
if (count($tinyspell->errorMsg) == 0) {
|
if (count($tinyspell->errorMsg) == 0) {
|
||||||
switch($cmd) {
|
switch($cmd) {
|
||||||
case "spell":
|
case "spell":
|
||||||
// Space for non-exec version and \n for the exec version.
|
// Space for non-exec version and \n for the exec version.
|
||||||
$words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
|
$words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
|
||||||
$result = $tinyspell->checkWords($words);
|
$result = $tinyspell->checkWords($words);
|
||||||
break;
|
break;
|
||||||
case "suggest":
|
case "suggest":
|
||||||
$result = $tinyspell->getSuggestion($check);
|
$result = $tinyspell->getSuggestion($check);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Just use this for now.
|
// Just use this for now.
|
||||||
$tinyspell->errorMsg[] = "No command.";
|
$tinyspell->errorMsg[] = "No command.";
|
||||||
$outputType = $outputType . "error";
|
$outputType = $outputType . "error";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
$outputType = $outputType . "error";
|
$outputType = $outputType . "error";
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
$result = array();
|
$result = array();
|
||||||
|
|
||||||
// Output data
|
// Output data
|
||||||
switch($outputType) {
|
switch($outputType) {
|
||||||
case "xml":
|
case "xml":
|
||||||
header('Content-type: text/xml; charset=utf-8');
|
header('Content-type: text/xml; charset=utf-8');
|
||||||
echo '<?xml version="1.0" encoding="utf-8" ?>';
|
echo '<?xml version="1.0" encoding="utf-8" ?>';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
if (count($result) == 0)
|
if (count($result) == 0)
|
||||||
echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
|
echo '<res id="' . $id . '" cmd="'. $cmd .'" />';
|
||||||
else
|
else
|
||||||
echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
|
echo '<res id="' . $id . '" cmd="'. $cmd .'">'. utf8_encode(implode(" ", $result)) .'</res>';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "xmlerror";
|
case "xmlerror";
|
||||||
header('Content-type: text/xml; charset=utf-8');
|
header('Content-type: text/xml; charset=utf-8');
|
||||||
echo '<?xml version="1.0" encoding="utf-8" ?>';
|
echo '<?xml version="1.0" encoding="utf-8" ?>';
|
||||||
echo "\n";
|
echo "\n";
|
||||||
echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
|
echo '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
|
||||||
break;
|
break;
|
||||||
case "html":
|
case "html":
|
||||||
var_dump($result);
|
var_dump($result);
|
||||||
break;
|
break;
|
||||||
case "htmlerror":
|
case "htmlerror":
|
||||||
echo "Error";
|
echo "Error";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -1,33 +1,33 @@
|
||||||
// EN lang variables
|
// EN lang variables
|
||||||
|
|
||||||
if (navigator.userAgent.indexOf('Mac OS') != -1) {
|
if (navigator.userAgent.indexOf('Mac OS') != -1) {
|
||||||
// Mac OS browsers use Ctrl to hit accesskeys
|
// Mac OS browsers use Ctrl to hit accesskeys
|
||||||
var metaKey = 'Ctrl';
|
var metaKey = 'Ctrl';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var metaKey = 'Alt';
|
var metaKey = 'Alt';
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
|
wordpress_more_button : 'Split post with More tag (' + metaKey + '+t)',
|
||||||
wordpress_page_button : 'Split post with Page tag',
|
wordpress_page_button : 'Split post with Page tag',
|
||||||
wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
|
wordpress_adv_button : 'Show/Hide Advanced Toolbar (' + metaKey + '+b)',
|
||||||
wordpress_more_alt : 'More...',
|
wordpress_more_alt : 'More...',
|
||||||
wordpress_page_alt : '...page...',
|
wordpress_page_alt : '...page...',
|
||||||
help_button_title : 'Help (' + metaKey + '+h)',
|
help_button_title : 'Help (' + metaKey + '+h)',
|
||||||
bold_desc : 'Bold (Ctrl+B)',
|
bold_desc : 'Bold (Ctrl+B)',
|
||||||
italic_desc : 'Italic (Ctrl+I)',
|
italic_desc : 'Italic (Ctrl+I)',
|
||||||
underline_desc : 'Underline (Ctrl+U)',
|
underline_desc : 'Underline (Ctrl+U)',
|
||||||
link_desc : 'Insert/edit link (' + metaKey + '+a)',
|
link_desc : 'Insert/edit link (' + metaKey + '+a)',
|
||||||
unlink_desc : 'Unlink (' + metaKey + '+s)',
|
unlink_desc : 'Unlink (' + metaKey + '+s)',
|
||||||
image_desc : 'Insert/edit image (' + metaKey + '+m)',
|
image_desc : 'Insert/edit image (' + metaKey + '+m)',
|
||||||
striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
|
striketrough_desc : 'Strikethrough (' + metaKey + '+k)',
|
||||||
justifyleft_desc : 'Align left (' + metaKey + '+f)',
|
justifyleft_desc : 'Align left (' + metaKey + '+f)',
|
||||||
justifycenter_desc : 'Align center (' + metaKey + '+c)',
|
justifycenter_desc : 'Align center (' + metaKey + '+c)',
|
||||||
justifyright_desc : 'Align right (' + metaKey + '+r)',
|
justifyright_desc : 'Align right (' + metaKey + '+r)',
|
||||||
justifyfull_desc : 'Align full (' + metaKey + '+j)',
|
justifyfull_desc : 'Align full (' + metaKey + '+j)',
|
||||||
bullist_desc : 'Unordered list (' + metaKey + '+l)',
|
bullist_desc : 'Unordered list (' + metaKey + '+l)',
|
||||||
numlist_desc : 'Ordered list (' + metaKey + '+o)',
|
numlist_desc : 'Ordered list (' + metaKey + '+o)',
|
||||||
outdent_desc : 'Outdent (' + metaKey + '+w)',
|
outdent_desc : 'Outdent (' + metaKey + '+w)',
|
||||||
indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
|
indent_desc : 'Indent List/Blockquote (' + metaKey + '+q)'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,57 +1,57 @@
|
||||||
/* Import plugin specific language pack */
|
/* Import plugin specific language pack */
|
||||||
tinyMCE.importPluginLanguagePack('wphelp', '');
|
tinyMCE.importPluginLanguagePack('wphelp', '');
|
||||||
|
|
||||||
function TinyMCE_wphelp_getControlHTML(control_name) {
|
function TinyMCE_wphelp_getControlHTML(control_name) {
|
||||||
switch (control_name) {
|
switch (control_name) {
|
||||||
case "wphelp":
|
case "wphelp":
|
||||||
var titleHelp = tinyMCE.getLang('lang_help_button_title');
|
var titleHelp = tinyMCE.getLang('lang_help_button_title');
|
||||||
var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\');return false;"><img id="{$editor_id}_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
|
var buttons = '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\')" target="_self" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\');return false;"><img id="{$editor_id}_help" src="{$pluginurl}/images/help.gif" title="'+titleHelp+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
|
||||||
var hiddenControls = '<div class="zerosize">'
|
var hiddenControls = '<div class="zerosize">'
|
||||||
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
|
+ '<input type="button" accesskey="b" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Bold\',false);" />'
|
||||||
+ '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
|
+ '<input type="button" accesskey="i" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Italic\',false);" />'
|
||||||
+ '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
|
+ '<input type="button" accesskey="d" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Strikethrough\',false);" />'
|
||||||
+ '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
|
+ '<input type="button" accesskey="l" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertUnorderedList\',false);" />'
|
||||||
+ '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
|
+ '<input type="button" accesskey="o" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'InsertOrderedList\',false);" />'
|
||||||
+ '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
|
+ '<input type="button" accesskey="w" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Outdent\',false);" />'
|
||||||
+ '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
|
+ '<input type="button" accesskey="q" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Indent\',false);" />'
|
||||||
+ '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
|
+ '<input type="button" accesskey="f" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyLeft\',false);" />'
|
||||||
+ '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
|
+ '<input type="button" accesskey="c" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyCenter\',false);" />'
|
||||||
+ '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
|
+ '<input type="button" accesskey="r" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'JustifyRight\',false);" />'
|
||||||
+ '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
|
+ '<input type="button" accesskey="a" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceLink\',true);" />'
|
||||||
+ '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
|
+ '<input type="button" accesskey="s" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'unlink\',false);" />'
|
||||||
+ '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
|
+ '<input type="button" accesskey="m" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceImage\',true);" />'
|
||||||
+ '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" />'
|
+ '<input type="button" accesskey="t" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\');" />'
|
||||||
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
|
+ '<input type="button" accesskey="u" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Undo\',false);" />'
|
||||||
+ '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
|
+ '<input type="button" accesskey="y" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'Redo\',false);" />'
|
||||||
+ '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
|
+ '<input type="button" accesskey="e" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceCodeEditor\',false);" />'
|
||||||
+ '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\',false);" />'
|
+ '<input type="button" accesskey="h" onclick="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceWordPressHelp\',false);" />'
|
||||||
+ '</div>';
|
+ '</div>';
|
||||||
return buttons+hiddenControls;
|
return buttons+hiddenControls;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) {
|
function TinyMCE_wphelp_execCommand(editor_id, element, command, user_interface, value) {
|
||||||
|
|
||||||
// Handle commands
|
// Handle commands
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case "mceWordPressHelp":
|
case "mceWordPressHelp":
|
||||||
var template = new Array();
|
var template = new Array();
|
||||||
|
|
||||||
template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
|
template['file'] = tinyMCE.baseURL + '/wp-mce-help.php';
|
||||||
template['width'] = 480;
|
template['width'] = 480;
|
||||||
template['height'] = 380;
|
template['height'] = 380;
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
resizable : 'yes',
|
resizable : 'yes',
|
||||||
scrollbars : 'yes'
|
scrollbars : 'yes'
|
||||||
};
|
};
|
||||||
|
|
||||||
tinyMCE.openWindow(template, args);
|
tinyMCE.openWindow(template, args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass to next handler in chain
|
// Pass to next handler in chain
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// EN lang variables
|
// EN lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
help_button_title : 'Help (Alt+h)'
|
help_button_title : 'Help (Alt+h)'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,82 +1,82 @@
|
||||||
// UK lang variables
|
// UK lang variables
|
||||||
|
|
||||||
tinyMCE.addToLang('',{
|
tinyMCE.addToLang('',{
|
||||||
theme_style_select : '-- Styles --',
|
theme_style_select : '-- Styles --',
|
||||||
theme_code_desc : 'Edit HTML Source',
|
theme_code_desc : 'Edit HTML Source',
|
||||||
theme_code_title : 'HTML Source Editor',
|
theme_code_title : 'HTML Source Editor',
|
||||||
theme_code_wordwrap : 'Word wrap',
|
theme_code_wordwrap : 'Word wrap',
|
||||||
theme_sub_desc : 'Subscript',
|
theme_sub_desc : 'Subscript',
|
||||||
theme_sup_desc : 'Superscript',
|
theme_sup_desc : 'Superscript',
|
||||||
theme_hr_desc : 'Insert horizontal ruler',
|
theme_hr_desc : 'Insert horizontal ruler',
|
||||||
theme_removeformat_desc : 'Remove formatting',
|
theme_removeformat_desc : 'Remove formatting',
|
||||||
theme_custom1_desc : 'Your custom description here',
|
theme_custom1_desc : 'Your custom description here',
|
||||||
insert_image_border : 'Border',
|
insert_image_border : 'Border',
|
||||||
insert_image_dimensions : 'Dimensions',
|
insert_image_dimensions : 'Dimensions',
|
||||||
insert_image_vspace : 'Vertical space',
|
insert_image_vspace : 'Vertical space',
|
||||||
insert_image_hspace : 'Horizontal space',
|
insert_image_hspace : 'Horizontal space',
|
||||||
insert_image_align : 'Alignment',
|
insert_image_align : 'Alignment',
|
||||||
insert_image_align_default : '-- Not set --',
|
insert_image_align_default : '-- Not set --',
|
||||||
insert_image_align_baseline : 'Baseline',
|
insert_image_align_baseline : 'Baseline',
|
||||||
insert_image_align_top : 'Top',
|
insert_image_align_top : 'Top',
|
||||||
insert_image_align_middle : 'Middle',
|
insert_image_align_middle : 'Middle',
|
||||||
insert_image_align_bottom : 'Bottom',
|
insert_image_align_bottom : 'Bottom',
|
||||||
insert_image_align_texttop : 'TextTop',
|
insert_image_align_texttop : 'TextTop',
|
||||||
insert_image_align_absmiddle : 'Absolute Middle',
|
insert_image_align_absmiddle : 'Absolute Middle',
|
||||||
insert_image_align_absbottom : 'Absolute Bottom',
|
insert_image_align_absbottom : 'Absolute Bottom',
|
||||||
insert_image_align_left : 'Left',
|
insert_image_align_left : 'Left',
|
||||||
insert_image_align_right : 'Right',
|
insert_image_align_right : 'Right',
|
||||||
theme_font_size : '-- Font size --',
|
theme_font_size : '-- Font size --',
|
||||||
theme_fontdefault : '-- Font family --',
|
theme_fontdefault : '-- Font family --',
|
||||||
theme_block : '-- Format --',
|
theme_block : '-- Format --',
|
||||||
theme_paragraph : 'Paragraph',
|
theme_paragraph : 'Paragraph',
|
||||||
theme_div : 'Div',
|
theme_div : 'Div',
|
||||||
theme_address : 'Address',
|
theme_address : 'Address',
|
||||||
theme_pre : 'Preformatted',
|
theme_pre : 'Preformatted',
|
||||||
theme_h1 : 'Heading 1',
|
theme_h1 : 'Heading 1',
|
||||||
theme_h2 : 'Heading 2',
|
theme_h2 : 'Heading 2',
|
||||||
theme_h3 : 'Heading 3',
|
theme_h3 : 'Heading 3',
|
||||||
theme_h4 : 'Heading 4',
|
theme_h4 : 'Heading 4',
|
||||||
theme_h5 : 'Heading 5',
|
theme_h5 : 'Heading 5',
|
||||||
theme_h6 : 'Heading 6',
|
theme_h6 : 'Heading 6',
|
||||||
theme_blockquote : 'Blockquote',
|
theme_blockquote : 'Blockquote',
|
||||||
theme_code : 'Code',
|
theme_code : 'Code',
|
||||||
theme_samp : 'Code sample',
|
theme_samp : 'Code sample',
|
||||||
theme_dt : 'Definition term ',
|
theme_dt : 'Definition term ',
|
||||||
theme_dd : 'Definition description',
|
theme_dd : 'Definition description',
|
||||||
theme_colorpicker_title : 'Select a color',
|
theme_colorpicker_title : 'Select a color',
|
||||||
theme_colorpicker_apply : 'Apply',
|
theme_colorpicker_apply : 'Apply',
|
||||||
theme_forecolor_desc : 'Select text color',
|
theme_forecolor_desc : 'Select text color',
|
||||||
theme_backcolor_desc : 'Select background color',
|
theme_backcolor_desc : 'Select background color',
|
||||||
theme_charmap_title : 'Select custom character',
|
theme_charmap_title : 'Select custom character',
|
||||||
theme_charmap_desc : 'Insert custom character',
|
theme_charmap_desc : 'Insert custom character',
|
||||||
theme_visualaid_desc : 'Toggle guidelines/invisible elements',
|
theme_visualaid_desc : 'Toggle guidelines/invisible elements',
|
||||||
insert_anchor_title : 'Insert/edit anchor',
|
insert_anchor_title : 'Insert/edit anchor',
|
||||||
insert_anchor_name : 'Anchor name',
|
insert_anchor_name : 'Anchor name',
|
||||||
theme_anchor_desc : 'Insert/edit anchor',
|
theme_anchor_desc : 'Insert/edit anchor',
|
||||||
theme_insert_link_titlefield : 'Title',
|
theme_insert_link_titlefield : 'Title',
|
||||||
theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
|
theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
|
||||||
theme_path : 'Path',
|
theme_path : 'Path',
|
||||||
cut_desc : 'Cut',
|
cut_desc : 'Cut',
|
||||||
copy_desc : 'Copy',
|
copy_desc : 'Copy',
|
||||||
paste_desc : 'Paste',
|
paste_desc : 'Paste',
|
||||||
link_list : 'Link list',
|
link_list : 'Link list',
|
||||||
image_list : 'Image list',
|
image_list : 'Image list',
|
||||||
browse : 'Browse',
|
browse : 'Browse',
|
||||||
image_props_desc : 'Image properties',
|
image_props_desc : 'Image properties',
|
||||||
newdocument_desc : 'New document',
|
newdocument_desc : 'New document',
|
||||||
class_name : 'Class',
|
class_name : 'Class',
|
||||||
newdocument : 'Are you sure you want clear all contents?',
|
newdocument : 'Are you sure you want clear all contents?',
|
||||||
about_title : 'About TinyMCE',
|
about_title : 'About TinyMCE',
|
||||||
about : 'About',
|
about : 'About',
|
||||||
license : 'License',
|
license : 'License',
|
||||||
plugins : 'Plugins',
|
plugins : 'Plugins',
|
||||||
plugin : 'Plugin',
|
plugin : 'Plugin',
|
||||||
author : 'Author',
|
author : 'Author',
|
||||||
version : 'Version',
|
version : 'Version',
|
||||||
loaded_plugins : 'Loaded plugins',
|
loaded_plugins : 'Loaded plugins',
|
||||||
help : 'Help',
|
help : 'Help',
|
||||||
not_set : '-- Not set --',
|
not_set : '-- Not set --',
|
||||||
close : 'Close',
|
close : 'Close',
|
||||||
toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
|
toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
|
||||||
invalid_data : 'Error: Invalid values entered, these are marked in red.'
|
invalid_data : 'Error: Invalid values entered, these are marked in red.'
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,210 +1,210 @@
|
||||||
/**
|
/**
|
||||||
* $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $
|
* $Id: form_utils.js 43 2006-08-08 16:10:07Z spocke $
|
||||||
*
|
*
|
||||||
* Various form utilitiy functions.
|
* Various form utilitiy functions.
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
|
var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
|
||||||
|
|
||||||
function getColorPickerHTML(id, target_form_element) {
|
function getColorPickerHTML(id, target_form_element) {
|
||||||
var h = "";
|
var h = "";
|
||||||
|
|
||||||
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
|
h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
|
||||||
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
|
h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
|
||||||
h += ' onmouseover="this.className=\'mceButtonOver\'"';
|
h += ' onmouseover="this.className=\'mceButtonOver\'"';
|
||||||
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
|
h += ' onmouseout="this.className=\'mceButtonNormal\'"';
|
||||||
h += ' onmousedown="this.className=\'mceButtonDown\'"';
|
h += ' onmousedown="this.className=\'mceButtonDown\'"';
|
||||||
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
||||||
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
||||||
|
|
||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
function pickColor(e, target_form_element) {
|
function pickColor(e, target_form_element) {
|
||||||
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
|
if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
|
||||||
tinyMCEPopup.pickColor(e, target_form_element);
|
tinyMCEPopup.pickColor(e, target_form_element);
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateColor(img_id, form_element_id) {
|
function updateColor(img_id, form_element_id) {
|
||||||
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBrowserDisabled(id, state) {
|
function setBrowserDisabled(id, state) {
|
||||||
var img = document.getElementById(id);
|
var img = document.getElementById(id);
|
||||||
var lnk = document.getElementById(id + "_link");
|
var lnk = document.getElementById(id + "_link");
|
||||||
|
|
||||||
if (lnk) {
|
if (lnk) {
|
||||||
if (state) {
|
if (state) {
|
||||||
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
lnk.setAttribute("realhref", lnk.getAttribute("href"));
|
||||||
lnk.removeAttribute("href");
|
lnk.removeAttribute("href");
|
||||||
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
|
tinyMCE.switchClass(img, 'mceButtonDisabled', true);
|
||||||
} else {
|
} else {
|
||||||
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
lnk.setAttribute("href", lnk.getAttribute("realhref"));
|
||||||
tinyMCE.switchClass(img, 'mceButtonNormal', false);
|
tinyMCE.switchClass(img, 'mceButtonNormal', false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBrowserHTML(id, target_form_element, type, prefix) {
|
function getBrowserHTML(id, target_form_element, type, prefix) {
|
||||||
var option = prefix + "_" + type + "_browser_callback";
|
var option = prefix + "_" + type + "_browser_callback";
|
||||||
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
|
||||||
if (cb == null)
|
if (cb == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
var html = "";
|
var html = "";
|
||||||
|
|
||||||
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
|
||||||
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
|
html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
|
||||||
html += ' onmouseover="this.className=\'mceButtonOver\';"';
|
html += ' onmouseover="this.className=\'mceButtonOver\';"';
|
||||||
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
|
html += ' onmouseout="this.className=\'mceButtonNormal\';"';
|
||||||
html += ' onmousedown="this.className=\'mceButtonDown\';"';
|
html += ' onmousedown="this.className=\'mceButtonDown\';"';
|
||||||
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
|
||||||
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openBrower(img_id, target_form_element, type, option) {
|
function openBrower(img_id, target_form_element, type, option) {
|
||||||
var img = document.getElementById(img_id);
|
var img = document.getElementById(img_id);
|
||||||
|
|
||||||
if (img.className != "mceButtonDisabled")
|
if (img.className != "mceButtonDisabled")
|
||||||
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
tinyMCEPopup.openBrowser(target_form_element, type, option);
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
|
||||||
if (!form_obj || !form_obj.elements[field_name])
|
if (!form_obj || !form_obj.elements[field_name])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var sel = form_obj.elements[field_name];
|
var sel = form_obj.elements[field_name];
|
||||||
|
|
||||||
var found = false;
|
var found = false;
|
||||||
for (var i=0; i<sel.options.length; i++) {
|
for (var i=0; i<sel.options.length; i++) {
|
||||||
var option = sel.options[i];
|
var option = sel.options[i];
|
||||||
|
|
||||||
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
|
||||||
option.selected = true;
|
option.selected = true;
|
||||||
found = true;
|
found = true;
|
||||||
} else
|
} else
|
||||||
option.selected = false;
|
option.selected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found && add_custom && value != '') {
|
if (!found && add_custom && value != '') {
|
||||||
var option = new Option(value, value);
|
var option = new Option(value, value);
|
||||||
option.selected = true;
|
option.selected = true;
|
||||||
sel.options[sel.options.length] = option;
|
sel.options[sel.options.length] = option;
|
||||||
sel.selectedIndex = sel.options.length - 1;
|
sel.selectedIndex = sel.options.length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSelectValue(form_obj, field_name) {
|
function getSelectValue(form_obj, field_name) {
|
||||||
var elm = form_obj.elements[field_name];
|
var elm = form_obj.elements[field_name];
|
||||||
|
|
||||||
if (elm == null || elm.options == null)
|
if (elm == null || elm.options == null)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return elm.options[elm.selectedIndex].value;
|
return elm.options[elm.selectedIndex].value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addSelectValue(form_obj, field_name, name, value) {
|
function addSelectValue(form_obj, field_name, name, value) {
|
||||||
var s = form_obj.elements[field_name];
|
var s = form_obj.elements[field_name];
|
||||||
var o = new Option(name, value);
|
var o = new Option(name, value);
|
||||||
s.options[s.options.length] = o;
|
s.options[s.options.length] = o;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addClassesToList(list_id, specific_option) {
|
function addClassesToList(list_id, specific_option) {
|
||||||
// Setup class droplist
|
// Setup class droplist
|
||||||
var styleSelectElm = document.getElementById(list_id);
|
var styleSelectElm = document.getElementById(list_id);
|
||||||
var styles = tinyMCE.getParam('theme_advanced_styles', false);
|
var styles = tinyMCE.getParam('theme_advanced_styles', false);
|
||||||
styles = tinyMCE.getParam(specific_option, styles);
|
styles = tinyMCE.getParam(specific_option, styles);
|
||||||
|
|
||||||
if (styles) {
|
if (styles) {
|
||||||
var stylesAr = styles.split(';');
|
var stylesAr = styles.split(';');
|
||||||
|
|
||||||
for (var i=0; i<stylesAr.length; i++) {
|
for (var i=0; i<stylesAr.length; i++) {
|
||||||
if (stylesAr != "") {
|
if (stylesAr != "") {
|
||||||
var key, value;
|
var key, value;
|
||||||
|
|
||||||
key = stylesAr[i].split('=')[0];
|
key = stylesAr[i].split('=')[0];
|
||||||
value = stylesAr[i].split('=')[1];
|
value = stylesAr[i].split('=')[1];
|
||||||
|
|
||||||
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
styleSelectElm.options[styleSelectElm.length] = new Option(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Use auto impored classes
|
// Use auto impored classes
|
||||||
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
|
var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
|
||||||
for (var i=0; i<csses.length; i++)
|
for (var i=0; i<csses.length; i++)
|
||||||
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
|
styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isVisible(element_id) {
|
function isVisible(element_id) {
|
||||||
var elm = document.getElementById(element_id);
|
var elm = document.getElementById(element_id);
|
||||||
|
|
||||||
return elm && elm.style.display != "none";
|
return elm && elm.style.display != "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertRGBToHex(col) {
|
function convertRGBToHex(col) {
|
||||||
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
|
||||||
|
|
||||||
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
var rgb = col.replace(re, "$1,$2,$3").split(',');
|
||||||
if (rgb.length == 3) {
|
if (rgb.length == 3) {
|
||||||
r = parseInt(rgb[0]).toString(16);
|
r = parseInt(rgb[0]).toString(16);
|
||||||
g = parseInt(rgb[1]).toString(16);
|
g = parseInt(rgb[1]).toString(16);
|
||||||
b = parseInt(rgb[2]).toString(16);
|
b = parseInt(rgb[2]).toString(16);
|
||||||
|
|
||||||
r = r.length == 1 ? '0' + r : r;
|
r = r.length == 1 ? '0' + r : r;
|
||||||
g = g.length == 1 ? '0' + g : g;
|
g = g.length == 1 ? '0' + g : g;
|
||||||
b = b.length == 1 ? '0' + b : b;
|
b = b.length == 1 ? '0' + b : b;
|
||||||
|
|
||||||
return "#" + r + g + b;
|
return "#" + r + g + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
function convertHexToRGB(col) {
|
function convertHexToRGB(col) {
|
||||||
if (col.indexOf('#') != -1) {
|
if (col.indexOf('#') != -1) {
|
||||||
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
|
||||||
|
|
||||||
r = parseInt(col.substring(0, 2), 16);
|
r = parseInt(col.substring(0, 2), 16);
|
||||||
g = parseInt(col.substring(2, 4), 16);
|
g = parseInt(col.substring(2, 4), 16);
|
||||||
b = parseInt(col.substring(4, 6), 16);
|
b = parseInt(col.substring(4, 6), 16);
|
||||||
|
|
||||||
return "rgb(" + r + "," + g + "," + b + ")";
|
return "rgb(" + r + "," + g + "," + b + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
return col;
|
return col;
|
||||||
}
|
}
|
||||||
|
|
||||||
function trimSize(size) {
|
function trimSize(size) {
|
||||||
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
|
return size.replace(new RegExp('[^0-9%]', 'gi'), '');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCSSSize(size) {
|
function getCSSSize(size) {
|
||||||
size = trimSize(size);
|
size = trimSize(size);
|
||||||
|
|
||||||
if (size == "")
|
if (size == "")
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
return size.indexOf('%') != -1 ? size : size + "px";
|
return size.indexOf('%') != -1 ? size : size + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStyle(elm, attrib, style) {
|
function getStyle(elm, attrib, style) {
|
||||||
var val = tinyMCE.getAttrib(elm, attrib);
|
var val = tinyMCE.getAttrib(elm, attrib);
|
||||||
|
|
||||||
if (val != '')
|
if (val != '')
|
||||||
return '' + val;
|
return '' + val;
|
||||||
|
|
||||||
if (typeof(style) == 'undefined')
|
if (typeof(style) == 'undefined')
|
||||||
style = attrib;
|
style = attrib;
|
||||||
|
|
||||||
val = eval('elm.style.' + style);
|
val = eval('elm.style.' + style);
|
||||||
|
|
||||||
return val == null ? '' : '' + val;
|
return val == null ? '' : '' + val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,210 +1,210 @@
|
||||||
/**
|
/**
|
||||||
* $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $
|
* $Id: mclayer.js 18 2006-06-29 14:11:23Z spocke $
|
||||||
*
|
*
|
||||||
* Moxiecode floating layer script.
|
* Moxiecode floating layer script.
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function MCLayer(id) {
|
function MCLayer(id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.settings = new Array();
|
this.settings = new Array();
|
||||||
this.blockerElement = null;
|
this.blockerElement = null;
|
||||||
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
|
this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
|
||||||
this.events = false;
|
this.events = false;
|
||||||
this.autoHideCallback = null;
|
this.autoHideCallback = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
MCLayer.prototype = {
|
MCLayer.prototype = {
|
||||||
moveRelativeTo : function(re, p, a) {
|
moveRelativeTo : function(re, p, a) {
|
||||||
var rep = this.getAbsPosition(re);
|
var rep = this.getAbsPosition(re);
|
||||||
var w = parseInt(re.offsetWidth);
|
var w = parseInt(re.offsetWidth);
|
||||||
var h = parseInt(re.offsetHeight);
|
var h = parseInt(re.offsetHeight);
|
||||||
var x, y;
|
var x, y;
|
||||||
|
|
||||||
switch (p) {
|
switch (p) {
|
||||||
case "tl":
|
case "tl":
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "tr":
|
case "tr":
|
||||||
x = rep.absLeft + w;
|
x = rep.absLeft + w;
|
||||||
y = rep.absTop;
|
y = rep.absTop;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "bl":
|
case "bl":
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "br":
|
case "br":
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.moveTo(x, y);
|
this.moveTo(x, y);
|
||||||
},
|
},
|
||||||
|
|
||||||
moveBy : function(dx, dy) {
|
moveBy : function(dx, dy) {
|
||||||
var e = this.getElement();
|
var e = this.getElement();
|
||||||
var x = parseInt(e.style.left);
|
var x = parseInt(e.style.left);
|
||||||
var y = parseInt(e.style.top);
|
var y = parseInt(e.style.top);
|
||||||
|
|
||||||
e.style.left = (x + dx) + "px";
|
e.style.left = (x + dx) + "px";
|
||||||
e.style.top = (y + dy) + "px";
|
e.style.top = (y + dy) + "px";
|
||||||
|
|
||||||
this.updateBlocker();
|
this.updateBlocker();
|
||||||
},
|
},
|
||||||
|
|
||||||
moveTo : function(x, y) {
|
moveTo : function(x, y) {
|
||||||
var e = this.getElement();
|
var e = this.getElement();
|
||||||
|
|
||||||
e.style.left = x + "px";
|
e.style.left = x + "px";
|
||||||
e.style.top = y + "px";
|
e.style.top = y + "px";
|
||||||
|
|
||||||
this.updateBlocker();
|
this.updateBlocker();
|
||||||
},
|
},
|
||||||
|
|
||||||
show : function() {
|
show : function() {
|
||||||
MCLayer.visibleLayer = this;
|
MCLayer.visibleLayer = this;
|
||||||
|
|
||||||
this.getElement().style.display = 'block';
|
this.getElement().style.display = 'block';
|
||||||
this.updateBlocker();
|
this.updateBlocker();
|
||||||
},
|
},
|
||||||
|
|
||||||
hide : function() {
|
hide : function() {
|
||||||
this.getElement().style.display = 'none';
|
this.getElement().style.display = 'none';
|
||||||
this.updateBlocker();
|
this.updateBlocker();
|
||||||
},
|
},
|
||||||
|
|
||||||
setAutoHide : function(s, cb) {
|
setAutoHide : function(s, cb) {
|
||||||
this.autoHideCallback = cb;
|
this.autoHideCallback = cb;
|
||||||
this.registerEventHandlers();
|
this.registerEventHandlers();
|
||||||
},
|
},
|
||||||
|
|
||||||
getElement : function() {
|
getElement : function() {
|
||||||
return document.getElementById(this.id);
|
return document.getElementById(this.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateBlocker : function() {
|
updateBlocker : function() {
|
||||||
if (!this.isMSIE)
|
if (!this.isMSIE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var e = this.getElement();
|
var e = this.getElement();
|
||||||
var b = this.getBlocker();
|
var b = this.getBlocker();
|
||||||
var x = this.parseInt(e.style.left);
|
var x = this.parseInt(e.style.left);
|
||||||
var y = this.parseInt(e.style.top);
|
var y = this.parseInt(e.style.top);
|
||||||
var w = this.parseInt(e.offsetWidth);
|
var w = this.parseInt(e.offsetWidth);
|
||||||
var h = this.parseInt(e.offsetHeight);
|
var h = this.parseInt(e.offsetHeight);
|
||||||
|
|
||||||
b.style.left = x + 'px';
|
b.style.left = x + 'px';
|
||||||
b.style.top = y + 'px';
|
b.style.top = y + 'px';
|
||||||
b.style.width = w + 'px';
|
b.style.width = w + 'px';
|
||||||
b.style.height = h + 'px';
|
b.style.height = h + 'px';
|
||||||
b.style.display = e.style.display;
|
b.style.display = e.style.display;
|
||||||
},
|
},
|
||||||
|
|
||||||
getBlocker : function() {
|
getBlocker : function() {
|
||||||
if (!this.blockerElement) {
|
if (!this.blockerElement) {
|
||||||
var d = document, b = d.createElement("iframe");
|
var d = document, b = d.createElement("iframe");
|
||||||
|
|
||||||
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
|
b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
|
||||||
b.src = 'javascript:false;';
|
b.src = 'javascript:false;';
|
||||||
b.frameBorder = '0';
|
b.frameBorder = '0';
|
||||||
b.scrolling = 'no';
|
b.scrolling = 'no';
|
||||||
|
|
||||||
d.body.appendChild(b);
|
d.body.appendChild(b);
|
||||||
this.blockerElement = b;
|
this.blockerElement = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.blockerElement;
|
return this.blockerElement;
|
||||||
},
|
},
|
||||||
|
|
||||||
getAbsPosition : function(n) {
|
getAbsPosition : function(n) {
|
||||||
var p = {absLeft : 0, absTop : 0};
|
var p = {absLeft : 0, absTop : 0};
|
||||||
|
|
||||||
while (n) {
|
while (n) {
|
||||||
p.absLeft += n.offsetLeft;
|
p.absLeft += n.offsetLeft;
|
||||||
p.absTop += n.offsetTop;
|
p.absTop += n.offsetTop;
|
||||||
n = n.offsetParent;
|
n = n.offsetParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return p;
|
return p;
|
||||||
},
|
},
|
||||||
|
|
||||||
registerEventHandlers : function() {
|
registerEventHandlers : function() {
|
||||||
if (!this.events) {
|
if (!this.events) {
|
||||||
var d = document;
|
var d = document;
|
||||||
|
|
||||||
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
|
this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
|
||||||
|
|
||||||
this.events = true;
|
this.events = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addEvent : function(o, n, h) {
|
addEvent : function(o, n, h) {
|
||||||
if (o.attachEvent)
|
if (o.attachEvent)
|
||||||
o.attachEvent("on" + n, h);
|
o.attachEvent("on" + n, h);
|
||||||
else
|
else
|
||||||
o.addEventListener(n, h, false);
|
o.addEventListener(n, h, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
onMouseDown : function(e) {
|
onMouseDown : function(e) {
|
||||||
e = typeof(e) == "undefined" ? window.event : e;
|
e = typeof(e) == "undefined" ? window.event : e;
|
||||||
var b = document.body;
|
var b = document.body;
|
||||||
var l = MCLayer.visibleLayer;
|
var l = MCLayer.visibleLayer;
|
||||||
|
|
||||||
if (l) {
|
if (l) {
|
||||||
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
|
var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
|
||||||
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
|
var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
|
||||||
var el = l.getElement();
|
var el = l.getElement();
|
||||||
var x = parseInt(el.style.left);
|
var x = parseInt(el.style.left);
|
||||||
var y = parseInt(el.style.top);
|
var y = parseInt(el.style.top);
|
||||||
var w = parseInt(el.offsetWidth);
|
var w = parseInt(el.offsetWidth);
|
||||||
var h = parseInt(el.offsetHeight);
|
var h = parseInt(el.offsetHeight);
|
||||||
|
|
||||||
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
|
if (!(mx > x && mx < x + w && my > y && my < y + h)) {
|
||||||
MCLayer.visibleLayer = null;
|
MCLayer.visibleLayer = null;
|
||||||
|
|
||||||
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
|
if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
l.hide();
|
l.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addCSSClass : function(e, c) {
|
addCSSClass : function(e, c) {
|
||||||
this.removeCSSClass(e, c);
|
this.removeCSSClass(e, c);
|
||||||
var a = this.explode(' ', e.className);
|
var a = this.explode(' ', e.className);
|
||||||
a[a.length] = c;
|
a[a.length] = c;
|
||||||
e.className = a.join(' ');
|
e.className = a.join(' ');
|
||||||
},
|
},
|
||||||
|
|
||||||
removeCSSClass : function(e, c) {
|
removeCSSClass : function(e, c) {
|
||||||
var a = this.explode(' ', e.className), i;
|
var a = this.explode(' ', e.className), i;
|
||||||
|
|
||||||
for (i=0; i<a.length; i++) {
|
for (i=0; i<a.length; i++) {
|
||||||
if (a[i] == c)
|
if (a[i] == c)
|
||||||
a[i] = '';
|
a[i] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
e.className = a.join(' ');
|
e.className = a.join(' ');
|
||||||
},
|
},
|
||||||
|
|
||||||
explode : function(d, s) {
|
explode : function(d, s) {
|
||||||
var ar = s.split(d);
|
var ar = s.split(d);
|
||||||
var oar = new Array();
|
var oar = new Array();
|
||||||
|
|
||||||
for (var i = 0; i<ar.length; i++) {
|
for (var i = 0; i<ar.length; i++) {
|
||||||
if (ar[i] != "")
|
if (ar[i] != "")
|
||||||
oar[oar.length] = ar[i];
|
oar[oar.length] = ar[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
return oar;
|
return oar;
|
||||||
},
|
},
|
||||||
|
|
||||||
parseInt : function(s) {
|
parseInt : function(s) {
|
||||||
if (s == null || s == '')
|
if (s == null || s == '')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return parseInt(s);
|
return parseInt(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,74 +1,74 @@
|
||||||
/**
|
/**
|
||||||
* $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $
|
* $Id: mctabs.js 18 2006-06-29 14:11:23Z spocke $
|
||||||
*
|
*
|
||||||
* Moxiecode DHTML Tabs script.
|
* Moxiecode DHTML Tabs script.
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function MCTabs() {
|
function MCTabs() {
|
||||||
this.settings = new Array();
|
this.settings = new Array();
|
||||||
};
|
};
|
||||||
|
|
||||||
MCTabs.prototype.init = function(settings) {
|
MCTabs.prototype.init = function(settings) {
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCTabs.prototype.getParam = function(name, default_value) {
|
MCTabs.prototype.getParam = function(name, default_value) {
|
||||||
var value = null;
|
var value = null;
|
||||||
|
|
||||||
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
|
||||||
|
|
||||||
// Fix bool values
|
// Fix bool values
|
||||||
if (value == "true" || value == "false")
|
if (value == "true" || value == "false")
|
||||||
return (value == "true");
|
return (value == "true");
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
MCTabs.prototype.displayTab = function(tab_id, panel_id) {
|
||||||
var panelElm = document.getElementById(panel_id);
|
var panelElm = document.getElementById(panel_id);
|
||||||
var panelContainerElm = panelElm ? panelElm.parentNode : null;
|
var panelContainerElm = panelElm ? panelElm.parentNode : null;
|
||||||
var tabElm = document.getElementById(tab_id);
|
var tabElm = document.getElementById(tab_id);
|
||||||
var tabContainerElm = tabElm ? tabElm.parentNode : null;
|
var tabContainerElm = tabElm ? tabElm.parentNode : null;
|
||||||
var selectionClass = this.getParam('selection_class', 'current');
|
var selectionClass = this.getParam('selection_class', 'current');
|
||||||
|
|
||||||
if (tabElm && tabContainerElm) {
|
if (tabElm && tabContainerElm) {
|
||||||
var nodes = tabContainerElm.childNodes;
|
var nodes = tabContainerElm.childNodes;
|
||||||
|
|
||||||
// Hide all other tabs
|
// Hide all other tabs
|
||||||
for (var i=0; i<nodes.length; i++) {
|
for (var i=0; i<nodes.length; i++) {
|
||||||
if (nodes[i].nodeName == "LI")
|
if (nodes[i].nodeName == "LI")
|
||||||
nodes[i].className = '';
|
nodes[i].className = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show selected tab
|
// Show selected tab
|
||||||
tabElm.className = 'current';
|
tabElm.className = 'current';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (panelElm && panelContainerElm) {
|
if (panelElm && panelContainerElm) {
|
||||||
var nodes = panelContainerElm.childNodes;
|
var nodes = panelContainerElm.childNodes;
|
||||||
|
|
||||||
// Hide all other panels
|
// Hide all other panels
|
||||||
for (var i=0; i<nodes.length; i++) {
|
for (var i=0; i<nodes.length; i++) {
|
||||||
if (nodes[i].nodeName == "DIV")
|
if (nodes[i].nodeName == "DIV")
|
||||||
nodes[i].className = 'panel';
|
nodes[i].className = 'panel';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show selected panel
|
// Show selected panel
|
||||||
panelElm.className = 'current';
|
panelElm.className = 'current';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MCTabs.prototype.getAnchor = function() {
|
MCTabs.prototype.getAnchor = function() {
|
||||||
var pos, url = document.location.href;
|
var pos, url = document.location.href;
|
||||||
|
|
||||||
if ((pos = url.lastIndexOf('#')) != -1)
|
if ((pos = url.lastIndexOf('#')) != -1)
|
||||||
return url.substring(pos + 1);
|
return url.substring(pos + 1);
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
// Global instance
|
// Global instance
|
||||||
var mcTabs = new MCTabs();
|
var mcTabs = new MCTabs();
|
||||||
|
|
|
@ -1,219 +1,219 @@
|
||||||
/**
|
/**
|
||||||
* $Id: validate.js 65 2006-08-24 15:54:55Z spocke $
|
* $Id: validate.js 65 2006-08-24 15:54:55Z spocke $
|
||||||
*
|
*
|
||||||
* Various form validation methods.
|
* Various form validation methods.
|
||||||
*
|
*
|
||||||
* @author Moxiecode
|
* @author Moxiecode
|
||||||
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
// String validation:
|
// String validation:
|
||||||
|
|
||||||
if (!Validator.isEmail('myemail'))
|
if (!Validator.isEmail('myemail'))
|
||||||
alert('Invalid email.');
|
alert('Invalid email.');
|
||||||
|
|
||||||
// Form validation:
|
// Form validation:
|
||||||
|
|
||||||
var f = document.forms['myform'];
|
var f = document.forms['myform'];
|
||||||
|
|
||||||
if (!Validator.isEmail(f.myemail))
|
if (!Validator.isEmail(f.myemail))
|
||||||
alert('Invalid email.');
|
alert('Invalid email.');
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var Validator = {
|
var Validator = {
|
||||||
isEmail : function(s) {
|
isEmail : function(s) {
|
||||||
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
return this.test(s, '^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');
|
||||||
},
|
},
|
||||||
|
|
||||||
isAbsUrl : function(s) {
|
isAbsUrl : function(s) {
|
||||||
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
return this.test(s, '^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');
|
||||||
},
|
},
|
||||||
|
|
||||||
isSize : function(s) {
|
isSize : function(s) {
|
||||||
return this.test(s, '^[0-9]+(px|%)?$');
|
return this.test(s, '^[0-9]+(px|%)?$');
|
||||||
},
|
},
|
||||||
|
|
||||||
isId : function(s) {
|
isId : function(s) {
|
||||||
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
return this.test(s, '^[A-Za-z_]([A-Za-z0-9_])*$');
|
||||||
},
|
},
|
||||||
|
|
||||||
isEmpty : function(s) {
|
isEmpty : function(s) {
|
||||||
var nl, i;
|
var nl, i;
|
||||||
|
|
||||||
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
if (s.nodeName == 'SELECT' && s.selectedIndex < 1)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (s.type == 'checkbox' && !s.checked)
|
if (s.type == 'checkbox' && !s.checked)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (s.type == 'radio') {
|
if (s.type == 'radio') {
|
||||||
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
for (i=0, nl = s.form.elements; i<nl.length; i++) {
|
||||||
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
if (nl[i].type == "radio" && nl[i].name == s.name && nl[i].checked)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
return new RegExp('^\\s*$').test(s.nodeType == 1 ? s.value : s);
|
||||||
},
|
},
|
||||||
|
|
||||||
isNumber : function(s, d) {
|
isNumber : function(s, d) {
|
||||||
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
return !isNaN(s.nodeType == 1 ? s.value : s) && (!d || !this.test(s, '^-?[0-9]*\\.[0-9]*$'));
|
||||||
},
|
},
|
||||||
|
|
||||||
test : function(s, p) {
|
test : function(s, p) {
|
||||||
s = s.nodeType == 1 ? s.value : s;
|
s = s.nodeType == 1 ? s.value : s;
|
||||||
|
|
||||||
return s == '' || new RegExp(p).test(s);
|
return s == '' || new RegExp(p).test(s);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var AutoValidator = {
|
var AutoValidator = {
|
||||||
settings : {
|
settings : {
|
||||||
id_cls : 'id',
|
id_cls : 'id',
|
||||||
int_cls : 'int',
|
int_cls : 'int',
|
||||||
url_cls : 'url',
|
url_cls : 'url',
|
||||||
number_cls : 'number',
|
number_cls : 'number',
|
||||||
email_cls : 'email',
|
email_cls : 'email',
|
||||||
size_cls : 'size',
|
size_cls : 'size',
|
||||||
required_cls : 'required',
|
required_cls : 'required',
|
||||||
invalid_cls : 'invalid',
|
invalid_cls : 'invalid',
|
||||||
min_cls : 'min',
|
min_cls : 'min',
|
||||||
max_cls : 'max'
|
max_cls : 'max'
|
||||||
},
|
},
|
||||||
|
|
||||||
init : function(s) {
|
init : function(s) {
|
||||||
var n;
|
var n;
|
||||||
|
|
||||||
for (n in s)
|
for (n in s)
|
||||||
this.settings[n] = s[n];
|
this.settings[n] = s[n];
|
||||||
},
|
},
|
||||||
|
|
||||||
validate : function(f) {
|
validate : function(f) {
|
||||||
var i, nl, s = this.settings, c = 0;
|
var i, nl, s = this.settings, c = 0;
|
||||||
|
|
||||||
nl = this.tags(f, 'label');
|
nl = this.tags(f, 'label');
|
||||||
for (i=0; i<nl.length; i++)
|
for (i=0; i<nl.length; i++)
|
||||||
this.removeClass(nl[i], s.invalid_cls);
|
this.removeClass(nl[i], s.invalid_cls);
|
||||||
|
|
||||||
c += this.validateElms(f, 'input');
|
c += this.validateElms(f, 'input');
|
||||||
c += this.validateElms(f, 'select');
|
c += this.validateElms(f, 'select');
|
||||||
c += this.validateElms(f, 'textarea');
|
c += this.validateElms(f, 'textarea');
|
||||||
|
|
||||||
return c == 3;
|
return c == 3;
|
||||||
},
|
},
|
||||||
|
|
||||||
invalidate : function(n) {
|
invalidate : function(n) {
|
||||||
this.mark(n.form, n);
|
this.mark(n.form, n);
|
||||||
},
|
},
|
||||||
|
|
||||||
reset : function(e) {
|
reset : function(e) {
|
||||||
var t = new Array('label', 'input', 'select', 'textarea');
|
var t = new Array('label', 'input', 'select', 'textarea');
|
||||||
var i, j, nl, s = this.settings;
|
var i, j, nl, s = this.settings;
|
||||||
|
|
||||||
if (e == null)
|
if (e == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i=0; i<t.length; i++) {
|
for (i=0; i<t.length; i++) {
|
||||||
nl = this.tags(e.form ? e.form : e, t[i]);
|
nl = this.tags(e.form ? e.form : e, t[i]);
|
||||||
for (j=0; j<nl.length; j++)
|
for (j=0; j<nl.length; j++)
|
||||||
this.removeClass(nl[j], s.invalid_cls);
|
this.removeClass(nl[j], s.invalid_cls);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
validateElms : function(f, e) {
|
validateElms : function(f, e) {
|
||||||
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
var nl, i, n, s = this.settings, st = true, va = Validator, v;
|
||||||
|
|
||||||
nl = this.tags(f, e);
|
nl = this.tags(f, e);
|
||||||
for (i=0; i<nl.length; i++) {
|
for (i=0; i<nl.length; i++) {
|
||||||
n = nl[i];
|
n = nl[i];
|
||||||
|
|
||||||
this.removeClass(n, s.invalid_cls);
|
this.removeClass(n, s.invalid_cls);
|
||||||
|
|
||||||
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
if (this.hasClass(n, s.required_cls) && va.isEmpty(n))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
if (this.hasClass(n, s.number_cls) && !va.isNumber(n))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
if (this.hasClass(n, s.int_cls) && !va.isNumber(n, true))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
if (this.hasClass(n, s.url_cls) && !va.isAbsUrl(n))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
if (this.hasClass(n, s.email_cls) && !va.isEmail(n))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
if (this.hasClass(n, s.size_cls) && !va.isSize(n))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
if (this.hasClass(n, s.id_cls) && !va.isId(n))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
|
|
||||||
if (this.hasClass(n, s.min_cls, true)) {
|
if (this.hasClass(n, s.min_cls, true)) {
|
||||||
v = this.getNum(n, s.min_cls);
|
v = this.getNum(n, s.min_cls);
|
||||||
|
|
||||||
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
if (isNaN(v) || parseInt(n.value) < parseInt(v))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hasClass(n, s.max_cls, true)) {
|
if (this.hasClass(n, s.max_cls, true)) {
|
||||||
v = this.getNum(n, s.max_cls);
|
v = this.getNum(n, s.max_cls);
|
||||||
|
|
||||||
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
if (isNaN(v) || parseInt(n.value) > parseInt(v))
|
||||||
st = this.mark(f, n);
|
st = this.mark(f, n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return st;
|
return st;
|
||||||
},
|
},
|
||||||
|
|
||||||
hasClass : function(n, c, d) {
|
hasClass : function(n, c, d) {
|
||||||
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
return new RegExp('\\b' + c + (d ? '[0-9]+' : '') + '\\b', 'g').test(n.className);
|
||||||
},
|
},
|
||||||
|
|
||||||
getNum : function(n, c) {
|
getNum : function(n, c) {
|
||||||
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
c = n.className.match(new RegExp('\\b' + c + '([0-9]+)\\b', 'g'))[0];
|
||||||
c = c.replace(/[^0-9]/g, '');
|
c = c.replace(/[^0-9]/g, '');
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
},
|
},
|
||||||
|
|
||||||
addClass : function(n, c, b) {
|
addClass : function(n, c, b) {
|
||||||
var o = this.removeClass(n, c);
|
var o = this.removeClass(n, c);
|
||||||
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
n.className = b ? c + (o != '' ? (' ' + o) : '') : (o != '' ? (o + ' ') : '') + c;
|
||||||
},
|
},
|
||||||
|
|
||||||
removeClass : function(n, c) {
|
removeClass : function(n, c) {
|
||||||
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
c = n.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
|
||||||
return n.className = c != ' ' ? c : '';
|
return n.className = c != ' ' ? c : '';
|
||||||
},
|
},
|
||||||
|
|
||||||
tags : function(f, s) {
|
tags : function(f, s) {
|
||||||
return f.getElementsByTagName(s);
|
return f.getElementsByTagName(s);
|
||||||
},
|
},
|
||||||
|
|
||||||
mark : function(f, n) {
|
mark : function(f, n) {
|
||||||
var s = this.settings;
|
var s = this.settings;
|
||||||
|
|
||||||
this.addClass(n, s.invalid_cls);
|
this.addClass(n, s.invalid_cls);
|
||||||
this.markLabels(f, n, s.invalid_cls);
|
this.markLabels(f, n, s.invalid_cls);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
markLabels : function(f, n, ic) {
|
markLabels : function(f, n, ic) {
|
||||||
var nl, i;
|
var nl, i;
|
||||||
|
|
||||||
nl = this.tags(f, "label");
|
nl = this.tags(f, "label");
|
||||||
for (i=0; i<nl.length; i++) {
|
for (i=0; i<nl.length; i++) {
|
||||||
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
if (nl[i].getAttribute("for") == n.id || nl[i].htmlFor == n.id)
|
||||||
this.addClass(nl[i], ic);
|
this.addClass(nl[i], ic);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue