MariaDB: Links to documentation in syntax highlighting

This commit is contained in:
Jakub Vrana 2018-02-08 23:47:16 +01:00
parent cf7fe88990
commit e299e9d82d
3 changed files with 11 additions and 3 deletions

View file

@ -960,8 +960,9 @@ class Adminer {
echo "jushLinks.$val = jushLinks.$jush;\n";
}
}
$server_info = $connection->server_info;
?>
bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\\d\\.?\\d).*~s', '\\1', $connection->server_info) : ""); ?>');
bodyLoad('<?php echo (is_object($connection) ? preg_replace('~^(\\d\\.?\\d).*~s', '\\1', $server_info) : ""); ?>'<?php echo (preg_match('~MariaDB~', $server_info) ? ", true" : ""); ?>);
</script>
<?php
}

View file

@ -2,8 +2,9 @@
/** Load syntax highlighting
* @param string first three characters of database system version
* @param [boolean]
*/
function bodyLoad(version) {
function bodyLoad(version, maria) {
if (window.jush) {
jush.create_links = ' target="_blank" rel="noreferrer noopener"';
if (version) {
@ -12,8 +13,14 @@ function bodyLoad(version) {
if (typeof obj[key] != 'string') {
obj = obj[key];
key = 0;
if (maria) {
for (var i = 1; i < obj.length; i++) {
obj[i] = obj[i].replace(/\.html/, '/');
}
}
}
obj[key] = obj[key]
.replace(/dev\.mysql\.com\/doc\/mysql\/en\//, (maria ? 'mariadb.com/kb/en/library/' : '$&')) // MariaDB
.replace(/\/doc\/mysql/, '/doc/refman/' + version) // MySQL
.replace(/\/docs\/current/, '/docs/' + version) // PostgreSQL
;

2
externals/jush vendored

@ -1 +1 @@
Subproject commit b1801c40d9cf4d68b7d1c8085f4f95c26c0c6a9e
Subproject commit 275c9cc888608f36895e3926c16e8d2e2dab0a1c