Problema com Syntax Highlighter
2 participantes
Página 1 de 1
Problema com Syntax Highlighter
Olá, Convidado.
Tentei instalar o Syntax Highlighter, mas não está reconhecendo o código.
Link do fórum: http://programeiros.maisforum.com/
Até mais.
Obrigado.
Tentei instalar o Syntax Highlighter, mas não está reconhecendo o código.
Link do fórum: http://programeiros.maisforum.com/
Até mais.
Obrigado.
Convidado- Convidado
Re: Problema com Syntax Highlighter
O que aconteceu foi o seguinte: você adicionou o script sem as tags <script>.
Veja abaixo como deve ser usado. Substitua o código por este:
Veja abaixo como deve ser usado. Substitua o código por este:
- Código:
<script language="javascript" type="text/javascript">
/* Syntax Highlighter by JScript - 2013-07-17 | http://jscript.forumeiros.com */
jQuery(function () {
jQuery('code').each(function () {
var sContent = jQuery(this).html();
var codebox = jQuery(this).parent().parent();
codebox.before('<div class="punbbtop">PunBB <button onclick="punbbExpand(this); return false;">expand</button><button style="display: none" onclick="punbbCollapse(this); return false;">collapse</button> <button onclick="punbbSelect(this); return false;">select</button> <button onclick="punbbPopup(this); return false;">popup</button> <button style="margin-right: 50px; float: right;" onclick="punbbAbout(this); return false;">?</button></div></div></div><pre class="highlight punbb_block">' + sContent + '</pre>');
codebox.remove();
});
jQuery.getScript('http://balupton.github.com/jquery-syntaxhighlighter/scripts/jquery.syntaxhighlighter.min.js', function () {
jQuery.SyntaxHighlighter.init({
'wrapLines': false
})
})
});
function punbbExpand(oThis) {
jQuery(oThis).css('display', 'none');
jQuery(oThis).next().css('display', '');
jQuery(oThis).parent().next('pre.punbb_block').addClass('expand');
}
function punbbCollapse(oThis) {
jQuery(oThis).css('display', 'none');
jQuery(oThis).prev().css('display', '');
/*jQuery(oThis).parent().parent().find('pre.punbb_block').css('height', '250px;');*/
jQuery(oThis).parent().next('pre.punbb_block').removeClass('expand');
}
function punbbPopup(oThis) {
var content = jQuery(oThis).parent().next('pre.punbb_block').html();
var my_window = window.open("", "PunBB code - Para selecionar o código: [Ctrl] + [A]", "scrollbars=1toolbar=no,menubar=no,personalbar=no,status=0,left=0,location=0,menubar=0,top=0,width=640,height=480");
my_window.document.write('<pre>'+content+'</pre>');
}
function punbbAbout(oThis) {
alert('Simple code to add Syntax Highlighter fuctionality for PunBB-Forumeiros\n\nBy JScript FROM Brazil - 2013/07/17\n');
}
function punbbSelect(oThis) {
var doc = document;
var text = jQuery(oThis).parent().next('pre.punbb_block')[0];
if (doc.body.createTextRange) {
var range = doc.body.createTextRange();
range.moveToElementText(text);
range.select();
} else if (window.getSelection) {
var selection = window.getSelection();
var range = doc.createRange();
range.selectNodeContents(text);
selection.removeAllRanges();
selection.addRange(range);
}
}
</script>
Re: Problema com Syntax Highlighter
Olá, isto resolveu o problema de leitura do código, mas mesmo assim ele não funcionou dentro do fórum.
Só tirando uma dúvida ele vai substituir ao CODE?
Só tirando uma dúvida ele vai substituir ao CODE?
Convidado- Convidado
Re: Problema com Syntax Highlighter
@Hastag
Como nosso amigo @Legolas afirmou acima que faltou a tag <script> pois eu não informei no tutorial, também esqueci de mencionar que deve ser adicionado dentro da tag <head> mas no final dela que é antes de </head>!
Basta você mover o código para o final da tag head, que significa que deve ser antes de </head>, percebendo estes inconvenientes, vou adicionar no tutorial a explicação a respeito disto.
Edit: Pode ser colocado abaixo ou acima de {HOSTING_JS}
JS
Como nosso amigo @Legolas afirmou acima que faltou a tag <script> pois eu não informei no tutorial, também esqueci de mencionar que deve ser adicionado dentro da tag <head> mas no final dela que é antes de </head>!
Basta você mover o código para o final da tag head, que significa que deve ser antes de </head>, percebendo estes inconvenientes, vou adicionar no tutorial a explicação a respeito disto.
Edit: Pode ser colocado abaixo ou acima de {HOSTING_JS}
JS
Última edição por JScript em Seg 09 Set 2013, 7:58 pm, editado 1 vez(es)
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|