Commits

Christopher Grebs committed b1c74de

Bugfix: info message if multi-file is selected was shown everytime, this commit fixes this and displays that info only if multi-file type is selected. Thanks jefferai for the report

Comments (0)

Files changed (1)

lodgeit/static/lodgeit.js

  * addes fancy and annoying javascript effects to that page
  * but hey. now it's web2.0!!!!111
  */
+
+String.prototype.startsWith = function(str){
+    return (this.indexOf(str) === 0);
+}
+
 var LodgeIt = {
 
   _toggleLock : false,
       // small workaround in order to not slow firefox down
       submitform.css('opacity', 'inherit');
     });
-
-    /**
-     * information about the multifile thing
-     */
-    var multiFileInfo = $('#multi-file-information').hide();
-    $('form.submitform select[name="language"]')
-      .change(function() {
-        if (this.value == 'multi')
-          multiFileInfo.fadeIn();
-        else
-          multiFileInfo.fadeOut('fast');
-      }).change();
   },
 
 
   var languages = [];
   var ids = [];
 
+  var multiFileInfo = $('#multi-file-information').hide();
+
   $('form.submitform select[name="language"] option').each(function() {
     ids.push($(this).val());
     languages.push($(this).text());
 
   var new_input = $('<input type="text" name="language" value="Text only">')
     .autocomplete(languages)
+    .result(function(event, data) {
+      if (data[0].toLowerCase().startsWith('multi'))
+        multiFileInfo.fadeIn();
+      else
+        multiFileInfo.fadeOut('fast');
+    })
     .click(function() { $(this).val(''); });
   $('form.submitform select[name="language"]').replaceWith($(new_input));
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.