From: Martin Koegler Date: Sun, 15 Apr 2007 20:46:08 GMT Subject: [PATCH 5/7] gitweb: Prototyp for selecting diffs in JavaScript Message-ID: <1176669971921-git-send-email-mkoegler@auto.tuwien.ac.at> In-Reply-To: <1176669971694-git-send-email-mkoegler@auto.tuwien.ac.at> --- This patch is only to test the other patches. I'm working on reimplementing it in perl. gitweb/gitweb.js | 273 ++++++++++++++++++++++++++++++++++++++++++++++++++++ gitweb/gitweb.perl | 1 + 2 files changed, 274 insertions(+), 0 deletions(-) create mode 100644 gitweb/gitweb.js diff --git a/gitweb/gitweb.js b/gitweb/gitweb.js new file mode 100644 index 0000000..2e1a94d --- /dev/null +++ b/gitweb/gitweb.js @@ -0,0 +1,273 @@ +function getCookie(name) +{ + var name=name+"="; + var c=document.cookie; + var p=c.indexOf(name); + if(p==-1) + return null; + c=c.substr(p+name.length,c.length); + p=c.indexOf(";"); + if(p==-1) + return c; + else + return c.substr(0, p); +} + +function insertAfter(elem, node) +{ + if(node.nextSibling) + node.parentNode.insertBefore(elem, node.nextSibling); + else + node.parentNode.appendChild(elem); +} + +function createLink(href, linktext) +{ + var l=document.createElement("a"); + l.appendChild(document.createTextNode(linktext)); + l.href=href; + return l; +} + +function createLinkGroup(href1, basetxt, href2, difftxt) +{ + var l=document.createElement("span"); + l.appendChild(document.createTextNode(" (")); + l.appendChild(createLink(href1, basetxt)); + l.appendChild(document.createTextNode(" | ")); + l.appendChild(createLink(href2, difftxt)); + l.appendChild(document.createTextNode(") ")); + return l; +} + +function GitRef() +{ + this.t=null; + this.h=null; + this.hb=null; + this.f=null; + this.ToRef=ToRef; +} + +function ToRef() +{ + var parts=new Array(); + if(this.f) + parts.push("f="+this.f); + if(this.h) + parts.push("h="+this.h); + if(this.hb) + parts.push("hb="+this.hb); + if(this.t) + parts.push("t="+this.t); + return parts.join("@"); +} + +function splitGitRef(ref) +{ + var parts=ref.split("@"); + var res=new GitRef(); + var i; + for(i=0;i1) + { + var parts=Urls[1].split(";"); + var i; + for(i=0;i'; print "\n" . ""; } -- 1.5.1.1.85.gf1888