Permalink
Browse files

cleanup: tabs replaced by 4 spaces

  • Loading branch information...
1 parent 073fef3 commit 29793020a14f0b8918ff5393edfe06bbebc41a2f @mrflix committed with May 18, 2011
Showing with 3,414 additions and 3,083 deletions.
  1. +362 −31 builder.html
  2. +373 −373 css/style.css
  3. +204 −204 js/application.js
  4. +110 −110 js/codebox.js
  5. +63 −63 js/color.js
  6. +191 −191 js/colorpicker.js
  7. +232 −232 js/css.js
  8. +448 −448 js/gradienteditor.js
  9. +4 −4 js/localization.js
  10. +11 −11 js/modernizr-1.7.min.js
  11. +149 −149 js/numbers.js
  12. +529 −529 js/style.js
  13. +165 −165 js/styleStore.js
  14. +256 −256 js/tools.js
  15. +152 −152 js/ui.js
  16. +165 −165 js/universe.js
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,112 +1,112 @@
var codeBox = {
- options: {
- visible: false,
- height: 163
- },
- minHeight: 100,
- init: function(){
- if(localStorage["codeBoxOptions"]) this.options = JSON.parse(localStorage["codeBoxOptions"]);
- this.$el = $('#codeBox');
- this.$box = this.$el.find('code');
- this.$body = this.$el.find('.body');
- this.$copyCode = this.$el.find('#copyCode');
- this.$dragger = this.$el.find('.dragger.y');
- this.$codeBoxToggle = $('#codeBoxToggle');
- this.$colorToggle = Object.create(toggle);
- this.$colorToggle.init("colorSwitch", "hex", tools.options, $.proxy( this, "render" ));
-
- this.location = window.location.href.slice(0, window.location.href.lastIndexOf("/"));
- this.initClipboard();
-
- this.$copyCode.add(this.$body).add(this.$box)
- .bind('mousedown', function(e){ e.stopPropagation(); });
- this.$codeBoxToggle.click( $.proxy( this, "toggle" ) );
- this.$dragger.mousedown( $.proxy( this, "drag") );
-
- this.updateView();
- },
- toggle: function(){
- if(this.$el.height() === 0){
- this.options.visible = true;
- } else {
- this.options.visible = false;
- }
- this.storeSettings();
- this.updateView();
- $(window).trigger('resize');
- },
- updateView: function(){
- if(this.options.visible){
- this.$el.height(this.options.height);
- } else {
- this.$el.height(0);
- }
- },
- drag: function(event){
- event.preventDefault();
- var my_offset = $(event.target).offset();
- offset = { y: event.pageY-my_offset.top };
- this.$el.addClass("resizing");
- this.resize(event);
- $(document).one('mouseup', function(){ codeBox.$el.removeClass('resizing') } );
- $(document).bind('mousemove.global', $.proxy( this, "resize") );
- },
- resize: function(event){
- this.options.height = Math.max(this.minHeight, $(document).height() - event.pageY + offset.y);
- this.$el.height(this.options.height);
- $(window).trigger('resize');
- this.storeSettings();
- },
- storeSettings: function(){
- localStorage["codeBoxOptions"] = JSON.stringify(this.options);
- },
- /**
- * @method initClipboard - a click on the button with the id 'copyCode' will copy 'this.$box.text()' into the clipboard
- * @see http://code.google.com/p/zeroclipboard/wiki/Instructions
- */
- initClipboard: function(){
- ZeroClipboard.setMoviePath( this.location + '/js/zeroclipboard/ZeroClipboard.swf' );
- this.clip = new ZeroClipboard.Client();
- this.clip.addEventListener( 'onMouseDown', $.proxy( this, "copy" ) );
- this.clip.setHandCursor(true);
- var flash = this.clip.getHTML(this.$copyCode.width(), this.$copyCode.height());
- this.$copyCode.append(flash);
- },
- copy: function(){
- var text = this.code.replace(/<br>/g, "\n").replace(/&nbsp;/g, "");
- this.clip.setText(text);
- },
- tabs: function(count){
- var tabString = "",
- tabs = count || this.options.tabs;
-
- for(;tabs--;){
- tabString += "&nbsp;";
- }
- return tabString;
- },
- render: function(){
- var borderRadiusObject;
- this.code = "";
- // add border
- this.code += currentStyle.border.isActive ? "border: " + css.border(currentStyle) + ";<br>" : "";
- // add border-radius
- if(currentStyle.borderRadius.isActive){
- borderRadiusObject = css.borderRadius(currentStyle);
- for(var key in borderRadiusObject){
- var radius = borderRadiusObject[key];
- if(radius !== 0){
- this.code += key + ": " + radius + ";<br>";
- }
- }
- }
- // add gradient
- if(currentStyle.background.isActive){
- this.code += "background-image: " + css.drawGradient(currentStyle, "-moz-") + ";<br>";
- this.code += "background-image: " + css.drawGradient(currentStyle, "-oldwebkit-") + ";<br>";
- }
- // add dropShadow and innerShadow
- this.code += currentStyle.dropShadow.isActive || currentStyle.innerShadow.isActive ? "box-shadow: " + css.boxShadow(currentStyle) + ";<br>" : "";
- this.$box.html(this.code);
- }
+ options: {
+ visible: false,
+ height: 163
+ },
+ minHeight: 100,
+ init: function(){
+ if(localStorage["codeBoxOptions"]) this.options = JSON.parse(localStorage["codeBoxOptions"]);
+ this.$el = $('#codeBox');
+ this.$box = this.$el.find('code');
+ this.$body = this.$el.find('.body');
+ this.$copyCode = this.$el.find('#copyCode');
+ this.$dragger = this.$el.find('.dragger.y');
+ this.$codeBoxToggle = $('#codeBoxToggle');
+ this.$colorToggle = Object.create(toggle);
+ this.$colorToggle.init("colorSwitch", "hex", tools.options, $.proxy( this, "render" ));
+
+ this.location = window.location.href.slice(0, window.location.href.lastIndexOf("/"));
+ this.initClipboard();
+
+ this.$copyCode.add(this.$body).add(this.$box)
+ .bind('mousedown', function(e){ e.stopPropagation(); });
+ this.$codeBoxToggle.click( $.proxy( this, "toggle" ) );
+ this.$dragger.mousedown( $.proxy( this, "drag") );
+
+ this.updateView();
+ },
+ toggle: function(){
+ if(this.$el.height() === 0){
+ this.options.visible = true;
+ } else {
+ this.options.visible = false;
+ }
+ this.storeSettings();
+ this.updateView();
+ $(window).trigger('resize');
+ },
+ updateView: function(){
+ if(this.options.visible){
+ this.$el.height(this.options.height);
+ } else {
+ this.$el.height(0);
+ }
+ },
+ drag: function(event){
+ event.preventDefault();
+ var my_offset = $(event.target).offset();
+ offset = { y: event.pageY-my_offset.top };
+ this.$el.addClass("resizing");
+ this.resize(event);
+ $(document).one('mouseup', function(){ codeBox.$el.removeClass('resizing') } );
+ $(document).bind('mousemove.global', $.proxy( this, "resize") );
+ },
+ resize: function(event){
+ this.options.height = Math.max(this.minHeight, $(document).height() - event.pageY + offset.y);
+ this.$el.height(this.options.height);
+ $(window).trigger('resize');
+ this.storeSettings();
+ },
+ storeSettings: function(){
+ localStorage["codeBoxOptions"] = JSON.stringify(this.options);
+ },
+ /**
+ * @method initClipboard - a click on the button with the id 'copyCode' will copy 'this.$box.text()' into the clipboard
+ * @see http://code.google.com/p/zeroclipboard/wiki/Instructions
+ */
+ initClipboard: function(){
+ ZeroClipboard.setMoviePath( this.location + '/js/zeroclipboard/ZeroClipboard.swf' );
+ this.clip = new ZeroClipboard.Client();
+ this.clip.addEventListener( 'onMouseDown', $.proxy( this, "copy" ) );
+ this.clip.setHandCursor(true);
+ var flash = this.clip.getHTML(this.$copyCode.width(), this.$copyCode.height());
+ this.$copyCode.append(flash);
+ },
+ copy: function(){
+ var text = this.code.replace(/<br>/g, "\n").replace(/&nbsp;/g, "");
+ this.clip.setText(text);
+ },
+ tabs: function(count){
+ var tabString = "",
+ tabs = count || this.options.tabs;
+
+ for(;tabs--;){
+ tabString += "&nbsp;";
+ }
+ return tabString;
+ },
+ render: function(){
+ var borderRadiusObject;
+ this.code = "";
+ // add border
+ this.code += currentStyle.border.isActive ? "border: " + css.border(currentStyle) + ";<br>" : "";
+ // add border-radius
+ if(currentStyle.borderRadius.isActive){
+ borderRadiusObject = css.borderRadius(currentStyle);
+ for(var key in borderRadiusObject){
+ var radius = borderRadiusObject[key];
+ if(radius !== 0){
+ this.code += key + ": " + radius + ";<br>";
+ }
+ }
+ }
+ // add gradient
+ if(currentStyle.background.isActive){
+ this.code += "background-image: " + css.drawGradient(currentStyle, "-moz-") + ";<br>";
+ this.code += "background-image: " + css.drawGradient(currentStyle, "-oldwebkit-") + ";<br>";
+ }
+ // add dropShadow and innerShadow
+ this.code += currentStyle.dropShadow.isActive || currentStyle.innerShadow.isActive ? "box-shadow: " + css.boxShadow(currentStyle) + ";<br>" : "";
+ this.$box.html(this.code);
+ }
};
View
@@ -1,69 +1,69 @@
var color = {
- hsbFromRgb: function(rgb) {
- r = rgb[0]/255, g = rgb[1]/255, b = rgb[2]/255;
- var max = Math.max(r, g, b), min = Math.min(r, g, b);
- var h, s, v = max;
+ hsbFromRgb: function(rgb) {
+ r = rgb[0]/255, g = rgb[1]/255, b = rgb[2]/255;
+ var max = Math.max(r, g, b), min = Math.min(r, g, b);
+ var h, s, v = max;
- var d = max - min;
- s = max === 0 ? 0 : d / max;
+ var d = max - min;
+ s = max === 0 ? 0 : d / max;
- if(max === min){
- h = 0;
- }else{
- switch(max){
- case r: h = (g - b) / d + (g < b ? 6 : 0); break;
- case g: h = (b - r) / d + 2; break;
- case b: h = (r - g) / d + 4; break;
- }
- h /= 6;
- }
- return [Math.round(h * 360), Math.round(s * 100), Math.round(v * 100)];
- },
- rgbFromHsb: function(hsv) {
- var r, g, b;
- h = hsv[0]/360; s = hsv[1]/100; v = hsv[2]/100;
+ if(max === min){
+ h = 0;
+ }else{
+ switch(max){
+ case r: h = (g - b) / d + (g < b ? 6 : 0); break;
+ case g: h = (b - r) / d + 2; break;
+ case b: h = (r - g) / d + 4; break;
+ }
+ h /= 6;
+ }
+ return [Math.round(h * 360), Math.round(s * 100), Math.round(v * 100)];
+ },
+ rgbFromHsb: function(hsv) {
+ var r, g, b;
+ h = hsv[0]/360; s = hsv[1]/100; v = hsv[2]/100;
- var i = Math.floor(h * 6);
- var f = h * 6 - i;
- var p = v * (1 - s);
- var q = v * (1 - f * s);
- var t = v * (1 - (1 - f) * s);
+ var i = Math.floor(h * 6);
+ var f = h * 6 - i;
+ var p = v * (1 - s);
+ var q = v * (1 - f * s);
+ var t = v * (1 - (1 - f) * s);
- switch(i % 6){
- case 0: r = v; g = t; b = p; break;
- case 1: r = q; g = v; b = p; break;
- case 2: r = p; g = v; b = t; break;
- case 3: r = p; g = q; b = v; break;
- case 4: r = t; g = p; b = v; break;
- case 5: r = v; g = p; b = q; break;
- }
- return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
- },
- rgbFromHex: function(hex){
- if(hex.length === 3){
- return [
- parseInt(hex.substring(0,1)+hex.substring(0,1), 16),
- parseInt(hex.substring(1,2)+hex.substring(1,2), 16),
- parseInt(hex.substring(2,3)+hex.substring(2,3), 16)
- ]
- } else {
- return [
- parseInt(hex.substring(0,2), 16),
- parseInt(hex.substring(2,4), 16),
- parseInt(hex.substring(4,6), 16)
- ]
- }
- },
- hexFromRgb: function(rgb){
- var hexcode = this.toHex(rgb[0])+this.toHex(rgb[1])+this.toHex(rgb[2]);
- parts = hexcode.split("");
- // "000" instead of "000000"
- return (parts[0]===parts[1]) && (parts[2]===parts[3]) && (parts[4]==parts[5]) ? parts[0]+parts[2]+parts[4] : hexcode;
- },
- toHex: function(n) {
- if(n === 0) { return '00'; }
- n = parseInt(n, 10);
- if (n === 0 || isNaN(n)) { return "00"; }
- return "0123456789abcdef".charAt((n-n%16)/16) + "0123456789abcdef".charAt(n%16);
- }
+ switch(i % 6){
+ case 0: r = v; g = t; b = p; break;
+ case 1: r = q; g = v; b = p; break;
+ case 2: r = p; g = v; b = t; break;
+ case 3: r = p; g = q; b = v; break;
+ case 4: r = t; g = p; b = v; break;
+ case 5: r = v; g = p; b = q; break;
+ }
+ return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];
+ },
+ rgbFromHex: function(hex){
+ if(hex.length === 3){
+ return [
+ parseInt(hex.substring(0,1)+hex.substring(0,1), 16),
+ parseInt(hex.substring(1,2)+hex.substring(1,2), 16),
+ parseInt(hex.substring(2,3)+hex.substring(2,3), 16)
+ ]
+ } else {
+ return [
+ parseInt(hex.substring(0,2), 16),
+ parseInt(hex.substring(2,4), 16),
+ parseInt(hex.substring(4,6), 16)
+ ]
+ }
+ },
+ hexFromRgb: function(rgb){
+ var hexcode = this.toHex(rgb[0])+this.toHex(rgb[1])+this.toHex(rgb[2]);
+ parts = hexcode.split("");
+ // "000" instead of "000000"
+ return (parts[0]===parts[1]) && (parts[2]===parts[3]) && (parts[4]==parts[5]) ? parts[0]+parts[2]+parts[4] : hexcode;
+ },
+ toHex: function(n) {
+ if(n === 0) { return '00'; }
+ n = parseInt(n, 10);
+ if (n === 0 || isNaN(n)) { return "00"; }
+ return "0123456789abcdef".charAt((n-n%16)/16) + "0123456789abcdef".charAt(n%16);
+ }
};
Oops, something went wrong.

0 comments on commit 2979302

Please sign in to comment.