Fossil SCM
Sync with trunk.
Commit
a1f60bee3cf147f3503646670750a265dae5ac7e83134b76b7b75716b42df523
Parent
878a56bc98a2dbd…
6 files changed
+1
-2
+1
+1
+54
-16
+54
-16
+11
-6
+1
-2
| --- src/add.c | ||
| +++ src/add.c | ||
| @@ -753,12 +753,11 @@ | ||
| 753 | 753 | ** |
| 754 | 754 | ** * All files in the repository but missing from the check-out (that is, |
| 755 | 755 | ** all files that show as MISSING with the "status" command) are |
| 756 | 756 | ** removed as if by the "[[rm]]" command. |
| 757 | 757 | ** |
| 758 | -** The command does not "[[commit]]". You must run the "[[commit]]" separately | |
| 759 | -** as a separate step. | |
| 758 | +** Note that this command does not "commit", as that is a separate step. | |
| 760 | 759 | ** |
| 761 | 760 | ** Files and directories whose names begin with "." are ignored unless |
| 762 | 761 | ** the --dotfiles option is used. |
| 763 | 762 | ** |
| 764 | 763 | ** The --ignore option overrides the "ignore-glob" setting, as do the |
| 765 | 764 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -753,12 +753,11 @@ | |
| 753 | ** |
| 754 | ** * All files in the repository but missing from the check-out (that is, |
| 755 | ** all files that show as MISSING with the "status" command) are |
| 756 | ** removed as if by the "[[rm]]" command. |
| 757 | ** |
| 758 | ** The command does not "[[commit]]". You must run the "[[commit]]" separately |
| 759 | ** as a separate step. |
| 760 | ** |
| 761 | ** Files and directories whose names begin with "." are ignored unless |
| 762 | ** the --dotfiles option is used. |
| 763 | ** |
| 764 | ** The --ignore option overrides the "ignore-glob" setting, as do the |
| 765 |
| --- src/add.c | |
| +++ src/add.c | |
| @@ -753,12 +753,11 @@ | |
| 753 | ** |
| 754 | ** * All files in the repository but missing from the check-out (that is, |
| 755 | ** all files that show as MISSING with the "status" command) are |
| 756 | ** removed as if by the "[[rm]]" command. |
| 757 | ** |
| 758 | ** Note that this command does not "commit", as that is a separate step. |
| 759 | ** |
| 760 | ** Files and directories whose names begin with "." are ignored unless |
| 761 | ** the --dotfiles option is used. |
| 762 | ** |
| 763 | ** The --ignore option overrides the "ignore-glob" setting, as do the |
| 764 |
+1
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -710,10 +710,11 @@ | ||
| 710 | 710 | border-bottom: 3px solid gold; |
| 711 | 711 | } |
| 712 | 712 | body.tkt div.content ol.tkt-changes > li:target > ol { |
| 713 | 713 | border-left: 1px solid gold; |
| 714 | 714 | } |
| 715 | +body.cpage-ckout .file-change-line, | |
| 715 | 716 | body.cpage-info .file-change-line, |
| 716 | 717 | body.cpage-vdiff .file-change-line { |
| 717 | 718 | margin-top: 16px; |
| 718 | 719 | margin-bottom: 16px; |
| 719 | 720 | margin-right: 1em /* keep it from nudging right up against the scrollbar-reveal zone */; |
| 720 | 721 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -710,10 +710,11 @@ | |
| 710 | border-bottom: 3px solid gold; |
| 711 | } |
| 712 | body.tkt div.content ol.tkt-changes > li:target > ol { |
| 713 | border-left: 1px solid gold; |
| 714 | } |
| 715 | body.cpage-info .file-change-line, |
| 716 | body.cpage-vdiff .file-change-line { |
| 717 | margin-top: 16px; |
| 718 | margin-bottom: 16px; |
| 719 | margin-right: 1em /* keep it from nudging right up against the scrollbar-reveal zone */; |
| 720 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -710,10 +710,11 @@ | |
| 710 | border-bottom: 3px solid gold; |
| 711 | } |
| 712 | body.tkt div.content ol.tkt-changes > li:target > ol { |
| 713 | border-left: 1px solid gold; |
| 714 | } |
| 715 | body.cpage-ckout .file-change-line, |
| 716 | body.cpage-info .file-change-line, |
| 717 | body.cpage-vdiff .file-change-line { |
| 718 | margin-top: 16px; |
| 719 | margin-bottom: 16px; |
| 720 | margin-right: 1em /* keep it from nudging right up against the scrollbar-reveal zone */; |
| 721 |
+1
| --- src/default.css | ||
| +++ src/default.css | ||
| @@ -710,10 +710,11 @@ | ||
| 710 | 710 | border-bottom: 3px solid gold; |
| 711 | 711 | } |
| 712 | 712 | body.tkt div.content ol.tkt-changes > li:target > ol { |
| 713 | 713 | border-left: 1px solid gold; |
| 714 | 714 | } |
| 715 | +body.cpage-ckout .file-change-line, | |
| 715 | 716 | body.cpage-info .file-change-line, |
| 716 | 717 | body.cpage-vdiff .file-change-line { |
| 717 | 718 | margin-top: 16px; |
| 718 | 719 | margin-bottom: 16px; |
| 719 | 720 | margin-right: 1em /* keep it from nudging right up against the scrollbar-reveal zone */; |
| 720 | 721 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -710,10 +710,11 @@ | |
| 710 | border-bottom: 3px solid gold; |
| 711 | } |
| 712 | body.tkt div.content ol.tkt-changes > li:target > ol { |
| 713 | border-left: 1px solid gold; |
| 714 | } |
| 715 | body.cpage-info .file-change-line, |
| 716 | body.cpage-vdiff .file-change-line { |
| 717 | margin-top: 16px; |
| 718 | margin-bottom: 16px; |
| 719 | margin-right: 1em /* keep it from nudging right up against the scrollbar-reveal zone */; |
| 720 |
| --- src/default.css | |
| +++ src/default.css | |
| @@ -710,10 +710,11 @@ | |
| 710 | border-bottom: 3px solid gold; |
| 711 | } |
| 712 | body.tkt div.content ol.tkt-changes > li:target > ol { |
| 713 | border-left: 1px solid gold; |
| 714 | } |
| 715 | body.cpage-ckout .file-change-line, |
| 716 | body.cpage-info .file-change-line, |
| 717 | body.cpage-vdiff .file-change-line { |
| 718 | margin-top: 16px; |
| 719 | margin-bottom: 16px; |
| 720 | margin-right: 1em /* keep it from nudging right up against the scrollbar-reveal zone */; |
| 721 |
+54
-16
| --- src/fossil.diff.js | ||
| +++ src/fossil.diff.js | ||
| @@ -1,43 +1,81 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | diff-related JS APIs for fossil. |
| 3 | 3 | */ |
| 4 | 4 | "use strict"; |
| 5 | +/* Locate the UI element (if any) into which we can inject some diff-related | |
| 6 | + UI controls. */ | |
| 7 | +window.fossil.onPageLoad(function(){ | |
| 8 | + const potentialParents = window.fossil.page.diffControlContainers = [ | |
| 9 | + /* CSS selectors for possible parents for injected diff-related UI | |
| 10 | + controls. */ | |
| 11 | + /* Put the most likely pages at the end, as array.pop() is more | |
| 12 | + efficient than array.shift() (see loop below). */ | |
| 13 | + /* /filedit */ 'body.cpage-fileedit #fileedit-tab-diff-buttons', | |
| 14 | + /* /wikiedit */ 'body.cpage-wikiedit #wikiedit-tab-diff-buttons', | |
| 15 | + /* /fdiff */ 'body.fdiff form div.submenu', | |
| 16 | + /* /vdiff */ 'body.vdiff form div.submenu', | |
| 17 | + /* /info, /vinfo, /ckout */ 'body.vinfo div.sectionmenu.info-changes-menu' | |
| 18 | + ]; | |
| 19 | + window.fossil.page.diffControlContainer = undefined; | |
| 20 | + while( potentialParents.length ){ | |
| 21 | + if( (window.fossil.page.diffControlContainer | |
| 22 | + = document.querySelector(potentialParents.pop())) ){ | |
| 23 | + break; | |
| 24 | + } | |
| 25 | + } | |
| 26 | +}); | |
| 27 | + | |
| 5 | 28 | window.fossil.onPageLoad(function(){ |
| 6 | 29 | /** |
| 7 | 30 | Adds toggle checkboxes to each file entry in the diff views for |
| 8 | 31 | /info and similar pages. |
| 9 | 32 | */ |
| 10 | 33 | const D = window.fossil.dom; |
| 11 | 34 | const allToggles = [/*collection of all diff-toggle checkboxes */]; |
| 12 | 35 | const addToggle = function(diffElem){ |
| 13 | 36 | const sib = diffElem.previousElementSibling, |
| 14 | - btnOne = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; | |
| 37 | + ckbox = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; | |
| 15 | 38 | if(!sib) return; |
| 16 | - const lblToggle = D.append(D.label(null, " Toggle "), btnOne); | |
| 39 | + const lblToggle = D.label(); | |
| 40 | + D.append(lblToggle, ckbox, D.text(" show/hide ")); | |
| 17 | 41 | const wrapper = D.append(D.span(), lblToggle); |
| 18 | - const btnAll = D.button("all"); | |
| 19 | - btnAll.$cb = btnOne; | |
| 20 | - allToggles.push(btnOne); | |
| 21 | - D.append(sib, D.append(wrapper, lblToggle, D.text(" "), btnAll)); | |
| 22 | - btnOne.addEventListener('change', function(){ | |
| 42 | + allToggles.push(ckbox); | |
| 43 | + D.append(sib, D.append(wrapper, lblToggle)); | |
| 44 | + ckbox.addEventListener('change', function(){ | |
| 23 | 45 | diffElem.classList[this.checked ? 'remove' : 'add']('hidden'); |
| 24 | - }, false); | |
| 25 | - btnAll.addEventListener('click', function(){ | |
| 26 | - /* Toggle all entries to match this line's new state. Note that | |
| 27 | - we use click() instead of cb.checked=... so that the | |
| 28 | - on-change event handler fires. */ | |
| 29 | - const checked = !this.$cb.checked; | |
| 30 | - allToggles.forEach( (cb)=>{ | |
| 31 | - if(cb.checked!==checked) cb.click(); | |
| 32 | - }); | |
| 33 | 46 | }, false); |
| 34 | 47 | }; |
| 35 | 48 | if( !document.querySelector('body.fdiff') ){ |
| 36 | 49 | /* Don't show the diff toggle button for /fdiff because it only |
| 37 | 50 | has a single file to show (and also a different DOM layout). */ |
| 38 | 51 | document.querySelectorAll('table.diff').forEach(addToggle); |
| 52 | + } | |
| 53 | + const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0; | |
| 54 | + if(icm) { | |
| 55 | + const btnAll = D.addClass(D.a("#", "Toggle all diffs"), "button"); | |
| 56 | + D.append( icm, btnAll ); | |
| 57 | + btnAll.addEventListener('click', function(ev){ | |
| 58 | + ev.preventDefault(); | |
| 59 | + ev.stopPropagation(); | |
| 60 | + /* Figure out whether we want to show all or hide all: if any diffs are | |
| 61 | + toggled off, show all, else hide all. */ | |
| 62 | + let show = false; | |
| 63 | + let ckbox; | |
| 64 | + for( ckbox of allToggles ){ | |
| 65 | + if( !ckbox.checked ){ | |
| 66 | + show = true; | |
| 67 | + break; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + for( ckbox of allToggles ){ | |
| 71 | + /* Toggle all entries to match this new state. We use click() | |
| 72 | + instead of ckbox.checked=... so that the on-change event handler | |
| 73 | + fires. */ | |
| 74 | + if(ckbox.checked!==show) ckbox.click(); | |
| 75 | + } | |
| 76 | + }, false); | |
| 39 | 77 | } |
| 40 | 78 | }); |
| 41 | 79 | |
| 42 | 80 | window.fossil.onPageLoad(function(){ |
| 43 | 81 | const F = window.fossil, D = F.dom; |
| 44 | 82 |
| --- src/fossil.diff.js | |
| +++ src/fossil.diff.js | |
| @@ -1,43 +1,81 @@ | |
| 1 | /** |
| 2 | diff-related JS APIs for fossil. |
| 3 | */ |
| 4 | "use strict"; |
| 5 | window.fossil.onPageLoad(function(){ |
| 6 | /** |
| 7 | Adds toggle checkboxes to each file entry in the diff views for |
| 8 | /info and similar pages. |
| 9 | */ |
| 10 | const D = window.fossil.dom; |
| 11 | const allToggles = [/*collection of all diff-toggle checkboxes */]; |
| 12 | const addToggle = function(diffElem){ |
| 13 | const sib = diffElem.previousElementSibling, |
| 14 | btnOne = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; |
| 15 | if(!sib) return; |
| 16 | const lblToggle = D.append(D.label(null, " Toggle "), btnOne); |
| 17 | const wrapper = D.append(D.span(), lblToggle); |
| 18 | const btnAll = D.button("all"); |
| 19 | btnAll.$cb = btnOne; |
| 20 | allToggles.push(btnOne); |
| 21 | D.append(sib, D.append(wrapper, lblToggle, D.text(" "), btnAll)); |
| 22 | btnOne.addEventListener('change', function(){ |
| 23 | diffElem.classList[this.checked ? 'remove' : 'add']('hidden'); |
| 24 | }, false); |
| 25 | btnAll.addEventListener('click', function(){ |
| 26 | /* Toggle all entries to match this line's new state. Note that |
| 27 | we use click() instead of cb.checked=... so that the |
| 28 | on-change event handler fires. */ |
| 29 | const checked = !this.$cb.checked; |
| 30 | allToggles.forEach( (cb)=>{ |
| 31 | if(cb.checked!==checked) cb.click(); |
| 32 | }); |
| 33 | }, false); |
| 34 | }; |
| 35 | if( !document.querySelector('body.fdiff') ){ |
| 36 | /* Don't show the diff toggle button for /fdiff because it only |
| 37 | has a single file to show (and also a different DOM layout). */ |
| 38 | document.querySelectorAll('table.diff').forEach(addToggle); |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | window.fossil.onPageLoad(function(){ |
| 43 | const F = window.fossil, D = F.dom; |
| 44 |
| --- src/fossil.diff.js | |
| +++ src/fossil.diff.js | |
| @@ -1,43 +1,81 @@ | |
| 1 | /** |
| 2 | diff-related JS APIs for fossil. |
| 3 | */ |
| 4 | "use strict"; |
| 5 | /* Locate the UI element (if any) into which we can inject some diff-related |
| 6 | UI controls. */ |
| 7 | window.fossil.onPageLoad(function(){ |
| 8 | const potentialParents = window.fossil.page.diffControlContainers = [ |
| 9 | /* CSS selectors for possible parents for injected diff-related UI |
| 10 | controls. */ |
| 11 | /* Put the most likely pages at the end, as array.pop() is more |
| 12 | efficient than array.shift() (see loop below). */ |
| 13 | /* /filedit */ 'body.cpage-fileedit #fileedit-tab-diff-buttons', |
| 14 | /* /wikiedit */ 'body.cpage-wikiedit #wikiedit-tab-diff-buttons', |
| 15 | /* /fdiff */ 'body.fdiff form div.submenu', |
| 16 | /* /vdiff */ 'body.vdiff form div.submenu', |
| 17 | /* /info, /vinfo, /ckout */ 'body.vinfo div.sectionmenu.info-changes-menu' |
| 18 | ]; |
| 19 | window.fossil.page.diffControlContainer = undefined; |
| 20 | while( potentialParents.length ){ |
| 21 | if( (window.fossil.page.diffControlContainer |
| 22 | = document.querySelector(potentialParents.pop())) ){ |
| 23 | break; |
| 24 | } |
| 25 | } |
| 26 | }); |
| 27 | |
| 28 | window.fossil.onPageLoad(function(){ |
| 29 | /** |
| 30 | Adds toggle checkboxes to each file entry in the diff views for |
| 31 | /info and similar pages. |
| 32 | */ |
| 33 | const D = window.fossil.dom; |
| 34 | const allToggles = [/*collection of all diff-toggle checkboxes */]; |
| 35 | const addToggle = function(diffElem){ |
| 36 | const sib = diffElem.previousElementSibling, |
| 37 | ckbox = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; |
| 38 | if(!sib) return; |
| 39 | const lblToggle = D.label(); |
| 40 | D.append(lblToggle, ckbox, D.text(" show/hide ")); |
| 41 | const wrapper = D.append(D.span(), lblToggle); |
| 42 | allToggles.push(ckbox); |
| 43 | D.append(sib, D.append(wrapper, lblToggle)); |
| 44 | ckbox.addEventListener('change', function(){ |
| 45 | diffElem.classList[this.checked ? 'remove' : 'add']('hidden'); |
| 46 | }, false); |
| 47 | }; |
| 48 | if( !document.querySelector('body.fdiff') ){ |
| 49 | /* Don't show the diff toggle button for /fdiff because it only |
| 50 | has a single file to show (and also a different DOM layout). */ |
| 51 | document.querySelectorAll('table.diff').forEach(addToggle); |
| 52 | } |
| 53 | const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0; |
| 54 | if(icm) { |
| 55 | const btnAll = D.addClass(D.a("#", "Toggle all diffs"), "button"); |
| 56 | D.append( icm, btnAll ); |
| 57 | btnAll.addEventListener('click', function(ev){ |
| 58 | ev.preventDefault(); |
| 59 | ev.stopPropagation(); |
| 60 | /* Figure out whether we want to show all or hide all: if any diffs are |
| 61 | toggled off, show all, else hide all. */ |
| 62 | let show = false; |
| 63 | let ckbox; |
| 64 | for( ckbox of allToggles ){ |
| 65 | if( !ckbox.checked ){ |
| 66 | show = true; |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | for( ckbox of allToggles ){ |
| 71 | /* Toggle all entries to match this new state. We use click() |
| 72 | instead of ckbox.checked=... so that the on-change event handler |
| 73 | fires. */ |
| 74 | if(ckbox.checked!==show) ckbox.click(); |
| 75 | } |
| 76 | }, false); |
| 77 | } |
| 78 | }); |
| 79 | |
| 80 | window.fossil.onPageLoad(function(){ |
| 81 | const F = window.fossil, D = F.dom; |
| 82 |
+54
-16
| --- src/fossil.diff.js | ||
| +++ src/fossil.diff.js | ||
| @@ -1,43 +1,81 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | diff-related JS APIs for fossil. |
| 3 | 3 | */ |
| 4 | 4 | "use strict"; |
| 5 | +/* Locate the UI element (if any) into which we can inject some diff-related | |
| 6 | + UI controls. */ | |
| 7 | +window.fossil.onPageLoad(function(){ | |
| 8 | + const potentialParents = window.fossil.page.diffControlContainers = [ | |
| 9 | + /* CSS selectors for possible parents for injected diff-related UI | |
| 10 | + controls. */ | |
| 11 | + /* Put the most likely pages at the end, as array.pop() is more | |
| 12 | + efficient than array.shift() (see loop below). */ | |
| 13 | + /* /filedit */ 'body.cpage-fileedit #fileedit-tab-diff-buttons', | |
| 14 | + /* /wikiedit */ 'body.cpage-wikiedit #wikiedit-tab-diff-buttons', | |
| 15 | + /* /fdiff */ 'body.fdiff form div.submenu', | |
| 16 | + /* /vdiff */ 'body.vdiff form div.submenu', | |
| 17 | + /* /info, /vinfo, /ckout */ 'body.vinfo div.sectionmenu.info-changes-menu' | |
| 18 | + ]; | |
| 19 | + window.fossil.page.diffControlContainer = undefined; | |
| 20 | + while( potentialParents.length ){ | |
| 21 | + if( (window.fossil.page.diffControlContainer | |
| 22 | + = document.querySelector(potentialParents.pop())) ){ | |
| 23 | + break; | |
| 24 | + } | |
| 25 | + } | |
| 26 | +}); | |
| 27 | + | |
| 5 | 28 | window.fossil.onPageLoad(function(){ |
| 6 | 29 | /** |
| 7 | 30 | Adds toggle checkboxes to each file entry in the diff views for |
| 8 | 31 | /info and similar pages. |
| 9 | 32 | */ |
| 10 | 33 | const D = window.fossil.dom; |
| 11 | 34 | const allToggles = [/*collection of all diff-toggle checkboxes */]; |
| 12 | 35 | const addToggle = function(diffElem){ |
| 13 | 36 | const sib = diffElem.previousElementSibling, |
| 14 | - btnOne = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; | |
| 37 | + ckbox = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; | |
| 15 | 38 | if(!sib) return; |
| 16 | - const lblToggle = D.append(D.label(null, " Toggle "), btnOne); | |
| 39 | + const lblToggle = D.label(); | |
| 40 | + D.append(lblToggle, ckbox, D.text(" show/hide ")); | |
| 17 | 41 | const wrapper = D.append(D.span(), lblToggle); |
| 18 | - const btnAll = D.button("all"); | |
| 19 | - btnAll.$cb = btnOne; | |
| 20 | - allToggles.push(btnOne); | |
| 21 | - D.append(sib, D.append(wrapper, lblToggle, D.text(" "), btnAll)); | |
| 22 | - btnOne.addEventListener('change', function(){ | |
| 42 | + allToggles.push(ckbox); | |
| 43 | + D.append(sib, D.append(wrapper, lblToggle)); | |
| 44 | + ckbox.addEventListener('change', function(){ | |
| 23 | 45 | diffElem.classList[this.checked ? 'remove' : 'add']('hidden'); |
| 24 | - }, false); | |
| 25 | - btnAll.addEventListener('click', function(){ | |
| 26 | - /* Toggle all entries to match this line's new state. Note that | |
| 27 | - we use click() instead of cb.checked=... so that the | |
| 28 | - on-change event handler fires. */ | |
| 29 | - const checked = !this.$cb.checked; | |
| 30 | - allToggles.forEach( (cb)=>{ | |
| 31 | - if(cb.checked!==checked) cb.click(); | |
| 32 | - }); | |
| 33 | 46 | }, false); |
| 34 | 47 | }; |
| 35 | 48 | if( !document.querySelector('body.fdiff') ){ |
| 36 | 49 | /* Don't show the diff toggle button for /fdiff because it only |
| 37 | 50 | has a single file to show (and also a different DOM layout). */ |
| 38 | 51 | document.querySelectorAll('table.diff').forEach(addToggle); |
| 52 | + } | |
| 53 | + const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0; | |
| 54 | + if(icm) { | |
| 55 | + const btnAll = D.addClass(D.a("#", "Toggle all diffs"), "button"); | |
| 56 | + D.append( icm, btnAll ); | |
| 57 | + btnAll.addEventListener('click', function(ev){ | |
| 58 | + ev.preventDefault(); | |
| 59 | + ev.stopPropagation(); | |
| 60 | + /* Figure out whether we want to show all or hide all: if any diffs are | |
| 61 | + toggled off, show all, else hide all. */ | |
| 62 | + let show = false; | |
| 63 | + let ckbox; | |
| 64 | + for( ckbox of allToggles ){ | |
| 65 | + if( !ckbox.checked ){ | |
| 66 | + show = true; | |
| 67 | + break; | |
| 68 | + } | |
| 69 | + } | |
| 70 | + for( ckbox of allToggles ){ | |
| 71 | + /* Toggle all entries to match this new state. We use click() | |
| 72 | + instead of ckbox.checked=... so that the on-change event handler | |
| 73 | + fires. */ | |
| 74 | + if(ckbox.checked!==show) ckbox.click(); | |
| 75 | + } | |
| 76 | + }, false); | |
| 39 | 77 | } |
| 40 | 78 | }); |
| 41 | 79 | |
| 42 | 80 | window.fossil.onPageLoad(function(){ |
| 43 | 81 | const F = window.fossil, D = F.dom; |
| 44 | 82 |
| --- src/fossil.diff.js | |
| +++ src/fossil.diff.js | |
| @@ -1,43 +1,81 @@ | |
| 1 | /** |
| 2 | diff-related JS APIs for fossil. |
| 3 | */ |
| 4 | "use strict"; |
| 5 | window.fossil.onPageLoad(function(){ |
| 6 | /** |
| 7 | Adds toggle checkboxes to each file entry in the diff views for |
| 8 | /info and similar pages. |
| 9 | */ |
| 10 | const D = window.fossil.dom; |
| 11 | const allToggles = [/*collection of all diff-toggle checkboxes */]; |
| 12 | const addToggle = function(diffElem){ |
| 13 | const sib = diffElem.previousElementSibling, |
| 14 | btnOne = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; |
| 15 | if(!sib) return; |
| 16 | const lblToggle = D.append(D.label(null, " Toggle "), btnOne); |
| 17 | const wrapper = D.append(D.span(), lblToggle); |
| 18 | const btnAll = D.button("all"); |
| 19 | btnAll.$cb = btnOne; |
| 20 | allToggles.push(btnOne); |
| 21 | D.append(sib, D.append(wrapper, lblToggle, D.text(" "), btnAll)); |
| 22 | btnOne.addEventListener('change', function(){ |
| 23 | diffElem.classList[this.checked ? 'remove' : 'add']('hidden'); |
| 24 | }, false); |
| 25 | btnAll.addEventListener('click', function(){ |
| 26 | /* Toggle all entries to match this line's new state. Note that |
| 27 | we use click() instead of cb.checked=... so that the |
| 28 | on-change event handler fires. */ |
| 29 | const checked = !this.$cb.checked; |
| 30 | allToggles.forEach( (cb)=>{ |
| 31 | if(cb.checked!==checked) cb.click(); |
| 32 | }); |
| 33 | }, false); |
| 34 | }; |
| 35 | if( !document.querySelector('body.fdiff') ){ |
| 36 | /* Don't show the diff toggle button for /fdiff because it only |
| 37 | has a single file to show (and also a different DOM layout). */ |
| 38 | document.querySelectorAll('table.diff').forEach(addToggle); |
| 39 | } |
| 40 | }); |
| 41 | |
| 42 | window.fossil.onPageLoad(function(){ |
| 43 | const F = window.fossil, D = F.dom; |
| 44 |
| --- src/fossil.diff.js | |
| +++ src/fossil.diff.js | |
| @@ -1,43 +1,81 @@ | |
| 1 | /** |
| 2 | diff-related JS APIs for fossil. |
| 3 | */ |
| 4 | "use strict"; |
| 5 | /* Locate the UI element (if any) into which we can inject some diff-related |
| 6 | UI controls. */ |
| 7 | window.fossil.onPageLoad(function(){ |
| 8 | const potentialParents = window.fossil.page.diffControlContainers = [ |
| 9 | /* CSS selectors for possible parents for injected diff-related UI |
| 10 | controls. */ |
| 11 | /* Put the most likely pages at the end, as array.pop() is more |
| 12 | efficient than array.shift() (see loop below). */ |
| 13 | /* /filedit */ 'body.cpage-fileedit #fileedit-tab-diff-buttons', |
| 14 | /* /wikiedit */ 'body.cpage-wikiedit #wikiedit-tab-diff-buttons', |
| 15 | /* /fdiff */ 'body.fdiff form div.submenu', |
| 16 | /* /vdiff */ 'body.vdiff form div.submenu', |
| 17 | /* /info, /vinfo, /ckout */ 'body.vinfo div.sectionmenu.info-changes-menu' |
| 18 | ]; |
| 19 | window.fossil.page.diffControlContainer = undefined; |
| 20 | while( potentialParents.length ){ |
| 21 | if( (window.fossil.page.diffControlContainer |
| 22 | = document.querySelector(potentialParents.pop())) ){ |
| 23 | break; |
| 24 | } |
| 25 | } |
| 26 | }); |
| 27 | |
| 28 | window.fossil.onPageLoad(function(){ |
| 29 | /** |
| 30 | Adds toggle checkboxes to each file entry in the diff views for |
| 31 | /info and similar pages. |
| 32 | */ |
| 33 | const D = window.fossil.dom; |
| 34 | const allToggles = [/*collection of all diff-toggle checkboxes */]; |
| 35 | const addToggle = function(diffElem){ |
| 36 | const sib = diffElem.previousElementSibling, |
| 37 | ckbox = sib ? D.addClass(D.checkbox(true), 'diff-toggle') : 0; |
| 38 | if(!sib) return; |
| 39 | const lblToggle = D.label(); |
| 40 | D.append(lblToggle, ckbox, D.text(" show/hide ")); |
| 41 | const wrapper = D.append(D.span(), lblToggle); |
| 42 | allToggles.push(ckbox); |
| 43 | D.append(sib, D.append(wrapper, lblToggle)); |
| 44 | ckbox.addEventListener('change', function(){ |
| 45 | diffElem.classList[this.checked ? 'remove' : 'add']('hidden'); |
| 46 | }, false); |
| 47 | }; |
| 48 | if( !document.querySelector('body.fdiff') ){ |
| 49 | /* Don't show the diff toggle button for /fdiff because it only |
| 50 | has a single file to show (and also a different DOM layout). */ |
| 51 | document.querySelectorAll('table.diff').forEach(addToggle); |
| 52 | } |
| 53 | const icm = allToggles.length>1 ? window.fossil.page.diffControlContainer : 0; |
| 54 | if(icm) { |
| 55 | const btnAll = D.addClass(D.a("#", "Toggle all diffs"), "button"); |
| 56 | D.append( icm, btnAll ); |
| 57 | btnAll.addEventListener('click', function(ev){ |
| 58 | ev.preventDefault(); |
| 59 | ev.stopPropagation(); |
| 60 | /* Figure out whether we want to show all or hide all: if any diffs are |
| 61 | toggled off, show all, else hide all. */ |
| 62 | let show = false; |
| 63 | let ckbox; |
| 64 | for( ckbox of allToggles ){ |
| 65 | if( !ckbox.checked ){ |
| 66 | show = true; |
| 67 | break; |
| 68 | } |
| 69 | } |
| 70 | for( ckbox of allToggles ){ |
| 71 | /* Toggle all entries to match this new state. We use click() |
| 72 | instead of ckbox.checked=... so that the on-change event handler |
| 73 | fires. */ |
| 74 | if(ckbox.checked!==show) ckbox.click(); |
| 75 | } |
| 76 | }, false); |
| 77 | } |
| 78 | }); |
| 79 | |
| 80 | window.fossil.onPageLoad(function(){ |
| 81 | const F = window.fossil, D = F.dom; |
| 82 |
+11
-6
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -668,10 +668,13 @@ | ||
| 668 | 668 | if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){ |
| 669 | 669 | pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; |
| 670 | 670 | }else{ |
| 671 | 671 | pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 672 | 672 | } |
| 673 | + @ <div class="sectionmenu info-changes-menu"> | |
| 674 | + /* Filled out by JS */ | |
| 675 | + @ </div> | |
| 673 | 676 | while( db_step(&q)==SQLITE_ROW ){ |
| 674 | 677 | const char *zTreename = db_column_text(&q,0); |
| 675 | 678 | int isDeleted = db_column_int(&q, 1); |
| 676 | 679 | int isChnged = db_column_int(&q,2); |
| 677 | 680 | int isNew = db_column_int(&q,3); |
| @@ -679,35 +682,37 @@ | ||
| 679 | 682 | int isLink = db_column_int(&q, 5); |
| 680 | 683 | const char *zUuid = db_column_text(&q, 6); |
| 681 | 684 | int showDiff = 1; |
| 682 | 685 | |
| 683 | 686 | pCfg->diffFlags &= (~DIFF_FILE_MASK); |
| 687 | + @ <div class='file-change-line'><span> | |
| 684 | 688 | if( isDeleted ){ |
| 685 | - @ <p>DELETED %h(zTreename)</p> | |
| 689 | + @ DELETED %h(zTreename) | |
| 686 | 690 | pCfg->diffFlags |= DIFF_FILE_DELETED; |
| 687 | 691 | showDiff = 0; |
| 688 | 692 | }else if( file_access(zTreename, F_OK) ){ |
| 689 | - @ <p>MISSING %h(zTreename)</p> | |
| 693 | + @ MISSING %h(zTreename) | |
| 690 | 694 | showDiff = 0; |
| 691 | 695 | }else if( isNew ){ |
| 692 | - @ <p>ADDED %h(zTreename)</p> | |
| 696 | + @ ADDED %h(zTreename) | |
| 693 | 697 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 694 | 698 | srcid = 0; |
| 695 | 699 | showDiff = 0; |
| 696 | 700 | }else if( isChnged==3 ){ |
| 697 | - @ <p>ADDED_BY_MERGE %h(zTreename)</p> | |
| 701 | + @ ADDED_BY_MERGE %h(zTreename) | |
| 698 | 702 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 699 | 703 | srcid = 0; |
| 700 | 704 | showDiff = 0; |
| 701 | 705 | }else if( isChnged==5 ){ |
| 702 | - @ <p>ADDED_BY_INTEGRATE %h(zTreename)</p> | |
| 706 | + @ ADDED_BY_INTEGRATE %h(zTreename) | |
| 703 | 707 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 704 | 708 | srcid = 0; |
| 705 | 709 | showDiff = 0; |
| 706 | 710 | }else{ |
| 707 | - @ <p>CHANGED %h(zTreename)</p> | |
| 711 | + @ CHANGED %h(zTreename) | |
| 708 | 712 | } |
| 713 | + @ </span></div> | |
| 709 | 714 | if( showDiff ){ |
| 710 | 715 | Blob old, new; |
| 711 | 716 | if( !isLink != !file_islink(zTreename) ){ |
| 712 | 717 | @ %s(DIFF_CANNOT_COMPUTE_SYMLINK) |
| 713 | 718 | continue; |
| 714 | 719 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -668,10 +668,13 @@ | |
| 668 | if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){ |
| 669 | pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; |
| 670 | }else{ |
| 671 | pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 672 | } |
| 673 | while( db_step(&q)==SQLITE_ROW ){ |
| 674 | const char *zTreename = db_column_text(&q,0); |
| 675 | int isDeleted = db_column_int(&q, 1); |
| 676 | int isChnged = db_column_int(&q,2); |
| 677 | int isNew = db_column_int(&q,3); |
| @@ -679,35 +682,37 @@ | |
| 679 | int isLink = db_column_int(&q, 5); |
| 680 | const char *zUuid = db_column_text(&q, 6); |
| 681 | int showDiff = 1; |
| 682 | |
| 683 | pCfg->diffFlags &= (~DIFF_FILE_MASK); |
| 684 | if( isDeleted ){ |
| 685 | @ <p>DELETED %h(zTreename)</p> |
| 686 | pCfg->diffFlags |= DIFF_FILE_DELETED; |
| 687 | showDiff = 0; |
| 688 | }else if( file_access(zTreename, F_OK) ){ |
| 689 | @ <p>MISSING %h(zTreename)</p> |
| 690 | showDiff = 0; |
| 691 | }else if( isNew ){ |
| 692 | @ <p>ADDED %h(zTreename)</p> |
| 693 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 694 | srcid = 0; |
| 695 | showDiff = 0; |
| 696 | }else if( isChnged==3 ){ |
| 697 | @ <p>ADDED_BY_MERGE %h(zTreename)</p> |
| 698 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 699 | srcid = 0; |
| 700 | showDiff = 0; |
| 701 | }else if( isChnged==5 ){ |
| 702 | @ <p>ADDED_BY_INTEGRATE %h(zTreename)</p> |
| 703 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 704 | srcid = 0; |
| 705 | showDiff = 0; |
| 706 | }else{ |
| 707 | @ <p>CHANGED %h(zTreename)</p> |
| 708 | } |
| 709 | if( showDiff ){ |
| 710 | Blob old, new; |
| 711 | if( !isLink != !file_islink(zTreename) ){ |
| 712 | @ %s(DIFF_CANNOT_COMPUTE_SYMLINK) |
| 713 | continue; |
| 714 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -668,10 +668,13 @@ | |
| 668 | if( pCfg->diffFlags & DIFF_SIDEBYSIDE ){ |
| 669 | pCfg->diffFlags |= DIFF_HTML | DIFF_NOTTOOBIG; |
| 670 | }else{ |
| 671 | pCfg->diffFlags |= DIFF_LINENO | DIFF_HTML | DIFF_NOTTOOBIG; |
| 672 | } |
| 673 | @ <div class="sectionmenu info-changes-menu"> |
| 674 | /* Filled out by JS */ |
| 675 | @ </div> |
| 676 | while( db_step(&q)==SQLITE_ROW ){ |
| 677 | const char *zTreename = db_column_text(&q,0); |
| 678 | int isDeleted = db_column_int(&q, 1); |
| 679 | int isChnged = db_column_int(&q,2); |
| 680 | int isNew = db_column_int(&q,3); |
| @@ -679,35 +682,37 @@ | |
| 682 | int isLink = db_column_int(&q, 5); |
| 683 | const char *zUuid = db_column_text(&q, 6); |
| 684 | int showDiff = 1; |
| 685 | |
| 686 | pCfg->diffFlags &= (~DIFF_FILE_MASK); |
| 687 | @ <div class='file-change-line'><span> |
| 688 | if( isDeleted ){ |
| 689 | @ DELETED %h(zTreename) |
| 690 | pCfg->diffFlags |= DIFF_FILE_DELETED; |
| 691 | showDiff = 0; |
| 692 | }else if( file_access(zTreename, F_OK) ){ |
| 693 | @ MISSING %h(zTreename) |
| 694 | showDiff = 0; |
| 695 | }else if( isNew ){ |
| 696 | @ ADDED %h(zTreename) |
| 697 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 698 | srcid = 0; |
| 699 | showDiff = 0; |
| 700 | }else if( isChnged==3 ){ |
| 701 | @ ADDED_BY_MERGE %h(zTreename) |
| 702 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 703 | srcid = 0; |
| 704 | showDiff = 0; |
| 705 | }else if( isChnged==5 ){ |
| 706 | @ ADDED_BY_INTEGRATE %h(zTreename) |
| 707 | pCfg->diffFlags |= DIFF_FILE_ADDED; |
| 708 | srcid = 0; |
| 709 | showDiff = 0; |
| 710 | }else{ |
| 711 | @ CHANGED %h(zTreename) |
| 712 | } |
| 713 | @ </span></div> |
| 714 | if( showDiff ){ |
| 715 | Blob old, new; |
| 716 | if( !isLink != !file_islink(zTreename) ){ |
| 717 | @ %s(DIFF_CANNOT_COMPUTE_SYMLINK) |
| 718 | continue; |
| 719 |