Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15386114
D19350.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D19350.diff
View Options
diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -385,7 +385,6 @@
'rsrc/js/application/diffusion/behavior-commit-branches.js' => 'bdaf4d04',
'rsrc/js/application/diffusion/behavior-commit-graph.js' => '75b83cbb',
'rsrc/js/application/diffusion/behavior-diffusion-browse-file.js' => '054a0f0b',
- 'rsrc/js/application/diffusion/behavior-jump-to.js' => '73d09eef',
'rsrc/js/application/diffusion/behavior-locate-file.js' => '6d3e1947',
'rsrc/js/application/diffusion/behavior-pull-lastmodified.js' => 'f01586dc',
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => '1db13e70',
@@ -471,7 +470,7 @@
'rsrc/js/core/behavior-keyboard-pager.js' => 'a8da01f0',
'rsrc/js/core/behavior-keyboard-shortcuts.js' => '01fca1f0',
'rsrc/js/core/behavior-lightbox-attachments.js' => '6b31879a',
- 'rsrc/js/core/behavior-line-linker.js' => '36165eb1',
+ 'rsrc/js/core/behavior-line-linker.js' => '66a62306',
'rsrc/js/core/behavior-more.js' => 'a80d0378',
'rsrc/js/core/behavior-object-selector.js' => '77c1f0b0',
'rsrc/js/core/behavior-oncopy.js' => '2926fff2',
@@ -601,7 +600,6 @@
'javelin-behavior-diffusion-browse-file' => '054a0f0b',
'javelin-behavior-diffusion-commit-branches' => 'bdaf4d04',
'javelin-behavior-diffusion-commit-graph' => '75b83cbb',
- 'javelin-behavior-diffusion-jump-to' => '73d09eef',
'javelin-behavior-diffusion-locate-file' => '6d3e1947',
'javelin-behavior-diffusion-pull-lastmodified' => 'f01586dc',
'javelin-behavior-document-engine' => '0333c0b6',
@@ -634,7 +632,7 @@
'javelin-behavior-phabricator-gesture-example' => '558829c2',
'javelin-behavior-phabricator-keyboard-pager' => 'a8da01f0',
'javelin-behavior-phabricator-keyboard-shortcuts' => '01fca1f0',
- 'javelin-behavior-phabricator-line-linker' => '36165eb1',
+ 'javelin-behavior-phabricator-line-linker' => '66a62306',
'javelin-behavior-phabricator-nav' => '94b7c320',
'javelin-behavior-phabricator-notification-example' => '8ce821c5',
'javelin-behavior-phabricator-object-selector' => '77c1f0b0',
@@ -1098,12 +1096,6 @@
'javelin-dom',
'javelin-vector',
),
- '36165eb1' => array(
- 'javelin-behavior',
- 'javelin-stratcom',
- 'javelin-dom',
- 'javelin-history',
- ),
'3ab51e2c' => array(
'javelin-behavior',
'javelin-behavior-device',
@@ -1395,6 +1387,12 @@
'phabricator-darklog',
'phabricator-darkmessage',
),
+ '66a62306' => array(
+ 'javelin-behavior',
+ 'javelin-stratcom',
+ 'javelin-dom',
+ 'javelin-history',
+ ),
'66a6def1' => array(
'javelin-behavior',
'javelin-dom',
@@ -1471,11 +1469,6 @@
'javelin-behavior',
'javelin-dom',
),
- '73d09eef' => array(
- 'javelin-behavior',
- 'javelin-vector',
- 'javelin-dom',
- ),
'758b4758' => array(
'javelin-install',
'javelin-workboard-card',
diff --git a/src/view/layout/PhabricatorSourceCodeView.php b/src/view/layout/PhabricatorSourceCodeView.php
--- a/src/view/layout/PhabricatorSourceCodeView.php
+++ b/src/view/layout/PhabricatorSourceCodeView.php
@@ -96,10 +96,15 @@
}
$base_uri = (string)$this->uri;
+ $wrote_anchor = false;
foreach ($lines as $line) {
$row_attributes = array();
if (isset($this->highlights[$line_number])) {
$row_attributes['class'] = 'phabricator-source-highlight';
+ if (!$wrote_anchor) {
+ $row_attributes['id'] = 'phabricator-line-linker-anchor';
+ $wrote_anchor = true;
+ }
}
if ($this->canClickHighlight) {
diff --git a/webroot/rsrc/js/application/diffusion/behavior-jump-to.js b/webroot/rsrc/js/application/diffusion/behavior-jump-to.js
deleted file mode 100644
--- a/webroot/rsrc/js/application/diffusion/behavior-jump-to.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/**
- * @provides javelin-behavior-diffusion-jump-to
- * @requires javelin-behavior
- * javelin-vector
- * javelin-dom
- */
-
-JX.behavior('diffusion-jump-to', function(config) {
-
- setTimeout(function() {
- var pos = JX.Vector.getPosWithScroll(JX.$(config.target));
- JX.DOM.scrollToPosition(0, pos.y - 100);
- }, 0);
-
-});
diff --git a/webroot/rsrc/js/core/behavior-line-linker.js b/webroot/rsrc/js/core/behavior-line-linker.js
--- a/webroot/rsrc/js/core/behavior-line-linker.js
+++ b/webroot/rsrc/js/core/behavior-line-linker.js
@@ -176,4 +176,16 @@
}
});
+
+ // Try to jump to the highlighted lines if we don't have an explicit anchor
+ // in the URI.
+ if (!window.location.hash.length) {
+ try {
+ var anchor = JX.$('phabricator-line-linker-anchor');
+ JX.DOM.scrollToPosition(0, JX.$V(anchor).y - 60);
+ } catch (ex) {
+ // If we didn't hit an element on the page, just move on.
+ }
+ }
+
});
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 16, 12:03 AM (6 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7704573
Default Alt Text
D19350.diff (4 KB)
Attached To
Mode
D19350: When following a link to a particular line ("/example.txt$12"), scroll to that line
Attached
Detach File
Event Timeline
Log In to Comment