“Some men, just want to see the world burn.”
– Alfred (The Dark Knight)

Posts Tagged ‘javascript’


09
Aug

jCryption, is simply Javascript Encryption. “j” stands for jQuery as core framework. And as always, everybody likes jQuery.

Normally if you submit a form and you don’t use SSL, your data will be sent in plain text.
But SSL is neither supported by every webhost nor it’s easy to install/apply sometimes.
So I created this plug-in in order that you are able to encrypt your data fast and simple.
jCryption uses the public-key algorithm of RSA for the encryption.

Author’s site had a good documentation on usage.

08
Dec

Google custom search has been around for some time now, but its only now that I look and use it.

However, I wanted it to fit on the top search box on my current WP theme. The query box has this background, so I looked at the CSS of the entire page. But nothing defines that google logo anywhere. Then, I found this code above embeded using javascript information on Web Developer toolbar. What I did is copy and modified the location of background image I want to use (q.style.background = 'url(your_new_path_to/watermark.gif)';) then, paste in the footer of my current theme. Barabimbaraboom! It executes last with a different background image location or new color background, that’s it.

But I reverted everything back to default! LOL, as I might violate Google T&C. Or if I found time to read the entire Google’s T&C on Custom Search, I will update this post, wether or not its ok to remove or change that watermark. ;)

(function()
{
    var f = document.getElementById('cse-search-box');
    if (!f)
    {
      f = document.getElementById('searchbox_demo');
    }
    if (f && f.q)
    {
      var q = f.q;
      var n = navigator;
      var l = location;
      if (n.platform == 'Win32') {
        q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;';
      }
      var b = function()
      {
        if (q.value == '')
        {
          /*
            change the path to your intended background image or color.
           */
          q.style.background = 'url(your_new_path_to/watermark.gif)';
        }
      };
      var f = function() {
        /*
           This part is when query box is in focus
         */
        q.style.background = '#ffffff';
      };
      q.onfocus = f;
      q.onblur = b;
      /* JS regex that calls blur function when query is not submitted */
      if (!/[&?]q=[^&]/.test(l.search))
      {
        b();
      }
    }
  }
)();