[website] take upcoming meetups from README.md (#6520)

This commit is contained in:
Ivan Blinkov 2019-08-16 16:22:26 +03:00 committed by GitHub
parent fa5f802adb
commit da6925f74f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -94,7 +94,6 @@
</div>
<div id="announcement" class="colored-block">
<div class="page">
Upcoming Meetups: <a class="announcement-link" href="https://yandex.ru/promo/clickhouse/moscow-2019" rel="external nofollow" target="_blank">Moscow</a> on September 5, <a class="announcement-link" href="https://www.eventbrite.com/e/clickhouse-paris-meetup-2019-registration-68493270215" rel="external nofollow" target="_blank">Paris</a> on October 3, <a class="announcement-link" href="https://www.meetup.com/Hong-Kong-Machine-Learning-Meetup/events/263580542/" rel="external nofollow" target="_blank">Hong Kong</a> on October 17, <a class="announcement-link" href="https://www.huodongxing.com/event/3483759917300" rel="external nofollow" target="_blank">Shenzhen</a> on October 20 and <a class="announcement-link" href="https://www.huodongxing.com/event/4483760336000" rel="external nofollow" target="_blank">Shanghai</a> on October 27
</div>
</div>
<div class="page">
@ -495,6 +494,38 @@ clickhouse-client
<script type="text/javascript" src="https://yastatic.net/jquery/3.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$.get('https://raw.githubusercontent.com/yandex/ClickHouse/master/README.md', function(e) {
var skip = true;
var lines = e.split('\n');
var result = [];
$.each(lines, function(idx) {
var line = lines[idx];
if (skip) {
if (line.includes('Upcoming Events')) {
skip = false;
}
} else {
if (!line) { return; };
line = line.split('](');
var tail = line[1].split(') ');
result.push(
'<a class="announcement-link" rel="external nofollow" target="_blank" href="' +
tail[0] + '">' + line[0].replace('* [', '').replace('ClickHouse Meetup in ', '') +
'</a> ' + tail[1].slice(0, -1)
);
}
});
if (result.length) {
if (result.length == 1) {
result = 'Upcoming Meetup: ' + result[0];
} else {
result = 'Upcoming Meetups: ' + result.join(', ');
var offset = result.lastIndexOf(', ');
result = result.slice(0, offset) + result.slice(offset).replace(', ', ' and ');
}
$('#announcement>.page').html(result);
}
});
var name = $('#main-title').text().trim().toLowerCase();
var feedback_address = name + '-feedback' + '@yandex-team.com';
var feedback_email = $('#feedback_email');