From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Koegler Subject: [PATCH 5/7] gitweb: Prototyp for selecting diffs in JavaScript Date: Sun, 15 Apr 2007 22:46:08 +0200 Message-ID: <1176669971921-git-send-email-mkoegler@auto.tuwien.ac.at> References: <11766699702663-git-send-email-mkoegler@auto.tuwien.ac.at> <11766699701308-git-send-email-mkoegler@auto.tuwien.ac.at> <11766699713715-git-send-email-mkoegler@auto.tuwien.ac.at> <1176669971694-git-send-email-mkoegler@auto.tuwien.ac.at> Cc: git@vger.kernel.org, Martin Koegler To: Jakub Narebski X-From: git-owner@vger.kernel.org Sun Apr 15 22:46:47 2007 Return-path: Envelope-to: gcvg-git@gmane.org Received: from vger.kernel.org ([209.132.176.167]) by lo.gmane.org with esmtp (Exim 4.50) id 1HdBcQ-00044c-Dd for gcvg-git@gmane.org; Sun, 15 Apr 2007 22:46:42 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753911AbXDOUqY (ORCPT ); Sun, 15 Apr 2007 16:46:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753803AbXDOUqY (ORCPT ); Sun, 15 Apr 2007 16:46:24 -0400 Received: from thor.auto.tuwien.ac.at ([128.130.60.15]:58503 "EHLO thor.auto.tuwien.ac.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753911AbXDOUqO (ORCPT ); Sun, 15 Apr 2007 16:46:14 -0400 Received: from localhost (localhost [127.0.0.1]) by thor.auto.tuwien.ac.at (Postfix) with ESMTP id 024F67A4D1AB; Sun, 15 Apr 2007 22:46:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at auto.tuwien.ac.at Received: from thor.auto.tuwien.ac.at ([127.0.0.1]) by localhost (thor.auto.tuwien.ac.at [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KxFaWoasWhbR; Sun, 15 Apr 2007 22:46:12 +0200 (CEST) Received: by thor.auto.tuwien.ac.at (Postfix, from userid 3001) id 234B47A4D1A4; Sun, 15 Apr 2007 22:46:11 +0200 (CEST) X-Mailer: git-send-email 1.5.0.5 In-Reply-To: <1176669971694-git-send-email-mkoegler@auto.tuwien.ac.at> Message-Id: <481946c2e3cff09ed4a623b1b20b9889666aedb0.1176659095.git.mkoegler@auto.tuwien.ac.at> In-Reply-To: <437446e84f3aea71f74fea7ea66db4c1c326fb6b.1176659094.git.mkoegler@auto.tuwien.ac.at> References: <437446e84f3aea71f74fea7ea66db4c1c326fb6b.1176659094.git.mkoegler@auto.tuwien.ac.at> Sender: git-owner@vger.kernel.org Precedence: bulk X-Mailing-List: git@vger.kernel.org --- 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