Highlighting only inside <code>

This commit is contained in:
Jakub Vrana 2010-11-12 17:17:46 +01:00
parent b535853694
commit d8c7ea9837
4 changed files with 4 additions and 6 deletions

View file

@ -398,7 +398,7 @@ document.getElementById('username').focus();
? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment ? ereg_replace('[\x80-\xFF]+$', '', substr($query, 0, 1e6)) . "\n..." // [\x80-\xFF] - valid UTF-8, \n - can end by one-line comment
: $query : $query
); //! respect $_GET["ns"] ); //! respect $_GET["ns"]
return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre class='jush-$jush'>" . shorten_utf8($query, 1000) . '</pre><p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>'; return " <a href='#$id' onclick=\"return !toggle('$id');\">" . lang('SQL command') . "</a><div id='$id' class='hidden'><pre><code class='jush-$jush'>" . shorten_utf8($query, 1000) . '</code></pre><p><a href="' . h(str_replace("db=" . urlencode(DB), "db=" . urlencode($_GET["db"]), ME) . 'sql=&history=' . (count($history[$_GET["db"]]) - 1)) . '">' . lang('Edit') . '</a></div>';
} }
/** Functions displayed in edit form /** Functions displayed in edit form

View file

@ -59,7 +59,7 @@ if (!$error && $_POST) {
$empty = false; $empty = false;
$q = substr($query, 0, $match[0][1]); $q = substr($query, 0, $match[0][1]);
$commands++; $commands++;
echo "<pre class='jush-$jush' id='sql-$commands'>" . shorten_utf8(trim($q), 1000) . "</pre>\n"; echo "<pre id='sql-$commands'><code class='jush-$jush'>" . shorten_utf8(trim($q), 1000) . "</code></pre>\n";
ob_flush(); ob_flush();
flush(); // can take a long time - show the running query flush(); // can take a long time - show the running query
$start = explode(" ", microtime()); // microtime(true) is available since PHP 5 $start = explode(" ", microtime()); // microtime(true) is available since PHP 5

View file

@ -22,8 +22,7 @@ function bodyLoad(version, protocol) {
if (window.jushLinks) { if (window.jushLinks) {
jush.custom_links = jushLinks; jush.custom_links = jushLinks;
} }
jush.highlight_tag('pre', 0); jush.highlight_tag('code', 0);
jush.highlight_tag('code');
} }
}; };
script.onreadystatechange = function () { script.onreadystatechange = function () {

View file

@ -223,8 +223,7 @@ function ajaxSend(url, data) {
clearTimeout(ajaxTimeout); clearTimeout(ajaxTimeout);
setHtml('main', text); setHtml('main', text);
if (window.jush) { if (window.jush) {
jush.highlight_tag('code'); jush.highlight_tag('code', 0);
jush.highlight_tag('pre', 0);
} }
} }
}, data); }, data);