diff --git a/lib/exe/js.php b/lib/exe/js.php index 56fa8575adecc83ef4516d59f41808d0d1b2255d..488320dddb74f378de7b8492f0fa44e086385328 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -79,6 +79,7 @@ function js_out(){ js_runonstart("ajax_qsearch.init('qsearch_in','qsearch_out')"); js_runonstart("addEvent(document,'click',closePopups)"); js_runonstart('addTocToggle()'); + js_runonstart('scrollToMarker()'); if($edit){ // size controls diff --git a/lib/plugins/usermanager/admin.php b/lib/plugins/usermanager/admin.php index 64ef0f5ff17f0503068f2f92a277dcf14487f4eb..b7ee032159cab6538158926baf73a6b598f38fee 100644 --- a/lib/plugins/usermanager/admin.php +++ b/lib/plugins/usermanager/admin.php @@ -226,7 +226,7 @@ class admin_plugin_usermanager extends DokuWiki_Admin_Plugin { } if($this->_edit_user && $this->_auth->canDo('modifyUser')){ - ptln("<div".$style.">"); + ptln("<div".$style." id=\"scroll__here\">"); print $this->locale_xhtml('edit'); ptln(" <div class=\"level2\">"); diff --git a/lib/scripts/script.js b/lib/scripts/script.js index a8c6fe3fdc63e63c02d1aa809646bc16eb26cc22..d2fbc35bfe4e724c0567559e3c1b946243ae1491 100644 --- a/lib/scripts/script.js +++ b/lib/scripts/script.js @@ -47,12 +47,7 @@ function $() { */ function findPosX(object){ var curleft = 0; - var obj; - if(typeof(object) == 'object'){ - obj = object; - }else{ - obj = $(object); - } + var obj = $(object); if (obj.offsetParent){ while (obj.offsetParent){ curleft += obj.offsetLeft; @@ -72,12 +67,7 @@ function findPosX(object){ */ function findPosY(object){ var curtop = 0; - var obj; - if(typeof(object) == 'object'){ - obj = object; - }else{ - obj = $(object); - } + var obj = $(object); if (obj.offsetParent){ while (obj.offsetParent){ curtop += obj.offsetTop; @@ -392,3 +382,11 @@ function closePopups(){ } } } + +/** + * Looks for an element with the ID scroll__here at scrolls to it + */ +function scrollToMarker(){ + var obj = $('scroll__here'); + if(obj) obj.scrollIntoView(); +}