Thats odd, it works fine in Safari.Kriston said:Just wanted to let you know.
It does NOT work in konqueror.
<xsl:sort select="t:Details/t:Title"/>
gman622 said:I've updated this so that the shows are now sortable.
By clicking on the table header titles you can sort by:
SourceStation, Title, CaptureDate, SourceSize, and Recording Quality.
*still only guaranteed to work with FireFox
I don't mind at all; sorry to inflict my code upon you. This was my first foray into xsl (and CSS and Javascript and XHTML for that matter) and it definitely turned into "the 'hack-iest' thing that could possibly work."GCymbala said:I made some changes to a copy of your "better now playing list" for my own needs.
that a good idea; although it might be better for me to generalize it (maybe an array of IP's) so that any number of tivo's will work.GCymbala said:a with the my list of TiVos.
that brings up a bug that I should fix, currently when you sort by title it doesn't take into account ones that start with "The" or "A" (are there others that i'm forgetting?). I don't think that can work with xsl:sort but it's an easy fix in the sortTable function.GCymbala said:I also defaulted to sorting by Title, by addingto the for-each Item loop.Code:<xsl:sort select="t:Details/t:Title"/>
var xsltProcessor = new XSLTProcessor();
var xmlDoc;
xsltProcessor.importStylesheet(xsltSheet);
var myXMLHTTPRequest = new XMLHttpRequest();
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
myXMLHTTPRequest.open("GET", 'np.xml', true,'tivo',mak);
myXMLHTTPRequest.onreadystatechange=function() {
if (myXMLHTTPRequest.readyState==4) {
xmlDoc = myXMLHTTPRequest.responseXML;
}
}
myXMLHTTPRequest.send(null);
var fragment = xsltProcessor.transformToFragment(xmlDoc, document);
Yep, I was thinking the same thing, but being lazy, couldn't be bothered to write a function to create the list dynamically from an array. Plus, I wanted to use their names, not just IP addresses, so it'd have to be a 2-dimensional array, which is a little ugly in JavaScript.gman622 said:that a good idea; although it might be better for me to generalize it (maybe an array of IP's) so that any number of tivo's will work.
I realized this too, but it didn't bother me too much.gman622 said:that brings up a bug that I should fix, currently when you sort by title it doesn't take into account ones that start with "The" or "A" (are there others that i'm forgetting?). I don't think that can work with xsl:sort but it's an easy fix in the sortTable function.
Sounds cool. The only SVG I've ever touched, though was inside Paint Shop Pro, and glancing at the source once or twice.gman622 said:There's also a couple of enhancements I was thinking of making including a SVG Pie Chart and making it possible to sort by Expiration Date. If anyone has any suggestions feel free to chime in.
I tried to get this working, but had trouble too. I ended up making the myXMLHTTPRequest in global scope. That seemed to solve something, but created others because the code continued to try to parse the response after the send. I ended up having to move a bunch of code into the onreadystate function, since that's where you need to fire things from.gman622 said:One problem I am having is trying to make an async xml request. It seems to retrieve the xml document ok but choke with an uncaught exception when I try to transform it. If anyone can help:
var totalGB = 29.252;
var xsltSheet = document.getElementsByTagNameNS('[XSL Namespace]', 'stylesheet')[1];
var myXMLHTTPRequest = new XMLHttpRequest();
function CheckXMLHTTPReadyState() {
if (myXMLHTTPRequest.readyState==4) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
var xsltNS = '[XSL Namespace]';
var xsltSheet = document.getElementsByTagNameNS(xsltNS, 'stylesheet')[0];
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsltSheet);
var xmlDoc;
xmlDoc = myXMLHTTPRequest.responseXML;
var fragment = xsltProcessor.transformToFragment(xmlDoc, document);
document.getElementById("divContent").appendChild(fragment);
convertDates();
calcTimeLeft();
}
}
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
myXMLHTTPRequest = new XMLHttpRequest();
myXMLHTTPRequest.onreadystatechange=CheckXMLHTTPReadyState;
myXMLHTTPRequest.open("GET", '[now playing url]', true,'tivo',mak);
myXMLHTTPRequest.send(null);
I was under the wrong impression that you only need to enable UniversalBrowserRead once per page, but according to the documentation, you need to call it per function.netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
var myXMLHTTPRequest;
function sendRequest() {
try {
myXMLHTTPRequest = new XMLHttpRequest();
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
myXMLHTTPRequest.onreadystatechange = handleResponse;
myXMLHTTPRequest.open("GET", 'https://'+tivo_ip+
'/TiVoConnect?Command=QueryContainer&Container=%2FNowPlaying&Recurse=Yes'
, true,'tivo',mak);
myXMLHTTPRequest.send(null);
}
catch (e) {
alert("Error occurred sending request: " + e);
}
}
function handleResponse()
{
try {
// if finished fetching page and no errors occurred
if ((myXMLHTTPRequest.readyState == 4) &&
(myXMLHTTPRequest.status < 300) &&
(myXMLHTTPRequest.responseText!="")) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalBrowserRead');
var xsltNS = 'http://www.w3.org/1999/XSL/Transform';
var xsltSheet = document.getElementsByTagNameNS(xsltNS, 'stylesheet')[0];
appendTransformation(xsltSheet);
convertDates();
calcTimeLeft();
}
}
catch (e) {
alert("Error occurred handling response: " + e);
}
}
function appendTransformation (xsltSheet) {
var divContent = document.getElementById("divContent");
var oForm = document.getElementById("frmSelTiVo");
while (divContent.hasChildNodes())
{
divContent.removeChild(divContent.childNodes[0]);
}
if (typeof XSLTProcessor != 'undefined') {
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(xsltSheet);
var xmlDoc = myXMLHTTPRequest.responseXML;
var fragment = xsltProcessor.transformToFragment(xmlDoc, document);
document.getElementById("divContent").appendChild(fragment);
}
}
window.onload = initPage;
function initPage()
{
var tivo_list = document.getElementById("selTiVos");
tivo_ip = tivo_list.options[tivo_list.selectedIndex].value;
sendRequest();
}
<xsl:sort select="t:Details/t:Title"/>
I get the exact same error with Firefox - both with the original script and with Morac's versionjhhyde said:All fine and very good, but can anyone explain why I get syntax error on line 7 when I try it in Firefox?
That would be the line that has this:
<![CDATA[
So far, the Firefox guarantee is not valid.