This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- test pass with CryptoJS v3.1.2 --> | |
<script src="rollups/tripledes.js"></script> | |
<script src="components/mode-ecb.js"></script> | |
<script> | |
/** | |
* Encrypt message by DES in ECB mode and Pkcs7 padding scheme | |
* | |
* NOTE: DES is weak, please use 3DES(Triple DES) or AES | |
* | |
* @param {String} message |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getPos(el) { | |
// yay readability | |
for (var lx=0, ly=0; | |
el != null; | |
lx += el.offsetLeft, ly += el.offsetTop, el = el.offsetParent); | |
return {x: lx,y: ly}; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function debounce(func, wait, immediate) { | |
var timeout, result; | |
return function() { | |
var context = this, args = arguments; | |
var later = function() { | |
timeout = null; | |
if (!immediate) result = func.apply(context, args); | |
}; | |
var callNow = immediate && !timeout; | |
clearTimeout(timeout); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addEvent(el,type,handler){ | |
if(el.addEventListener){ | |
el.addEventListener(type,handler,false); | |
}else if(el.attachEvent && htmlEvents['on'+type]){// IE < 9 | |
el.attachEvent('on'+type,handler); | |
}else{ | |
el['on'+type]=handler; | |
} | |
} | |
function removeEvent(el,type,handler){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function triggerEvent(el,eventName){ | |
var event; | |
if(document.createEvent){ | |
event = document.createEvent('HTMLEvents'); | |
event.initEvent(eventName,true,true); | |
}else if(document.createEventObject){// IE < 9 | |
event = document.createEventObject(); | |
event.eventType = eventName; | |
} | |
event.eventName = eventName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin circle($width, $color) { | |
width: $width; | |
height: $width; | |
background: $color; | |
-webkit-border-radius: $width/2; | |
-moz-border-radius: $width/2; | |
border-radius: $width/2; | |
} | |
.circle { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin triangle ($size, $color, $direction) { | |
height: 0; | |
width: 0; | |
@if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) { | |
border-color: transparent; | |
border-style: solid; | |
border-width: $size / 2; | |
@if $direction == up { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-XXXXX-X'); | |
ga('send', 'pageview'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function outerHeight(el, includeMargin){ | |
var height = el.offsetHeight; | |
if(includeMargin){ | |
var style = getComputedStyle(el); | |
height += parseInt(style.marginTop) + parseInt(style.marginBottom); | |
} | |
return height; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var deepExtend = function(out) { | |
out = out || {}; | |
for (var i = 1; i < arguments.length; i++) { | |
var obj = arguments[i]; | |
if (!obj) | |
continue; | |
for (var key in obj) { |
NewerOlder