Skip to content

Instantly share code, notes, and snippets.

View tanshio's full-sized avatar
🤢
😭

Shota Tanno tanshio

🤢
😭
View GitHub Profile
@tanshio
tanshio / fadePage.min.js
Created August 15, 2014 23:29
fadePage.min.js
;(function(e,t){function n(e){var t=/^webkit|^moz|^ms|^O/g,n=e,r=n.replace(t,"");return r.toLowerCase()}function r(e){var t=e.arr,r=e.prop,i=e.value,s;for(var o=0;o<t.length;o++){s=t[o];if(!document.querySelector(s)){return}var u=n(r);document.querySelector(s).style[r]=i;document.querySelector(s).style[u]=i}}function i(t){var n={duration:1e3,smp:false,selector:[]},i=/webkit/i.test(navigator.appVersion)?"webkit":/firefox/i.test(navigator.userAgent)?"moz":/trident/i.test(navigator.userAgent)?"ms":"opera"in e?"O":"";for(var s in t){if(!n.hasOwnProperty(s)){continue}n[s]=t[s]}if(!n.smp&&/iPhone|iPad|iPod|Android/.test(navigator.userAgent)){return}document.body.style.visibility="hidden";document.body.style.opacity=0;r({arr:n.selector,prop:"opacity",value:"0"});e.addEventListener("load",function(){setTimeout(function(){document.body.style[i+"Transition"]="all "+n.duration*.5*.001+"s ease-in";document.body.style["transition"]="all "+n.duration*.5*.001+"s ease-in";r({arr:n.selector,prop:i+"Transition",value:"all "+n.
@tanshio
tanshio / fadePage.js
Last active August 29, 2015 14:05
fadePage.js
;(function(window,config){
function deleteVendor(vendor){
var re = /^webkit|^moz|^ms|^O/g,
str = vendor,
noVendor = str.replace(re, "");
return noVendor.toLowerCase();
}
@tanshio
tanshio / deleteVender.js
Created August 15, 2014 20:35
deleteVender.js
function deleteVendor(vendor){
var re = /^webkit|^moz|^ms|^O/g,
str = vendor,
newstr = str.replace(re, "");
return newstr.toLowerCase();
}
@tanshio
tanshio / lightbox.js
Created August 15, 2014 13:45
lightbox.js
lightbox = (function(){
var lightboxList = document.querySelectorAll('.js-gallery img'),
lightboxLength = lightboxList.length;
for (var i = 0; i < lightboxLength; i++) {
lightboxList[i].setAttribute('deta-lb-number',i);
lightboxList[i].addEventListener('click', lightboxShow, false);
}
@tanshio
tanshio / loop.js
Created August 15, 2014 13:30
配列.js
for (var i = 0, item; item = 配列[i++];) {
// item について何かする
}
@tanshio
tanshio / smoothscroll.js
Created August 13, 2014 23:37
smoothscroll.js
Math.ease = function (t, b, c, d) {
t /= d/2;
if (t < 1) return c/2*t*t*t + b;
t -= 2;
return c/2*(t*t*t + 2) + b;
};
function smoothScroll(hash){
var date = new Date(),
@tanshio
tanshio / ease.js
Created August 8, 2014 09:07
easejs
var date = new Date();
//t=now-date
//b=最初の値
//c=最後の値
//d=何秒
Math.ease = function(t, b, c, d, s) {
if(s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
@tanshio
tanshio / vender.js
Created August 7, 2014 22:02
vender
var vender = (/webkit/i).test(navigator.appVersion) ? 'webkit' :
(/firefox/i).test(navigator.userAgent) ? 'moz' :
(/trident/i).test(navigator.userAgent) ? 'ms' :
'opera' in window ? 'O' : '';
@tanshio
tanshio / gulpfile.js
Created July 31, 2014 07:50
gulp20140731
'use strict';
var gulp = require('gulp'),
$ = require('gulp-load-plugins')(),
jade = require('gulp-jade'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
runSequence = require('run-sequence');
gulp.task('jade', function() {
@tanshio
tanshio / function.php
Created July 18, 2014 17:28
my_theme_switcher
// 特定のURL、固定ページのみ「theme」を切り替える
// http://ja.forums.wordpress.org/topic/13483
function my_theme_switcher($theme){
// yes, it's hardcoded!
if ( $_SERVER['REQUEST_URI'] == 'HOMEからのパス' ) { // /lp/2014/
$overrideTheme = wp_get_theme('テーマ名');
if ( $overrideTheme->exists() ) {
return $overrideTheme['テーマ名'];
} else {