We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    This is an auto-generated topic for <a href="http://modxcms.com/extras/package/581">QM Show/Hide Link 0.1.1-Initial</a> by zgambino.

    Brief Description:
    Minimizes the QM bar to a small square allowing access to elements behind it like nav links and login boxes.
      • 14491
      • 15 Posts
      Great idea. This is needed! I can’t seem to get it to work yet on firefox though. It looks like the JS is added to my page right before the </head> tag but isn’t run at the page load.

      FF Web Developer Toolbar says

      Error: $(document).ready is not a function

      It works great on Safari and Chrome. Good work.
        • 14491
        • 15 Posts
        Ok, solution: I use lightbox v2 on my page and it uses scriptaculous. It looks like jquery and scriptaculous were having problems, so I used jQuery.noConflict. Keep in mind my javascript is pretty poor so if I’m doing this wrong, someone let me know! I also modified the css a little to make the toggle link fit better and make a larger clickable area (using padding). I figured a gray will be more visible on both white and dark backgrounds. The code now reads

        /* Quick Manager + Show/Hide Link
         * Version: 0.0.2
         * Author: zgambino
         * Updated to use jQuery.noConflict by John Boiles
         *
         * Description:
         * Allows the QM+ editor bar buttons to be minimized to a much smaller area
         * and allows you to access elements behind it like login boxes, navigation, etc.
         * 
         * Installation:
         * 	1. Simply copy and paste the contents of this file into a new snippet.
         * 	2. Attach it to the OnWebPagePrerender system event.
         * 	3. Name the plugin :"QM Show/Hide Link"
         * 	4. Enter a description: "<strong>0.0.1</strong> Enables support for toggling the visibility of the QM editor buttons on the front end."
         *
         * Configuration:
         *	There's really ony one configuration option: Change startMin to false if you would not like the QM to start minimized.
         *
         * That's it! Enjoy.
         */
        
        ob_start();
        ?>
        <script type='text/javascript'>
        var $j = jQuery.noConflict();
        $j(document).ready(function () {
        	var startMin = true; // Change to false if you would not like the QM to start minimized.
        
        
        	$j('#qmEditor').append("<a href='#' onclick='return false;' id='qeToggler'>Toggle</a>");
        	$j('#qmEditor ul').css({"overflow":"hidden", "width":"600px"});
        	$j('#qmEditor').css({"overflow":"hidden"});
        	$j('#qeToggler').toggle(
        		function(){
        			$j('#qmEditor').animate({ width: "36px", overflow:"hidden"});
        		},
        		function(){
        			$j('#qmEditor').animate({ width: "100%", overflow:"hidden"});
        		}		
        	).css({
        		'color':'gray',
        		'left':'0px',
        		'position':'absolute',
        		'text-decoration':'none',
        		'font-size':'8pt',
                        'top':'0px',
                        'padding':'0px 5px 28px 5px'
        	});
        	if(startMin){
        		$j('#qeToggler').trigger("click");
        	}
        });
        </script>
        <?
        $linkJS = ob_get_clean();
        
        global $modx;
        if(isset($_SESSION['mgrValidated']) && $_REQUEST['z'] != 'manprev') {
        	$output = &$modx->documentOutput;
        	
        	// Place Qm head information in head, just before </head> tag
        	$output = preg_replace('~(</head>)~i', $linkJS . '\1', $output);
        
        }
          • 19094
          • 9 Posts
          Sorry, sure a stupid question, but;

          2. Attach it to the OnWebPagePrerender system event.

          where do I do that?
            • 4310
            • 2,310 Posts
            In the Manager go to :
            Resources => Manage Resources => Plugins => QM Show/Hide Link => System Events => OnWebPagePrerender (enable the check box)
            Noticed a typo in the in Installation process :
            1. Simply copy and paste the contents of this file into a new snippet.
            Should read :
            1. Simply copy and paste the contents of this file into a new plugin.
              • 33510
              • 13 Posts
              Quote from: johnboiles at Sep 17, 2009, 05:50 PM

              Ok, solution: I use lightbox v2 on my page and it uses scriptaculous. It looks like jquery and scriptaculous were having problems, so I used jQuery.noConflict.

              Great Suggestion, I’ll add it to the next version!
              I suppose I should have taken a more conservative approach. I forget that not everyone uses only jquery wink.
                • 33510
                • 13 Posts

                1. Simply copy and paste the contents of this file into a new snippet.
                Should read :
                1. Simply copy and paste the contents of this file into a new plugin.

                Lol, yup. Thanks!
                  • 11055 ☆ A M B ☆
                  • 3,112 Posts
                  why do you guys like short tag php?
                  <? to <?php
                  anything else is great.
                  thx.
                    Rico
                    Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                    MODx is great, but knowing how to use it well makes it perfect!

                    www.virtudraft.com

                    Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                    Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                    Maintainter/contributor of Babel

                    Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.