Tag code igual ao do FDF

4 participantes

Ver o tópico anterior Ver o tópico seguinte Ir para baixo

Tópico resolvido Tag code igual ao do FDF

Mensagem por Mauricio Molina 10.05.14 18:24

  • Descrição:
Alguém pode me fornecer o código da tag code aqui do FDF?

Código:
Este aqui

E claro como introduzo em meu fórum...

Obrigado!

  • Informações:
Fórum:http://aquapeixes.forumeiros.comVersão:PHPBB3
Tipo:Pedido de códigoTags:igual



Última edição por Mauricio Molina em 14.05.14 1:34, editado 1 vez(es)
Mauricio Molina

Mauricio Molina
Membro

Membro desde : 22/09/2009
Mensagens : 993
Pontos : 1429

http://aquapeixes.forumeiros.com/forum.htm

Ir para o topo Ir para baixo

Membro Entusiasta

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Roevs 10.05.14 18:29

Olá,

Veja este tópico

https://ajuda.forumeiros.com/t89738-

Até
Roevs

Roevs
Membro Entusiasta
Membro Entusiasta

Membro desde : 10/02/2012
Mensagens : 6484
Pontos : 8343

https://www.sololevelingrpg.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Mauricio Molina 10.05.14 19:22

Não é igual a este do FDF

Código:
Este aqui
Mauricio Molina

Mauricio Molina
Membro

Membro desde : 22/09/2009
Mensagens : 993
Pontos : 1429

http://aquapeixes.forumeiros.com/forum.htm

Ir para o topo Ir para baixo

Membro Entusiasta
  • 0

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Hancki 10.05.14 19:29

Olá!

Use este JS investido nos tópicos:
Código:
jQuery(function () {
    var sCSS = '<style>' + '/***' + '* Syntax Highlighter funtionality for Forumotion!' + '* CSS: .codebox dd.cont_code' + '* (c) http://balupton.github.io' + '* Version: 1.28082013-jq1.9.1' + '* Made by JScript - 2013/12/16' + '*/' + 'code.punbb_block, pre.punbb_block {' + '  background-color: #FAFAFA !important;' + '  border: 1px solid #C9C9C9 !important;' + '  color: #000000;' + '  font-family: Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace !important;' + '  font-size: 11px !important;' + '  line-height: 110% !important;' + '  max-height: 250px !important;' + '  overflow: auto !important;' + '  padding: 5px !important;' + '  white-space: pre-wrap !important;' + '  width: auto !important;' + '}' + '.punbbtop {' + '  background-color: #FFDEAD !important;' + '  color: #1D3652;' + '  font-size: 10px;' + '  font-weight: bold;' + '  line-height: 100%;' + '  margin-top: 5px;' + '  padding: 2px 1px 2px 3px;' + '}' + '.punbbtop button {' + '  background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;' + '  border: 1px solid #BBBBBB;' + '  border-radius: 3px 3px 3px 3px;' + '  color: #1D3652;' + '  cursor: pointer;' + '  display: inline-block;' + '  font-size: 10px;' + '  padding: 0 6px;' + '  text-decoration: none;' + '}' + '.punbbtop button:hover {' + '  background: -moz-linear-gradient(center top , #DFDFDF 5%, #EDEDED 100%) repeat scroll 0 0 #DFDFDF;' + '  border-color: #9A9A9A;' + '  color: #3D70A3;' + '}' + '.punbbtop button:active {' + '  position: relative;' + '  top: 1px;' + '}' + 'pre.punbb_block.expand, code.punbb_block.expand {' + '  max-height: 100% !important;' + '}' + '.prettyprint ol.linenums {' + '  padding-left: 15px !important;' + '}' + '</style>';
    document.head.insertAdjacentHTML('beforeEnd', sCSS);
    if (jQuery('.cont_code').length) {
        var tagCode = jQuery('.cont_code')
    } else {
        if (jQuery('.cont_code').length) {
            var tagCode = jQuery('.code')
        } else {
            var tagCode = jQuery('code')
        }
    }
    tagCode.each(function () {
        var sContent = jQuery(this).html();
        var codebox = jQuery(this).parent().parent();
        codebox.before('<div class="punbbtop">Código        <button onclick="punbbExpand(this); return false;">Expandir</button><button style="display: none" onclick="punbbCollapse(this); return false;">Diminuir</button>  <button onclick="punbbSelect(this); return false;">Selecionar</button>  <button onclick="punbbPopup(this); return false;">Pop-up</button>  </div><pre class="highlight punbb_block">' + sContent + '</pre>');
        codebox.remove()
    });
    jQuery.getScript('http://balupton.github.io/jquery-syntaxhighlighter/scripts/jquery.syntaxhighlighter.min.js', function () {
        jQuery.SyntaxHighlighter.init({
            'wrapLines': false
        })
    })
});
Hancki
Hancki

Hancki
Membro Entusiasta
Membro Entusiasta

Membro desde : 03/10/2009
Mensagens : 8190
Pontos : 12245

https://ajuda.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Mauricio Molina 10.05.14 19:31

Obrigado!

É possível adicionar a opção de copiar também?

EDIT:

Acabei de introduzir e não esta funcionando as funções!
Mauricio Molina

Mauricio Molina
Membro

Membro desde : 22/09/2009
Mensagens : 993
Pontos : 1429

http://aquapeixes.forumeiros.com/forum.htm

Ir para o topo Ir para baixo

Membro Entusiasta

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Hancki 10.05.14 20:18

Tem toda a razão, me desculpe!
Código:
jQuery(function () {
    var sCSS = '<style>' + '/***' + '* Syntax Highlighter funtionality for Forumotion!' + '* CSS: .codebox dd.cont_code' + '* (c) http://balupton.github.io' + '* Version: 1.28082013-jq1.9.1' + '* Made by JScript - 2013/12/16' + '*/' + 'code.punbb_block, pre.punbb_block {' + '  background-color: #FAFAFA !important;' + '  border: 1px solid #C9C9C9 !important;' + '  color: #000000;' + '  font-family: Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace !important;' + '  font-size: 11px !important;' + '  line-height: 110% !important;' + '  max-height: 250px !important;' + '  overflow: auto !important;' + '  padding: 5px !important;' + '  white-space: pre-wrap !important;' + '  width: auto !important;' + '}' + '.punbbtop {' + '  background-color: #FFDEAD !important;' + '  color: #1D3652;' + '  font-size: 10px;' + '  font-weight: bold;' + '  line-height: 100%;' + '  margin-top: 5px;' + '  padding: 2px 1px 2px 3px;' + '}' + '.punbbtop button {' + '  background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;' + '  border: 1px solid #BBBBBB;' + '  border-radius: 3px 3px 3px 3px;' + '  color: #1D3652;' + '  cursor: pointer;' + '  display: inline-block;' + '  font-size: 10px;' + '  padding: 0 6px;' + '  text-decoration: none;' + '}' + '.punbbtop button:hover {' + '  background: -moz-linear-gradient(center top , #DFDFDF 5%, #EDEDED 100%) repeat scroll 0 0 #DFDFDF;' + '  border-color: #9A9A9A;' + '  color: #3D70A3;' + '}' + '.punbbtop button:active {' + '  position: relative;' + '  top: 1px;' + '}' + 'pre.punbb_block.expand, code.punbb_block.expand {' + '  max-height: 100% !important;' + '}' + '.prettyprint ol.linenums {' + '  padding-left: 15px !important;' + '}' + '</style>';
    document.head.insertAdjacentHTML('beforeEnd', sCSS);
    if (jQuery('.cont_code').length) {
        var tagCode = jQuery('.cont_code')
    } else {
        if (jQuery('.cont_code').length) {
            var tagCode = jQuery('.code')
        } else {
            var tagCode = jQuery('code')
        }
    }
    tagCode.each(function () {
        var sContent = jQuery(this).html();
        var codebox = jQuery(this).parent().parent();
        codebox.before('<div class="punbbtop">Código        <button onclick="punbbExpand(this); return false;">Expandir</button><button style="display: none" onclick="punbbCollapse(this); return false;">Diminuir</button>  <button onclick="punbbSelect(this); return false;">Selecionar</button>  <button onclick="punbbPopup(this); return false;">Pop-up</button>  </div><pre class="highlight punbb_block">' + sContent + '</pre>');
        codebox.remove()
    });
    jQuery.getScript('http://balupton.github.io/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().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 Forumotion\n\nBy JScript FROM Brazil - 2013/12/16\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)
    }
}
Agora funciona!
Hancki

Hancki
Membro Entusiasta
Membro Entusiasta

Membro desde : 03/10/2009
Mensagens : 8190
Pontos : 12245

https://ajuda.forumeiros.com/

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Mauricio Molina 10.05.14 21:32

Agora sim, obrigado!

É possível adicionar a opção de copiar?
Mauricio Molina

Mauricio Molina
Membro

Membro desde : 22/09/2009
Mensagens : 993
Pontos : 1429

http://aquapeixes.forumeiros.com/forum.htm

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Kyo Panda 13.05.14 13:50

Adicionado. Feliz

Código:
jQuery(function () {
    var sCSS = '<style>' + '/***' + '* Syntax Highlighter funtionality for Forumotion!' + '* CSS: .codebox dd.cont_code' + '* (c) http://balupton.github.io' + '* Version: 1.28082013-jq1.9.1' + '* Made by JScript - 2013/12/16' + '*/' + 'code.punbb_block, pre.punbb_block {' + '  background-color: #FAFAFA !important;' + '  border: 1px solid #C9C9C9 !important;' + '  color: #000000;' + '  font-family: Consolas,"Bitstream Vera Sans Mono","Andale Mono",Monaco,"DejaVu Sans Mono","Lucida Console",monospace !important;' + '  font-size: 11px !important;' + '  line-height: 110% !important;' + '  max-height: 250px !important;' + '  overflow: auto !important;' + '  padding: 5px !important;' + '  white-space: pre-wrap !important;' + '  width: auto !important;' + '}' + '.punbbtop {' + '  background-color: #FFDEAD !important;' + '  color: #1D3652;' + '  font-size: 10px;' + '  font-weight: bold;' + '  line-height: 100%;' + '  margin-top: 5px;' + '  padding: 2px 1px 2px 3px;' + '}' + '.punbbtop button {' + '  background: -moz-linear-gradient(center top , #EDEDED 5%, #DFDFDF 100%) repeat scroll 0 0 #EDEDED;' + '  border: 1px solid #BBBBBB;' + '  border-radius: 3px 3px 3px 3px;' + '  color: #1D3652;' + '  cursor: pointer;' + '  display: inline-block;' + '  font-size: 10px;' + '  padding: 0 6px;' + '  text-decoration: none;' + '}' + '.punbbtop button:hover {' + '  background: -moz-linear-gradient(center top , #DFDFDF 5%, #EDEDED 100%) repeat scroll 0 0 #DFDFDF;' + '  border-color: #9A9A9A;' + '  color: #3D70A3;' + '}' + '.punbbtop button:active {' + '  position: relative;' + '  top: 1px;' + '}' + 'pre.punbb_block.expand, code.punbb_block.expand {' + '  max-height: 100% !important;' + '}' + '.prettyprint ol.linenums {' + '  padding-left: 15px !important;' + '}' + '</style>';
    document.head.insertAdjacentHTML('beforeEnd', sCSS);
    if (jQuery('.cont_code').length) {
        var tagCode = jQuery('.cont_code')
    } else {
        if (jQuery('.cont_code').length) {
            var tagCode = jQuery('.code')
        } else {
            var tagCode = jQuery('code')
        }
    }
    tagCode.each(function (key) {
        var sContent = jQuery(this).html();
        var codebox = jQuery(this).parent().parent();       
        codebox.before('<div class="punbbtop">Código        <button onclick="punbbExpand(this); return false;">Expandir</button><button style="display: none" onclick="punbbCollapse(this); return false;">Diminuir</button>  <button onclick="punbbSelect(this); return false;">Selecionar</button> <button class="punbb-copy" data-clipboard-target="codebox-' + key + '">Copiar</button> <button onclick="punbbPopup(this); return false;">Pop-up</button>  </div><pre class="highlight punbb_block">' + sContent + '</pre>');
        codebox.prev().attr('id', 'codebox-' + key);
        codebox.remove()
    });
    jQuery.getScript('http://balupton.github.io/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().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 Forumotion\n\nBy JScript FROM Brazil - 2013/12/16\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)
    }
}

$(function() {
    var deferreds;
    deferreds    = [];
    if (typeof ZeroClipboard === 'undefined') {
        deferreds.push($.getScript('http://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.0.0-beta.5/ZeroClipboard.min.js'));
    }
    $.when.apply(null, deferreds).then(function() {
        var client;
        ZeroClipboard.config({swfPath: 'http://cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.0.0-beta.5/ZeroClipboard.swf'});
        client = ZeroClipboard($('.punbb-copy'));
    });
});
Kyo Panda

Kyo Panda
Hiper Membro

Membro desde : 08/01/2012
Mensagens : 4641
Pontos : 5939

https://ajuda.forumeiros.com

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Mauricio Molina 13.05.14 21:44

Ola...

Não alterou, continua as mesmas funções, expandir, selecionar e pop-up

Até...
Mauricio Molina

Mauricio Molina
Membro

Membro desde : 22/09/2009
Mensagens : 993
Pontos : 1429

http://aquapeixes.forumeiros.com/forum.htm

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Kyo Panda 13.05.14 23:54

Eu verifiquei no seu fórum e o código não foi atualizado. Verifique se não houve algum erro no momento de salvar, pois:

http://ajuda-punbb.forumeiros.com/t11-ola-mundo

O código é funcional. Feliz
Kyo Panda

Kyo Panda
Hiper Membro

Membro desde : 08/01/2012
Mensagens : 4641
Pontos : 5939

https://ajuda.forumeiros.com

Ir para o topo Ir para baixo

Tópico resolvido Re: Tag code igual ao do FDF

Mensagem por Mauricio Molina 14.05.14 1:34

Agora funcionou..

Estranho, pois tinha a atualizado, mas tudo bem...

Esta correto agora...

Muito obrigado!
Mauricio Molina

Mauricio Molina
Membro

Membro desde : 22/09/2009
Mensagens : 993
Pontos : 1429

http://aquapeixes.forumeiros.com/forum.htm

Ir para o topo Ir para baixo

Ver o tópico anterior Ver o tópico seguinte Ir para o topo

- Tópicos semelhantes

Permissões neste sub-fórum
Não podes responder a tópicos