remove inline js from main.php
This commit is contained in:
28
js/main_custom_color.js
Normal file
28
js/main_custom_color.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* for main custom color
|
||||
*
|
||||
*/
|
||||
$(document).ready(function() {
|
||||
$('#li_custom_color').show();
|
||||
// Choosing another id does not work!
|
||||
$('#colorSelector').ColorPicker({
|
||||
color: '#0000ff',
|
||||
onShow: function (colpkr) {
|
||||
$(colpkr).fadeIn(500);
|
||||
return false;
|
||||
},
|
||||
onHide: function (colpkr) {
|
||||
$(colpkr).fadeOut(500);
|
||||
return false;
|
||||
},
|
||||
onChange: function(hsb, hex, rgb) {
|
||||
top.frame_content.document.body.style.backgroundColor = '#' + hex;
|
||||
top.frame_navigation.document.body.style.backgroundColor = '#' + hex;
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb) {
|
||||
$('#custom_color').val('#' + hex);
|
||||
$('#colorform').submit();
|
||||
}
|
||||
});
|
||||
});
|
50
main.php
50
main.php
@@ -14,6 +14,7 @@ require_once './libraries/common.inc.php';
|
||||
|
||||
$GLOBALS['js_include'][] = 'jquery/jquery-1.4.2-min.js';
|
||||
$GLOBALS['js_include'][] = 'colorpicker/js/colorpicker.js';
|
||||
$GLOBALS['js_include'][] = 'main_custom_color.js';
|
||||
|
||||
// Handles some variables that may have been sent by the calling script
|
||||
$GLOBALS['db'] = '';
|
||||
@@ -153,45 +154,18 @@ if ($GLOBALS['cfg']['ThemeManager']) {
|
||||
echo '<li id="li_select_theme">';
|
||||
echo $_SESSION['PMA_Theme_Manager']->getHtmlSelectBox();
|
||||
echo '</li>';
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
document.write('<li id="li_custom_color">');
|
||||
document.write('<?php echo PMA_escapeJsString($strCustomColor) . ': '; ?>');
|
||||
document.write('<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">');
|
||||
document.write('<?php echo PMA_generate_common_hidden_inputs(); ?>');
|
||||
document.write('<input type="hidden" id="custom_color" name="custom_color" value="" />');
|
||||
document.write('<input type="submit" name="custom_color_reset" value="<?php echo $strReset; ?>" />');
|
||||
document.write('</form>');
|
||||
document.write('<div id="colorSelector">');
|
||||
document.write('</div>');
|
||||
document.write('</li>');
|
||||
|
||||
$(document).ready(function() {
|
||||
// Choosing another id does not work!
|
||||
$('#colorSelector').ColorPicker({
|
||||
color: '#0000ff',
|
||||
onShow: function (colpkr) {
|
||||
$(colpkr).fadeIn(500);
|
||||
return false;
|
||||
},
|
||||
onHide: function (colpkr) {
|
||||
$(colpkr).fadeOut(500);
|
||||
return false;
|
||||
},
|
||||
onChange: function(hsb, hex, rgb) {
|
||||
top.frame_content.document.body.style.backgroundColor = '#' + hex;
|
||||
top.frame_navigation.document.body.style.backgroundColor = '#' + hex;
|
||||
},
|
||||
onSubmit: function(hsb, hex, rgb) {
|
||||
$('#custom_color').val('#' + hex);
|
||||
$('#colorform').submit();
|
||||
}
|
||||
});
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
// see js/main_custom_color.js
|
||||
echo '<li id="li_custom_color" class="hide">';
|
||||
echo PMA_escapeJsString($strCustomColor) . ': ';
|
||||
echo '<form name="colorform" id="colorform" method="post" action="index.php" target="_parent">';
|
||||
echo PMA_generate_common_hidden_inputs();
|
||||
echo '<input type="hidden" id="custom_color" name="custom_color" value="" />';
|
||||
echo '<input type="submit" name="custom_color_reset" value="' . $strReset . '" />';
|
||||
echo '</form>';
|
||||
echo '<div id="colorSelector">';
|
||||
echo '</div>';
|
||||
echo '</li>';
|
||||
}
|
||||
echo '<li id="li_select_fontsize">';
|
||||
echo PMA_Config::getFontsizeForm();
|
||||
|
@@ -1227,6 +1227,11 @@ code.sql {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* for elements that should be revealed only via js */
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#li_select_server {
|
||||
padding-bottom: 0.3em;
|
||||
border-bottom: 0.3em solid <?php echo $GLOBALS['cfg']['ThBackground']; ?>;
|
||||
|
@@ -1178,6 +1178,11 @@ code.sql {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* for elements that should be revealed only via js */
|
||||
.hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#li_select_server {
|
||||
padding-bottom: 0.3em;
|
||||
border-bottom: 0.3em solid <?php echo $GLOBALS['cfg']['ThBackground']; ?>;
|
||||
|
Reference in New Issue
Block a user