Commits

Marcin Kuzminski committed 4debfe3

ie8 fixes for inline comments :/

  • Participants
  • Parent commits 4565e65

Comments (0)

Files changed (1)

File rhodecode/public/js/rhodecode.js

     };
 }
 
+// IE(CRAP) doesn't support previousElementSibling
+var prevElementSibling = function( el ) {
+    if( el.previousElementSibling ) {
+        return el.previousElementSibling;
+    } else {
+        while( el = el.previousSibling ) {
+            if( el.nodeType === 1 ) return el;
+        }
+    }
+}
+
+
+
+
 /**
  * SmartColorGenerator
  *
 		  tooltip_activate();
 		  MentionsAutoComplete('text_'+lineno, 'mentions_container_'+lineno, 
 	                         _USERS_AC_DATA, _GROUPS_AC_DATA);
-		  YUD.get('text_'+lineno).focus();
+		  var _e = YUD.get('text_'+lineno);
+		  if(_e){
+			  _e.focus();
+		  }
 	  },10)
 };
 
     var postData = {'_method':'delete'};
     var success = function(o){
         var n = YUD.get('comment-tr-'+comment_id);
-        var root = n.previousElementSibling.previousElementSibling;
+        var root = prevElementSibling(prevElementSibling(n));
         n.parentNode.removeChild(n);
 
         // scann nodes, and attach add button to last one
 		return [null, null];
     };
     
-	ownerAC.textboxKeyUpEvent.subscribe(function(type, args){
-		
-		var ac_obj = args[0];
-		var currentMessage = args[1];
-		var currentCaretPosition = args[0]._elTextbox.selectionStart;
-
-		var unam = ownerAC.get_mention(currentMessage, currentCaretPosition); 
-		var curr_search = null;
-		if(unam[0]){
-			curr_search = unam[0];
-		}
-		
-		ownerAC.dataSource.chunks = unam[1];
-		ownerAC.dataSource.mentionQuery = curr_search;
-
-	})
-
+    if (ownerAC.textboxKeyUpEvent){
+		ownerAC.textboxKeyUpEvent.subscribe(function(type, args){
+			
+			var ac_obj = args[0];
+			var currentMessage = args[1];
+			var currentCaretPosition = args[0]._elTextbox.selectionStart;
+	
+			var unam = ownerAC.get_mention(currentMessage, currentCaretPosition); 
+			var curr_search = null;
+			if(unam[0]){
+				curr_search = unam[0];
+			}
+			
+			ownerAC.dataSource.chunks = unam[1];
+			ownerAC.dataSource.mentionQuery = curr_search;
+	
+		})
+	}	
     return {
         ownerDS: ownerDS,
         ownerAC: ownerAC,