Skip to content

Instantly share code, notes, and snippets.

//"babel-loader": "6.2.4"
//"babel-plugin-transform-runtime": "6.7.5"
//"babel-preset-es2015": "6.6.0"
var path = require('path')
var glob = require('globby')
var webpack = require('webpack')
var JS_PATH = path.join(__dirname, './fe/js')
function getEntries() {
!(function($, _) {
var tmpl_error = '<div class="item-info text-red"><i class="iconfont icon-wrong"></i> {{msg}}</div>'
var tmpl_option = '<div class="item-info text-orange"><i class="iconfont icon-caution"></i> {{msg}}</div>'
function cancelZoom() {
var d = document,
viewport,
content,
maxScale = ',maximum-scale=',
maxScaleRegex = /,*maximum\-scale\=\d*\.*\d*/;
@beiyuu
beiyuu / validate.js
Created October 28, 2014 09:00
validate.js
!(function($, window) {
'use strict';
var defalut_rules = {
require: {
test: function(val) {
return !val;
},
msg: '{{name}}是必填项,请您填写'
},
<table border="0" cellpadding="0" cellspacing="0" width="500" class="wrapper">
<tr>
<td>…Content…</td>
</tr>
</table>
@media screen and (max-width:525px) {
table[class=“wrapper”] {
width:100% !important;
}
(function($){
$.fn.outside = function(ename, cb){
return this.each(function(){
var $this = $(this),
self = this;
$(document).bind(ename, function tempo(e){
if(e.target !== self && !$.contains(self, e.target)){
cb.apply(self, [e]);
if(!self.parentNode) $(document.body).unbind(ename, tempo);
'哈哈'.replace(/[^\x00-\xff]/g, '豆瓣') //豆瓣豆瓣
.arrow-outter,
.arrow-inner {
left: 285px;
border: 8px dashed transparent;
display: block;
position: absolute;
height: 0;
width: 0;
}
.arrow-inner {
var TemplateEngine = function(html, options) {
var re = /<%([^%>]+)?%>/g, reExp = /(^( )?(if|for|else|switch|case|break|{|}))(.*)?/g
, code = 'var r=[];\n', cursor = 0;
var add = function(line, js) {
js? (code += line.match(reExp) ? line + '\n' : 'r.push(' + line + ');\n') :
(code += line != '' ? 'r.push("' + line.replace(/"/g, '\\"') + '");\n' : '');
return add;
}
while(match = re.exec(html)) {
var ua = navigator.userAgent;
if( ua.indexOf("Android") >= 0 ) {
var androidversion = parseFloat(ua.slice(ua.indexOf("Android")+8));
if (androidversion < 2.3) {
// do whatever
}
}
$('#favorite').click(function(e){
e.preventDefault();
var url = 'http://github.com';
var title = 'GitHub';
var ctrl = (window.navigator.userAgent.toLowerCase()).indexOf('mac') !== -1 ? 'Command' : 'Ctrl';
var info = 'Sorry, your browser is not supported. Please use' + ctrl + '+D to add favorite';
try {
window.external.addFavorite(url, title);