Commits

Michael Shepanski  committed 8cfe467

Better namespaceing in JS; Cleanup list and code styles

  • Participants
  • Parent commits e2c8922

Comments (0)

Files changed (10)

File themes/v2-hardwood/static/css/base.css

 h1:first-child{margin-top:0px;}
 p{font-family:$basefonts;font-size:15px;line-height:1.6em;}
 ul,ol{margin-top:5px;}
-li{line-height:20px;}
-li pre{margin:5px 0px;}
+li{font-size:14px;line-height:20px;}
+li pre{margin:10px 0px;}
 .documentation p{margin-left:20px;}
 .documentation pre{margin-left:20px;}
 input,textarea{background-color:#F0EFEB;border:1px solid #aaa;}
 textarea{font-size:11px;font-family:Liberation Mono,Consolas,Menlo,Monaco,Lucida Console,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;line-height:15px;color:#111;}
 input:focus,textarea:focus{-webkit-box-shadow:0px 0px 6px rgba(61, 87, 138, 0.3);-moz-box-shadow:0px 0px 6px rgba(61, 87, 138, 0.3);box-shadow:0px 0px 6px rgba(61, 87, 138, 0.3);border-color:rgba(61, 87, 138, 0.8);}
-pre,code{font-family:Liberation Mono,Consolas,Menlo,Monaco,Lucida Console,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif;}
-code{background-color:rgba(0, 0, 0, 0.1);border:none;color:#333;font-family:Monaco, monospace;font-size:12px;padding:1px 5px;text-shadow:none;white-space:nowrap;}
-pre{-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;-webkit-border-top-left-radius:0px;-webkit-border-bottom-left-radius:0px;-moz-border-radius-topleft:0px;-moz-border-radius-bottomleft:0px;border-top-left-radius:0px;border-bottom-left-radius:0px;-webkit-box-shadow:inset -1px 1px 1px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset -1px 1px 1px rgba(0, 0, 0, 0.1);box-shadow:inset -1px 1px 1px rgba(0, 0, 0, 0.1);background-color:rgba(0, 0, 0, 0.1);border:none;border-left:2px solid #876;line-height:18px;margin:0 0 22px 0;overflow-y:auto;padding:5px 10px;}
+code{background-color:rgba(0, 0, 0, 0.1);border:none;color:#333;font-size:11px;padding:4px 5px 3px 5px;text-shadow:none;white-space:nowrap;}
+pre{-webkit-border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;-webkit-border-top-left-radius:0px;-webkit-border-bottom-left-radius:0px;-moz-border-radius-topleft:0px;-moz-border-radius-bottomleft:0px;border-top-left-radius:0px;border-bottom-left-radius:0px;-webkit-box-shadow:inset -1px 1px 1px rgba(0, 0, 0, 0.1);-moz-box-shadow:inset -1px 1px 1px rgba(0, 0, 0, 0.1);box-shadow:inset -1px 1px 1px rgba(0, 0, 0, 0.1);background-color:rgba(0, 0, 0, 0.1);border:none;border-left:2px solid #876;letter-spacing:-1px;margin:0 0 22px 0;overflow-y:auto;padding:5px 10px;}
 pre code{background:transparent;border:none;color:#eee;white-space:nowrap;}
 .prettyprint .str{color:#333;}
 .prettyprint .kwd{color:#044;}

File themes/v2-hardwood/static/css/code.less

 // PushingKarma - Code
 //------------------------------------------------------------------------
 
-pre, code {
-  font-family: @monoFontFamily;
-}
 code {
   background-color: rgba(0,0,0,0.1);
   border: none;
   color: #333;
-  font-family: Monaco, monospace;
-  font-size: 12px;
-  padding: 1px 5px;
+  font-size: 11px;
+  padding: 4px 5px 3px 5px;
   text-shadow: none;
   white-space: nowrap;
 }
   background-color: rgba(0,0,0,0.1);
   border: none;
   border-left: 2px solid #876;
-  line-height: 18px;
+  letter-spacing: -1px;
+  //line-height: 18px;
   margin: 0 0 22px 0;
   overflow-y: auto;
   padding: 5px 10px;

File themes/v2-hardwood/static/css/type.less

 }
 
 ul, ol { margin-top: 5px; }
-li { line-height: 20px; }
-li pre { margin: 5px 0px; }
+li { font-size: 14px; line-height: 20px; }
+li pre { margin: 10px 0px; }
 
 
 // Documentation

File themes/v2-hardwood/static/js/pk.init.js

+//==============================================================
+// PushingKarma Javascript
+// Author: Michael Shepanski
+// =============================================================
+"use strict";
+
+(function() {
+
+    // Register Tooltips
+    $("a[data-tooltip]").tooltip({delay:{show:200, hide:50}});
+
+    // Apply Prettyprint to code blocks
+    $(".content pre").prettyPrint();
+    //$(".article p code").prettyPrint();
+    //$(".article li code").prettyPrint();
+
+})();

File themes/v2-hardwood/static/js/pk.particles.js

+//==============================================================
+// PushingKarma Javascript
+// Author: Michael Shepanski
+// Project: v2-hardwood
+// =============================================================
+"use strict";
+
+(function($) {
+
+    $(function() {
+        var canvas = $("#particles");
+        var ctx = canvas.get()[0].getContext("2d");
+        var header = canvas.parent();
+        var width = 10;
+        var height = 10;
+        var particles = [];
+
+        // Particle Object
+        var Particle = function() {
+            this.x = Math.random() * width;
+            this.y = Math.random() * height;
+            this.radius = 1;
+            this.color = "255,255,255";
+            this.opacity = (Math.random() * 0.4) + 0.2;
+            this.direction = Math.floor(Math.random() * Math.PI*2);
+            this.speed = null;
+            this.turnin = null;
+
+            this.init = function() {
+                this.setSpeed();
+                this.setTurns();
+                return this;
+            };
+            this.checkBoundries = function() {
+                if (this.x < - 5) this.x = width + 5;
+                if (this.y < - 5) this.y = height + 5;
+                if (this.x > width + 5) this.x = - 5;
+                if (this.y > height + 5) this.y = - 5;
+            };
+            this.decrimentTurn = function() {
+                this.turnin -= 1;
+                if (this.turnin < 0) {
+                    this.updateDirection();
+                    this.setSpeed();
+                    this.setTurns();
+                }
+            };
+            this.draw = function() {
+                ctx.beginPath();
+                var gradient = ctx.createRadialGradient(this.x, this.y, 0, this.x, this.y, this.radius);
+                gradient.addColorStop(0, "rgba("+this.color+","+this.opacity+")");
+                gradient.addColorStop(1, "rgba("+this.color+",0)");
+                ctx.fillStyle = gradient;
+                ctx.arc(this.x, this.y, this.radius, Math.PI*2, false);
+                ctx.fill();
+
+            }
+            this.setSpeed = function() { this.speed = (Math.random() * 0.3) + 0.1; };
+            this.setTurns = function() { this.turnin = Math.floor(Math.random() * 80) + 20; };
+            this.updateDirection = function() { this.direction += Math.random() * 0.5 * (Math.random()>0.5 ? 1:-1); };
+            this.updatePosition = function() {
+                this.x += Math.cos(this.direction) * this.speed;
+                this.y += Math.sin(this.direction) * this.speed;
+                this.checkBoundries();
+                this.decrimentTurn();
+            };
+        };
+
+        // Update the canvas size
+        var updateCanvasSize = function() {
+            var newWidth = Math.floor(header.width() / 2);
+            var newHeight = Math.floor(header.height() / 2);
+            if ((newWidth != width) || (newHeight != height) && (newHeight < 200)) {
+                width = newWidth;
+                height = newHeight;
+                canvas.attr("width", width);
+                canvas.attr("height", height);
+                canvas.css({width:(width*2)+"px", height:(height*2)+"px"});
+            }
+        }
+
+        // Animate the Particles
+        var drawParticles = function() {
+            updateCanvasSize();
+            ctx.clearRect(0, 0, width, height);
+            ctx.globalCompositeOperation = "lighter";
+            for (var i=0; i<particles.length; i++) {
+                var particle = particles[i];
+                particle.draw();
+                particle.updatePosition();
+            }
+        };
+
+        // Return True if Canvas works
+        function isCanvasSupported() {
+            var elem = document.createElement("canvas");
+            return !!(elem.getContext && elem.getContext("2d"));
+        }
+
+        // Create an array or particles
+        if (isCanvasSupported()) {
+            updateCanvasSize();
+            var numparticles = Math.floor(width / 40);
+            for (var i=0; i<numparticles; i++) { particles.push(new Particle().init()); }
+            setInterval(drawParticles, 30);
+        }
+    });
+
+})(window.jQuery);

File themes/v2-hardwood/static/js/pk.plugins.js

+//==============================================================
+// PushingKarma JQuery Plugins
+// Author: Michael Shepanski
+// =============================================================
+
+
+/**
+ * Pretty Print Plugin
+ * Applies Prettyprint to the selected elements
+ **/
+$.fn.prettyPrint = function() {
+    if ($(this).length) {
+        $(this).addClass("prettyprint");
+        prettyPrint();
+    }
+};
+
+
+/**
+ * Slide Link Plugin
+ * Slide to the selected element's href
+ **/
+$.fn.slideLink = function() {
+    $(this).click(function() {
+        var anchor = $(this).attr("href");
+        $('html,body').animate({scrollTop: $(anchor).offset().top}, function() {
+            return true;
+        });
+    });
+};
+

File themes/v2-hardwood/static/js/pushingkarma.js

-//==============================================================
-// PushingKarma Javascript
-// Author: Michael Shepanski
-// Project: v2-hardwood
-// =============================================================
-"use strict";
-
-!function($) {
-
-    /**
-     * Utility Functions
-     **/
-    function isCanvasSupported(){
-        var elem = document.createElement("canvas");
-        return !!(elem.getContext && elem.getContext("2d"));
-    }
-
-
-    /**
-     * Pretty Print Plugin
-     * Applies Prettyprint to the selected elements
-     **/
-    $.fn.prettyPrint = function() {
-        if ($(this).length) {
-            $(this).addClass("prettyprint");
-            prettyPrint();
-        }
-    };
-
-
-    /**
-     * Slide Link Plugin
-     * Slide to the selected element's href
-     **/
-    $.fn.slideLink = function() {
-        $(this).click(function() {
-            var anchor = $(this).attr("href");
-            $('html,body').animate({scrollTop: $(anchor).offset().top}, function() {
-                return true;
-            });
-        });
-    };
-
-
-    /**
-     * Header Particles Class
-     * Little floating particles in the header image
-     */
-    $(function() {
-        var canvas = $("#particles");
-        var ctx = canvas.get()[0].getContext("2d");
-        var header = canvas.parent();
-        var width = 10;
-        var height = 10;
-        var particles = [];
-
-        // Particle Object
-        var Particle = function() {
-            this.x = Math.random() * width;
-            this.y = Math.random() * height;
-            this.radius = 1;
-            this.color = "255,255,255";
-            this.opacity = (Math.random() * 0.4) + 0.2;
-            this.direction = Math.floor(Math.random() * Math.PI*2);
-            this.speed = null;
-            this.turnin = null;
-
-            this.init = function() {
-                this.setSpeed();
-                this.setTurns();
-                return this;
-            };
-            this.checkBoundries = function() {
-                if (this.x < - 5) this.x = width + 5;
-                if (this.y < - 5) this.y = height + 5;
-                if (this.x > width + 5) this.x = - 5;
-                if (this.y > height + 5) this.y = - 5;
-            };
-            this.decrimentTurn = function() {
-                this.turnin -= 1;
-                if (this.turnin < 0) {
-                    this.updateDirection();
-                    this.setSpeed();
-                    this.setTurns();
-                }
-            };
-            this.draw = function() {
-                ctx.beginPath();
-                var gradient = ctx.createRadialGradient(this.x, this.y, 0, this.x, this.y, this.radius);
-                gradient.addColorStop(0, "rgba("+this.color+","+this.opacity+")");
-                gradient.addColorStop(1, "rgba("+this.color+",0)");
-                ctx.fillStyle = gradient;
-                ctx.arc(this.x, this.y, this.radius, Math.PI*2, false);
-                ctx.fill();
-
-            }
-            this.setSpeed = function() { this.speed = (Math.random() * 0.3) + 0.1; };
-            this.setTurns = function() { this.turnin = Math.floor(Math.random() * 80) + 20; };
-            this.updateDirection = function() { this.direction += Math.random() * 0.5 * (Math.random()>0.5 ? 1:-1); };
-            this.updatePosition = function() {
-                this.x += Math.cos(this.direction) * this.speed;
-                this.y += Math.sin(this.direction) * this.speed;
-                this.checkBoundries();
-                this.decrimentTurn();
-            };
-        };
-
-        // Update the canvas size
-        var updateCanvasSize = function() {
-            var newWidth = Math.floor(header.width() / 2);
-            var newHeight = Math.floor(header.height() / 2);
-            if ((newWidth != width) || (newHeight != height) && (newHeight < 200)) {
-                width = newWidth;
-                height = newHeight;
-                canvas.attr("width", width);
-                canvas.attr("height", height);
-                canvas.css({width:(width*2)+"px", height:(height*2)+"px"});
-            }
-        }
-
-        // Animate the Particles
-        var drawParticles = function() {
-            updateCanvasSize();
-            ctx.clearRect(0, 0, width, height);
-            ctx.globalCompositeOperation = "lighter";
-            for (var i=0; i<particles.length; i++) {
-                var particle = particles[i];
-                particle.draw();
-                particle.updatePosition();
-            }
-        };
-
-        // Create an array or particles
-        if (isCanvasSupported()) {
-            updateCanvasSize();
-            var numparticles = Math.floor(width / 40);
-            for (var i=0; i<numparticles; i++) { particles.push(new Particle().init()); }
-            setInterval(drawParticles, 30);
-        }
-    });
-
-
-    /**
-     * Main Page Initialization
-     **/
-    $("a[data-tooltip]").tooltip({delay:{show:200, hide:50}});
-
-    // Apply Prettyprint to all code blocks
-    $(".article pre").prettyPrint();
-    $(".article p code").prettyPrint();
-    $(".article li code").prettyPrint();
-
-
-}(window.jQuery);

File themes/v2-hardwood/templates/base.html

     <script src="{{STATIC_URL}}shared/prettify-2009-12-03/lang-css.js"></script>
     <script src="{{STATIC_URL}}shared/showdown-0.9.js"></script>
     <script src="{{STATIC_URL}}shared/wysiwym/wysiwym/wysiwym.js"></script>
-    <script src="{{STATIC_URL}}js/pushingkarma.js"></script>
+
+    <script src="{{STATIC_URL}}js/pk.plugins.js"></script>
+    <script src="{{STATIC_URL}}js/pk.particles.js"></script>
+    <script src="{{STATIC_URL}}js/pk.init.js"></script>
     {% block extrajs %}{% endblock %}
   </body>
 </html>

File themes/v2-hardwood/templates/projects/jquery_wysiwym/wysiwym.html

       <!-- Wysiwym Editor -->
       <div id='wysiwym-demowrap' class='clearfix' style='margin-bottom:10px;'>
         {% anchor_header "h2" "Demo" "margin:20px 0px 10px 0px;" %}
-        <div>Edit the textarea to update the live preview below.</div>
+        <p>Edit the textarea to update the live preview below.</p>
         <textarea id='mytextarea' style='width:98%; height:250px; display:block;' wrap="off">{% include "projects/jquery_wysiwym/demo_input.txt" %}</textarea>
       </div>
       <div id='livepreview'></div>
 
 if (settings.SERVER_NAME == 'development'):
     urlpatterns = urlpatterns + patterns('',
-        (r'^media/(?P<path>.*)$', 'django.views.static.serve',
-            {'document_root': settings.MEDIA_ROOT, 'show_indexes': True},),
-        (r'^static/(?P<path>.*)$', 'django.views.static.serve',
-            {'document_root': settings.STATIC_ROOT, 'show_indexes': True},),
+        (r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True},),
+        (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes': True},),
     )