Skip to content
This repository
Browse code

Removing prototype and just using vanilla js

  • Loading branch information...
commit cefe723e285f20d1f2a33f67da03348568f7e0b0 1 parent d78e3fe
Mikel Lindsaar authored March 03, 2010
34  railties/lib/generators/rails/app/templates/public/index.html
@@ -181,27 +181,27 @@
181 181
       }
182 182
 
183 183
     </style>
184  
-    <script type="text/javascript" src="javascripts/prototype.js"></script>
185  
-    <script type="text/javascript" src="javascripts/effects.js"></script>
186 184
     <script type="text/javascript">
187 185
       function about() {
188  
-        if (Element.empty('about-content')) {
189  
-          new Ajax.Updater('about-content', 'rails/info/properties', {
190  
-            method:     'get',
191  
-            onFailure:  function() {Element.classNames('about-content').add('failure')},
192  
-            onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
193  
-          });
194  
-        } else {
195  
-          new Effect[Element.visible('about-content') ?
196  
-            'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
197  
-        }
  186
+        info = document.getElementById('about-content');
  187
+        if (window.XMLHttpRequest)
  188
+          { xhr = new XMLHttpRequest(); }
  189
+        else
  190
+          { xhr = new ActiveXObject("Microsoft.XMLHTTP"); }
  191
+        xhr.open("GET","rails/info/properties",false);
  192
+        xhr.send("");
  193
+        info.innerHTML = xhr.responseText;
  194
+        info.style.display = 'block'
  195
+      }
  196
+
  197
+      function prepend() {
  198
+        search = document.getElementById('search-text');
  199
+        text = search.value;
  200
+        search.value = 'site:rubyonrails.org ' + text;
198 201
       }
199 202
 
200 203
       window.onload = function() {
201  
-        $('search-text').value = '';
202  
-        $('search').onsubmit = function() {
203  
-          $('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
204  
-        }
  204
+        document.getElementById('search-text').value = '';
205 205
       }
206 206
     </script>
207 207
   </head>
@@ -210,7 +210,7 @@
210 210
       <div id="sidebar">
211 211
         <ul id="sidebar-items">
212 212
           <li>
213  
-            <form id="search" action="http://www.google.com/search" method="get">
  213
+            <form id="search" action="http://www.google.com/search" method="get" onSubmit="prepend();">
214 214
               <input type="hidden" name="hl" value="en" />
215 215
               <input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
216 216
               <input type="submit" value="Search" /> the Rails site

0 notes on commit cefe723

Please sign in to comment.
Something went wrong with that request. Please try again.