GetSimple Support Forum

Full Version: Set cursor focus to title when creating page
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sets the cursor focus to the page title field if creating a new page.
Paste the following code on your text editor and save as setfocus-editpage.php (or whatever) in your plugins folder:

Code:
<?php

/* setfocus-editpage.php */
/* for GetSimple 2.02+ */

$thisfile = basename(__FILE__, ".php");
register_plugin(
    $thisfile,
    'Set focus (edit page)',
    '0.1 beta',
    'Carlos Navarro',
    '#',
    'Set cursor focus to title field when creating a new page'
);

add_action('edit-content','setfocus_editpage');

function setfocus_editpage() {
    global $data_edit;
    if(!isset($data_edit)) { echo "<script type=\"text/javascript\">try{document.getElementById('post-title').focus();}catch(e){}</script>"; }
}
?>

Sorry, not for 2.01 (didn't have the edit-content hook)