Permalink
Browse files

Build 0.0.33 - Updating copyright

  • Loading branch information...
1 parent 0bb9040 commit 76761815b79e03a0780668bbe95c57acc136bdd9 @draeton committed Feb 21, 2013
View
@@ -1,4 +1,4 @@
-Copyright (c) 2011, Matthew Cobbs
+Copyright (c) 2013, Matthew Cobbs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,28 +1,28 @@
## Lockdown
[Lockdown](http://draeton.github.com/lockdown/) obfuscates code snippets by writing them to the canvas.
-The current version is `0.0.32`. Documentation is available
+The current version is `0.0.33`. Documentation is available
[here](http://draeton.github.com/lockdown/lockdown/docs/lockdown.html).
## Implementation
Place jQuery, the Lockdown script and the Lockdown stylesheet on the page:
- <link rel="stylesheet" href="css/lockdown-0.0.32-min.css">
+ <link rel="stylesheet" href="css/lockdown-0.0.33-min.css">
<script src="js/jquery-1.7.1.min.js"></script>
<script src="js/modernizr-2.0.6.min.js"></script>
- <script src="js/lockdown-0.0.32-min.js"></script>
+ <script src="js/lockdown-0.0.33-min.js"></script>
Once that's in place, you may replace code blocks using the `Lockdown.lock` method:
Modernizr.load([
- "js/lockdown-0.0.32-min.js",
+ "js/lockdown-0.0.33-min.js",
{
test: Modernizr.canvas,
nope: "js/flashcanvas/flashcanvas.js",
complete: function () {
$(function () {
-
+
var $elements = $("pre.code");
var options = {
jsdir: "lockdown/build/js",
@@ -31,7 +31,7 @@ Once that's in place, you may replace code blocks using the `Lockdown.lock` meth
};
Lockdown.init( options );
Lockdown.lock( $elements );
-
+
});
}
}
@@ -45,7 +45,7 @@ jQuery 1.7+, Modernizr; *Flashcanvas for older browser support*
(The MIT License)
-Copyright (c) 2011, <[Matthew Cobbs](mailto:draeton@gmail.com)>
+Copyright (c) 2013, <[Matthew Cobbs](mailto:draeton@gmail.com)>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -22,7 +22,7 @@ Once that's in place, you may replace code blocks using the `Lockdown.lock` meth
nope: "js/flashcanvas/flashcanvas.js",
complete: function () {
$(function () {
-
+
var $elements = $("pre.code");
var options = {
jsdir: "lockdown/build/js",
@@ -31,7 +31,7 @@ Once that's in place, you may replace code blocks using the `Lockdown.lock` meth
};
Lockdown.init( options );
Lockdown.lock( $elements );
-
+
});
}
}
@@ -45,7 +45,7 @@ jQuery 1.7+, Modernizr; *Flashcanvas for older browser support*
(The MIT License)
-Copyright (c) 2011, <[Matthew Cobbs](mailto:draeton@gmail.com)>
+Copyright (c) 2013, <[Matthew Cobbs](mailto:draeton@gmail.com)>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -1,4 +1,4 @@
-#Thu, 21 Feb 2013 04:03:56 -0500
+#Thu, 21 Feb 2013 04:05:55 -0500
build.major=0
build.minor=0
-build.number=32
+build.number=33
@@ -3,6 +3,6 @@
* Obfuscates code snippets by writing them to the canvas
* http://draeton.github.com/lockdown
*
- * Copyright 2011, Matthew Cobbs
+ * Copyright 2013, Matthew Cobbs
* Licensed under the MIT license.
*/canvas.lockdown{outline:1px dotted black;display:block;clear:both;margin-bottom:18px}canvas.lockdown:hover{outline:1px dotted #aaa}
@@ -3,7 +3,7 @@
* Obfuscates code snippets by writing them to the canvas
* http://draeton.github.com/lockdown
*
- * Copyright 2011, Matthew Cobbs
+ * Copyright 2013, Matthew Cobbs
* Licensed under the MIT license.
*/
canvas.lockdown {
File renamed without changes.
@@ -1,9 +1,9 @@
// ## Lockdown
-//
+//
// Obfuscates code snippets by writing them to the canvas
// [http://draeton.github.com/lockdown](http://draeton.github.com/lockdown)
//
-// Copyright 2011, Matthew Cobbs
+// Copyright 2013, Matthew Cobbs
// Licensed under the MIT license.
//
/*global jQuery, FlashCanvas*/
@@ -21,20 +21,20 @@
font : "12px Courier",
baseline : "top",
yoffset : (24 - 12) / 2 - 2,
-
+
/* font colors */
linecolor : "blue",
codecolor : "black",
rowcolor : "LightCyan",
-
+
/* text start position */
top : 10,
left : 15,
indent : 8,
-
+
/* canvas width */
width : 600,
-
+
/* lines to remove from code before drawing */
filterexp : null
}
@@ -53,34 +53,34 @@
// ## Lockdown prototype
Lockdown.prototype = {
// ### init
- //
+ //
// Update the settings object, perhaps when styling
// a new section of code blocks
init: function (options) {
this.settings = $.extend({}, defaults, options);
},
-
+
// ### lock
- //
+ //
// Loop through each element to replace the code
// blocks with canvas elements
//
// @param {jQuery} $elements Set of nodes to lock down
// @return {jQuery} The locked down canvas nodes
lock: function ($elements) {
var self = this;
-
+
if ($elements) {
$elements = $elements.map(function (i, element) {
return self._replaceCodeBlock(element);
});
}
-
+
return $elements;
},
// ### *_getCode*
- //
+ //
// Decode the base64 encoded code,
// get the code text as an array of lines,
// filter out the garbage lines
@@ -98,20 +98,20 @@
/* remove whitespace and split on new lines */
var code = $.trim(innerText).split("\n");
-
+
/* if there is a filterexp regexp, filter lines */
if (s.filterexp) {
code = $.grep(code, function (line, i) {
return !s.filterexp.test(line);
});
}
-
+
/* return the array of code lines */
return code;
},
// ### *_getCanvas*
- //
+ //
// Create the canvas element with height for the # of lines;
// FlashCanvas for IE support
//
@@ -134,9 +134,9 @@
},
// ### *_writeText*
- //
+ //
// Write a piece of text to the canvas
- //
+ //
// @param {CanvasRenderingContext2D} context
// @param {String} text Text to write to context
// @param {Number} x X-position
@@ -154,17 +154,17 @@
},
// ### *_writeTextRight*
- //
+ //
// Curry `_writeText` to align text to the right
_writeTextRight: function (context, text, x, y, color) {
this._writeText(context, text, x, y, color, "right");
},
// ### *_writeLine*
- //
+ //
// Write the line number;
// write the code
- //
+ //
// @param {CanvasRenderingContext2D} context
// @param {Number} i Line number
// @param {String} line Line text
@@ -186,11 +186,11 @@
},
// ### *_replaceCodeBlock*
- //
+ //
// Parse the code from the pre element;
// place and get the canvas;
// get the drawing context
- //
+ //
// @param {HTMLElement} element
// @return {jQuery} Wrapped canvas node
_replaceCodeBlock: function (element) {
@@ -209,13 +209,13 @@
/* replace the element */
$(element).replaceWith(canvas);
-
+
/* get the drawing context and starting drawing lines */
var context = canvas.getContext("2d");
$.each(code, function (i, line) {
self._writeLine(context, i, line);
});
-
+
/* return the canvas with the code added to DOM data and a class of `lockdown` */
$canvas.data("code", code.join("\n")).addClass("lockdown");
return $canvas;
View
Binary file not shown.
View
@@ -3,7 +3,7 @@
<p>Obfuscates code snippets by writing them to the canvas
<a href="http://draeton.github.com/lockdown">http://draeton.github.com/lockdown</a></p>
-<p>Copyright 2011, Matthew Cobbs <br />
+<p>Copyright 2013, Matthew Cobbs
Licensed under the MIT license.</p> </td> <td class="code"> <div class="highlight"><pre><span class="cm">/*global jQuery, FlashCanvas*/</span>
<span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nb">window</span><span class="p">,</span> <span class="nx">$</span><span class="p">)</span> <span class="p">{</span>
@@ -19,20 +19,20 @@
<span class="nx">font</span> <span class="o">:</span> <span class="s2">&quot;12px Courier&quot;</span><span class="p">,</span>
<span class="nx">baseline</span> <span class="o">:</span> <span class="s2">&quot;top&quot;</span><span class="p">,</span>
<span class="nx">yoffset</span> <span class="o">:</span> <span class="p">(</span><span class="mi">24</span> <span class="o">-</span> <span class="mi">12</span><span class="p">)</span> <span class="o">/</span> <span class="mi">2</span> <span class="o">-</span> <span class="mi">2</span><span class="p">,</span>
-
+
<span class="cm">/* font colors */</span>
<span class="nx">linecolor</span> <span class="o">:</span> <span class="s2">&quot;blue&quot;</span><span class="p">,</span>
<span class="nx">codecolor</span> <span class="o">:</span> <span class="s2">&quot;black&quot;</span><span class="p">,</span>
<span class="nx">rowcolor</span> <span class="o">:</span> <span class="s2">&quot;LightCyan&quot;</span><span class="p">,</span>
-
+
<span class="cm">/* text start position */</span>
<span class="nx">top</span> <span class="o">:</span> <span class="mi">10</span><span class="p">,</span>
<span class="nx">left</span> <span class="o">:</span> <span class="mi">15</span><span class="p">,</span>
<span class="nx">indent</span> <span class="o">:</span> <span class="mi">8</span><span class="p">,</span>
-
+
<span class="cm">/* canvas width */</span>
<span class="nx">width</span> <span class="o">:</span> <span class="mi">600</span><span class="p">,</span>
-
+
<span class="cm">/* lines to remove from code before drawing */</span>
<span class="nx">filterexp</span> <span class="o">:</span> <span class="kc">null</span>
<span class="p">}</span>
@@ -58,7 +58,7 @@
<span class="nx">init</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">settings</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">extend</span><span class="p">({},</span> <span class="nx">defaults</span><span class="p">,</span> <span class="nx">options</span><span class="p">);</span>
<span class="p">},</span>
-
+
</pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <h3>lock</h3>
<p>Loop through each element to replace the code
@@ -69,13 +69,13 @@
</code></pre> </td> <td class="code"> <div class="highlight"><pre>
<span class="nx">lock</span><span class="o">:</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">$elements</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">self</span> <span class="o">=</span> <span class="k">this</span><span class="p">;</span>
-
+
<span class="k">if</span> <span class="p">(</span><span class="nx">$elements</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">$elements</span> <span class="o">=</span> <span class="nx">$elements</span><span class="p">.</span><span class="nx">map</span><span class="p">(</span><span class="kd">function</span> <span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="nx">element</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="nx">self</span><span class="p">.</span><span class="nx">_replaceCodeBlock</span><span class="p">(</span><span class="nx">element</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">}</span>
-
+
<span class="k">return</span> <span class="nx">$elements</span><span class="p">;</span>
<span class="p">},</span>
@@ -99,14 +99,14 @@
<span class="cm">/* remove whitespace and split on new lines */</span>
<span class="kd">var</span> <span class="nx">code</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">trim</span><span class="p">(</span><span class="nx">innerText</span><span class="p">).</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;\n&quot;</span><span class="p">);</span>
-
+
<span class="cm">/* if there is a filterexp regexp, filter lines */</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">s</span><span class="p">.</span><span class="nx">filterexp</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">code</span> <span class="o">=</span> <span class="nx">$</span><span class="p">.</span><span class="nx">grep</span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">line</span><span class="p">,</span> <span class="nx">i</span><span class="p">)</span> <span class="p">{</span>
<span class="k">return</span> <span class="o">!</span><span class="nx">s</span><span class="p">.</span><span class="nx">filterexp</span><span class="p">.</span><span class="nx">test</span><span class="p">(</span><span class="nx">line</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">}</span>
-
+
<span class="cm">/* return the array of code lines */</span>
<span class="k">return</span> <span class="nx">code</span><span class="p">;</span>
<span class="p">},</span>
@@ -214,13 +214,13 @@
<span class="cm">/* replace the element */</span>
<span class="nx">$</span><span class="p">(</span><span class="nx">element</span><span class="p">).</span><span class="nx">replaceWith</span><span class="p">(</span><span class="nx">canvas</span><span class="p">);</span>
-
+
<span class="cm">/* get the drawing context and starting drawing lines */</span>
<span class="kd">var</span> <span class="nx">context</span> <span class="o">=</span> <span class="nx">canvas</span><span class="p">.</span><span class="nx">getContext</span><span class="p">(</span><span class="s2">&quot;2d&quot;</span><span class="p">);</span>
<span class="nx">$</span><span class="p">.</span><span class="nx">each</span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="kd">function</span> <span class="p">(</span><span class="nx">i</span><span class="p">,</span> <span class="nx">line</span><span class="p">)</span> <span class="p">{</span>
<span class="nx">self</span><span class="p">.</span><span class="nx">_writeLine</span><span class="p">(</span><span class="nx">context</span><span class="p">,</span> <span class="nx">i</span><span class="p">,</span> <span class="nx">line</span><span class="p">);</span>
<span class="p">});</span>
-
+
<span class="cm">/* return the canvas with the code added to DOM data and a class of `lockdown` */</span>
<span class="nx">$canvas</span><span class="p">.</span><span class="nx">data</span><span class="p">(</span><span class="s2">&quot;code&quot;</span><span class="p">,</span> <span class="nx">code</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s2">&quot;\n&quot;</span><span class="p">)).</span><span class="nx">addClass</span><span class="p">(</span><span class="s2">&quot;lockdown&quot;</span><span class="p">);</span>
<span class="k">return</span> <span class="nx">$canvas</span><span class="p">;</span>
View
@@ -3,7 +3,7 @@
* Obfuscates code snippets by writing them to the canvas
* http://draeton.github.com/lockdown
*
- * Copyright 2011, Matthew Cobbs
+ * Copyright 2013, Matthew Cobbs
* Licensed under the MIT license.
*/
canvas.lockdown {
Oops, something went wrong.

0 comments on commit 7676181

Please sign in to comment.