<commit_before>$(document).ready(function () {

	$("#messageList").scrollTop($("#messageList")[0].scrollHeight);
	var currentURL;
  var usersname = "a";
	chrome.tabs.getSelected(null, function(tab) {

	currentURL = tab.url;
	currentURL = currentURL.split("/");
	if(currentURL[2] != "ctools.umich.edu")
	{
		$("body").html("GO TO CTOOLS");
	}
	currentURL = currentURL.pop();
	currentURL = currentURL.split("-");
	currentURL = currentURL.pop();

	var tabTitle = tab.title;
	tabTitle = tabTitle.split(":");
	tabTitle = tabTitle[1];
	helpme();

	//currentURL = currentURL.split("/").pop();
    document.getElementById('currentLink').innerHTML = tabTitle;
});

$("#nameButton").click(function(){


  usersname = $("#nameval").val();


});



// Initialize the PubNub API connection.
function helpme(){
var pubnub = PUBNUB.init({
publish_key: '<KEY>',
subscribe_key: 'sub-c-f02d84f8-357b-11e4-afa1-02ee2ddab7fe'

});
 
   function PubNub() {
    this.publishKey = '<KEY>';
    this.subscribeKey = 'sub-c-f02d84f8-357b-11e4-afa1-02ee2ddab7fe';
    this.subscriptions = localStorage["pn-subscriptions"] || [];

    if(typeof this.subscriptions == "string") {
      this.subscriptions = this.subscriptions.split(",");
    }
    this.subscriptions = $.unique(this.subscriptions);
  }

  PubNub.prototype.connect = function(username) {
    this.username = username;
    this.connection = PUBNUB.init({
      publish_key: this.publishKey,
      subscribe_key: this.subscribeKey,
      uuid: this.username
    });
  };

  PubNub.prototype.addSubscription = function(channel) {
    this.subscriptions.push(channel);
    this.subscriptions = $.unique(this.subscriptions);
  };

  PubNub.prototype.removeSubscription = function(channel) {
    if (this.subscriptions.indexOf(channel) !== -1) {
      this.subscriptions.splice(this.subscriptions.indexOf(channel), 1);
    }
    this.saveSubscriptions();
  };

  PubNub.prototype.saveSubscriptions = function() {
    localStorage["pn-subscriptions"] = this.subscriptions;
  };

  PubNub.prototype.subscribe = function(options) {
    this.connection.subscribe.apply(this.connection, arguments);
    this.addSubscription(options.channel);
    this.saveSubscriptions();
  };

  PubNub.prototype.unsubscribe = function(options) {
    this.connection.unsubscribe.apply(this.connection, arguments);
  };

  PubNub.prototype.publish = function() {
    this.connection.publish.apply(this.connection, arguments);
  };

  PubNub.prototype.history = function() {
    this.connection.history.apply(this.connection, arguments);
  };


// Grab references for all of our elements.
var messageContent = $('#messageContent'),
sendMessageButton = $('#sendMessageButton'),
messageList = $('#messageList');
 
// Handles all the messages coming in from pubnub.subscribe.
function handleMessage(message) {
var messageEl = $("<li class='message'>"
+ "<span class='username'>" + message.username + ": </span>"
+ message.text
+ "</li>");
messageList.append(messageEl);
messageList.listview('refresh');


$("#messageList").scrollTop(($("#messageList")[0].scrollHeight));


 
// Scroll to bottom of page
 $("html, body").animate({ scrollTop: $(document).height() - $(window).height() }, 'slow');
};
 
// Compose and send a message when the user clicks our send message button.

var chatChannel = currentURL, 
chatRoomName = $('#chatRoomName'),
charListEl = $('#chatList'),
subscriptions = [],
pages = {
chatList: $("#chatListPage"),
chat: $("#chatPage")
};


sendMessageButton.click(function (event) {


var message = messageContent.val();
 
if (message != '') {
pubnub.publish({
channel: chatChannel,
message: {
username: usersname,
text: message
}
});
 
messageContent.val("");


}
});
 
// Also send a message when the user hits the enter button in the text area.
messageContent.bind('keydown', function (event) {
if((event.keyCode || event.charCode) !== 13) return true;
sendMessageButton.click();
return false;
});
 
// Subscribe to messages coming in from the channel.
pubnub.subscribe({
channel: chatChannel,
message: handleMessage
});
 

pubnub.history({
channel: chatChannel,
limit: 100
}, function (messages) {
messages = messages[0];
messages = messages || [];
 
for(var i = 0; i < messages.length; i++) {
handleMessage(messages[i], false);
}
 
});

};


});<commit_msg>small bug fix<commit_after>$(document).ready(function () {

	$("#messageList").scrollTop($("#messageList")[0].scrollHeight);
	var currentURL;
  var usersname = "a";
	chrome.tabs.getSelected(null, function(tab) {

	currentURL = tab.url;
	currentURL = currentURL.split("/");
	if(currentURL[2] != "ctools.umich.edu")
	{
		$("body").html("GO TO CTOOLS");
	}
	currentURL = currentURL.pop();
	currentURL = currentURL.split("-");
	currentURL = currentURL.pop();

	var tabTitle = tab.title;
	tabTitle = tabTitle.split(":");
	tabTitle = tabTitle[1];
	helpme();

	//currentURL = currentURL.split("/").pop();
    document.getElementById('currentLink').innerHTML = tabTitle;
});

$("#nameButton").click(function(){


  usersname = $("#nameval").val();
  $("#nameval").val('');



});



// Initialize the PubNub API connection.
function helpme(){
var pubnub = PUBNUB.init({
publish_key: '<KEY>',
subscribe_key: 'sub-c-f02d84f8-357b-11e4-afa1-02ee2ddab7fe'

});
 
   function PubNub() {
    this.publishKey = '<KEY>';
    this.subscribeKey = 'sub-c-f02d84f8-357b-11e4-afa1-02ee2ddab7fe';
    this.subscriptions = localStorage["pn-subscriptions"] || [];

    if(typeof this.subscriptions == "string") {
      this.subscriptions = this.subscriptions.split(",");
    }
    this.subscriptions = $.unique(this.subscriptions);
  }

  PubNub.prototype.connect = function(username) {
    this.username = username;
    this.connection = PUBNUB.init({
      publish_key: this.publishKey,
      subscribe_key: this.subscribeKey,
      uuid: this.username
    });
  };

  PubNub.prototype.addSubscription = function(channel) {
    this.subscriptions.push(channel);
    this.subscriptions = $.unique(this.subscriptions);
  };

  PubNub.prototype.removeSubscription = function(channel) {
    if (this.subscriptions.indexOf(channel) !== -1) {
      this.subscriptions.splice(this.subscriptions.indexOf(channel), 1);
    }
    this.saveSubscriptions();
  };

  PubNub.prototype.saveSubscriptions = function() {
    localStorage["pn-subscriptions"] = this.subscriptions;
  };

  PubNub.prototype.subscribe = function(options) {
    this.connection.subscribe.apply(this.connection, arguments);
    this.addSubscription(options.channel);
    this.saveSubscriptions();
  };

  PubNub.prototype.unsubscribe = function(options) {
    this.connection.unsubscribe.apply(this.connection, arguments);
  };

  PubNub.prototype.publish = function() {
    this.connection.publish.apply(this.connection, arguments);
  };

  PubNub.prototype.history = function() {
    this.connection.history.apply(this.connection, arguments);
  };


// Grab references for all of our elements.
var messageContent = $('#messageContent'),
sendMessageButton = $('#sendMessageButton'),
messageList = $('#messageList');
 
// Handles all the messages coming in from pubnub.subscribe.
function handleMessage(message) {
var messageEl = $("<li class='message'>"
+ "<span class='username'>" + message.username + ": </span>"
+ message.text
+ "</li>");
messageList.append(messageEl);
messageList.listview('refresh');


$("#messageList").scrollTop(($("#messageList")[0].scrollHeight));


 
// Scroll to bottom of page
 $("html, body").animate({ scrollTop: $(document).height() - $(window).height() }, 'slow');
};
 
// Compose and send a message when the user clicks our send message button.

var chatChannel = currentURL, 
chatRoomName = $('#chatRoomName'),
charListEl = $('#chatList'),
subscriptions = [],
pages = {
chatList: $("#chatListPage"),
chat: $("#chatPage")
};


sendMessageButton.click(function (event) {


var message = messageContent.val();
 
if (message != '') {
pubnub.publish({
channel: chatChannel,
message: {
username: usersname,
text: message
}
});
 
messageContent.val("");


}
});
 
// Also send a message when the user hits the enter button in the text area.
messageContent.bind('keydown', function (event) {
if((event.keyCode || event.charCode) !== 13) return true;
sendMessageButton.click();
return false;
});
 
// Subscribe to messages coming in from the channel.
pubnub.subscribe({
channel: chatChannel,
message: handleMessage
});
 

pubnub.history({
channel: chatChannel,
limit: 100
}, function (messages) {
messages = messages[0];
messages = messages || [];
 
for(var i = 0; i < messages.length; i++) {
handleMessage(messages[i], false);
}
 
});

};


});
{'fraction_non_alphanumeric': 0.17124243834341554, 'fraction_numerical': 0.010469986040018614, 'mean_word_length': 4.517971758664955, 'pattern_counts': {'":': 4, '<': 17, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4752301', 'n_tokens_mistral': 2785, 'n_tokens_neox': 2670, 'n_words': 529}