{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1745907819,
"reponame":"cgit",
"desc":"CGI gitweb",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/cgit",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"3eb6eb8069469be871800daed048c3d4",
"commit": {"type":"commit",
"time": 1530589970,
"time_ofs": 480,
"oid_tree": { "oid": "b812a0f7cdad7014519ee422188ed25f5612d900", "alias": []},
"oid":{ "oid": "7c21e4c1a9ccc208f1d31c1f952b1894fe3e289b", "alias": []},
"msg": "line-range-highlight: onclick handler and range selection",
"sig_commit": { "git_time": { "time": 1530589970, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },
"sig_author": { "git_time": { "time": 1529802520, "offset": 480 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }},
"body": "line-range-highlight: onclick handler and range selection\n\nThis allows the user to select line ranges simply by clicking on the\nline number links.\n\n - No selected highlit line, or a range already selected, causes the\nclick to highlight just the clicked line as usual.\n\n - Clicking on a second line number link when a single line was already\nhighlit creates a line range highlight, between the lowest and\nhighest line numbers of the already-selected and newly-selected\nline number links.\n\nThe order of the clicks is unimportant, you can click the higher\nline number link first and then the lower to define the range of\nlines equally well.\n\nThe implementation is slightly complicated by our single parent\nonclick handler not being able to interrupt the already ongoing\nprocessing of the a href #n change from the link click itself.\n\nRather than bloat every linenumber link with its own onclick handler\ndefeating this default we simply do it with a single parent\nonclick event and apply any computed range url in the existing\nhashchange event handler.\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e"
,
"diff": "diff --git a/cgit.js b/cgit.js\nindex d99c980..015dd76 100644\n--- a/cgit.js\n+++ b/cgit.js\n@@ -108,11 +108,45 @@ function line_range_highlight()\n \tt.scrollIntoView(true);\n }\n \n+function line_range_click(e) {\n+\tvar t, m, n \u003d window.location.href.length - window.location.hash.length;\n+\n+\t/* disable passthru to stop needless scrolling by default browser #URL handler */\n+\te.stopPropagation();\n+\te.preventDefault();\n+\n+\tif (!window.location.hash ||\n+\t window.location.hash.indexOf(\u0022-\u0022) \u003e\u003d 0)\n+\t\tt \u003d window.location.href.substring(0, n) +\n+\t\t '#n' + e.target.id.substring(1);\n+\telse {\n+\t\tif (parseInt(window.location.hash.substring(2)) \u003c\n+\t\t parseInt(e.target.id.substring(1))) /* forwards */\n+\t\t\tt \u003d window.location + '-' + e.target.id.substring(1);\n+\t\telse\n+\t\t\tt \u003d window.location.href.substring(0, n) +\n+\t\t\t\t'#n' + e.target.id.substring(1) + '-' +\n+\t\t\t\twindow.location.href.substring(n + 2);\n+\t}\n+\n+\twindow.history.replaceState(null, null, t);\n+\n+\tline_range_highlight();\n+}\n+\n /* we have to use load, because header images can push the layout vertically */\n window.addEventListener(\u0022load\u0022, function() {\n \tline_range_highlight();\n }, false);\n \n+document.addEventListener(\u0022DOMContentLoaded\u0022, function() {\n+\t/* event listener cannot override default #URL browser processing,\n+\t * requires onclick */\n+\tvar e \u003d document.getElementById(\u0022linenumbers\u0022);\n+\tif (e)\n+\t\te.onclick \u003d line_range_click;\n+}, false);\n+\n window.addEventListener(\u0022hashchange\u0022, function() {\n \tline_range_highlight();\n }, false);\ndiff --git a/ui-blame.c b/ui-blame.c\nindex 50d0580..c9cca18 100644\n--- a/ui-blame.c\n+++ b/ui-blame.c\n@@ -170,7 +170,7 @@ static void print_object(const struct object_id *oid, const char *path,\n \n \t/* Line numbers */\n \tif (ctx.cfg.enable_tree_linenumbers) {\n-\t\thtml(\u0022\u003ctd class\u003d'linenumbers'\u003e\u0022);\n+\t\thtml(\u0022\u003ctd id\u003d'linenumbers' class\u003d'linenumbers'\u003e\u0022);\n \t\tfor (ent \u003d sb.ent; ent; ent \u003d ent-\u003enext) {\n \t\t\thtml(\u0022\u003cdiv class\u003d'alt'\u003e\u003cpre\u003e\u0022);\n \t\t\temit_blame_entry_linenumber(ent);\ndiff --git a/ui-tree.c b/ui-tree.c\nindex 2114c27..7a55e77 100644\n--- a/ui-tree.c\n+++ b/ui-tree.c\n@@ -62,7 +62,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)\n \thtml(\u0022\u003ctable summary\u003d'blob content' class\u003d'blob'\u003e\u005cn\u0022);\n \n \tif (ctx.cfg.enable_tree_linenumbers) {\n-\t\thtml(\u0022\u003ctr\u003e\u003ctd class\u003d'linenumbers'\u003e\u003cpre\u003e\u0022);\n+\t\thtml(\u0022\u003ctr\u003e\u003ctd id\u003d'linenumbers' class\u003d'linenumbers'\u003e\u003cpre\u003e\u0022);\n \t\tidx \u003d 0;\n \t\tlineno \u003d 0;\n \n","s":{"c":1745907819,"u": 4815}}
],"g": 5800,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}