TadhgDS / syntaxhighlighter

Automatically exported from code.google.com/p/syntaxhighlighter
GNU General Public License v3.0
0 stars 0 forks source link

After expanding collapsed source, there is no way to collapse it #66

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I found it kind of annoying that the syntax highlighter didn't allow you to
recollapse an expanded chunk of code.. so I hacked in a fix for my site..
anyone who is interested can see it here

http://blog.codesushi.com/codesushi/entry/syntax_highlighter

Original issue reported on code.google.com by bacheld...@gmail.com on 23 Mar 2008 at 10:56

GoogleCodeExporter commented 9 years ago
Yeah I don't like that either =/

Original comment by envygeeks on 24 Apr 2008 at 5:49

GoogleCodeExporter commented 9 years ago
I can't get to site mentioned by bachelderd, but here's a fix I used.  Just 
change
shCore.js dp.sh.Toolbar.Commands to start like this:

dp.sh.Toolbar.Commands = {
    ExpandSource: {
        label: '+ show source',
        //check: function(highlighter) { return highlighter.collapse; },
        func: function(sender, highlighter)
        {
            //sender.parentNode.removeChild(sender);
            if(highlighter.div.className.indexOf('collapsed') != -1){
            highlighter.div.className = highlighter.div.className.replace('collapsed', '');
            sender.innerHTML =  '- hide source';
            }
            else{
            highlighter.div.className += ' collapsed';
            sender.innerHTML =  '- show source';
            }
        }
    },

    // opens a new windows and puts the original unformatted source code inside.
    ViewSource: {

Original comment by JoeCoval...@gmail.com on 7 Dec 2008 at 1:55

GoogleCodeExporter commented 9 years ago
sorry about that... I think the URL changed at some point... it's:

http://blog.codesushi.com/codesushi/entry/js_syntax_highlighter

Original comment by bacheld...@gmail.com on 7 Dec 2008 at 2:01

GoogleCodeExporter commented 9 years ago
Thanks, bachelderd.  Turns out my way above only works if you start with the 
source
collapsed.  I fixed that and came back and saw your new URL.  Maybe your way is
better, but for the record, here's what I'm using at the second:  

        ExpandSource: {
                label: '+ show source',
                check: function(highlighter) { 
                    if(!highlighter.collapse)
                        dp.sh.Toolbar.Commands.ExpandSource.label = '- hide source'; 
                    return true;
                },
                func: function(sender, highlighter)
                {
                    //sender.parentNode.removeChild(sender);
                    if(highlighter.div.className.indexOf('collapsed') != -1){
                        highlighter.div.className =
highlighter.div.className.replace('collapsed', '');
                        sender.innerHTML =  '- hide source';
                    }
                    else{
                        highlighter.div.className += ' collapsed';
                        sender.innerHTML =  '+ show source';
                    }
                }
        },

Original comment by JoeCoval...@gmail.com on 8 Dec 2008 at 12:15

GoogleCodeExporter commented 9 years ago
Get advanced  Free php script on 
http://getphpscript.blogspot.in/

Original comment by kumarg...@gmail.com on 6 Nov 2013 at 6:04