Hpyer 的未知空间

国家/州/市及省/市/区三级联动JS代码

Posted by Hpyer on 星期一, 三月 26th, 2012

最近做项目要用到城市三级联动的JS程序,但是本人手头只有之前从扣扣上取得的脚本,然而这个脚本的数据是全世界城市的,而项目则需要国内的城市,且需要详细到县市区的,显然原来的数据不适合。 在询问了许久的谷歌和度娘后,终于找到了一份比较全的国内省市区的数据,按照原来数据的格式将其修改成了进行修正,以让现有的脚本可以完美的支持。 这样以来,只要让不同的项目读取所需的数据即可,足以满足日常的应用。 然而有时我们可能需要将城市信息直接输出,而不是以下拉列表的形式呈现给用,所以本人又对脚本做了优化,使之只需简单设置即可这一功能,也可以定义各个下拉列表的名称,也可以支持多语言(数据须后期再翻译)。 演示地址 http://demo.hpyer.cn/js/LocalList/ 下载地址 使用方式 <script type="text/javascript" src="LocalList.js"></script><script type="text/javascript">// 全世界数据var options = {    country: ‘country’,        // “国家”下拉列表的名称    state: ‘state’,            // “州”下拉列表的名称    city: ‘city’,            // “城市”下拉列表的名称    current: ‘CHN|33|1′,        // 当前默认值,用管道符“|”分割    language: ‘zh_cn’,        // 数据文件的语言   [...]

continue reading

POTCreator – Gettext POT文件生成器

Posted by Hpyer on 星期三, 一月 18th, 2012

概要 / Summary 这是一个用于生成 GETTEXT 的 POT 文件的类,然后你就可以使用 Poedit 进行翻译啦。 – This class can help you to create a POT file for GETTEXT, Then you can translate it by Poedit. 网上找了很久,都没有找到这样的工具,于是乎自己写了一个,大家使用过程中有问题,可以在此回复。 – Please report bug here, thank you! 主页 / Home:http://hpyer.cn/codes/potcreator 用法 / Usage <?php// 包含类库 – Include the classinclude(‘POTCreator.php’); // 创建对象 – Create object$obj = [...]

continue reading

ECShop插件 – 会员签到送积分

Posted by Hpyer on 星期四, 十一月 10th, 2011

如何留住用户,提高用户的回头率,一直是各类网站的重要关注的问题,尤其是商城类网站。ECShop提供基本的会员功能,可以方便的注册、购买、收藏,但是却没有足够留住老用户的功能。或许您会说其本身有用户推广分成的功能,但是又有多少商家会开通呢?本文介绍的就是这么一款具有该方面功效的ECShop插件——会员签到送积分。 效果图: 注:该图只是效果图,需买家提供与您网站切合的样式、图片等。 该插件具有如下功能: 支持每天赠送相同积分 支持递增积分赠送(即第二天赠送的积分比第一天多) 支持后台设置 支持任意位置添加签到按钮 现在购买本插件,您还可以得到: 帮助完成插件安装(需提供临时的FTP及后台的账号、密码),并调试完成 永久享受本插件的后续升级、修复服务(如:淘宝数据包升级而引起的功能失效等) 插件价格 100.00 RMB 注:此价格只包含前文所述的功能及服务,若需额外增加的朋友请联系站长协商。 购买方式 本站支持支付宝、财付通的担保交易,需要的朋友请即刻联系站长,以便提供购买链接给您。

continue reading

jQuery plugin base64 encode and decode

Reload page to: English简体中文繁體中文

Summary

Base64 encoder and decoder write by JavaScript. This script was a plugin of jQeury, so you must load jQuery library first if you want to use this script.
After encode by this script, you can decode it with PHP, and vice versa
Support Unicode library
This script was collected from the network, I just rewrite it as the plugin of jQuery, the copyright belongs to original work(s).

Demo

 

 

Download

  • jQuery plugin base64   [v1.1 build 20110323 - 873.5 kB - 5765 Hits]

    - Bug fixed. When user input an empty sting, it will generate a empty string now.
    - NOTE: The unicode library is only support chinese.

  • Or you can get this code from jQuery.com

Usage

Whether or not to use UNICODE library:

$.base64.is_unicode = false/true;

Encode:

$.base64.encode('$.base64');

Decode:

$.base64.decode('JC5iYXNlNjQ=');

9 Responses to “jQuery plugin base64 encode and decode”

  1. It’s so great,I like it,too match

  2. [...] Demo http://hpyer.cn/codes/jquery-plugin-base64-encode-and-decode [...]

  3. [...] This post was mentioned on Twitter by Phelipe Rost and Marcelo Fraga, Rafael C. Oliveira. Rafael C. Oliveira said: jQuery plugin base64 encode and decode – http://migre.me/3Lgh5 #jquery [...]

  4. [...] Site Oficial do Projeto [...]

  5. Hi,

    I like this library a lot – whatever algorithm it uses for base64 encode and decode match with the PHP server-side version, and that is not true of the webtoolkit javascript library (which is the current google top hit for a javascript base64 encoder).
    Great work, and thank you,

    - Kris.

  6. Hi
    I’ve found a problem, which seems not being reported earlier.
    In case encode has an empty sting as input (for example an empty input field), it will generate a none empty string. However in PHP, encoding of an empty string, return an empty string.
    The main reason is that the code use a do while loop, which means it will always be run once, just by using a while, it will not be encoded, which should be the case.
    Check also issue http://www.codingforums.com/showthread.php?t=196237
    Currently i’ve made my own workaround.

    - Broer

  7. Hi,

    I used this library. I can encode a text but when i failed to encode a picture: .
    in my script: function encode () { alert ($.base64.encode(‘here, i must put my picture’));
    I didn’t found how introduce my micture in this script.
    Any one help me??

  8. @monia:
    Sorry, you can’t encode picture with this library. It’s can only encode text.

  9. bug for “測試” string

Leave a Reply

About | Contact | Guestbook | Archives | Sitemap

如果您觉得本站的文章有帮助,并且条件允许的话,希望您能慷慨捐赠,以支持本站更好的发展。非常感谢!