📄 functions.php
字号:
lc = document.getElementById('lowercolor').value.replace('#', ''); hi = document.getElementById('headerimage'); 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('advuppercolor').value = '#'+uc; document.getElementById('advlowercolor').value = '#'+lc; } if ( 'fontcolor' == oid ) { document.getElementById('header').style.color = document.getElementById('fontcolor').value; document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value; } if ( 'fontdisplay' == oid ) { document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value; } } function toggleDisplay() { td = document.getElementById('fontdisplay'); td.value = ( td.value == 'none' ) ? 'inline' : 'none'; kUpdate('fontdisplay'); } function toggleAdvanced() { a = document.getElementById('jsAdvanced'); if ( a.style.display == 'none' ) a.style.display = 'block'; else a.style.display = 'none'; } function kDefaults() { document.getElementById('headerimage').value = ''; document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#69aee7'; 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.color = '#FFFFFF'; document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = ''; document.getElementById('fontdisplay').value = 'inline'; document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value; } function kRevert() { document.getElementById('headerimage').value = '<?php echo js_escape(kubrick_header_image()); ?>'; document.getElementById('advuppercolor').value = document.getElementById('uppercolor').value = '#<?php echo js_escape(kubrick_upper_color()); ?>'; document.getElementById('advlowercolor').value = document.getElementById('lowercolor').value = '#<?php echo js_escape(kubrick_lower_color()); ?>'; document.getElementById('header').style.background = 'url("<?php echo js_escape(kubrick_header_image_url()); ?>") center no-repeat'; document.getElementById('header').style.color = ''; document.getElementById('advfontcolor').value = document.getElementById('fontcolor').value = '<?php echo js_escape(kubrick_header_color_string()); ?>'; document.getElementById('fontdisplay').value = '<?php echo js_escape(kubrick_header_display_string()); ?>'; document.getElementById('headerimg').style.display = document.getElementById('fontdisplay').value; } function kInit() { document.getElementById('jsForm').style.display = 'block'; document.getElementById('nonJsForm').style.display = 'none'; } addLoadEvent(kInit);// ]]></script><style type='text/css'> #headwrap { text-align: center; } #kubrick-header { font-size: 80%; } #kubrick-header .hibrowser { width: 780px; height: 260px; overflow: scroll; } #kubrick-header #hitarget { display: none; } #kubrick-header #header h1 { font-family: 'Trebuchet MS', 'Lucida Grande', Verdana, Arial, Sans-Serif; font-weight: bold; font-size: 4em; text-align: center; padding-top: 70px; margin: 0; } #kubrick-header #header .description { font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif; font-size: 1.2em; text-align: center; } #kubrick-header #header { text-decoration: none; color: <?php echo kubrick_header_color_string(); ?>; padding: 0; margin: 0; height: 200px; text-align: center; background: url('<?php echo kubrick_header_image_url(); ?>') center no-repeat; } #kubrick-header #headerimg { margin: 0; height: 200px; width: 100%; display: <?php echo kubrick_header_display_string(); ?>; } #jsForm { display: none; text-align: center; } #jsForm input.submit, #jsForm input.button, #jsAdvanced input.button { padding: 0px; margin: 0px; } #advanced { text-align: center; width: 620px; } html>body #advanced { text-align: center; position: relative; left: 50%; margin-left: -380px; } #jsAdvanced { text-align: right; } #nonJsForm { position: relative; text-align: left; margin-left: -370px; left: 50%; } #nonJsForm label { padding-top: 6px; padding-right: 5px; float: left; width: 100px; text-align: right; } .defbutton { font-weight: bold; } .zerosize { width: 0px; height: 0px; overflow: hidden; } #colorPickerDiv a, #colorPickerDiv a:hover { padding: 1px; text-decoration: none; border-bottom: 0px; }</style><?php}function kubrick_theme_page() { if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';?><div class='wrap'> <h2><?php _e('Customize Header'); ?></h2> <div id="kubrick-header"> <div id="headwrap"> <div id="header"> <div id="headerimg"> <h1><?php bloginfo('name'); ?></h1> <div class="description"><?php bloginfo('description'); ?></div> </div> </div> </div> <br /> <div id="nonJsForm"> <form method="post" action=""> <?php wp_nonce_field('kubrick-header'); ?> <div class="zerosize"><input type="submit" name="defaultsubmit" value="<?php echo attribute_escape(__('Save')); ?>" /></div> <label for="njfontcolor"><?php _e('Font Color:'); ?></label><input type="text" name="njfontcolor" id="njfontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /> <?php printf(__('Any CSS color (%s or %s or %s)'), '<code>red</code>', '<code>#FF0000</code>', '<code>rgb(255, 0, 0)</code>'); ?><br /> <label for="njuppercolor"><?php _e('Upper Color:'); ?></label><input type="text" name="njuppercolor" id="njuppercolor" value="#<?php echo attribute_escape(kubrick_upper_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br /> <label for="njlowercolor"><?php _e('Lower Color:'); ?></label><input type="text" name="njlowercolor" id="njlowercolor" value="#<?php echo attribute_escape(kubrick_lower_color()); ?>" /> <?php printf(__('HEX only (%s or %s)'), '<code>#FF0000</code>', '<code>#F00</code>'); ?><br /> <input type="hidden" name="hi" id="hi" value="<?php echo attribute_escape(kubrick_header_image()); ?>" /> <input type="submit" name="toggledisplay" id="toggledisplay" value="<?php echo attribute_escape(__('Toggle Text')); ?>" /> <input type="submit" name="defaults" value="<?php echo attribute_escape(__('Use Defaults')); ?>" /> <input type="submit" class="defbutton" name="submitform" value=" <?php _e('Save'); ?> " /> <input type="hidden" name="action" value="save" /> <input type="hidden" name="njform" value="true" /> </form> </div> <div id="jsForm"> <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>"> <?php wp_nonce_field('kubrick-header'); ?> <input type="button" class="button-secondary" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php echo attribute_escape(__('Font Color')); ?>"></input> <input type="button" class="button-secondary" onclick="tgt=document.getElementById('uppercolor');colorSelect(tgt,'pick2');return false;" name="pick2" id="pick2" value="<?php echo attribute_escape(__('Upper Color')); ?>"></input> <input type="button" class="button-secondary" onclick="tgt=document.getElementById('lowercolor');colorSelect(tgt,'pick3');return false;" name="pick3" id="pick3" value="<?php echo attribute_escape(__('Lower Color')); ?>"></input> <input type="button" class="button-secondary" name="revert" value="<?php echo attribute_escape(__('Revert')); ?>" onclick="kRevert()" /> <input type="button" class="button-secondary" value="<?php echo attribute_escape(__('Advanced')); ?>" onclick="toggleAdvanced()" /> <input type="hidden" name="action" value="save" /> <input type="hidden" name="fontdisplay" id="fontdisplay" value="<?php echo attribute_escape(kubrick_header_display()); ?>" /> <input type="hidden" name="fontcolor" id="fontcolor" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /> <input type="hidden" name="uppercolor" id="uppercolor" value="<?php echo attribute_escape(kubrick_upper_color()); ?>" /> <input type="hidden" name="lowercolor" id="lowercolor" value="<?php echo attribute_escape(kubrick_lower_color()); ?>" /> <input type="hidden" name="headerimage" id="headerimage" value="<?php echo attribute_escape(kubrick_header_image()); ?>" /> <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php echo attribute_escape(__('Update Header')); ?>" onclick="cp.hidePopup('prettyplease')" /></p> </form> <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div> <div id="advanced"> <form id="jsAdvanced" style="display:none;" action=""> <?php wp_nonce_field('kubrick-header'); ?> <label for="advfontcolor"><?php _e('Font Color (CSS):'); ?> </label><input type="text" id="advfontcolor" onchange="advUpdate(this.value, 'fontcolor')" value="<?php echo attribute_escape(kubrick_header_color()); ?>" /><br /> <label for="advuppercolor"><?php _e('Upper Color (HEX):');?> </label><input type="text" id="advuppercolor" onchange="advUpdate(this.value, 'uppercolor')" value="#<?php echo attribute_escape(kubrick_upper_color()); ?>" /><br /> <label for="advlowercolor"><?php _e('Lower Color (HEX):'); ?> </label><input type="text" id="advlowercolor" onchange="advUpdate(this.value, 'lowercolor')" value="#<?php echo attribute_escape(kubrick_lower_color()); ?>" /><br /> <input type="button" class="button-secondary" name="default" value="<?php echo attribute_escape(__('Select Default Colors')); ?>" onclick="kDefaults()" /><br /> <input type="button" class="button-secondary" onclick="toggleDisplay();return false;" name="pick" id="pick" value="<?php echo attribute_escape(__('Toggle Text Display')); ?>"></input><br /> </form> </div> </div> </div></div><?php } ?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -