Jump to content

Talk:FLOSS-Exchange/Matrix

Add topic
From Meta, a Wikimedia project coordination wiki
Latest comment: 2 months ago by Valerio Bozzolan in topic SUM

To make this easier to update you can use the Google Sheet (P) and e.g. excel2wiki. /André Costa (WMSE) (talk) 15:50, 5 April 2017 (UTC)Reply

@André Costa (WMSE) smart. Thank you for doing this. @Andrerodriguex is doing WM LGBT+ UG entry update. --Zblace (talk) 11:53, 12 January 2023 (UTC)Reply
@André Costa (WMSE) @Zblace I updated the Google Sheet page for WM LGBT+ UG. Andrerodriguex (talk) 23:15, 12 January 2023 (UTC)Reply

@Envlh @Yug :) ValerioBozz (talk) 10:27, 19 May 2023 (UTC)Reply

Landing FLOSS info to Wikidata

[edit]

I would like to help in slowly migrate this FLOSS table into Wikidata. Major benefit: better handling of historical data (example: "use ... + start date + stop date").

Example proposed structure:

Wikimedia Italia (Q15136611)

uses (P2283)
BigBlueButton (Q4904858)
start time (P580) May 2020
ownCloud (Q290284)
start time (P580) May 2020
end time (P582) Mar 2018
CiviCRM (Q142028)
start time (P580) Mar 2023

Potential obscacles:

Can the Wikidata community may be against documenting Wikimedia Organizations? I honestly think no. I think we have green light, as long as the data structure has sense.

Can we then export data in a nice way (like in this wiki table)? I sincerely think yes. Developers welcome.

Thanks for any tip in the data structure or anything. ValerioBozz (talk) 11:01, 15 March 2024 (UTC)Reply

CSS style to make first headers sticky

[edit]

I created a stupid CSS snippet to make headers "a bit" sticky but I'm not a designer indeed.

It may be the only way to contribute to this table with a small screen.

At the moment I'm copy-pasting this in my console to hot-use that and I'm not bold enough to activate a templatestyle since it will probably bork everything.

Thanks for trying in your console and for any edit.

#content {
  overflow-x: scroll;
}

/* Make first column sticky (software names) */
#content table tr th:first-child,
#content table tr td:first-child
{
  position: sticky;
  left: 1px;
  z-index:2;
  background-color: #cdcdcd;
}

/* Make second column sticky (+1 votes) */
#content table thead tr:nth-child(1) th:nth-child(2),
#content table thead tr:nth-child(2) th:nth-child(2),
#content table tbody                 td:nth-child(2)
{
  position: sticky;
  left: 130px;
  z-index:2;
  background-color: #cdcdcd;
}

/* Make third column sticky (-1 votes) */
#content table thead tr:nth-child(2) th:nth-child(3),
#content table tbody                 td:nth-child(3)
{
  position: sticky;
  left: 179px;
  z-index:2;
  background-color: #cdcdcd;
}

/* Make 4th column sticky (proprietary or free) */
#content table thead tr:nth-child(1) th:nth-child(3),
#content table thead tr:nth-child(2) th:nth-child(4),
#content table tbody                 td:nth-child(4)
{
  position: sticky;
  left: 219px;
  z-index:2;
  background-color: #cdcdcd;
}

/* Make 1 row sticky (NOT WORKING) */
/*
#content table thead tr:nth-child(1) th:not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)),
#content table thead tr:nth-child(2) th:not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(4))
{
  position: sticky;
  top: 100px;
  z-index:1;
  background: red;
}
*/

ValerioBozz (talk) 07:28, 10 May 2024 (UTC)Reply

SUM

[edit]

LOL to calculate the sums, run this in your browser console with VisualEditor opened in edit mode:

$(function() {
    function editCell($cell, v) {
      var s = ve.init.target.getSurface();
      if (!s) {
        alert("Edit the page with VisualEditor and retry");
        throw "edit with visual editor and retry";
      }
      var view = $cell.data('view');
      if (!view) {
        return;
      } 
      var range = view.model.getRange();
      var m = s.getModel();
      var fragment = m.getLinearFragment(range);
      if (fragment) {
        fragment.insertContent('' + v);
      }
    };

    $('#bodyContent .ve-ce-surface table tbody tr').each(function() {
        var $tr = $(this);
        var plus  = 0;
        var minus = 0;
        var plusFree = 0;
        var plusProprietary = 0;
        var re = new RegExp("^-?([0-9]+\.)?[0-9]+");
        var $tds       = $tr.find('td');
        var $plusCell  = $tds.eq(0);
        var $minusCell = $tr.find('td:eq(1)');
        var $typeCell  = $tr.find('td:eq(2)');
        var isFree = $typeCell.text().trim() === 'F';
        $tds.each(function(i) {
            if (i < 3) {
              return;
            }
            var value = $(this).text() || '';
            if (value === '') {
              return;
            }
            var matches = value.match(re);
            if (!matches) {
              return;
            }
            value = matches[0] || '0';
            value = parseFloat(value);
            var absValue = Math.abs(value);
            var isStrong = absValue >= 1;
            if (value == 0) {
              if (!isFree) {
                $(this).css("background", "lightgreen");
              }
            } else {
              if (value > 0) {
                  plus += value;
              } else {
                  minus += value;
              }
              if (isFree || value < 0) {
                if (isStrong) {
                  $(this).css("background", "green");
                } else {
                  $(this).css("background", "lightgreen");
                }
              } else {
                if (isStrong) {
                  $(this).css("background", "red");
                } else {
                  $(this).css("background", "coral");
                }
              }
            }
        });
        editCell($plusCell, plus);
        editCell($minusCell, minus);
    });
});

Then touch a cell to be able to save, and save. LOL --ValerioBozz (talk) 18:04, 9 August 2024 (UTC)Reply

Wow, it works now! :D thanks User:Matma Rex for the in-depth surf into VisualEditor core stuff [1] [2] \o/ --ValerioBozz (talk) 14:55, 10 August 2024 (UTC)Reply