GetSimple Support Forum
Set cursor focus to title when creating page - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: Set cursor focus to title when creating page (/showthread.php?tid=786)



Set cursor focus to title when creating page - Carlos - 2010-06-08

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)