[Pro] Javascript for Search Field, Safari problems

One last question for you, Walter…

In the past in another thread, you kindly gave me the following code for use inside “DOM Loaded Observer” in your Protaculous2 Action. It displays an overlay (splash screen of sorts) when the page is first loaded and then a cookie is set so the overlay won’t bother the same user again for a week.

//this cookie ensures the patent-splash displays only once a week
var message_box = $('legaleze').setStyle('z-index: 1000');
$$('body').first().insert(message_box.remove());
//cookie expires once a week, in seconds:
var jar = new CookieJar({expires: '604800'});
if(!jar.get('hide_message')){
  message_box.show().observe(
    'click',
    function(evt){
      jar.put('hide_message',true);
      this.hide();
    }
  );
};

I copied the content of the external cookiejar.js file, minified it, and dumped that just above the above code in “DOM Loaded Observer.” What I want to do now is eliminate the reliance on prototype.js (delete Protaculous2 entirely on that page). To do that, I need to rewrite the above script in regular JS. Since I am not well versed in JS, this is proving to be a challenge.

I thought I could just extract the relevant functions contained inside prototype.js, but my oh my are there many, and so many are all tied together. It would be a huge amount of code to do it that way.

Is there some online tool that can magically take prototype code and change it to regular JS? (Probably not, since I couldn’t find it.)

Thanks,

James W.


dynamo mailing list
email@hidden
Update your subscriptions at: