diff --git a/pom.xml b/pom.xml
index 4aba7ba..3dd4b4f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
org.jenkins-ci.plugins
plugin
- 1.509.4
+ 1.554.1
linenumbers
diff --git a/src/main/resources/org/jenkinsci/plugins/linenumbers/LineNumbersAnnotatorFactory/script.js b/src/main/resources/org/jenkinsci/plugins/linenumbers/LineNumbersAnnotatorFactory/script.js
index 8b87c0a..7685dee 100644
--- a/src/main/resources/org/jenkinsci/plugins/linenumbers/LineNumbersAnnotatorFactory/script.js
+++ b/src/main/resources/org/jenkinsci/plugins/linenumbers/LineNumbersAnnotatorFactory/script.js
@@ -1,5 +1,32 @@
-Behaviour.specify('div.fold', 'fold.toggle', 10, function(element) {
- element.onclick = function() {
- element.toggleClassName('open');
- }
-});
\ No newline at end of file
+/*global window */
+(function () {
+ "use strict";
+
+ Behaviour.specify('div.fold', 'fold.toggle', 10, function (element) {
+ element.onclick = function () {
+ element.toggleClassName('open');
+ };
+ });
+
+ function scrollToElement(element) {
+ window.scrollTo(0, element.offsetTop - 30);
+ }
+
+ $(document).on("click", "a[href^='#L']", function (event) {
+ event.preventDefault();
+ scrollToElement(event.target);
+ });
+
+ $(document).observe("dom:loaded", function () {
+ var hash = window.location.hash.substring(1),
+ targetLine;
+ if (hash.length !== 0) {
+ targetLine = document.getElementById(hash);
+ if (targetLine) {
+ window.setTimeout(function () {
+ scrollToElement(targetLine);
+ }, 200);
+ }
+ }
+ });
+}());