Youtube Comments
|
|
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 |
|
|
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 |
|
|
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 |
|
|
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
|
|
|
Nope Not Working :( .... Thanks For Trying Though !!! I Wish The Script Maker Would Make It But He Said He Isnt So :( |
|
|
I would also want a script as described by Matrix0191. Please help, any kind soul? |
|
|
See below |
|
|
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) |
|
|
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 |
|
|
:( 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 |
|
|
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? |
|
|
cleared console ... then loaded a video and thats what i get
|
|
|
Do you have any other YouTube script installed? I tested it again and it works |
|
|
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 |
|
|
Are you using Firefox 3 beta? There has been some problems with xmlHttpRequest and Greasemonkey in the beta |
|
|
nope lol |
