##사용하기
- 기본 사용법: basic.md
- 좀더 발전된 사용법: advanced.md
- 환경 설정하기: configuring-vim.md
| @file:Suppress("NOTHING_TO_INLINE") | |
| package kore.wrap | |
| /** | |
| * 성공, 실패를 내포하는 결과값 보고 객체. 최초 값을 람다로 설정하면 이후 모든 map연산이 지연연산으로 처리됨 | |
| */ | |
| object W{ | |
| /** 예외 발생이 가능한 블록을 실행하고 그 결과에 따라 Wrap생성 */ | |
| inline fun <VALUE:Any>catch(throwableBlock:()->VALUE): Wrap<VALUE> = try { | |
| Wrap(throwableBlock()) |
| if (!document.querySelectorAll) { | |
| document.querySelectorAll = function (selectors) { | |
| var style = document.createElement('style'), elements = [], element; | |
| document.documentElement.firstChild.appendChild(style); | |
| document._qsa = []; | |
| style.styleSheet.cssText = selectors + '{x-qsa:expression(document._qsa && document._qsa.push(this))}'; | |
| window.scrollBy(0, 0); | |
| style.parentNode.removeChild(style); |
##사용하기
| // encode(decode) html text into html entity | |
| var decodeHtmlEntity = function(str) { | |
| return str.replace(/&#(\d+);/g, function(match, dec) { | |
| return String.fromCharCode(dec); | |
| }); | |
| }; | |
| var encodeHtmlEntity = function(str) { | |
| var buf = []; | |
| for (var i=str.length-1;i>=0;i--) { |
| // http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
| // http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
| // requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
| // MIT license | |
| (function() { | |
| var lastTime = 0; | |
| var vendors = ['ms', 'moz', 'webkit', 'o']; |