Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

まっは mach3

🏠
Working from home
View GitHub Profile
@mach3
mach3 / remove-utm.js
Created Oct 1, 2011
utmのパラメータをURLから取り除くブックマークレット
View remove-utm.js
/**
* Remove utm parameters from url
* ( Use this as bookmarklet )
*/
(function(){
var loc, search, params, i;
loc = location;
search = loc.search.replace( /^\?/, '' ).split( '&' );
params = [];
i = search.length;
View mixin.js
export const vnodeRender = {
methods: {
vnodeRender(vnode) {
if (process.browser) {
if (!vnode.tag) {
return document.createTextNode(vnode.text)
}
const el = document.createElement(vnode.tag)
if (vnode.data) {
if (vnode.data.staticClass) {
@mach3
mach3 / delegate.js
Created Jan 23, 2017
$.fn.on(eventType, selector, selector, handler) みたいな物を。挙動はちょっと異なります。
View delegate.js
var _delegate = function(elms, type, selector, callback){
elms = (_type(elms) === "string") ? document.querySelectorAll(elms)
: (! elms.length) ? [elms]
: elms;
Array.from(elms).forEach(function(elm){
elm.addEventListener(type, function(e){
var valid = !! Array.from(this.querySelectorAll(selector))
.filter(function(el){
return el === e.target;
}).length;
View jquery.xgraident.js
/*
* jquery.xgradient.js
* http://blog.mach3.jp/
*
* Publish Date : 2010/5/13
* Requirement : jQuery 1.4 or later
* http://jquery.com/
*
* Copyright 2010, Mach3
*/
@mach3
mach3 / grunt-pngquant.js
Last active Dec 25, 2015
更新時刻を保持するpngquantタスク
View grunt-pngquant.js
/**
* Grunt task for pngquant
* -----------------------
*/
// @example:
//
// pngquant: {
// options: {
// preserve_mtime: true
@mach3
mach3 / jquery-attrs.js
Created Sep 17, 2013
html要素に設定した属性を全て取得するやつ
View jquery-attrs.js
(function($, undefined){
/**
* Get all custom attributes
* @param HTMLElement el
* @return Object
*/
$.getAttributes = function(el){
var $el, data, add, i;
$el = $(el);
@mach3
mach3 / jquery-transition.js
Last active Dec 22, 2015
CSSのTransitionを$.fn.animateっぽく使うやつ。Transition非対応環境で$.fn.animateでそれっぽくフォールバックする。
View jquery-transition.js
(function($){
/**
* Detect support of css transition, event name
*/
$.support.transitionInfo = (function(){
var el, names, name, info = null;
el = document.createElement("div");
names = {
"WebkitTransition": "webkitTransitionEnd",
@mach3
mach3 / jquery.swipeevents.js
Created Sep 4, 2013
スワイプイベントを発火するやつを試作
View jquery.swipeevents.js
(function($){
/**
* Detect supports
*/
$.support.touchEvents = "ontouchstart" in document;
$.support.msPointerEvents = window.navigator.msPointerEnabled;
/**
* Swipe event object
@mach3
mach3 / assets.js
Last active Dec 21, 2015
harvestは根本的な不具合があったので、ローダーだけクラスにしてみた
View assets.js
(function(win, doc){
var Assets = function(){
this.items = [];
this.nodes = [];
this.attrs = {
callback: null,
append: true
};
};
@mach3
mach3 / harvest.js
Created Aug 24, 2013
シンプルなスクリプトローダーの試作版
View harvest.js
(function(win, doc){
/**
* Namespace
* ---------
*/
var ns = win._harvest = {};
/**
* Loader
You can’t perform that action at this time.