Youtube Comments

Subscribe to Youtube Comments 16 posts, 4 voices

 
Matrix0191 User

I Would Love A Script To Expand All The Comments On The Page Like The YousableTubeFix Script but without all the extras ... i have tried editing that script but no luck

http://userscripts.org/scripts/show/13333

 
no0n Scriptwright

That script is pretty well documented and I don't see anything about expanding all the comments. I see expanding the video information, I see making more comments per page (500). Can't get on youtube right now so I can't check

 
Matrix0191 User

Yea That Is What I Want .. All I Want From That Script Is The Comment Part ... What It Does Is Displays 500 Comments On One Page Instead Of Multiple Pages

 
no0n Scriptwright

I don't like ripping off people's scripts so I will only paste the chopped up version's source instead of uploading it here. I haven't tested this and can't test it until later. I've browsed through it a few times, looks okay to me, but its probably broken

code

 
Matrix0191 User

Nope Not Working :( .... Thanks For Trying Though !!!

I Wish The Script Maker Would Make It But He Said He Isnt So :(

 
jfty.009260 User

I would also want a script as described by Matrix0191. Please help, any kind soul?

 
no0n Scriptwright

See below

 
Mindeye Scriptwright

Some of the code you posted is not really needed...

I said I wouldn't make it because I don't want to maintain a bunch of scripts with only a YousableTubeFix feature. But I can post it here if you want (I don't understand yet why don't you use the full version, though)

 
Mindeye Scriptwright

Use this:

// ==UserScript==
// @name          YousableTubeFix (comments only)
// @namespace     http://userscripts.org/scripts/show/13333
// @description   Displays all comments on video page
// @include       http://youtube.tld/*
// @include       http://*.youtube.tld/*
// ==/UserScript==

/*
Author: Mindeye
Script initially based on ETcelera's YousableTube userscript (http://userscripts.org/scripts/show/5906)
Version: 10 Apr 2008
*/

// Shortcut to document.getElementById
function $(id) {
	return document.getElementById(id);
}

// Runs a particular XPath expression p against the context node context (or the document, if not provided)
// If a document (docObj) is provided, its evaluate method is used instead of document.evaluate (and it's also the default context)
// Returns the results as an array
function $x(p, context, docObj) {
	if (!docObj) docObj = document;
	if (!context) context = docObj;
	var item, arr = [], xpr = docObj.evaluate(p, context, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
	for (var i = 0; item = xpr.snapshotItem(i); i++) arr.push(item);
	return arr;
}

// Returns only the first element of the array returned by $x
function $x1(p, context, docObj) {
	var nodeArray = $x(p, context, docObj);
	if (nodeArray.length > 0) return nodeArray[0];
	return null;
}

// Creates a new node with the given attributes
function createNode(type, attributes) {
	var node = document.createElement(type);
	for (var attr in attributes) {
		node.setAttribute(attr, attributes[attr]);
	}
	return node;
}

// Adds !important to CSS rules of any type
String.prototype.makeImportant = function() {

	var Selector, DeclarationBlock, CssArray = this.match(/([^{]+)({[^{}]+})/);
	if (CssArray === null) {
		// Inline CSS rule (e.g. "display: none") or scripting rule (e.g. element.style.display = "none")
		Selector = "";
		DeclarationBlock = this;
	}
	else {
		// Complete CSS rule (e.g. ".nd {display: none}")
		Selector = CssArray[1];
		DeclarationBlock = CssArray[2];
	}

	// Adds !important to each rule
	if (DeclarationBlock.indexOf(":") != -1) {
		DeclarationBlock = DeclarationBlock.replace(/[^:;{}]+:[^:;{}]+/g, "$& !important");
	}
	else {
		// No estructure could be recognized, so we'll just add !important
		DeclarationBlock += " !important";
	}
	// Remove any !important duplicates
	DeclarationBlock = DeclarationBlock.replace(/(?:\s*!important\s*){2,}/gi, " !important");

	return Selector + DeclarationBlock;

}

// Adds styles for the ajax wrapper div and its contents
GM_addStyle("#gsajaxWrapper {margin: 100px auto; cursor: default; text-align: center}".makeImportant());
GM_addStyle("#gsajaxWrapper * {vertical-align: middle}".makeImportant()); // vertical-align isn't automatically inherited
GM_addStyle("#gsloadingIcon {margin: 5px}".makeImportant());
GM_addStyle("#gsprogressMeter {font-variant: small-caps}".makeImportant());
GM_addStyle("#gsabortButton {margin: 5px auto; display: block}".makeImportant());

var player = $("movie_player");
if (!player) return;

var ytHost = window.location.protocol + "//" + window.location.host;
var videoId = player.wrappedJSObject.GetVariable("video_id");

// Substitutes the original page size of comments in video page (10) for the bigger one used in the view all comments page (500)
// Other page sizes can't be easily used because Youtube ajax page only accepts those values in the pagesize parameter (others seem to default to 10)
// Gets necessary data from the page
var recentComments = $("recent_comments");
var commentsThreshold = $x1("//div[@id='watch-tab-commentary-body']//form//select[@name='commentthreshold']");

if (recentComments) {

	// Creates the elements that will indicate that the comments are being loaded
	var loadingIcon = createNode("img", {id: "gsloadingIcon", alt: "Loading...", src: ytHost + "/img/icn_loading_animated.gif"});
	var progressMeter = createNode("span", {id: "gsprogressMeter"});
	var abortButton = createNode("input", {id: "gsabortButton", title: "Abort the transaction", type: "button", value: "Abort"});
	var ajaxWrapper = createNode("div", {id: "gsajaxWrapper", title: "The comments are being loaded..."});

	// Inserts the contents within the wrapper
	ajaxWrapper.appendChild(loadingIcon);
	ajaxWrapper.appendChild(progressMeter);
	ajaxWrapper.appendChild(abortButton);

	// Select the original comments with a range and extracts them from the DOM tree into a document fragment
	var recentCommentsRange = document.createRange();
	recentCommentsRange.selectNodeContents(recentComments);
	var recentCommentsFrag = recentCommentsRange.extractContents();
	recentCommentsRange.detach();

	// Inserts the wrapper within the now empty div
	recentComments.appendChild(ajaxWrapper);

	// Adds an event listener to the abort button
	abortButton.addEventListener("click", abortAjax, false);

	// Gets the XML data from Youtube
	// GM_xmlhttpRequest's privileged features aren't necessary and it doesn't support responseXML without using DOMParser
	var xhrComments = new XMLHttpRequest();
	xhrComments.onload = function(evt) {

		// Checks for errors
		if ((xhrComments.readyState != 4) || (xhrComments.status != 200) || (!xhrComments.responseXML)) {
			restoreComments();
			return;
		}

		// The data was received. It is now used to fill the recent comments div
		var xmlData = $x1("//html_content", null, xhrComments.responseXML);
		var xmlReturnCodeNode = $x1("//return_code", null, xhrComments.responseXML);
		var xmlReturnCode = ((xmlReturnCodeNode) && (xmlReturnCodeNode.textContent)) ? xmlReturnCodeNode.textContent : null;
		if ((xmlData) && (xmlData.textContent) && (xmlReturnCode === "0")) {
			recentComments.innerHTML = xmlData.textContent;
		}
		else {
			restoreComments();
			return;
		}

		// Change the commentsThreshold combobox (if it exists) so it won't restore the old pagesize
		if ((commentsThreshold) && (commentsThreshold.hasAttribute("onchange"))) {
			commentsThreshold.setAttribute("onchange", commentsThreshold.getAttribute("onchange").replace("&page_size=10", "&page_size=500"));
		}

	}
	xhrComments.onprogress = function(evt) {
		progressMeter.textContent = Math.round(((evt.position / evt.totalSize) * 100)) + "% completed";
	}
	xhrComments.onerror = function(evt) {
		restoreComments();
	}
	var commentsURL = ytHost + "/watch_ajax?v=" + videoId + "&action_get_comments=1&p=1&commentthreshold=" + ((commentsThreshold) ? commentsThreshold.value : -5) + "&page_size=500";
	xhrComments.open("GET", commentsURL, true);
	xhrComments.send(null);

}


// Function to remove the ajax wrapper (with the loading icon, etc...) and restore the original comments
// It is called if the ajax transaction fails or is aborted
function restoreComments() {
	recentComments.replaceChild(recentCommentsFrag, ajaxWrapper);
}

// Function to abort the ajax transaction
// It is called by the ajax abort button event listener
function abortAjax(evt) {
	abortButton.disabled = true;
	if (xhrComments) xhrComments.abort();
	restoreComments();
}

Tested and adapted to the new YouTube design

 
Matrix0191 User

:( Not Working For Me

did you disable the yousabletubefix while you where checking this one ... because it might have been the yousabletube doing the comments

 
Mindeye Scriptwright

Of course I did. Do you have any other YouTube script installed? Maybe it is a script conflict in your end. Any error in the error console?

 
Matrix0191 User

cleared console ... then loaded a video and thats what i get


Error: Components.classes['@mozilla.org/uriloader/content-handler;1?type=application/x-maf'] has no properties
Source file: chrome://maf/content/maf.js
Line: 773
----------
Error: Components.classes['@mozilla.org/uriloader/content-handler;1?type=application/x-maf'] has no properties
Source file: chrome://maf/content/maf.js
Line: 773
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 111
----------
Warning: Unknown property '-o-text-overflow'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 275
----------
Warning: Unknown property 'text-overflow'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 276
----------
Warning: Unknown property 'zoom'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 280
----------
Warning: Unknown property '-o-text-overflow'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 291
----------
Warning: Unknown property 'text-overflow'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 292
----------
Warning: Expected declaration but found '*'. Skipped to next declaration.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 293
----------
Warning: Error in parsing value for property 'display'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 496
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 702
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 904
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1375
----------
Warning: Unknown property 'filter'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1512
----------
Warning: Unknown property 'filter'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1518
----------
Warning: Unknown property 'filter'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1524
----------
Warning: Unknown property 'filter'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1632
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1930
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 1983
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 2036
----------
Warning: Unknown property 'filter'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 2588
----------
Warning: Unknown property 'filter'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 2595
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 3959
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4163
----------
Warning: Error in parsing value for property 'display'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4255
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4314
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4350
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4357
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4878
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 4886
----------
Warning: Error in parsing value for property 'display'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 5166
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 5261
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 5302
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 5966
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 6090
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 6314
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 6324
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 6343
----------
Warning: Error in parsing value for property 'cursor'. Declaration dropped.
Source file: http://s.ytimg.com/yt/css/base_all-vfl37295.css
Line: 6388
----------
Warning: Error in parsing value for property 'vertical-align'. Declaration dropped.
Source file: http://www.youtube.com/watch?v=2_efTYjhea0&fmt=18&feature=dir
----------
http://www.theworldofstuff.com/greasemonkey/YouTube Full Description: collapse-content
----------
Error: Components.classes['@mozilla.org/uriloader/content-handler;1?type=application/x-maf'] has no properties
Source file: chrome://maf/content/maf.js
Line: 773
----------
Error: Components.classes['@mozilla.org/uriloader/content-handler;1?type=application/x-maf'] has no properties
Source file: chrome://maf/content/maf.js
Line: 773
----------
Error: syntax error
Source file: http://n4061ad.doubleclick.net/adi/com.ytpwatch.comedy/main_1849;sz=300x250;!c=1849;kvid=2_efTYjhea0;kpu=WayoutTV;ko=p;kpid=1849;kr=A;u=2_efTYjhea0|1849|DBF79F4D88E179AD;tile=1;dcopt=ist;ord=4488054588574132?
Line: 2, Column: 27
Source code:
var google_cust_age = ;

 
Mindeye Scriptwright

Do you have any other YouTube script installed? I tested it again and it works

 
Matrix0191 User

yes i have removed EVERY script except this one and its still not working

can someone else please try this that has not installed the yousabletubefix before

 
Mindeye Scriptwright

Are you using Firefox 3 beta? There has been some problems with xmlHttpRequest and Greasemonkey in the beta

 
Matrix0191 User

nope lol