Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First glorious commit upon the world

  • Loading branch information...
commit a9b891063b098f3948cac52a919dd0b864b6f8b2 0 parents
Joe Nelson authored
Showing with 106 additions and 0 deletions.
  1. +6 −0 README
  2. +42 −0 demo.html
  3. +58 −0 style.js
6 README
@@ -0,0 +1,6 @@
+Enigma came from a discussion I had with friends about the worst
+possible web design. We decided nothing could be worse than a page
+which looks entirely different every time it loads. That's what
+Enigma does; it is a snippet of JavaScript which adds dynamic and
+unpredictable CSS effects to a webpage. You can control the likelihood
+of certain effects from within the source.
42 demo.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <link rel="stylesheet" type="text/css"
+ href="http://yui.yahooapis.com/3.3.0/build/cssreset/reset-min.css">
+ <script type="text/javascript"
+ src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js">
+ </script>
+ <script type="text/javascript" src="style.js"></script>
+ <title>Beautiful Web Design</title>
+ </head>
+ <body>
+ <header>
+ <h1>Beautiful Web Design</h1>
+ <nav><ul>
+ <li><a href="">Home</a></li>
+ <li><a href="">Portfolio</a></li>
+ <li><a href="">News</a></li>
+ <li><a href="">The perfect world</a></li>
+ <li><a href="">The control group</a></li>
+ <li><a href="">About</a></li>
+ </ul></nav>
+ </header>
+
+ <p>Welcome to home page of the the award-winning web design
+ company <strong>DazzleWerkz</strong>. We specialize in Web 3.0
+ design, blending high art, high tech, and high fashion into
+ new heights of savory eye candy &mdash; all while increasing
+ ROI on the day2day B2B.</p>
+
+ <p><strong>DazzleWerks</strong> was created by true indigenous
+ digital natives, hunting amongst the red-black trees with fiber
+ optic nets and wearing binary camouflage. <a href="">Contact</a>
+ our hyper-caffeinated tribe and a digital chieftain will reply
+ to your silicon smoke signals.</p>
+
+ <p>Join us and scalp your competitors' web presence while
+ increasing your wampum conversion rates. Learn why our patented
+ <strong>ControlGroup&copy;</strong> technology earned the coveted
+ Cruel and Unusual Design Award for 2011.
+ </body>
+</html>
58 style.js
@@ -0,0 +1,58 @@
+var elts = ['html', 'ul', 'li', 'h1', 'strong', 'a', 'p'];
+
+var fx = {
+ color: { prob: .5, type: 'hex' },
+ 'background-color': { prob: .5, type: 'hex' },
+ 'font-family': { prob: .6, type: 'enum', vals: ['sans-serif', 'serif', 'monospace',
+ 'Comic Sans', 'cursive', 'Impact', 'fantasy'] },
+ 'font-style': { prob: .30, type: 'enum', vals: ['normal', 'italic', 'oblique'] },
+ 'font-weight': { prob: .30, type: 'enum', vals: ['normal', 'bold'] },
+ 'text-decoration': { prob: .20, type: 'enum', vals: ['none', 'underline', 'overline',
+ 'line-through', 'blink', 'inherit'] },
+ 'font-size': { prob: .4, type: 'range', range: [8, 24] },
+ 'text-align': { type: 'enum', vals: ['left', 'center', 'right', 'justify' ] },
+
+ width: { prob: .4, type: 'range', range: [30, 900] },
+ 'margin-top': { type: 'range', range: [0, 10] },
+ 'margin-bottom': { type: 'range', range: [0, 10] },
+ 'margin-left': { type: 'range', range: [0, 10] },
+ 'margin-right': { type: 'range', range: [0, 10] },
+ 'padding-top': { type: 'range', range: [0, 10] },
+ 'padding-bottom': { type: 'range', range: [0, 10] },
+ 'padding-left': { type: 'range', range: [0, 10] },
+ 'padding-right': { type: 'range', range: [0, 10] },
+
+ 'border-style': { prob: .3, type: 'enum', vals: ['none', 'hidden', 'dotted', 'dashed',
+ 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'inherit'] },
+ 'border-width': { prob: .3, type: 'range', range: [0, 5] },
+ 'border-color': { prob: .3, type: 'hex' },
+ 'border-radius': { prob: .1, type: 'range', range: [2, 10] },
+
+ float: { prob: .5, type: 'enum', vals: ['left', 'right'] },
+ clear: { prob: .1, type: 'enum', vals: ['left', 'right', 'both'] },
+ display: { prob: .2, type: 'enum', vals: ['block', 'inline'] }
+};
+
+function pick(f) {
+ if(f.type == 'enum') {
+ return f.vals[Math.floor ( Math.random() * f.vals.length )];
+ }
+ if(f.type == 'hex') {
+ return '#' + (Math.random()*0xFFFFFF<<0).toString(16);
+ }
+ if(f.type == 'range') {
+ var m = f.range[0], n = f.range[1];
+ return Math.floor(m + (1+n-m)*Math.random());
+ }
+ return '';
+}
+
+$(document).ready(function() {
+ for(var e in elts) {
+ for(var f in fx) {
+ if(!fx[f].prob || Math.random() <= fx[f].prob) {
+ $(elts[e]).css(f, pick(fx[f]));
+ }
+ }
+ }
+});
Please sign in to comment.
Something went wrong with that request. Please try again.