Skip to content

Instantly share code, notes, and snippets.

@mingyun
mingyun / bootstrap.autocomplete.js
Created December 28, 2013 06:47
自动完成插件
!function($){
/* 基于Bootstrap Typeahead改造而来的自动完成插件
* Author:F.L.F
* Site: http://digdata.me
* ================================= */
var Autocomplete = function (element, options) {
this.$element = $(element)
this.options = $.extend({}, $.fn.autocomplete.defaults, options)
this.sorter = this.options.sorter || this.sorter
/*! http://mths.be/placeholder v2.0.7 by @mathias */
;(function(f,h,$){var a='placeholder' in h.createElement('input'),d='placeholder' in h.createElement('textarea'),i=$.fn,c=$.valHooks,k,j;if(a&&d){j=i.placeholder=function(){return this};j.input=j.textarea=true}else{j=i.placeholder=function(){var l=this;l.filter((a?'textarea':':input')+'[placeholder]').not('.placeholder').bind({'focus.placeholder':b,'blur.placeholder':e}).data('placeholder-enabled',true).trigger('blur.placeholder');return l};j.input=a;j.textarea=d;k={get:function(m){var l=$(m);return l.data('placeholder-enabled')&&l.hasClass('placeholder')?'':m.value},set:function(m,n){var l=$(m);if(!l.data('placeholder-enabled')){return m.value=n}if(n==''){m.value=n;if(m!=h.activeElement){e.call(m)}}else{if(l.hasClass('placeholder')){b.call(m,true,n)||(m.value=n)}else{m.value=n}}return l}};a||(c.input=k);d||(c.textarea=k);$(function(){$(h).delegate('form','submit.placeholder',function(){var l=$('.placeholder',this).each(b);setTimeout(function(){l.each(e)},1
@mingyun
mingyun / scrolltotop.js
Created December 28, 2013 06:16
to top
var scrolltotop={
setting: {startline:1, scrollto: 0, scrollduration:1000, fadeduration:[500, 100]},
controlHTML: '<img src="http://res.quxue.com/images/upTop.gif" style="width:23px; height:72px" />',
controlattrs: {offsetx:5, offsety:45},
anchorkeyword: '#top',
state: {isvisible:false, shouldvisible:false},
scrollup:function(){
if (!this.cssfixedsupport)
this.$control.css({opacity:0})
var dest=isNaN(this.setting.scrollto)? this.setting.scrollto : parseInt(this.setting.scrollto)
@mingyun
mingyun / countdown.js
Created December 25, 2013 13:08
jquery倒计时插件
$(document).ready(function () {
/* 延迟函数 */
jQuery.fn.delay = function (time, func) {
return this.each(function () {
setTimeout(func, time);
});
};
jQuery.fn.countDown = function (settings, to) {
settings = jQuery.extend({
startFontSize: '36px',
@mingyun
mingyun / pinyin.php
Created December 24, 2013 03:39
PHP获取可以用GBK编码的汉字拼音首字母
<?php
/**
* 中文拼音
* 目前仅支持可以以GBK编码的20902个汉字提取拼音首字母
*/
class Spell{
//当前字符
protected $word='';
//资源
protected $source = array();
@mingyun
mingyun / underscore.php
Created December 24, 2013 01:03
源自undersocre.js
<?php
/**
* Underscore.php v1.3.1
* Copyright (c) 2011 Brian Haveri
* Underscore.php is licensed under the MIT license
* Underscore.php was inspired by and borrowed from Underscore.js
* For docs, license, tests, and downloads, see: http://brianhaveri.github.com/Underscore.php
*/
(function($) {
$.eb = $.eb || {};
// $.eb.ie = function (min,max) {
// // return true;
// if ($.browser.msie) {
// var v = Math.floor($.browser.version);
// if (v >= min && v <= max) {
// return true;
// }
/* NAVBAR */
/* !CPU HIGH, fix for IE6 shake when scroll */
* html,* html body {
_background-image:url(about:blank);
_background-attachment:fixed;
}
/* !CPU HIGH, fix for IE6 not support fixed position */
.navbar-fixed-top {
_position:absolute;
@mingyun
mingyun / bootstrap-ie6.css
Created December 22, 2013 03:06
bsie css 补丁文件
/*!
* Bootstrap v2.2.1
*
* Copyright 2012 Twitter, Inc
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
* Designed and built with all the love in the world @twitter by @mdo and @fat.
*/
article,
var areaData={"请选择":{val:"",items:{"---":{val:"",items:{"---":""}}}},"北京":{val:"2",items:{"北京":{val:"36",items:{"东城区":"501","西城区":"502","海淀区":"503","朝阳区":"504","崇文区":"505","宣武区":"506","丰台区":"507","石景山区":"508","房山区":"509","门头沟区":"510","通州区":"511","顺义区":"512","昌平区":"513","怀柔区":"514","平谷区":"515","大兴区":"516","密云县":"517","延庆县":"518"}}}},"安徽":{val:"3",items:{"安庆":{val:"37",items:{"迎江区":"399","大观区":"400","宜秀区":"401","桐城市":"402","怀宁县":"403","枞阳县":"404","潜山县":"405","太湖县":"406","宿松县":"407","望江县":"408","岳西县":"409"}},"蚌埠":{val:"38",items:{"中市区":"410","东市区":"411","西市区":"412","郊区":"413","怀远县":"414","五河县":"415","固镇县":"416"}},"巢湖":{val:"39",items:{"居巢区":"417","庐江县":"418","无为县":"419","含山县":"420","和县":"421"}},"池州":{val:"40",items:{"贵池区":"422","东至县":"423","石台县":"424","青阳县":"425"}},"滁州":{val:"41",items:{"琅琊区":"426","南谯区":"427","天长市":"428","明光市":"429","来安县":"430","全椒县":"431","定远县":"432","凤阳县":"433"}},"阜阳":{val:"42",items:{"蚌山区":"434","龙子湖区":"435","禹会区":"436","淮上区":"437","颍州区":"438","颍东区":"439","颍泉区":"440","界首市":"441","临泉县":"442",