Changeset View
Changeset View
Standalone View
Standalone View
webroot/rsrc/js/core/behavior-line-linker.js
Show First 20 Lines • Show All 154 Lines • ▼ Show 20 Lines | function(e) { | ||||||||||||||||||
uri.setPath(path); | uri.setPath(path); | ||||||||||||||||||
uri = uri.toString(); | uri = uri.toString(); | ||||||||||||||||||
} | } | ||||||||||||||||||
origin = null; | origin = null; | ||||||||||||||||||
target = null; | target = null; | ||||||||||||||||||
root = null; | root = null; | ||||||||||||||||||
var lines = (o == t ? o : Math.min(o, t) + '-' + Math.max(o, t)); | |||||||||||||||||||
uri = JX.$U(uri); | uri = JX.$U(uri); | ||||||||||||||||||
path = uri.getPath(); | path = uri.getPath(); | ||||||||||||||||||
path = path + '$' + lines; | // Use anchor fragment for single line (calling the resulting URL will | ||||||||||||||||||
// not highlight or scroll). Use custom $ when selecting multiple lines | |||||||||||||||||||
// (calling the resulting URL will highlight and scroll to position). | |||||||||||||||||||
if (o == t) { | |||||||||||||||||||
path = path + '#' + o; | |||||||||||||||||||
} else { | |||||||||||||||||||
path = path + '$' + Math.min(o, t) + '-' + Math.max(o, t); | |||||||||||||||||||
} | |||||||||||||||||||
valerio.bozzolanUnsubmitted Not Done Inline Actions
valerio.bozzolan: | |||||||||||||||||||
valerio.bozzolanUnsubmitted Not Done Inline ActionsAt this point this line should also be removed: path = path + '#' + o; valerio.bozzolan: At this point this line should also be removed:
lang=javascript
path = path + '#' + o; | |||||||||||||||||||
uri = uri.setPath(path).toString(); | uri = uri.setPath(path).toString(); | ||||||||||||||||||
JX.History.replace(uri); | JX.History.replace(uri); | ||||||||||||||||||
if (editor_link) { | if (editor_link) { | ||||||||||||||||||
var data = JX.Stratcom.getData(editor_link); | var data = JX.Stratcom.getData(editor_link); | ||||||||||||||||||
var variables = { | var variables = { | ||||||||||||||||||
Show All 9 Lines | function(e) { | ||||||||||||||||||
editor_link.href = editor_uri; | editor_link.href = editor_uri; | ||||||||||||||||||
} | } | ||||||||||||||||||
}); | }); | ||||||||||||||||||
// Try to jump to the highlighted lines if we don't have an explicit anchor | // Try to jump to the highlighted lines if we don't have an explicit anchor | ||||||||||||||||||
// in the URI. | // in the URI. | ||||||||||||||||||
if (!window.location.hash.length) { | if (!window.location.hash.length) { | ||||||||||||||||||
valerio.bozzolanUnsubmitted Not Done Inline Actions
Something like this to highlight at startup valerio.bozzolan: Something like this to highlight at startup | |||||||||||||||||||
try { | try { | ||||||||||||||||||
var anchor = JX.$('phabricator-line-linker-anchor'); | var anchor = JX.$('phabricator-line-linker-anchor'); | ||||||||||||||||||
JX.DOM.scrollToPosition(0, JX.$V(anchor).y - 60); | JX.DOM.scrollToPosition(0, JX.$V(anchor).y - 60); | ||||||||||||||||||
} catch (ex) { | } catch (ex) { | ||||||||||||||||||
// If we didn't hit an element on the page, just move on. | // If we didn't hit an element on the page, just move on. | ||||||||||||||||||
} | } | ||||||||||||||||||
} | } | ||||||||||||||||||
Show All 13 Lines |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0