Skip to content

Instantly share code, notes, and snippets.

View markyun's full-sized avatar
😮‍💨
代码成就万世基积沙镇海

云云酱 markyun

😮‍💨
代码成就万世基积沙镇海
View GitHub Profile
(function() {
var cache = {};
this.tmpl = function(str, data) {
cache[str] = cache[str] ||
new Function('data', [
'var _p="";\nwith(arguments[0]||{}){\n_p+="',
str.replace(/"/g, '\\$&')
.replace(/[\r\n]/g, '')
.replace(/<%([^\w\s\}\)]*)\s*(.*?)\s*%>/g, function(match, mark, code) {
if (mark === '=') return '"+(' + code + ')+"';
anonymous
anonymous / core
Created April 16, 2013 04:49
my oa core js
//调取负责人ajax
$(".c_fuze").click(function(e) {
//$("#add_fuzeren").empty();
if ($("#add_fuzeren").html() == "" || 1 == 1) {
geta($("#add_fuzeren"), '/Works/plus/act/fuze', loadGif);
@wiky
wiky / event.js
Created August 29, 2012 04:37
Serial Event Listener
function addEvent(el, type, handler) {
if (el.attachEvent) { // IE
// 为元素的事件类型创建一个哈希表
el._events = el._events || {};
if (!handler) {
return;
}
// 取得事件处理函数的数组的引用
var handlers = el._events[type];
if (handlers) {
@eduardocereto
eduardocereto / cb_addEventListener.js
Created May 4, 2011 17:45
a cross-browser implementation of addEventListener/AttachEvent without external dependencies
/**
* Cross Browser helper to addEventListener.
*
* @param {HTMLElement} obj The Element to attach event to.
* @param {string} evt The event that will trigger the binded function.
* @param {function(event)} fnc The function to bind to the element.
* @return {boolean} true if it was successfuly binded.
*/
var cb_addEventListener = function(obj, evt, fnc) {
// W3C model