aboutsummaryrefslogtreecommitdiff
path: root/source/javascripts/octopress.js
diff options
context:
space:
mode:
authorB Mathis <brandon@imathis.com>2009-11-12 10:19:36 -0600
committerB Mathis <brandon@imathis.com>2009-11-12 10:19:36 -0600
commit1eddd60a716accb9252600202b79f25a7ceda904 (patch)
treef32be4dc9def10bb206b6be792ab638160d6f39f /source/javascripts/octopress.js
parent790d5a447cf732a2f3f336c4984ef9a386fd155a (diff)
downloadmy_new_personal_website-1eddd60a716accb9252600202b79f25a7ceda904.tar.xz
my_new_personal_website-1eddd60a716accb9252600202b79f25a7ceda904.zip
updated syntax style, added javascript for expanding code blocks
Diffstat (limited to 'source/javascripts/octopress.js')
-rw-r--r--source/javascripts/octopress.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/source/javascripts/octopress.js b/source/javascripts/octopress.js
new file mode 100644
index 00000000..300d9c6a
--- /dev/null
+++ b/source/javascripts/octopress.js
@@ -0,0 +1,34 @@
+window.addEvent('domready', function() {
+ addPreExpanders();
+});
+
+function addPreExpanders(){
+ $$('div.highlight').each(function(div){
+ addExpander(div);
+ });
+}
+function addExpander(div){
+ new Element('span',{
+ html: 'expand &raquo;',
+ 'class': 'pre_expander',
+ 'styles': {
+ 'display': 'block'
+ },
+ 'events': {
+ 'click': function(){
+ toggleExpander();
+ }
+ }
+ }).inject(div, 'top');
+}
+function toggleExpander(){
+ var html = '';
+ if($('main').toggleClass('expanded').hasClass('expanded')){
+ html = '&laquo; contract';
+ } else {
+ html = 'expand &raquo;';
+ }
+ $$('div.highlight span.pre_expander').each(function(span){
+ span.set('html',html);
+ });
+} \ No newline at end of file