This file contains 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
/* | |
Script: Color.js | |
Class for creating and manipulating colors in JavaScript. Includes basic color manipulations and HSB <-> RGB <-> HEX Conversions. | |
License: | |
MIT-style license. | |
*/ | |
function Color(params){ | |
var ptype = $type(params); |
This file contains 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
iOS 使用 chrome 開啟 | |
googlechrome://www.google.com | |
Android 使用 chrome 開啟 | |
googlechrome://navigate?url=www.example.com |
This file contains 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
https://www.yahoo.co.jp/ | |
→ Open in LINE browser | |
https://www.yahoo.co.jp/?openExternalBrowser=1 | |
→ Open in default browser |
This file contains 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 str= '\u6e2c\u8a66'; | |
var msg = unescape(str.replace(/\\u/g, '%u')); | |
// -> 測試 |
This file contains 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 border-radius($radius){ | |
-webkit-border-radius: $radius; | |
-moz-border-radius: $radius; | |
-ms-border-radius: $radius; | |
border-radius: $radius; | |
} | |
@mixin border-radius-4-variables($radiusTL, $radiusTR, $radiusBR, $radiusBL){ | |
-webkit-border-radius: $radiusTL $radiusTR $radiusBR $radiusBL; | |
-moz-border-radius: $radiusTL $radiusTR $radiusBR $radiusBL; |
This file contains 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
// Converts from degrees to radians. | |
Math.radians = function(degrees) { | |
return degrees * Math.PI / 180; | |
}; | |
// Converts from radians to degrees. | |
Math.degrees = function(radians) { | |
return radians * 180 / Math.PI; | |
}; |
This file contains 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 getCanvasMousePosition(e, canvas) { | |
var isRetina = true; | |
var offsetX = 0, offsetY = 0, mx, my; | |
if (canvas.offsetParent !== undefined) { | |
do { | |
offsetX += canvas.offsetLeft - canvas.scrollLeft; | |
offsetY += canvas.offsetTop - canvas.scrollTop; | |
} while ((canvas = canvas.offsetParent)); | |
} |
This file contains 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
/** | |
* Fix the 'ie' is not compatible with window.scrollY | |
* test with ie 9, 10, 11, edge. | |
**/ | |
function getScrollTop(){ | |
var t = typeof window.scrollY === 'undefined' ? window.pageYOffset : window.scrollY; | |
return t; | |
} |
This file contains 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 randomRGBColor(){ | |
var r = Math.floor(Math.random()*256); | |
var g = Math.floor(Math.random()*256); | |
var b = Math.floor(Math.random()*256); | |
return "rgb("+ r + "," + g + "," + b +")"; | |
} | |
function randomHSLColor(){ | |
var h = Math.floor(Math.random()*360); |
NewerOlder