diff options
| author | hukl <contact@smyck.org> | 2009-08-08 16:54:22 +0200 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-08-08 16:54:22 +0200 |
| commit | 0f45522f8713c51080f6ae18430ad31426a2e399 (patch) | |
| tree | 88263c0ba2babf74220d22cea9c853d25d516367 /public/javascripts | |
| parent | 479010bfa7e4dcb8ec14e4df51c24c96deb397a3 (diff) | |
encapsulated javascript magic into objects
Diffstat (limited to 'public/javascripts')
| -rw-r--r-- | public/javascripts/admin_interface.js | 38 | ||||
| -rw-r--r-- | public/javascripts/admin_search.js | 9 |
2 files changed, 28 insertions, 19 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index f890afb..62801ca 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -1,23 +1,6 @@ | |||
| 1 | $(document).ready(function () { | 1 | $(document).ready(function () { |
| 2 | $("#search_widget").hide(); | 2 | admin_search.initialize(); |
| 3 | 3 | meta_data.initialize(); | |
| 4 | $(document).bind("keydown", 'Alt+f', function(){ | ||
| 5 | admin_search.display_toggle(); | ||
| 6 | return false; | ||
| 7 | }); | ||
| 8 | |||
| 9 | $("#metadata").attr("style", "display: none;"); | ||
| 10 | |||
| 11 | $("#button").click(function () { | ||
| 12 | $("#metadata").slideToggle("slow"); | ||
| 13 | |||
| 14 | if ($("#button").attr("class") == "unselected") { | ||
| 15 | $("#button").attr("class", "selected"); | ||
| 16 | } | ||
| 17 | else { | ||
| 18 | $("#button").attr("class", "unselected"); | ||
| 19 | } | ||
| 20 | }); | ||
| 21 | 4 | ||
| 22 | jQuery.ajaxSetup({ | 5 | jQuery.ajaxSetup({ |
| 23 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} | 6 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} |
| @@ -26,6 +9,23 @@ $(document).ready(function () { | |||
| 26 | }); | 9 | }); |
| 27 | 10 | ||
| 28 | 11 | ||
| 12 | meta_data = { | ||
| 13 | initialize : function() { | ||
| 14 | $("#metadata").attr("style", "display: none;"); | ||
| 15 | |||
| 16 | $("#button").click(function () { | ||
| 17 | $("#metadata").slideToggle("slow"); | ||
| 18 | |||
| 19 | if ($("#button").attr("class") == "unselected") { | ||
| 20 | $("#button").attr("class", "selected"); | ||
| 21 | } | ||
| 22 | else { | ||
| 23 | $("#button").attr("class", "unselected"); | ||
| 24 | } | ||
| 25 | }); | ||
| 26 | } | ||
| 27 | }; | ||
| 28 | |||
| 29 | cccms = { | 29 | cccms = { |
| 30 | setup_autosave : function() { | 30 | setup_autosave : function() { |
| 31 | 31 | ||
diff --git a/public/javascripts/admin_search.js b/public/javascripts/admin_search.js index e339c49..28f87a0 100644 --- a/public/javascripts/admin_search.js +++ b/public/javascripts/admin_search.js | |||
| @@ -1,5 +1,14 @@ | |||
| 1 | admin_search = { | 1 | admin_search = { |
| 2 | 2 | ||
| 3 | initialize : function() { | ||
| 4 | $("#search_widget").hide(); | ||
| 5 | |||
| 6 | $(document).bind("keydown", 'Alt+f', function(){ | ||
| 7 | admin_search.display_toggle(); | ||
| 8 | return false; | ||
| 9 | }); | ||
| 10 | }, | ||
| 11 | |||
| 3 | display_toggle : function() { | 12 | display_toggle : function() { |
| 4 | if ($('#search_widget').css("display") != "none") { | 13 | if ($('#search_widget').css("display") != "none") { |
| 5 | $('#search_widget').fadeOut(); | 14 | $('#search_widget').fadeOut(); |
