Skip to content

Instantly share code, notes, and snippets.

View kejun's full-sized avatar
💭
I may be slow to respond.

kejun kejun

💭
I may be slow to respond.
View GitHub Profile
javascript:(function(){var api='https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy?url={URL}&container=focus&gadget=a&no_expand=1&rewriteMime=image%2F*&nocache=1',imgs=document.getElementsByTagName('img'),i=0,img;for(;img=imgs[i++];){if(img.src.indexOf('googleusercontent') < 0 && /farm3|farm5/i.test(img.src)){img.src=api.replace('{URL}',img.src);}}})();
var getCarePos = function (node) {
var range, range2, pos = [];
if (document.selection) {
range = document.selection.createRange();
range2 = range.duplicate();
range2.moveToElementText(node);
range2.setEndPoint('EndToEnd', range);
pos = [range2.text.length - range.text.length, range2.text.length];
} else {
pos = [node.selectionStart, node.selectionEnd];
@kejun
kejun / GM Script: 自动用xiami播放专辑
Created January 12, 2011 10:29
Douban音乐推荐直接用xiami播放
// ==UserScript==
// @name douban_xiami
// @namespace org.kejun
// @include http://music.douban.com/*
// ==/UserScript==
//使用说明:
// 1. 安装本脚本到Greasemonkey
// 2. 到http://music.douban.com/recommended
// 3. 点击专辑封面会自动用虾米播放(如果窗口没弹出,检查是否被浏览器拦截)
au BufWritePost *.less silent !lessc -x %:p > %:r.css
@kejun
kejun / gist:1069908
Created July 7, 2011 16:28
豆瓣说快捷键
javascript:void(function(_d){ var s = _d.createElement('script'); s.type = 'text/javascript'; s.src = 'http://kejun.github.com/demos/floatline.js'; _d.getElementsByTagName('head')[0].appendChild(s); }(document));
@kejun
kejun / dabblet.css
Created December 16, 2011 03:03
通知框
@import url(http://img3.douban.com/css/packed_douban4234332340.css);
/* 通知框 */
.notification-popup { position:absolute;width:290px;top:100px;left:50%;background:#fff;border:1px solid #f0f0f0; }
.notification-popup .ft { text-align:center;background:#fafafa;line-height:36px; }
.notification-popup li,
.notification-popup .content { overflow:hidden;zoom:1; }
.notification-popup .pic { float:left;margin-right:10px; }
.notification-popup li { padding:12px 10px;color:#999;border-bottom:1px solid #f0f0f0; }
.notification-popup .opts { float:right; }
@kejun
kejun / dabblet.css
Created December 16, 2011 03:48
可以灵活的适应宽度
@import url(http://img3.douban.com/css/packed_douban7774204613.css);
.more-events .bd { overflow:hidden; }
.more-events li { display:inline-block;*display:inline;zoom:1;margin:0 -2px 0 .5ex;padding:0 1ex 0 1ex;border-left:1px solid #aaa;line-height:10px;_margin-bottom:10px;letter-spacing:normal;word-spacing:normal; }
.more-events li a { _position:relative; }
.more-events ul { margin-left:-1ex;letter-spacing:-0.31em;*letter-spacing:normal;word-spacing-0.43em; }
/* 可以灵活的适应宽度 */
@kejun
kejun / dabblet.css
Created December 16, 2011 10:52
通用按钮样式
@import url(http://img3.douban.com/css/packed_douban7774204613.css);
/* 通用按钮样式 */
/* reset */
.bn-small,
.bn-cta,
.bn-flat input { margin:0;border:none;background:transparent;cursor:pointer;-webkit-appearance: none; }
@kejun
kejun / dabblet.css
Created December 29, 2011 05:57
渐变
.mod {
height:100px;
width:50%;
margin:auto;
font-size:12px;
text-align:center;
background-image:
url(http://img3.douban.com/icon/u1170308-29.jpg),
@kejun
kejun / dabblet.css
Created January 10, 2012 09:42
通知框
@import url(http://img3.douban.com/css/packed_douban4234332340.css);
/* 通知框 */
.notification-popup { position:absolute;width:290px;top:100px;left:50%;background:#fff;border:1px solid #aaa; }
.notification-popup .ft { text-align:center;background:#fafafa;line-height:36px; }
.notification-popup li,
.notification-popup .content { overflow:hidden;zoom:1; }
.notification-popup .pic { float:left;margin-right:10px; }
.notification-popup li { padding:12px 10px;color:#999;border-bottom:1px solid #aaa; }
.notification-popup .opts { float:right; }