}
echo "</script>\n";
}
- echo script("bodyLoad('" . (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '\1', $connection->server_info) : "") . "'" . ($connection->maria ? ", true" : "") . ");");
+ echo script("syntaxHighlighting('" . (is_object($connection) ? preg_replace('~^(\d\.?\d).*~s', '\1', $connection->server_info) : "") . "'"
+ . ($connection->maria ? ", 'maria'" : ($connection->cockroach ? ", 'cockroach'" : "")) . ");"
+ );
}
/** Prints databases list in menu
$urls = array(
'sql' => "https://dev.mysql.com/doc/refman/$version/en/",
'sqlite' => "https://www.sqlite.org/",
- 'pgsql' => "https://www.postgresql.org/docs/$version/",
+ 'pgsql' => "https://www.postgresql.org/docs/" . ($connection->cockroach ? "current" : $version) . "/",
'mssql' => "https://learn.microsoft.com/en-us/sql/",
'oracle' => "https://www.oracle.com/pls/topic/lookup?ctx=db" . preg_replace('~^.* (\d+)\.(\d+)\.\d+\.\d+\.\d+.*~s', '\1\2', $server_info) . "&id=",
);
/** Load syntax highlighting
* @param string first three characters of database system version
-* @param [boolean]
+* @param [string]
*/
-function bodyLoad(version, maria) {
+function syntaxHighlighting(version, vendor) {
if (window.jush) {
jush.create_links = ' target="_blank" rel="noreferrer noopener"';
if (version) {
if (typeof obj[key] != 'string') {
obj = obj[key];
key = 0;
- if (maria) {
+ if (vendor == 'maria') {
for (var i = 1; i < obj.length; i++) {
obj[i] = obj[i]
.replace('.html', '/')
}
}
- obj[key] = (maria ? obj[key].replace('dev.mysql.com/doc/mysql', 'mariadb.com/kb') : obj[key]) // MariaDB
+ obj[key] = (vendor == 'maria' ? obj[key].replace('dev.mysql.com/doc/mysql', 'mariadb.com/kb') : obj[key]) // MariaDB
.replace('/doc/mysql', '/doc/refman/' + version) // MySQL
- .replace('/docs/current', '/docs/' + version) // PostgreSQL
;
+ if (vendor != 'cockroach') {
+ obj[key] = obj[key].replace('/docs/current', '/docs/' + version); // PostgreSQL
+ }
}
}
if (window.jushLinks) {