Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Use the longer hash prefix for the click-to-copy. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | copybtn.js-demonstration |
| Files: | files | file ages | folders |
| SHA3-256: |
2196555351f62337c65108206408c959 |
| User & Date: | drh 2019-06-01 00:52:27.760 |
References
|
2019-06-10
| ||
| 16:08 | Fix a minor coding typo from [2196555351] (property name). ... (check-in: af2ca38890 user: florian tags: tooltip-tweaks) | |
|
2019-06-03
| ||
| 08:51 | Cherry-pick [2196555351]: Use the longer hash prefix for the click-to-copy. ... (Closed-Leaf check-in: 21f38e85b3 user: florian tags: tooltip-copyhash) | |
Context
|
2019-06-03
| ||
| 08:51 | Cherry-pick [2196555351]: Use the longer hash prefix for the click-to-copy. ... (Closed-Leaf check-in: 21f38e85b3 user: florian tags: tooltip-copyhash) | |
|
2019-06-01
| ||
| 07:07 | Also use the now global hash_digits() function in src/info.c, and set the copy length limit to FOSSIL_HASH_DIGITS_URL for consistency with the copy buttons on the tooltips. ... (check-in: 710229e713 user: florian tags: copybtn.js-demonstration) | |
| 00:52 | Use the longer hash prefix for the click-to-copy. ... (check-in: 2196555351 user: drh tags: copybtn.js-demonstration) | |
|
2019-05-31
| ||
| 16:36 | Demonstration of the copybtn.js module beyond tooltips: add a copy button near the full-length hash of check-ins on the /info page, to copy only the hash prefix when clicked. ... (check-in: 46f91da1a8 user: florian tags: copybtn.js-demonstration) | |
Changes
Changes to src/graph.js.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 | ** "omitDescenders": BOOLEAN, // Omit ancestor lines off bottom of screen ** "fileDiff": BOOLEAN, // True for file diff. False for check-in ** "scrollToSelect": BOOLEAN, // Scroll to selection on first render ** "nrail": INTEGER, // Number of vertical "rails" ** "baseUrl": TEXT, // Top-level URL ** "dwellTimeout": INTEGER, // Tooltip show delay in milliseconds ** "closeTimeout": INTEGER, // Tooltip close delay in milliseconds | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
** "omitDescenders": BOOLEAN, // Omit ancestor lines off bottom of screen
** "fileDiff": BOOLEAN, // True for file diff. False for check-in
** "scrollToSelect": BOOLEAN, // Scroll to selection on first render
** "nrail": INTEGER, // Number of vertical "rails"
** "baseUrl": TEXT, // Top-level URL
** "dwellTimeout": INTEGER, // Tooltip show delay in milliseconds
** "closeTimeout": INTEGER, // Tooltip close delay in milliseconds
** "hashDigits": INTEGER, // Limit of tooltip hashes ("hash-digits")
** "rowinfo": ROWINFO-ARRAY }
**
** The rowinfo field is an array of structures, one per entry in the timeline,
** where each structure has the following fields:
**
** id: The id of the <div> element for the row. This is an integer.
** to get an actual id, prepend "m" to the integer. The top node
|
| ︙ | ︙ | |||
96 97 98 99 100 101 102 |
if (tooltipInfo.ixActive != -1) resumeCloseTimer();
};
/* State information for the tooltip popup and its timers */
window.tooltipInfo = {
dwellTimeout: 250, /* The tooltip dwell timeout. */
closeTimeout: 3000, /* The tooltip close timeout. */
| | | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
if (tooltipInfo.ixActive != -1) resumeCloseTimer();
};
/* State information for the tooltip popup and its timers */
window.tooltipInfo = {
dwellTimeout: 250, /* The tooltip dwell timeout. */
closeTimeout: 3000, /* The tooltip close timeout. */
hashDigits: 16, /* Limit of tooltip hashes ("hash-digits"). */
idTimer: 0, /* The tooltip dwell timer id. */
idTimerClose: 0, /* The tooltip close timer id. */
ixHover: -1, /* The id of the element with the mouse. */
ixActive: -1, /* The id of the element with the tooltip. */
nodeHover: null, /* Graph node under mouse when ixHover==-2 */
posX: 0, posY: 0 /* The last mouse position. */
};
|
| ︙ | ︙ | |||
141 142 143 144 145 146 147 |
/* Construct that graph corresponding to the timeline-data-N object that
** is passed in by the tx parameter */
function TimelineGraph(tx){
var topObj = document.getElementById("timelineTable"+tx.iTableId);
amendCss(tx.circleNodes, tx.showArrowheads);
tooltipInfo.dwellTimeout = tx.dwellTimeout
tooltipInfo.closeTimeout = tx.closeTimeout
| | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
/* Construct that graph corresponding to the timeline-data-N object that
** is passed in by the tx parameter */
function TimelineGraph(tx){
var topObj = document.getElementById("timelineTable"+tx.iTableId);
amendCss(tx.circleNodes, tx.showArrowheads);
tooltipInfo.dwellTimeout = tx.dwellTimeout
tooltipInfo.closeTimeout = tx.closeTimeout
tooltipInfo.hashDigits = tx.hashDigits
topObj.onclick = clickOnGraph
topObj.ondblclick = dblclickOnGraph
topObj.onmousemove = function(e) {
var ix = findTxIndex(e);
topObj.style.cursor = (ix<0) ? "" : "pointer"
/* Keep the already visible tooltip at a constant position, as long as the
** mouse is over the same element. */
|
| ︙ | ︙ | |||
595 596 597 598 599 600 601 |
function showGraphTooltip(){
var html = null
var ix = -1
if( tooltipInfo.ixHover==-2 ){
ix = parseInt(tooltipInfo.nodeHover.id.match(/\d+$/)[0],10)-tx.iTopRow
var h = tx.rowinfo[ix].h
var dest = tx.baseUrl + "/info/" + h
| | | 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
function showGraphTooltip(){
var html = null
var ix = -1
if( tooltipInfo.ixHover==-2 ){
ix = parseInt(tooltipInfo.nodeHover.id.match(/\d+$/)[0],10)-tx.iTopRow
var h = tx.rowinfo[ix].h
var dest = tx.baseUrl + "/info/" + h
h = h.slice(0,tooltipInfo.hashDigits); // Assume single-byte characters.
if( tx.fileDiff ){
html = "artifact <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
}else{
html = "check-in <a id=\"tooltip-link\" href=\""+dest+"\">"+h+"</a>"
}
tooltipInfo.ixActive = -2;
}else if( tooltipInfo.ixHover>=0 ){
|
| ︙ | ︙ |
Changes to src/printf.c.
| ︙ | ︙ | |||
46 47 48 49 50 51 52 | #endif /* ** Return the number of artifact hash digits to display. The number is for ** human output if the bForUrl is false and is destined for a URL if ** bForUrl is false. */ | | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
#endif
/*
** Return the number of artifact hash digits to display. The number is for
** human output if the bForUrl is false and is destined for a URL if
** bForUrl is false.
*/
int hash_digits(int bForUrl){
static int nDigitHuman = 0;
static int nDigitUrl = 0;
if( nDigitHuman==0 ){
nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
if( nDigitHuman < 6 ) nDigitHuman = 6;
if( nDigitHuman > 40 ) nDigitHuman = 40;
nDigitUrl = nDigitHuman + 6;
if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL;
if( nDigitUrl > 40 ) nDigitUrl = 40;
}
return bForUrl ? nDigitUrl : nDigitHuman;
}
/*
** Return the number of characters in a %S output.
*/
int length_of_S_display(void){
return hash_digits(0);
}
/*
** Conversion types fall into various categories as defined by the
** following enumeration.
*/
#define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */
|
| ︙ | ︙ | |||
677 678 679 680 681 682 683 |
int limit = flag_alternateform ? va_arg(ap,int) : -1;
bufpt = va_arg(ap,char*);
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
zExtra = bufpt;
}else if( xtype==etSTRINGID ){
| | | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
int limit = flag_alternateform ? va_arg(ap,int) : -1;
bufpt = va_arg(ap,char*);
if( bufpt==0 ){
bufpt = "";
}else if( xtype==etDYNSTRING ){
zExtra = bufpt;
}else if( xtype==etSTRINGID ){
precision = hash_digits(flag_altform2);
}
length = StrNLen32(bufpt, limit);
if( precision>=0 && precision<length ) length = precision;
break;
}
case etBLOB: {
int limit = flag_alternateform ? va_arg(ap, int) : -1;
|
| ︙ | ︙ |
Changes to src/timeline.c.
| ︙ | ︙ | |||
830 831 832 833 834 835 836 |
int colorGraph; /* Use colors for graph lines */
int iTopRow; /* Index of the top row of the graph */
int fileDiff; /* True for file diff. False for check-in diff */
int omitDescenders; /* True to omit descenders */
int scrollToSelect; /* True to scroll to the selection */
int dwellTimeout; /* Milliseconds to wait for tooltips to show */
int closeTimeout; /* Milliseconds to wait for tooltips to close */
| < < < < < < | | 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 |
int colorGraph; /* Use colors for graph lines */
int iTopRow; /* Index of the top row of the graph */
int fileDiff; /* True for file diff. False for check-in diff */
int omitDescenders; /* True to omit descenders */
int scrollToSelect; /* True to scroll to the selection */
int dwellTimeout; /* Milliseconds to wait for tooltips to show */
int closeTimeout; /* Milliseconds to wait for tooltips to close */
u8 *aiMap; /* The rail map */
iRailPitch = atoi(PD("railpitch","0"));
showArrowheads = skin_detail_boolean("timeline-arrowheads");
circleNodes = skin_detail_boolean("timeline-circle-nodes");
colorGraph = skin_detail_boolean("timeline-color-graph-lines");
iTopRow = pGraph->pFirst ? pGraph->pFirst->idx : 0;
omitDescenders = (tmFlags & TIMELINE_DISJOINT)!=0;
fileDiff = (tmFlags & TIMELINE_FILEDIFF)!=0;
scrollToSelect = (tmFlags & TIMELINE_NOSCROLL)==0;
dwellTimeout = atoi(db_get("timeline-dwelltime","100"));
closeTimeout = atoi(db_get("timeline-closetime","250"));
@ <script id='timeline-data-%d(iTableId)' type='application/json'>{
@ "iTableId": %d(iTableId),
@ "circleNodes": %d(circleNodes),
@ "showArrowheads": %d(showArrowheads),
@ "iRailPitch": %d(iRailPitch),
@ "colorGraph": %d(colorGraph),
@ "nomo": %d(PB("nomo")),
@ "iTopRow": %d(iTopRow),
@ "omitDescenders": %d(omitDescenders),
@ "fileDiff": %d(fileDiff),
@ "scrollToSelect": %d(scrollToSelect),
@ "nrail": %d(pGraph->mxRail+1),
@ "baseUrl": "%R",
@ "dwellTimeout": %d(dwellTimeout),
@ "closeTimeout": %d(closeTimeout),
@ "hashDigit": %d(hash_digits(1)),
@ "bottomRowId": "btm-%d(iTableId)",
if( pGraph->nRow==0 ){
@ "rowinfo": null
}else{
@ "rowinfo": [
}
|
| ︙ | ︙ |