Skip to content

Instantly share code, notes, and snippets.

View webcyou's full-sized avatar

web帳 webcyou

View GitHub Profile
@webcyou
webcyou / TransitionEvent_whichAnimationEvent.js
Last active January 24, 2017 12:25
whichTransitionEvent & whichAnimationEvent
var vendor = {
name: "",
browser: "",
prefix: "",
transitionend: whichTransitionEvent(),
animationend: whichAnimationEvent()
};
function whichAnimationEvent() {
var t,
@webcyou
webcyou / select_schedule.ts
Last active August 29, 2015 14:25
TypeScript & AngularJS SelectSchedule
/*
* Author: Daisuke Takayama
* Website:http://www.webcyou.com/?p=5915
*/
'use strict';
var e = eval, global = e('this');
module Schedule {
/*
var AjaxTime = 10000;
var AjaxPath = {
requestFile: "ajaxPath"
};
var AjaxController = function(){};
AjaxController.prototype ={
createHttpRequest: function() {
try {
return newXMLHttpRequest();
@webcyou
webcyou / gist:56fa6a63c845a6f516cc
Created September 17, 2014 17:05
get transform val
var div = document.getElementById("result"),
elm = document.getElementById("elm");
var computedStyle,mat,a,b,c,d,e,f,
reMat = /matrix\(\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*\,\s*(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)\s*\)/;
computedStyle = window.getComputedStyle(elm, null);
mat = computedStyle['-webkit-transform'].match(reMat).slice(1);
a = parseFloat(mat[0], 10);
b = parseFloat(mat[1], 10);
var cloneItem = new Array();
var defaultItem = [0,1,2,3,4,5,6,7];
//clone
Array.prototype.clone = function() {
if (this[0].constructor == Array ) {
var ar, n;
ar = new Array(this.length);
for(n = 0; n < ar.length; n++) {
ar[n] = this[n].clone();
@webcyou
webcyou / gist:9e68327cb6bd2ea513ee
Created September 17, 2014 17:02
get element position
var elm = document.getElementById("elm");
var getElmPosition = function(elm) {
var left = 0,
top = 0;
while(elm.parentNode) {
left += elm.offsetLeft;
top += elm.offsetTop;
elm = elm.parentNode;
@webcyou
webcyou / gist:5f6e6b15e851028b4db2
Created September 17, 2014 16:59
get userAgent & version
var ua = navigator.userAgent,
uaFunc = function(s,h) { return (h.indexOf(s) > -1)};
var userInfo = {};
if(uaFunc("iPhone", ua)) {
userInfo.device = "iPhone";
} else if(uaFunc("iPad", ua)) {
userInfo.device = "iPad";
} else if(uaFunc("Android", ua)) {
userInfo.device = "Android";