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
// http://www.avoid.org/?p=78 | |
function hasClass(el, name) { | |
return new RegExp('(\\s|^)' + name + '(\\s|$)').test(el.className); | |
} | |
function addClass(el, name) { | |
if ( !hasClass(el, name) ) | |
el.className += (el.className ? ' ' : '') + name; | |
} |
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
javascript:(function(d){var win=window.open(),doc=win.document,TITLE=d.title,vURL=d.URL,vID=vURL.replace(/http:\/\/www.nicovideo.jp\/watch\//g,'');doc.title=TITLE;doc.write('<h1>'+TITLE+'</h1><script type="text/javascript" src="http://ext.nicovideo.jp/thumb_watch/'+vID+'?w=490&h=307"></script><div>'+ d.getElementById('des_full').innerHTML+'</div><div>掲載URL : <a href="'+vURL+'">'+vURL+'</a></div>');doc.getElementsByClassName("font12")[0].removeChild(doc.getElementsByTagName("a")[0]);doc.body.style.fontFamily="arial,helvetica,meiryo,sans-serif";})(document); |
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 stopWatch (fn, timerName) { | |
console.log( console.time(timerName) ); | |
fn(); | |
console.log( console.timeEnd(timerName) ); | |
} | |
/* Usage *//* | |
function testFn() { | |
return 10 * 10 * 10; |
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(DP) { | |
Date.now || (Date.now = function() { | |
return new Date().getTime(); | |
}); | |
})(Date.prototype); |
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 | |
E3, E6, E12, E24, | |
E48, E96, E192; | |
E3 = [ | |
1.0, 2.2, 4.7 | |
]; | |
E6 = [ |
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
// ==UserScript== | |
// @name 直リン画像回転くん | |
// @namespace http://ethertank.jp | |
// @version 0.2 | |
// @description 直リン画像回転くん | |
// @include *.jpg | |
// @include *.jpeg | |
// @include *.png | |
// @include *.gif |
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(N, global) { | |
// 不完全 | |
// The value of Number.MAX_SAFE_INTEGER is 9007199254740991 (2e53-1) | |
// This property has the attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }. | |
// IE8 の Object.defineProperty は Dom オブジェクトでのみ有効で、動作も異なる | |
if(!N.MAX_SAFE_INTEGER) { | |
N.MAX_SAFE_INTEGER = 9007199254740991; | |
Object.defineProperty && Object.defineProperty(N, "MAX_SAFE_INTEGER", { | |
writable : false, |
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
/*jshint multistr: true */ | |
// 全ての艦名 (改造艦は含まない) | |
var allKanmusu = | |
"長門, 陸奥, 伊勢, 日向, 雪風,\ | |
赤城, 加賀, 蒼龍, 飛龍, 島風,\ | |
吹雪, 白雪, 初雪, 深雪, 叢雲,\ | |
磯波, 綾波, 敷波, 大井, 北上,\ | |
金剛, 比叡, 榛名, 霧島, 鳳翔,\ |
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
// document.body.style | |
// ※これだと length プロパティなどもふくまれてしまうので目視で削除・加工 | |
// 何か良い方法は無いものか | |
var webkitCssStyles = [ | |
"alignContent", | |
"alignItems", | |
"alignSelf", | |
"alignmentBaseline", | |
"background", |