├── big-star.coffee ├── big-star.css ├── big-star.js ├── haikei-gunyagunya.js ├── haikei-gunyagunya2.js ├── index.html ├── nikki.css ├── nikki2-my.coffee ├── nikki2-my.css ├── nikki2-my.js ├── nikki2.coffee ├── nikki2.css ├── nikki2.js ├── presentation ├── README.md ├── presentation.css └── presentation.js ├── rokuyo.coffee ├── rokuyo.js └── speech.js /big-star.coffee: -------------------------------------------------------------------------------- 1 | do -> 2 | 3 | user_icon = (name) -> 4 | "http://www.hatena.ne.jp/users/#{encodeURI(name.slice(0, 2))}/#{encodeURI(name)}/profile.gif" 5 | 6 | throttle = (fn, delay) -> 7 | timer = null 8 | -> 9 | return if timer 10 | context = this 11 | args = arguments 12 | timer = setTimeout -> 13 | timer = null 14 | fn.apply context, args 15 | , delay || 50 16 | 17 | replaceStar = ($star) -> 18 | return if $star.prop 'data-hatena-big-star-init' 19 | $star.prop 'data-hatena-big-star-init', true 20 | 21 | $container = $ '' 22 | $container.addClass 'hatena-big-star-star-container' 23 | 24 | # mouseoverを再利用するために改造して使う…… 25 | $user_image = $star.find 'img' 26 | $star_src = $user_image.attr('src') 27 | 28 | $user_image.addClass 'hatena-big-star-user' 29 | 30 | $user_image.attr 31 | src: user_icon $star[0].href.match(/hatena\.ne\.jp\/([^\/]+)\/?/)[1] 32 | 33 | $star_image = $('') 34 | $star_image.addClass 'hatena-big-star-star' 35 | $star_image.attr 36 | src: $star_src 37 | 38 | $container 39 | .append($user_image) 40 | .append($star_image) 41 | 42 | $star.append $container 43 | 44 | replaceButton = ($container) -> 45 | return if $container.prop 'data-hatena-big-star-init' 46 | $container.prop 'data-hatena-big-star-init', true 47 | 48 | replaceCommentButton = ($button) -> 49 | return if $button.prop 'data-hatena-big-star-comment-init' 50 | $button.prop 'data-hatena-big-star-comment-init', true 51 | 52 | filter = throttle -> 53 | $('span.hatena-star-star-container a').each -> 54 | try 55 | replaceStar $(this) 56 | catch error 57 | console.log(error) if console 58 | 59 | $('.hatena-star-star-container').each -> 60 | replaceButton $(this) 61 | 62 | $('.hatena-star-comment-button').each -> 63 | replaceCommentButton $(this) 64 | 65 | filter() 66 | 67 | override = -> 68 | style = 69 | '-webkit-transform': 'scale(2.0)' 70 | '-webkit-transform-origin': '0% 0%' 71 | '-moz-transform': 'scale(2.0)' 72 | '-moz-transform-origin': '0% 0%' 73 | '-o-transform': 'scale(2.0)' 74 | '-o-transform-origin': '0% 0%' 75 | 'background': 'white' 76 | 77 | for k, v of style 78 | Hatena.Star.Pallet.PALLET_STYLE += "#{k}: #{v}; " 79 | 80 | # pos.x, yを増やしてる 81 | Hatena.Star.AddButton.prototype.showColorPallet = (e) -> 82 | @clearSelectedColorTimer() 83 | @pallet = new Hatena.Star.Pallet() unless @pallet 84 | pos = Ten.Geometry.getElementPosition @img 85 | if Ten.Browser.isFirefox || Ten.Browser.isOpera 86 | pos.y += 40 87 | pos.x += 6 88 | else 89 | pos.x += 2 90 | pos.y += 36 91 | @pallet.showPallet(pos, @) 92 | 93 | bindEvents = -> 94 | $(document.body).bind 'DOMNodeInserted', -> 95 | filter() 96 | 97 | $(document.body).bind 'mouseup', -> 98 | filter() 99 | 100 | bindEvents() 101 | 102 | override() -------------------------------------------------------------------------------- /big-star.css: -------------------------------------------------------------------------------- 1 | .hatena-star-star-container { 2 | font-size: 18px; 3 | } 4 | 5 | .hatena-star-comment-button { 6 | width: 44px; 7 | height: 30px; 8 | } 9 | 10 | .hatena-star-add-button { 11 | width: 32px; 12 | height: 32px; 13 | margin: 1px !important; 14 | } 15 | 16 | .hatena-star-add-button-image { 17 | background-image: url(http://cdn.www.st-hatena.com/images/one/touch/star_button_small2@2x.png); 18 | } 19 | 20 | 21 | .hatena-big-star-star-container { 22 | display: inline-block; 23 | position: relative; 24 | width: 32px; 25 | height: 32px; 26 | margin: 1px; 27 | vertical-align: middle; 28 | border-radius: 2px; 29 | overflow: hidden; 30 | } 31 | 32 | .hatena-big-star-user { 33 | width: 32px; 34 | height: 32px; 35 | position: absolute; 36 | top: 0px; 37 | left: 0px; 38 | margin: 0px; 39 | padding: 0px; 40 | margin-bottom: 0px !important; 41 | z-index: 100; 42 | border-radius: 3px; 43 | } 44 | 45 | .hatena-big-star-star { 46 | position: absolute; 47 | bottom: 0px; 48 | left: 0px; 49 | margin: 0px; 50 | padding: 0px; 51 | margin-bottom: 0px !important; 52 | z-index: 110; 53 | background: rgba(255, 255, 255, 0.6); 54 | border-top-right-radius: 2px; 55 | border-bottom-left-radius: 2px; 56 | } 57 | -------------------------------------------------------------------------------- /big-star.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var bindEvents, filter, override, replaceButton, replaceCommentButton, replaceStar, throttle, user_icon; 3 | user_icon = function(name) { 4 | return "http://www.hatena.ne.jp/users/" + (encodeURI(name.slice(0, 2))) + "/" + (encodeURI(name)) + "/profile.gif"; 5 | }; 6 | throttle = function(fn, delay) { 7 | var timer; 8 | timer = null; 9 | return function() { 10 | var args, context; 11 | if (timer) { 12 | return; 13 | } 14 | context = this; 15 | args = arguments; 16 | return timer = setTimeout(function() { 17 | timer = null; 18 | return fn.apply(context, args); 19 | }, delay || 50); 20 | }; 21 | }; 22 | replaceStar = function($star) { 23 | var $container, $star_image, $star_src, $user_image; 24 | if ($star.prop('data-hatena-big-star-init')) { 25 | return; 26 | } 27 | $star.prop('data-hatena-big-star-init', true); 28 | $container = $(''); 29 | $container.addClass('hatena-big-star-star-container'); 30 | $user_image = $star.find('img'); 31 | $star_src = $user_image.attr('src'); 32 | $user_image.addClass('hatena-big-star-user'); 33 | $user_image.attr({ 34 | src: user_icon($star[0].href.match(/hatena\.ne\.jp\/([^\/]+)\/?/)[1]) 35 | }); 36 | $star_image = $(''); 37 | $star_image.addClass('hatena-big-star-star'); 38 | $star_image.attr({ 39 | src: $star_src 40 | }); 41 | $container.append($user_image).append($star_image); 42 | return $star.append($container); 43 | }; 44 | replaceButton = function($container) { 45 | if ($container.prop('data-hatena-big-star-init')) { 46 | return; 47 | } 48 | return $container.prop('data-hatena-big-star-init', true); 49 | }; 50 | replaceCommentButton = function($button) { 51 | if ($button.prop('data-hatena-big-star-comment-init')) { 52 | return; 53 | } 54 | return $button.prop('data-hatena-big-star-comment-init', true); 55 | }; 56 | filter = throttle(function() { 57 | $('span.hatena-star-star-container a').each(function() { 58 | try { 59 | return replaceStar($(this)); 60 | } catch (error) { 61 | if (console) { 62 | return console.log(error); 63 | } 64 | } 65 | }); 66 | $('.hatena-star-star-container').each(function() { 67 | return replaceButton($(this)); 68 | }); 69 | return $('.hatena-star-comment-button').each(function() { 70 | return replaceCommentButton($(this)); 71 | }); 72 | }); 73 | filter(); 74 | override = function() { 75 | var k, style, v; 76 | style = { 77 | '-webkit-transform': 'scale(2.0)', 78 | '-webkit-transform-origin': '0% 0%', 79 | '-moz-transform': 'scale(2.0)', 80 | '-moz-transform-origin': '0% 0%', 81 | '-o-transform': 'scale(2.0)', 82 | '-o-transform-origin': '0% 0%', 83 | 'background': 'white' 84 | }; 85 | for (k in style) { 86 | v = style[k]; 87 | Hatena.Star.Pallet.PALLET_STYLE += "" + k + ": " + v + "; "; 88 | } 89 | return Hatena.Star.AddButton.prototype.showColorPallet = function(e) { 90 | var pos; 91 | this.clearSelectedColorTimer(); 92 | if (!this.pallet) { 93 | this.pallet = new Hatena.Star.Pallet(); 94 | } 95 | pos = Ten.Geometry.getElementPosition(this.img); 96 | if (Ten.Browser.isFirefox || Ten.Browser.isOpera) { 97 | pos.y += 40; 98 | pos.x += 6; 99 | } else { 100 | pos.x += 2; 101 | pos.y += 36; 102 | } 103 | return this.pallet.showPallet(pos, this); 104 | }; 105 | }; 106 | bindEvents = function() { 107 | $(document.body).bind('DOMNodeInserted', function() { 108 | return filter(); 109 | }); 110 | return $(document.body).bind('mouseup', function() { 111 | return filter(); 112 | }); 113 | }; 114 | bindEvents(); 115 | return override(); 116 | })(); -------------------------------------------------------------------------------- /haikei-gunyagunya.js: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | * はてなブログの背景を記事内の画像にしてぐにゃぐにゃさせる 4 | 5 | 背景がぐにゃぐにゃになります 6 | 7 | ** 使い方 8 | 9 | 以下をコピーして 詳細設定→head要素に貼り付け 10 | 11 | 12 | 13 | 14 | perlin noiseの生成に https://github.com/josephg/noisejs を使っています 15 | 16 | */ 17 | 18 | (function() { 19 | 20 | // https://github.com/josephg/noisejs public domain 21 | /* 22 | * A speed-improved perlin and simplex noise algorithms for 2D. 23 | * 24 | * Based on example code by Stefan Gustavson (stegu@itn.liu.se). 25 | * Optimisations by Peter Eastman (peastman@drizzle.stanford.edu). 26 | * Better rank ordering method by Stefan Gustavson in 2012. 27 | * Converted to Javascript by Joseph Gentle. 28 | * 29 | * Version 2012-03-09 30 | * 31 | * This code was placed in the public domain by its original author, 32 | * Stefan Gustavson. You may use it as you see fit, but 33 | * attribution is appreciated. 34 | * 35 | */ 36 | 37 | (function(global){ 38 | var module = global.noise = {}; 39 | 40 | function Grad(x, y, z) { 41 | this.x = x; this.y = y; this.z = z; 42 | } 43 | 44 | Grad.prototype.dot2 = function(x, y) { 45 | return this.x*x + this.y*y; 46 | }; 47 | 48 | Grad.prototype.dot3 = function(x, y, z) { 49 | return this.x*x + this.y*y + this.z*z; 50 | }; 51 | 52 | var grad3 = [new Grad(1,1,0),new Grad(-1,1,0),new Grad(1,-1,0),new Grad(-1,-1,0), 53 | new Grad(1,0,1),new Grad(-1,0,1),new Grad(1,0,-1),new Grad(-1,0,-1), 54 | new Grad(0,1,1),new Grad(0,-1,1),new Grad(0,1,-1),new Grad(0,-1,-1)]; 55 | 56 | var p = [151,160,137,91,90,15, 57 | 131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23, 58 | 190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33, 59 | 88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166, 60 | 77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244, 61 | 102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196, 62 | 135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123, 63 | 5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42, 64 | 223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9, 65 | 129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228, 66 | 251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107, 67 | 49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254, 68 | 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180]; 69 | // To remove the need for index wrapping, double the permutation table length 70 | var perm = new Array(512); 71 | var gradP = new Array(512); 72 | 73 | // This isn't a very good seeding function, but it works ok. It supports 2^16 74 | // different seed values. Write something better if you need more seeds. 75 | module.seed = function(seed) { 76 | if(seed > 0 && seed < 1) { 77 | // Scale the seed out 78 | seed *= 65536; 79 | } 80 | 81 | seed = Math.floor(seed); 82 | if(seed < 256) { 83 | seed |= seed << 8; 84 | } 85 | 86 | for(var i = 0; i < 256; i++) { 87 | var v; 88 | if (i & 1) { 89 | v = p[i] ^ (seed & 255); 90 | } else { 91 | v = p[i] ^ ((seed>>8) & 255); 92 | } 93 | 94 | perm[i] = perm[i + 256] = v; 95 | gradP[i] = gradP[i + 256] = grad3[v % 12]; 96 | } 97 | }; 98 | 99 | module.seed(0); 100 | 101 | /* 102 | for(var i=0; i<256; i++) { 103 | perm[i] = perm[i + 256] = p[i]; 104 | gradP[i] = gradP[i + 256] = grad3[perm[i] % 12]; 105 | }*/ 106 | 107 | // Skewing and unskewing factors for 2, 3, and 4 dimensions 108 | var F2 = 0.5*(Math.sqrt(3)-1); 109 | var G2 = (3-Math.sqrt(3))/6; 110 | 111 | var F3 = 1/3; 112 | var G3 = 1/6; 113 | 114 | // 2D simplex noise 115 | module.simplex2 = function(xin, yin) { 116 | var n0, n1, n2; // Noise contributions from the three corners 117 | // Skew the input space to determine which simplex cell we're in 118 | var s = (xin+yin)*F2; // Hairy factor for 2D 119 | var i = Math.floor(xin+s); 120 | var j = Math.floor(yin+s); 121 | var t = (i+j)*G2; 122 | var x0 = xin-i+t; // The x,y distances from the cell origin, unskewed. 123 | var y0 = yin-j+t; 124 | // For the 2D case, the simplex shape is an equilateral triangle. 125 | // Determine which simplex we are in. 126 | var i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords 127 | if(x0>y0) { // lower triangle, XY order: (0,0)->(1,0)->(1,1) 128 | i1=1; j1=0; 129 | } else { // upper triangle, YX order: (0,0)->(0,1)->(1,1) 130 | i1=0; j1=1; 131 | } 132 | // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and 133 | // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where 134 | // c = (3-sqrt(3))/6 135 | var x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords 136 | var y1 = y0 - j1 + G2; 137 | var x2 = x0 - 1 + 2 * G2; // Offsets for last corner in (x,y) unskewed coords 138 | var y2 = y0 - 1 + 2 * G2; 139 | // Work out the hashed gradient indices of the three simplex corners 140 | i &= 255; 141 | j &= 255; 142 | var gi0 = gradP[i+perm[j]]; 143 | var gi1 = gradP[i+i1+perm[j+j1]]; 144 | var gi2 = gradP[i+1+perm[j+1]]; 145 | // Calculate the contribution from the three corners 146 | var t0 = 0.5 - x0*x0-y0*y0; 147 | if(t0<0) { 148 | n0 = 0; 149 | } else { 150 | t0 *= t0; 151 | n0 = t0 * t0 * gi0.dot2(x0, y0); // (x,y) of grad3 used for 2D gradient 152 | } 153 | var t1 = 0.5 - x1*x1-y1*y1; 154 | if(t1<0) { 155 | n1 = 0; 156 | } else { 157 | t1 *= t1; 158 | n1 = t1 * t1 * gi1.dot2(x1, y1); 159 | } 160 | var t2 = 0.5 - x2*x2-y2*y2; 161 | if(t2<0) { 162 | n2 = 0; 163 | } else { 164 | t2 *= t2; 165 | n2 = t2 * t2 * gi2.dot2(x2, y2); 166 | } 167 | // Add contributions from each corner to get the final noise value. 168 | // The result is scaled to return values in the interval [-1,1]. 169 | return 70 * (n0 + n1 + n2); 170 | }; 171 | 172 | // 3D simplex noise 173 | module.simplex3 = function(xin, yin, zin) { 174 | var n0, n1, n2, n3; // Noise contributions from the four corners 175 | 176 | // Skew the input space to determine which simplex cell we're in 177 | var s = (xin+yin+zin)*F3; // Hairy factor for 2D 178 | var i = Math.floor(xin+s); 179 | var j = Math.floor(yin+s); 180 | var k = Math.floor(zin+s); 181 | 182 | var t = (i+j+k)*G3; 183 | var x0 = xin-i+t; // The x,y distances from the cell origin, unskewed. 184 | var y0 = yin-j+t; 185 | var z0 = zin-k+t; 186 | 187 | // For the 3D case, the simplex shape is a slightly irregular tetrahedron. 188 | // Determine which simplex we are in. 189 | var i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords 190 | var i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords 191 | if(x0 >= y0) { 192 | if(y0 >= z0) { i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } 193 | else if(x0 >= z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } 194 | else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } 195 | } else { 196 | if(y0 < z0) { i1=0; j1=0; k1=1; i2=0; j2=1; k2=1; } 197 | else if(x0 < z0) { i1=0; j1=1; k1=0; i2=0; j2=1; k2=1; } 198 | else { i1=0; j1=1; k1=0; i2=1; j2=1; k2=0; } 199 | } 200 | // A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z), 201 | // a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and 202 | // a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where 203 | // c = 1/6. 204 | var x1 = x0 - i1 + G3; // Offsets for second corner 205 | var y1 = y0 - j1 + G3; 206 | var z1 = z0 - k1 + G3; 207 | 208 | var x2 = x0 - i2 + 2 * G3; // Offsets for third corner 209 | var y2 = y0 - j2 + 2 * G3; 210 | var z2 = z0 - k2 + 2 * G3; 211 | 212 | var x3 = x0 - 1 + 3 * G3; // Offsets for fourth corner 213 | var y3 = y0 - 1 + 3 * G3; 214 | var z3 = z0 - 1 + 3 * G3; 215 | 216 | // Work out the hashed gradient indices of the four simplex corners 217 | i &= 255; 218 | j &= 255; 219 | k &= 255; 220 | var gi0 = gradP[i+ perm[j+ perm[k ]]]; 221 | var gi1 = gradP[i+i1+perm[j+j1+perm[k+k1]]]; 222 | var gi2 = gradP[i+i2+perm[j+j2+perm[k+k2]]]; 223 | var gi3 = gradP[i+ 1+perm[j+ 1+perm[k+ 1]]]; 224 | 225 | // Calculate the contribution from the four corners 226 | var t0 = 0.5 - x0*x0-y0*y0-z0*z0; 227 | if(t0<0) { 228 | n0 = 0; 229 | } else { 230 | t0 *= t0; 231 | n0 = t0 * t0 * gi0.dot3(x0, y0, z0); // (x,y) of grad3 used for 2D gradient 232 | } 233 | var t1 = 0.5 - x1*x1-y1*y1-z1*z1; 234 | if(t1<0) { 235 | n1 = 0; 236 | } else { 237 | t1 *= t1; 238 | n1 = t1 * t1 * gi1.dot3(x1, y1, z1); 239 | } 240 | var t2 = 0.5 - x2*x2-y2*y2-z2*z2; 241 | if(t2<0) { 242 | n2 = 0; 243 | } else { 244 | t2 *= t2; 245 | n2 = t2 * t2 * gi2.dot3(x2, y2, z2); 246 | } 247 | var t3 = 0.5 - x3*x3-y3*y3-z3*z3; 248 | if(t3<0) { 249 | n3 = 0; 250 | } else { 251 | t3 *= t3; 252 | n3 = t3 * t3 * gi3.dot3(x3, y3, z3); 253 | } 254 | // Add contributions from each corner to get the final noise value. 255 | // The result is scaled to return values in the interval [-1,1]. 256 | return 32 * (n0 + n1 + n2 + n3); 257 | 258 | }; 259 | 260 | // ##### Perlin noise stuff 261 | 262 | function fade(t) { 263 | return t*t*t*(t*(t*6-15)+10); 264 | } 265 | 266 | function lerp(a, b, t) { 267 | return (1-t)*a + t*b; 268 | } 269 | 270 | // 2D Perlin Noise 271 | module.perlin2 = function(x, y) { 272 | // Find unit grid cell containing point 273 | var X = Math.floor(x), Y = Math.floor(y); 274 | // Get relative xy coordinates of point within that cell 275 | x = x - X; y = y - Y; 276 | // Wrap the integer cells at 255 (smaller integer period can be introduced here) 277 | X = X & 255; Y = Y & 255; 278 | 279 | // Calculate noise contributions from each of the four corners 280 | var n00 = gradP[X+perm[Y]].dot2(x, y); 281 | var n01 = gradP[X+perm[Y+1]].dot2(x, y-1); 282 | var n10 = gradP[X+1+perm[Y]].dot2(x-1, y); 283 | var n11 = gradP[X+1+perm[Y+1]].dot2(x-1, y-1); 284 | 285 | // Compute the fade curve value for x 286 | var u = fade(x); 287 | 288 | // Interpolate the four results 289 | return lerp( 290 | lerp(n00, n10, u), 291 | lerp(n01, n11, u), 292 | fade(y)); 293 | }; 294 | 295 | // 3D Perlin Noise 296 | module.perlin3 = function(x, y, z) { 297 | // Find unit grid cell containing point 298 | var X = Math.floor(x), Y = Math.floor(y), Z = Math.floor(z); 299 | // Get relative xyz coordinates of point within that cell 300 | x = x - X; y = y - Y; z = z - Z; 301 | // Wrap the integer cells at 255 (smaller integer period can be introduced here) 302 | X = X & 255; Y = Y & 255; Z = Z & 255; 303 | 304 | // Calculate noise contributions from each of the eight corners 305 | var n000 = gradP[X+ perm[Y+ perm[Z ]]].dot3(x, y, z); 306 | var n001 = gradP[X+ perm[Y+ perm[Z+1]]].dot3(x, y, z-1); 307 | var n010 = gradP[X+ perm[Y+1+perm[Z ]]].dot3(x, y-1, z); 308 | var n011 = gradP[X+ perm[Y+1+perm[Z+1]]].dot3(x, y-1, z-1); 309 | var n100 = gradP[X+1+perm[Y+ perm[Z ]]].dot3(x-1, y, z); 310 | var n101 = gradP[X+1+perm[Y+ perm[Z+1]]].dot3(x-1, y, z-1); 311 | var n110 = gradP[X+1+perm[Y+1+perm[Z ]]].dot3(x-1, y-1, z); 312 | var n111 = gradP[X+1+perm[Y+1+perm[Z+1]]].dot3(x-1, y-1, z-1); 313 | 314 | // Compute the fade curve value for x, y, z 315 | var u = fade(x); 316 | var v = fade(y); 317 | var w = fade(z); 318 | 319 | // Interpolate 320 | return lerp( 321 | lerp( 322 | lerp(n000, n100, u), 323 | lerp(n001, n101, u), w), 324 | lerp( 325 | lerp(n010, n110, u), 326 | lerp(n011, n111, u), w), 327 | v); 328 | }; 329 | 330 | })(this); 331 | 332 | $(function() { 333 | var check = function() { 334 | var src = $('.entry-content img:visible:first').attr('src'); 335 | if (!src) return false; 336 | $('body').css('background', 'url(' + src + ')'); 337 | return true; 338 | }; 339 | 340 | if (!check()) { 341 | var timer = setInterval(function() { 342 | if (check()) { 343 | clearInterval(timer); 344 | } 345 | }, 1000); 346 | } 347 | 348 | var $style = $('