We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4971
    • 964 Posts
    Thanks for a great script... works great!
    Would be nice to implement what manu37 suggested...
    Thanks again

    Carlos
      Website: www.mercologia.com
      MODX Revo Tutorials:  www.modxperience.com

      MODX Professional Partner
      • 6038
      • 228 Posts
      christianhanvey Reply #12, 18 years ago
      Hi,
      the plug-in is great - but is there a way to turn it off for selected pages?
      For example, i have a members page where they can update their details, but the field containing their email address is getting mangled because of the emo script converting the contents of the input box. If there was some way to it turn off selectively??

      The profile form pre-fills the profile form with the users email address from the database, so the ’check for submit’ clause mentioned above doesnt’ work in this instance - the form appears with the email address encoded within the value field like so:

      <input id="wlpeUserProfileEmail" type="text" name="email" value="<span id="_emoaddrId1"><span class="emo_address"><a href="/index.php?id=9">Contact Us</a></span></span>"


      Thanks
        • 4971
        • 964 Posts
        Well, the script works fine obfuscating email addresses BUT
        it conflicts with overlib... dont know what is wrong because
        I do not know javascript... but a lot of Turn on Javascript!
        notes appear where there are overlib tooltips!!!

        guess I will try something different...

        [Edit - 7Oct08:] one of the overlib calls had a email address in the header, so it collided with emo. ALL is good now!!

        @crunch
        you can make a TV that would include the emo snippet and
        thus can "not include" it in a page...
          Website: www.mercologia.com
          MODX Revo Tutorials:  www.modxperience.com

          MODX Professional Partner
          • 6038
          • 228 Posts
          christianhanvey Reply #14, 18 years ago
          Quote from: charliez at Oct 07, 2008, 12:07 AM

          you can make a TV that would include the emo snippet and thus can "not include" it in a page...

          thanks dude! why did i not think of that?!?!!

          ... no, wait - but how would you do that?
          I was thinking you could make the javascript call be added to the head optionally, but you also actually need to encode the email addresses in the page before it is output. How do you make a plug-in optional for different pages??
            • 4971
            • 964 Posts
            I have a tv named [*extra_head*] in my template to put extra head stuff like css or javascript calls in any particular page that I want. In this case I have a chunk called {{emojs}} which has the javascript call:
            <script type="text/javascript" src="assets/templates/project/js/emo.js"></script>
              Website: www.mercologia.com
              MODX Revo Tutorials:  www.modxperience.com

              MODX Professional Partner
              • 6038
              • 228 Posts
              christianhanvey Reply #16, 18 years ago
              apologies for being a bonehead here, but I don’t see how that works at all?!
              The plug in interacts with the page before it is output (using ondocprerender event) and converts email addresses before the final html page is sent from the server. The javascript call is added to the head at this point also, so it can decode the converted email address jibberish that is now in the page.

              How does making a tv that inserts javascript then ’turn on’ this functionality?
              As I understand it, if the plug in is enabled all documents are still processed so if the tv is turned off, the plug in still encodes email addresses, and adds the javascript call to the head, and if the tv is turned on you would simply be adding the javascript call a second time.
              If the plug-in is disabled, then you are simply adding a javascript reference to a page which wouldnt have the pre-processed email addresses created so would effectively be useless?

              Sorry if i’m asking for details that seem obvious to some - I’m still new here and getting to grips with the modx framework!
                • 10076
                • 1,024 Posts
                I think you must be right, I tried that TV and that just gave me a "turn on javascript" message displayed. As you say the script is run OnWebPagePrerender.

                Still I have problems on a page with forms populated with a custom script, pulling data from a table, the email address keeps diplaying "turn on javascript" .
                So is there a way to exclude pages from that OnWebPagePrerender event?


                here the page source of the page where it breaks down my page:
                <a href="mailto:<span id="_emoaddrId2"><span class="emo_address">Turn on JavaScript!</span></span>" title="Edition Gravis"><img src="http://www.pianoquartet.nl/assets/snippets/nbscripts/images/email.png" alt="Email Edition Gravis" title="Email Edition Gravis" style="border:0"></a>


                URL: http://www.pianoquartet.nl/index.php?id=3&pubchar=G

                The plugin works very well on all my normal pages on this site and all other sites I use it on. Very nice plugin, thanks.
                  • 18174
                  • 116 Posts
                  here’s my solution to call the plugin just for selected pages:
                  1. Insert the following code just at the beginning of the emo plugin - I did it around line 25
                  /* START EM MOD
                   * modified 2008-14-10 by manu, contact www.pixolution.ch
                   * Title: enhanced for conditional include/exclude of content ID's
                  */
                  $emoTplOnly = isset($emoTplOnly) ? $emoTplOnly : 'disable';
                  $emoSelection = isset($emoSelection ) ? $emoSelection : 'exclude';
                  $emoSelectionRange = isset($emoSelectionRange ) ? $emoSelectionRange : '';
                  
                  $emoTplOnly=($emoTplOnly=='enable');
                  if ($emoTplOnly) if ($modx->documentObject['template']==0) return;
                  
                  $emoSelection=($emoSelection=='include');
                  $emoSelectionRange=explode(',',$emoSelectionRange);
                  $emoFound=in_array($modx->documentObject['id'],$emoSelectionRange);
                  if ($emoFound != $emoSelection) return;
                  /* END EM MOD */

                  2. In the configuration tab, Insert this code into the "plugin configuration" input field
                  &emoTplOnly=Templates only?;list;enable,disable;enable &emoSelection=How to select ID's?;list;exclude,include;exclude &emoSelectionRange=Chosen ID's;text;

                  Now you are able to activate/deactivate the plugin, either for docs with/without template (as I used for a vcard output) or include/exclude docs by their IDs, separated by commas. If you just need one of the two possibilities, delete the other on in the "plugin configuration" input field.
                  best regards
                  manu

                    • 10076
                    • 1,024 Posts
                    this is great it works really well,

                    thanks a lot, Frank.
                      • 6038
                      • 228 Posts
                      christianhanvey Reply #20, 18 years ago
                      nice work, manu37! laugh laugh
                      This would be a good feature to add permanently.