Showing posts with label Javascript. Show all posts
Showing posts with label Javascript. Show all posts

Tuesday, November 08, 2011

Javascript and PHP AES encrypt decrypt library

This is a Javascript AES encrypt decrypt library
AES Advanced Encryption Standard

And this is a PHP AES encrypt decrypt library
AES in PHP

Monday, August 08, 2011

jQuery file upload plugin: AjaxFileUpload

We can use AjaxFileUpload make a file upload process.

Basic usage:
function ajaxFileUpload()
{
  $.ajaxFileUpload({
    url:'upload.php',
    secureuri:false,
    fileElementId:'fileToUpload',
    data:{name:'logan', id:'id'},
    success: function (data, status) {
      alert($(data).text());
    }
  });
  return false;
}

Official Guide have more detail usage.

Tuesday, July 27, 2010

Google 翻譯 API

<!-- Google翻譯的API -->
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
// load Google 翻譯的 API
google.load("language", "1");
// 處理翻譯
function translate()
{
  var lang = $j('#google_translation_language').val();
  switch (lang)
  {
    case 'zh-TW':
    case 'en':
    {
      var text = $j('#auction_item_description').html();
      google.language.translate(text, "ja", lang, function(result) {
        if (!result.error) {
          $j('#auction_item_description_translated').html(result.translation);
          $j('#auction_item_description_translated').removeClass('hidden');
          $j('#auction_item_description').addClass('hidden');
        }
        else alert(result.error.message);
      });
      break;
    }
    case 'original':
    default:
    {
      $j('#auction_item_description_translated').addClass('hidden');
      $j('#auction_item_description').removeClass('hidden');
    }
  }
}