diff --git a/data/css_compress/compress.py b/data/css_compress/compress.py index 5855aa4..a81d411 100644 --- a/data/css_compress/compress.py +++ b/data/css_compress/compress.py @@ -134,7 +134,7 @@ print('') print('') print('======== REGEX ========') -data = re.sub(r'(\}*\})', '\g<1>\n', data) +data = re.sub(r'(\}*\})', '\\g<1>\n', data) print('css data modified (1)') diff --git a/www/data/css/styles.css b/www/data/css/styles.css index b8fcc8c..7fc9c39 100644 --- a/www/data/css/styles.css +++ b/www/data/css/styles.css @@ -763,6 +763,7 @@ html, body { border-radius: 3px; box-sizing: border-box; opacity: 0; + pointer-events: none; } .extGitGraphContainer { diff --git a/www/data/css/styles.min.css b/www/data/css/styles.min.css index e9760b7..4f495cc 100644 --- a/www/data/css/styles.min.css +++ b/www/data/css/styles.min.css @@ -145,7 +145,7 @@ html,body{margin:0;padding:0;height:100%} .git_list text.caption_month{font-size:8px;fill:#BBB} .git_list text.caption_day{font-size:8px;fill:#BBB} .svg-tip:after{box-sizing:border-box;position:absolute;left:50%;height:5px;width:5px;bottom:-10px;margin:0 0 0 -5px;content:" ";border:5px solid transparent;border-top-color:rgba(0,0,0,0.8);border-image:none} -.svg-tip{padding:5px;background:none repeat scroll 0 0 rgba(0,0,0,0.8);color:#BBB;font-size:12px;position:absolute;z-index:99999;text-align:center;border-radius:3px;box-sizing:border-box;opacity:0} +.svg-tip{padding:5px;background:none repeat scroll 0 0 rgba(0,0,0,0.8);color:#BBB;font-size:12px;position:absolute;z-index:99999;text-align:center;border-radius:3px;box-sizing:border-box;opacity:0;pointer-events: none;} .extGitGraphContainer{background-color:#fcfcfc;margin:10px;display:inline-block;border:1px solid #222;border-radius:0;box-shadow:0 0 1px rgba(0,0,0,0.25) inset} .egg_footer{margin-top:5px;text-align:right;margin-right:5px;margin-bottom:5px;color:#888} .egg_footer>a{text-decoration:none;color:inherit} diff --git a/www/data/css/styles_about.scss b/www/data/css/styles_about.scss index 6c6acbc..654dec5 100644 --- a/www/data/css/styles_about.scss +++ b/www/data/css/styles_about.scss @@ -67,6 +67,8 @@ border-radius: 3px; box-sizing: border-box; opacity: 0; + pointer-events: none; + } .extGitGraphContainer { diff --git a/www/data/javascript/extendedgitgraph.js b/www/data/javascript/extendedgitgraph.js index 57d8808..5894c4c 100644 --- a/www/data/javascript/extendedgitgraph.js +++ b/www/data/javascript/extendedgitgraph.js @@ -10,6 +10,7 @@ var ExtendedGitGraph2; masterTip.style.display = 'none'; const masterTipHeader = masterTip.getElementsByTagName('strong')[0]; const masterTipContent = masterTip.getElementsByTagName('span')[0]; + const masterTipExtra = masterTip.getElementsByTagName('span')[0]; const rects = Array.from(document.getElementsByClassName("egg_rect")); for (let rect of rects) { rect.addEventListener("mouseenter", event => { @@ -19,6 +20,24 @@ var ExtendedGitGraph2; masterTip.style.display = 'block'; masterTipHeader.innerHTML = count + ' commits'; masterTipContent.innerHTML = ' on ' + date; + if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) { + masterTipExtra.style.display = 'grid'; + const extraAttr = target.getAttributeNames().sort().filter(p => p.startsWith('data-repo-')).map(p => target.getAttribute(p)); + let extraHTML = ''; + for (const attr of extraAttr) { + try { + let obj = JSON.parse(attr.replace(/'/g, '"')); + extraHTML += `[${obj.source}] ${obj.repo_name}:${obj.count}\n`; + } + catch (e) { + console.error('Error parsing extra attribute:', attr, e); + } + } + masterTipExtra.innerHTML = extraHTML; + } + else { + masterTipExtra.style.display = 'none'; + } masterTip.style.left = (window.pageXOffset + target.getBoundingClientRect().left - masterTip.getBoundingClientRect().width / 2 - 3.5 + 9) + 'px'; masterTip.style.top = (window.pageYOffset + target.getBoundingClientRect().top - masterTip.getBoundingClientRect().height - 10) + 'px'; }); @@ -27,4 +46,4 @@ var ExtendedGitGraph2; } ExtendedGitGraph2.initHover = initHover; })(ExtendedGitGraph2 || (ExtendedGitGraph2 = {})); -window.onload = () => { ExtendedGitGraph2.initHover(); }; \ No newline at end of file +window.onload = () => { ExtendedGitGraph2.initHover(); }; diff --git a/www/extern/egg/EGGDatabase.php b/www/extern/egg/EGGDatabase.php index fbe851a..31e61b6 100644 --- a/www/extern/egg/EGGDatabase.php +++ b/www/extern/egg/EGGDatabase.php @@ -484,7 +484,7 @@ class EGGDatabase $i++; } - $sql = str_replace("/*{INDETITY_COND}*/", $cond, $sql); + $sql = str_replace("/*{IDENTITY_COND}*/", $cond, $sql); $rows = $this->sql_query_assoc_prep($sql, $prep); @@ -494,6 +494,44 @@ class EGGDatabase return $r; } + /** + * @param int $year + * @param string[] $identities + * @return array + */ + public function getPerRepoCommitCountOfYearByDate(int $year, array $identities): array + { + $sql = file_get_contents(__DIR__ . "/db_queryday.sql"); + + $cond = "(1=0)"; + $prep = + [ + [":year", "".$year, PDO::PARAM_STR] + ]; + $i=0; + foreach ($identities as $ident) + { + $cond .= " OR (mail1 = :_".$i."_)"; + $prep []= [":_".$i."_", $ident, PDO::PARAM_STR]; + $i++; + $cond .= " OR (mail2 = :_".$i."_)"; + $prep []= [":_".$i."_", $ident, PDO::PARAM_STR]; + $i++; + } + + $sql = str_replace("/*{IDENTITY_COND}*/", $cond, $sql); + + $rows = $this->sql_query_assoc_prep($sql, $prep); + + $r = []; + foreach ($rows as $row) { + if (!isset($r[$row['commitdate']])) $r[$row['commitdate']] = []; + $r[$row['commitdate']] []= $row; + } + + return $r; + } + /** * @return int[] */ diff --git a/www/extern/egg/ExtendedGitGraph2.php b/www/extern/egg/ExtendedGitGraph2.php index 6acafb5..a319f12 100644 --- a/www/extern/egg/ExtendedGitGraph2.php +++ b/www/extern/egg/ExtendedGitGraph2.php @@ -79,7 +79,6 @@ class ExtendedGitGraph2 implements ILogger $this->db->beginTransaction(); $this->db->deleteOldSources(array_map(function (IRemoteSource $v){ return $v->getName(); }, $this->sources)); - $this->db->deleteDanglingCommitdata(); $this->db->commitTransaction(); $this->proclog("Update finished."); diff --git a/www/extern/egg/OutputGenerator.php b/www/extern/egg/OutputGenerator.php index 71dc5c3..e9d509e 100644 --- a/www/extern/egg/OutputGenerator.php +++ b/www/extern/egg/OutputGenerator.php @@ -179,13 +179,15 @@ class SingleYearRenderer implements IOutputGenerator */ private function generate(EGGDatabase $db) { - $dbdata = $db->getCommitCountOfYearByDate($this->year, $this->identities); + $dbdataCount = $db->getCommitCountOfYearByDate($this->year, $this->identities); - if (Utils::array_value_max(0, $dbdata) === 0) return null; + if (Utils::array_value_max(0, $dbdataCount) === 0) return null; + + $dbDataRepoCount = $db->getPerRepoCommitCountOfYearByDate($this->year, $this->identities); $now = new DateTime(); $date = new DateTime($this->year . '-01-01'); - $ymapmax = Utils::array_value_max(1, $dbdata); + $ymapmax = Utils::array_value_max(1, $dbdataCount); $monthlist = array_fill(0, 12, [0, 0]); @@ -217,7 +219,7 @@ class SingleYearRenderer implements IOutputGenerator continue; } - $c_count = array_key_exists($date->format('Y-m-d'), $dbdata) ? $dbdata[$date->format('Y-m-d')] : 0; + $c_count = array_key_exists($date->format('Y-m-d'), $dbdataCount) ? $dbdataCount[$date->format('Y-m-d')] : 0; $color_idx9 = min(((9)-1), ceil(pow($c_count/$ymapmax, $exponent9) * ((9)-1))); $color_idx5 = min(((5)-1), ceil(pow($c_count/$ymapmax, $exponent5) * ((5)-1))); @@ -239,12 +241,30 @@ class SingleYearRenderer implements IOutputGenerator $monthlist[$date->format('m') - 1][1] = $week + ($wday / 7); } + $extra = Utils::sharpFormat("\ndata-totalrepo-count={c}", ['c' => 0]); + + if (array_key_exists($date->format('Y-m-d'), $dbDataRepoCount)) + { + $extra = Utils::sharpFormat("\ndata-totalrepo-count={c}", ['c' => count($dbDataRepoCount[$date->format('Y-m-d')])]); + + foreach ($dbDataRepoCount[$date->format('Y-m-d')] as $repos) { + + $extra .= Utils::sharpFormat("\n data-repo-{repo_id}-count=\"{'repo_id': '{repo_id}', 'repo_name': '{repo_name}', 'source': '{source}', 'count': {count}}\"", [ + 'repo_id' => $repos['repo_id'], + 'repo_name' => $repos['repo_name'], + 'source' => $repos['source'], + 'count' => $repos['count'] + ]); + } + } + $html .= '' . "\n"; @@ -270,8 +290,8 @@ class SingleYearRenderer implements IOutputGenerator $html .= '' . "\n"; $html .= '' . "\n"; - $html .= '
' . "\n"; - $html .= '  ' . "\n"; + $html .= '
' . "\n"; + $html .= '  
' . "\n"; $html .= '
' . "\n"; $html .= '