We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6890
    • 21 Posts
    Quote from: zi at Jan 19, 2011, 10:32 AM

    One more thing, its omitting the last //--> in the above example.
    zi, I’ve resolved this issue by using a preg_match_all and then filtering by another preg_match. The // --> remains but likewise will // text -->

    Quote from: Romain at Jan 19, 2011, 02:31 PM

    With the beta2, if i choose to strip comments, conditional comments are removed.
    If i set StripComments to no, conditional comments are still indented.
    I changed an expression for better matching, I’ll revert it and test again tonight. Can you give me an example of the indent. Mine outputs the following:
        
    <!--[if lt IE 8]>
    <style type="text/css">
        li a {display:inline-block;} li a {display:block;}
    </style>
    <![endif]-->
    

    which keeps the style declarations inline.


    Quote from: Romain at Jan 19, 2011, 08:17 AM

    Thanks DT, will definitely give it a try.
    By any chance, are you on Github ?
    Unfortunately not. Most of my application development is VisualLISP and AutoLISP with a splash of C++ and C# for AutoCAD. Never needed one. Although, I might look into it.

    DT
      • 33976 ☆ A M B ☆
      • 571 Posts
      Sure, here is
      <!doctype html> 
      <!--[if lt IE 7 ]> <html class="ie6 no-js" lang="fr"> <![endif]--> 
        <!--[if IE 7 ]>    <html class="ie7 no-js" lang="fr"> <![endif]--> 
          <!--[if IE 8 ]>    <html class="ie8 no-js" lang="fr"> <![endif]--> 
            <!--[if IE 9 ]>    <html class="ie9 no-js" lang="fr"> <![endif]--> 
              <!--[if (gt IE 9)|!(IE)]><!--> 
              <html class="no-js" lang="fr"> 
                <!--<![endif]--> 
                <head> 
                  <meta charset="utf-8" /> 
                  <!--[if IE] >< ![endif]--> 


      And after turning StripComments to on
                      </footer> 
                      <!-- Grab Google CDN's jQuery. fall back to local if necessary --> 
                      <!-- allowing to choose library/version ? --> 
                      <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
                      <script>!window.jQuery && document.write(unescape('%3Cscript src="/assets/js/mylibs/jquery-1.4.4.min.js"%3E%3C/script%3E'))</script>
                      <script src="/assets/js/plugins.js?v=1"></script>
                      <script src="/assets/js/script.js?v=1"></script>--> 
                      <!-- end concatenated and minified scripts--> 
                      <!--[if lt IE 7 ]>
                      <script src="/assets/js/libs/dd_belatedpng.js?v=1"></script>
                      <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script>
                        <![endif]--> 
                        <script> 

      becomes
            </footer> 
            <!--<script src="
              <script>!window.jQuery && document.write(unescape('%3Cscript src="/assets/js/mylibs/jquery-1.4.4.min.js"%3E%3C/script%3E'))</script>
              <script src="/assets/js/plugins.js?v=1"></script>
              <script src="/assets/js/script.js?v=1"></script>--> 
              <!--[if lt IE 7 ]>
              <script src="/assets/js/libs/dd_belatedpng.js?v=1"></script>
              <script> DD_belatedPNG.fix('img, .png_bg');
                <![endif]--> 
                <script> 


      I hope this will help
        • 6890
        • 21 Posts
        Zi,
        I’ve release a beta3 which should resolve the --> issue, and also fixed a bug where it was removing part of the DOCTYPE. The output I see now from the snippet you gave me is thus: (note, I formatted it to confirm the removal of comments).
            <script language="javascript" type="text/javascript"> 
              <!-- 
        	      if(!s.c_r('elqCustomerGUID')) 
        		{ 
        			d=new Date; d.setTime(d.getTime()+(365*24*60*60*1000)); 
        			s.c_w('elqCustomerGUID',GetElqCustomerGUID(),d); 
        		}
        		s.pageName='SiteCatalyst'; 
        		s.channel='Products'; 
        		s.prop6='English'; 
        		if(s && s.c_r('tc_demo')==1 && s.c_r('tc_extra_info') != 'milestone=touchclarity') 
        			{ 
        				tc_extra_info = 'milestone=sitecatalyst'; 
        				s.c_w('tc_extra_info','milestone=sitecatalyst'); 
        			}
        	      if(typeof mboxCreate == 'function') 
        		      { var epi_offer_name; 
        			      var epi_offer_product; 
        			      var epi_offer_centricity; 
        			      var epi_offer_type; 
        			      if(s.pageName==undefined) s.pageName=window.location; 
        			      mboxCreate('global_page_vars','pageinfo_name='+s.pageName,'pageinfo_section='+s.channel,'pageinfo_url='+window.location,'pageinfo_offer_name='+epi_offer_name,'pageinfo_offer_product='+epi_offer_product,'pageinfo_offer_centricity='+epi_offer_centricity,'pageinfo_offer_type='+epi_offer_type); 
        			}
        	      mboxLoadSCPlugin(s); var s_code=s.t();if(s_code)document.write(s_code) 
        	//-->
            </script> 
        
        

          • 6890
          • 21 Posts
          Romain, I can get this:
          </footer> 
          <!-- Grab Google CDN's jQuery. fall back to local if necessary --> 
          <!-- allowing to choose library/version ? --> 
          <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
          <script>!window.jQuery && document.write(unescape('%3Cscript src="/assets/js/mylibs/jquery-1.4.4.min.js"%3E%3C/script%3E'))</script>
          <script src="/assets/js/plugins.js?v=1"></script>
          <script src="/assets/js/script.js?v=1"></script>--> 
          <!-- end concatenated and minified scripts--> 
          <!--[if lt IE 7 ]>
          <script src="/assets/js/libs/dd_belatedpng.js?v=1"></script>
          <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script>
          <![endif]--> 
          <script>
          


          To convert to this:
          </footer> 
          <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
          <script>!window.jQuery && document.write(unescape('%3Cscript src="/assets/js/mylibs/jquery-1.4.4.min.js"%3E%3C/script%3E'))</script>
          <script src="/assets/js/plugins.js?v=1"></script>
          <script src="/assets/js/script.js?v=1"></script>--> 
          <!--[if lt IE 7 ]>
          <script src="/assets/js/libs/dd_belatedpng.js?v=1"></script>
          <script> DD_belatedPNG.fix('img, .png_bg');
          <![endif]--> 
          <script>
          


          But I have a few queries:

            [li]should
          <script> DD_belatedPNG.fix('img, .png_bg'); //fix any <img> or .png_bg background-images </script>
          be
          <script> DD_belatedPNG.fix('img, .png_bg'); </script>//fix any <img> or .png_bg background-images

          • I Believe the final closing script tag should be above the endif...? but there may be a starting script tag I’m missing

          To get the first change, alter line 32 to: (added a double quotation after the 0-9
          $source = preg_replace('%[^-:A-Za-z0-9"]//[^->].*$%m','',$source);//Strip any single line comments // not starting with a character or ending in ->
          


          As for the conditionals:
          Quote from: Romain at Jan 20, 2011, 12:53 AM

          Sure, here is
          <!doctype html> 
          <!--[if lt IE 7 ]> <html class="ie6 no-js" lang="fr"> <![endif]--> 
          <!--[if IE 7 ]>    <html class="ie7 no-js" lang="fr"> <![endif]--> 
          <!--[if IE 8 ]>    <html class="ie8 no-js" lang="fr"> <![endif]--> 
          <!--[if IE 9 ]>    <html class="ie9 no-js" lang="fr"> <![endif]--> 
          <!--[if (gt IE 9)|!(IE)]><!--> 
          <html class="no-js" lang="fr"> 
          <!--<![endif]--> 
          <head> 
          <meta charset="utf-8" /> 
          <!--[if IE] >< ![endif]-->

          The only thing that’s different between your conditionals and mine is that yours are on the same line.
          If you change line 32 to:
          $source = preg_replace('/<!--[^\[<>].*?(?<!!)-->/m','',$source); //strip html comments <!-- -->
          your conditionals will remain but standard html comments will be removed.
          Note: these changes will be included in beta4
            • 10357
            • 573 Posts
            nice idea, thank you grin

            Only problem I see is its not formatting lists very well:


            currently its like this
            <ul><li><a href="#">text</a></li><li><a href="#">text</a></li></ul>
            

            would be nice if it was:
            <ul>
             <li><a href="#">text</a></li> 
             <li><a href="#">text</a></li>
            </ul>
            

            also will this plugin add any time to the page load?
              • 6890
              • 21 Posts
              Quote from: g5604 at Jan 20, 2011, 06:07 AM

              nice idea, thank you grin

              Only problem I see is its not formatting lists very well:

              currently its like this
              <ul><li><a href="#">text</a></li><li><a href="#">text</a></li></ul>
              

              would be nice if it was:
              <ul>
               <li><a href="#">text</a></li> 
               <li><a href="#">text</a></li>
              </ul>
              

              also will this plugin add any time to the page load?
              g5604, as far as I’m aware in my page loading times it’s still unnoticeable, maybe .2 of a second??? I couldn’t honestly tell you.
              As for the links, thats a good point. The actual link should be inline. I’ll see what I can do for Beta 4.

              DT
                • 13226
                • 953 Posts
                Is there also a package for EVO ?

                Cheers
                  • 6890
                  • 21 Posts
                  Quote from: iusemodx at Jan 21, 2011, 01:57 AM

                  Is there also a package for EVO ?

                  Cheers
                  The plugin was originally developed under evolution for use across my sites some 6 months or so ago. I still have one site using evolution so I will do a quick test tomorrow, however it should be compatible.

                  DT
                    • 11076
                    • 159 Posts
                    Quote from: DeathTiger at Jan 24, 2011, 04:08 PM

                    Quote from: iusemodx at Jan 21, 2011, 01:57 AM

                    Is there also a package for EVO ?
                    Cheers
                    The plugin was originally developed under evolution for use across my sites some 6 months or so ago. I still have one site using evolution so I will do a quick test tomorrow, however it should be compatible.
                    DT
                    meanwhile you can see it in here:
                    http://modxcms.com/forums/index.php?topic=47198.0
                      Michael Shraibman( gOmp)  | Freelance Design & Development | wink  impossible is nothing...