Fossil SCM
Minor tweaks to the Copy Buttons: restore the flipped button look, and shorten the sequence "copy-copy-button" for auto-generated IDs.
Commit
2ce9ca95f79829056daa8f509f5fe04f7a44b061a2542f9b1388938a81b6c7b3
Parent
30bfba32c86c939…
1 file changed
+5
-3
+5
-3
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -527,10 +527,11 @@ | ||
| 527 | 527 | va_list ap; |
| 528 | 528 | char *zText; |
| 529 | 529 | char *zResult = 0; |
| 530 | 530 | char *zId = 0; |
| 531 | 531 | Blob btn; |
| 532 | + const char *zBtnClass = "copy-button"; | |
| 532 | 533 | |
| 533 | 534 | va_start(ap,zTextFmt); |
| 534 | 535 | zText = vmprintf(zTextFmt/*works-like:?*/,ap); |
| 535 | 536 | va_end(ap); |
| 536 | 537 | |
| @@ -541,24 +542,25 @@ | ||
| 541 | 542 | } |
| 542 | 543 | blob_init(&btn, 0, 0); |
| 543 | 544 | blob_append_string(&btn, "<span class=\"nobr\">"); |
| 544 | 545 | if( zTargetId==0 ){ |
| 545 | 546 | static unsigned int cnt = 0; |
| 546 | - zId = mprintf("copy-button-id-%u", ++cnt); | |
| 547 | + zId = mprintf("content-id-%u", ++cnt); | |
| 547 | 548 | zTargetId = zId; |
| 548 | 549 | } |
| 549 | 550 | if( bAfter ){ |
| 550 | 551 | blob_appendf(&btn, "<span id=\"%h\">%s</span>", |
| 551 | 552 | zTargetId, zText); |
| 553 | + zBtnClass = "copy-button copy-button-flipped"; | |
| 552 | 554 | } |
| 553 | 555 | blob_appendf(&btn, |
| 554 | 556 | "<button " |
| 555 | - "class=\"copy-button\" " | |
| 557 | + "class=\"%s\" " | |
| 556 | 558 | "id=\"copy-%h\" " |
| 557 | 559 | "data-copytarget=\"%h\" " |
| 558 | 560 | "data-copylength=\"%d\"", |
| 559 | - zTargetId, zTargetId, mxLength); | |
| 561 | + zBtnClass, zTargetId, zTargetId, mxLength); | |
| 560 | 562 | if( zToCopy ){ |
| 561 | 563 | blob_appendf(&btn," data-content=\"%h\"", zToCopy); |
| 562 | 564 | } |
| 563 | 565 | blob_append_string(&btn, "><span></span></button>"); |
| 564 | 566 | if( !bAfter ){ |
| 565 | 567 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -527,10 +527,11 @@ | |
| 527 | va_list ap; |
| 528 | char *zText; |
| 529 | char *zResult = 0; |
| 530 | char *zId = 0; |
| 531 | Blob btn; |
| 532 | |
| 533 | va_start(ap,zTextFmt); |
| 534 | zText = vmprintf(zTextFmt/*works-like:?*/,ap); |
| 535 | va_end(ap); |
| 536 | |
| @@ -541,24 +542,25 @@ | |
| 541 | } |
| 542 | blob_init(&btn, 0, 0); |
| 543 | blob_append_string(&btn, "<span class=\"nobr\">"); |
| 544 | if( zTargetId==0 ){ |
| 545 | static unsigned int cnt = 0; |
| 546 | zId = mprintf("copy-button-id-%u", ++cnt); |
| 547 | zTargetId = zId; |
| 548 | } |
| 549 | if( bAfter ){ |
| 550 | blob_appendf(&btn, "<span id=\"%h\">%s</span>", |
| 551 | zTargetId, zText); |
| 552 | } |
| 553 | blob_appendf(&btn, |
| 554 | "<button " |
| 555 | "class=\"copy-button\" " |
| 556 | "id=\"copy-%h\" " |
| 557 | "data-copytarget=\"%h\" " |
| 558 | "data-copylength=\"%d\"", |
| 559 | zTargetId, zTargetId, mxLength); |
| 560 | if( zToCopy ){ |
| 561 | blob_appendf(&btn," data-content=\"%h\"", zToCopy); |
| 562 | } |
| 563 | blob_append_string(&btn, "><span></span></button>"); |
| 564 | if( !bAfter ){ |
| 565 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -527,10 +527,11 @@ | |
| 527 | va_list ap; |
| 528 | char *zText; |
| 529 | char *zResult = 0; |
| 530 | char *zId = 0; |
| 531 | Blob btn; |
| 532 | const char *zBtnClass = "copy-button"; |
| 533 | |
| 534 | va_start(ap,zTextFmt); |
| 535 | zText = vmprintf(zTextFmt/*works-like:?*/,ap); |
| 536 | va_end(ap); |
| 537 | |
| @@ -541,24 +542,25 @@ | |
| 542 | } |
| 543 | blob_init(&btn, 0, 0); |
| 544 | blob_append_string(&btn, "<span class=\"nobr\">"); |
| 545 | if( zTargetId==0 ){ |
| 546 | static unsigned int cnt = 0; |
| 547 | zId = mprintf("content-id-%u", ++cnt); |
| 548 | zTargetId = zId; |
| 549 | } |
| 550 | if( bAfter ){ |
| 551 | blob_appendf(&btn, "<span id=\"%h\">%s</span>", |
| 552 | zTargetId, zText); |
| 553 | zBtnClass = "copy-button copy-button-flipped"; |
| 554 | } |
| 555 | blob_appendf(&btn, |
| 556 | "<button " |
| 557 | "class=\"%s\" " |
| 558 | "id=\"copy-%h\" " |
| 559 | "data-copytarget=\"%h\" " |
| 560 | "data-copylength=\"%d\"", |
| 561 | zBtnClass, zTargetId, zTargetId, mxLength); |
| 562 | if( zToCopy ){ |
| 563 | blob_appendf(&btn," data-content=\"%h\"", zToCopy); |
| 564 | } |
| 565 | blob_append_string(&btn, "><span></span></button>"); |
| 566 | if( !bAfter ){ |
| 567 |