Advertisement
pushrbx

April's fool script v1.0

Mar 26th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // jQuery.Cookie plugin - https://github.com/carhartl/jquery-cookie
  2. (function(e){if(typeof define==="function"&&define.amd){define(["jquery"],e)}else{e(jQuery)}})(function(e){function n(e){return u.raw?e:encodeURIComponent(e)}function r(e){return u.raw?e:decodeURIComponent(e)}function i(e){return n(u.json?JSON.stringify(e):String(e))}function s(e){if(e.indexOf('"')===0){e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")}try{e=decodeURIComponent(e.replace(t," "))}catch(n){return}try{return u.json?JSON.parse(e):e}catch(n){}}function o(t,n){var r=u.raw?t:s(t);return e.isFunction(n)?n(r):r}var t=/\+/g;var u=e.cookie=function(t,s,a){if(s!==undefined&&!e.isFunction(s)){a=e.extend({},u.defaults,a);if(typeof a.expires==="number"){var f=a.expires,l=a.expires=new Date;l.setDate(l.getDate()+f)}return document.cookie=[n(t),"=",i(s),a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}var c=t?undefined:{};var h=document.cookie?document.cookie.split("; "):[];for(var p=0,d=h.length;p<d;p++){var v=h[p].split("=");var m=r(v.shift());var g=v.join("=");if(t&&t===m){c=o(g,s);break}if(!t&&(g=o(g))!==undefined){c[m]=g}}return c};u.defaults={};e.removeCookie=function(t,n){if(e.cookie(t)!==undefined){e.cookie(t,"",e.extend({},n,{expires:-1}));return true}return false}});
  3. // --- jQuery.Cookie plugin end
  4. $(document).ready(function() {
  5.     var genJibberish = function() {
  6.         var text = "";
  7.         var possible = "あかさたないきしちにうくすつぬえけせてねおこそとのはまやらわひみりゐふむゆるんへめれゑほもよろをがざ だ ば ぱぎじ ぢ びぴぐ ずづ ぶぷげ ぜ で べ ぺ ご ぞ ど ぼ ぽ きゃしゃちゃひゃぴゃきゅしゅちゅひゅぴゅきょしょちょひょぴょぎゃじゃにゃびゃみゃぎゅじゅにゅびゅみゅぎょじょにょびょみょりゃりゅりょぢゃぢゅアカサタナイキシチニウクスツヌエケセテネオコソトノハマヤラワヒミリヰフムユルンヘメレヱホモヨロヲガザダバギジヂビピグズヅブプゲゼデベペゴゾドボポキャシャチャヒャピャキュシュチュヒュピュキョショチョヒョピョギャジャニャビャミャギュジュニュビュミュギョジョニョビョミョリャリュリョヂャヂュイェヴァシェウィヸヴィジェ ウェヴェチェウォヴォヺヴャティツァファトゥツィフィテュツェフェディツォ フォドゥフュデュ";
  8.         var rnd = Math.floor((Math.random()*22)+5);
  9.         for( var i=0; i < rnd; i++ ) {
  10.             text += possible.charAt(Math.floor(Math.random() * possible.length));
  11.         }
  12.  
  13.         return text;
  14.     }
  15.     function recursiveReplace(node) {
  16.         if (node.nodeType == 3) { // text node
  17.             node.nodeValue = node.nodeValue.replace(node.nodeValue, genJibberish());
  18.         } else if (node.nodeType == 1) { // element
  19.             $(node).contents().each(function () {
  20.                 recursiveReplace(this);
  21.             });
  22.         }
  23.     }
  24.     if($.cookie('jibberish') == undefined) {
  25.         $.cookie('jibberish', 1, { path: '/', expires: 7 });
  26.     }
  27.     if($.cookie('jibberish') <= 20) {
  28.         recursiveReplace($('.menu')[0]);
  29.         recursiveReplace($('#minecontainer')[0]);
  30.         $.cookie('jibberish', $.cookie('jibberish') + 1);
  31.     }
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement