-
-
Save kururu-abdo/aa4d603a8db1d741b6d7bd7ab4e69dbc to your computer and use it in GitHub Desktop.
Revisions
-
igeligel revised this gist
Nov 4, 2018 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ const totalTypes = { VIEWS: 2, READS: 3, FANS: 5 }; const getTotal = tableColumn => @@ -14,5 +15,6 @@ const getTotal = tableColumn => console.log({ totalViews: getTotal(totalTypes.VIEWS), totalReads: getTotal(totalTypes.READS), totalFans: getTotal(totalTypes.FANS) }); -
igeligel revised this gist
Nov 4, 2018 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,8 +3,12 @@ const totalTypes = { READS: 3 }; const getTotal = tableColumn => [ ...document.querySelectorAll( `td:nth-child(${tableColumn}) > span.sortableTable-number` ) ] .map(e => parseInt(e.getAttribute("title").replace(/,/g, ""), 10)) .reduce((a, b) => a + b, 0); -
igeligel created this gist
Nov 4, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ const totalTypes = { VIEWS: 2, READS: 3 }; const getTotal = (tableColumn) => [...document.querySelectorAll(`td:nth-child(${tableColumn}) > span.sortableTable-number`)] .map(e => parseInt(e.getAttribute("title").replace(/,/g, ""), 10)) .reduce((a, b) => a + b, 0); console.log({ totalViews: getTotal(totalTypes.VIEWS), totalReads: getTotal(totalTypes.READS) });