djangosnippets.org: Latest snippets tagged with 'js'https://djangosnippets.org/tags/js/2009-11-06T03:09:07.307181-06:00Google Closure support in django-compress
2009-11-06T03:09:07.307181-06:00fabrice.bonnyhttps://djangosnippets.org/snippets/1785/<p>A filter to integrate Google Closure compiler in django-compress plugin.
</p>
<ol>
<li>
<a href="http://code.google.com/p/django-compress/">download django-compress</a>
</li>
<li>
install it
</li>
<li>
<a href="http://code.google.com/closure/compiler">download Closure Compiler</a>
</li>
<li>
put the jar at the root of your project
</li>
<li>
put this snippet as a <strong><strong>init</strong>.py</strong> file in a <strong>google_closure</strong> directory in the filters directory of the plugin
</li>
<li>
add <code>COMPRESS_JS_FILTERS = ('compress.filters.google_closure.GoogleClosureCompilerFilter',)</code> to …</li></ol>
Freely redistributableMinify JS template tag
2008-08-09T13:11:03.345519-05:00julianhttps://djangosnippets.org/snippets/953/<p>Uses JSMin. Python version available from
<a href="http://www.crockford.com/javascript/jsmin.py.txt">http://www.crockford.com/javascript/jsmin.py.txt</a></p>
<p>Provides template tags to minify JavaScript on the fly.</p>
<p><code>{% minifyjs %}[code]{% endminifyjs %}</code></p>
Freely redistributableversioned_media templatetag
2008-08-06T11:16:39.384733-05:00dnordberghttps://djangosnippets.org/snippets/946/<p>Best practice based on <a href="http://developer.yahoo.com/yslow/">YSlow recommendations</a>, add the following to your Apache config for your media directory.</p>
<pre><code><Directory /home/.../site_media/>
...
FileETag None
ExpiresActive on
ExpiresDefault "access plus 10 years"
AddOutputFilterByType DEFLATE text/css application/x-javascript
</Directory`
</code></pre>
<p>Make sure to enable mod_deflate and mod_expires.</p>
Freely redistributableJavascript Chain Select Widget
2008-06-02T10:19:39.533473-05:00ogohttps://djangosnippets.org/snippets/782/<p>This widget will render a chained select menu powered by JavaScript to make it easier to identify foreign keys. This widget includes danjak's form decorator (http://www.djangosnippets.org/snippets/59/), and Xin Yang's chained select javascript functions (http://www.yxscripts.com/).</p>
<p>I developed this to be used with an IT inventory system. See screenshot here: http://bayimg.com/cAjAGAabN
The …</p>
Freely redistributable