Start implementing requirejs
Start implementing requirejs

file:b/js/common.js (new)
  /*
  * GitPHP Javascript common loader
  *
  * Initializes script modules used across all pages
  *
  * @author Christopher Han <xiphux@gmail.com>
  * @copyright Copyright (c) 2011 Christopher Han
  * @package GitPHP
  * @subpackage Javascript
  */
 
  define(["jquery", "lang", "tooltip.snapshot"], function($, lang, tooltipSnapshot) {
  $(function() {
  lang($('div.lang_select'));
  tooltipSnapshot($('a.snapshotTip'));
  });
 
  var project = window.location.href.match(/p=([^&]+)/);
  if (!project) {
  return;
  }
  project = unescape(project[1]);
 
  var url = window.location.href.match(/^([^\?]+\/)/);
  if (!url) {
  return;
  }
  url = url[1];
 
  require(["jquery", "tooltip.commit", "tooltip.tag"], function($, tooltipCommit, tooltipTag) {
  $(function() {
  tooltipCommit($('a.commitTip'), project, url);
  tooltipTag($('a.tagTip'), project, url);
  });
  });
  });
 
file:b/js/ext/require.js (new)
  /*
  RequireJS 0.26.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
  Available via the MIT or new BSD license.
  see: http://github.com/jrburke/requirejs for details
  */
  var requirejs,require,define;
  (function(){function M(a){return $.call(a)==="[object Function]"}function E(a){return $.call(a)==="[object Array]"}function V(a,c,g){for(var e in c)if(!(e in J)&&(!(e in a)||g))a[e]=c[e];return d}function R(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a);if(d)a.originalError=d;return a}function aa(a,c,d){var e,x,j;for(e=0;j=c[e];e++){j=typeof j==="string"?{name:j}:j;x=j.location;if(d&&(!x||x.indexOf("/")!==0&&x.indexOf(":")===-1))x=d+"/"+(x||j.name);a[j.name]={name:j.name,location:x||
  j.name,main:(j.main||"main").replace(fa,"").replace(ba,"")}}}function W(a,d){a.holdReady?a.holdReady(d):d?a.readyWait+=1:a.ready(!0)}function ga(a){function c(b,h){var n,o;if(b&&b.charAt(0)==="."&&h){p.pkgs[h]?h=[h]:(h=h.split("/"),h=h.slice(0,h.length-1));n=b=h.concat(b.split("/"));var a;for(o=0;a=n[o];o++)if(a===".")n.splice(o,1),o-=1;else if(a==="..")if(o===1&&(n[2]===".."||n[0]===".."))break;else o>0&&(n.splice(o-1,2),o-=2);o=p.pkgs[n=b[0]];b=b.join("/");o&&b===n+"/"+o.main&&(b=n)}return b}function g(b,
  h){var n=b?b.indexOf("!"):-1,o=null,a=h?h.name:null,ha=b,g,l;n!==-1&&(o=b.substring(0,n),b=b.substring(n+1,b.length));o&&(o=c(o,a));b&&(g=o?(n=m[o])?n.normalize?n.normalize(b,function(b){return c(b,a)}):c(b,a):"__$p"+a+"@"+(b||""):c(b,a),l=E[g],l||(l=d.toModuleUrl?d.toModuleUrl(f,g,h):f.nameToUrl(g,null,h),E[g]=l));return{prefix:o,name:g,parentMap:h,url:l,originalName:ha,fullName:o?o+"!"+(g||""):g}}function e(){var b=!0,h=p.priorityWait,n,a;if(h){for(a=0;n=h[a];a++)if(!s[n]){b=!1;break}b&&delete p.priorityWait}return b}
  function x(b){return function(h){b.exports=h}}function j(b,h,n){return function(){var a=[].concat(ia.call(arguments,0)),d;if(n&&M(d=a[a.length-1]))d.__requireJsBuild=!0;a.push(h);return b.apply(null,a)}}function q(b,h){var a=j(f.require,b,h);V(a,{nameToUrl:j(f.nameToUrl,b),toUrl:j(f.toUrl,b),defined:j(f.requireDefined,b),specified:j(f.requireSpecified,b),ready:d.ready,isBrowser:d.isBrowser});if(d.paths)a.paths=d.paths;return a}function v(b){var h=b.prefix,a=b.fullName;y[a]||a in m||(h&&!K[h]&&(K[h]=
  void 0,(S[h]||(S[h]=[])).push(b),(t[h]||(t[h]=[])).push({onDep:function(b){if(b===h){var a,n,d,c,f,e,j=S[h];if(j)for(d=0;a=j[d];d++)if(b=a.fullName,a=g(a.originalName,a.parentMap),a=a.fullName,n=t[b]||[],c=t[a],a!==b){b in y&&(delete y[b],y[a]=!0);t[a]=c?c.concat(n):n;delete t[b];for(c=0;c<n.length;c++){e=n[c].depArray;for(f=0;f<e.length;f++)e[f]===b&&(e[f]=a)}}delete S[h]}}}),v(g(h))),f.paused.push(b))}function w(b){var h,a,c;h=b.callback;var k=b.fullName,e=[],j=b.depArray;if(h&&M(h)){if(j)for(h=
  0;h<j.length;h++)e.push(b.deps[j[h]]);if(p.catchError.define)try{a=d.execCb(k,b.callback,e,m[k])}catch(l){c=l}else a=d.execCb(k,b.callback,e,m[k]);if(k)b.cjsModule&&b.cjsModule.exports!==void 0?a=m[k]=b.cjsModule.exports:a===void 0&&b.usingExports?a=m[k]:m[k]=a}else k&&(a=m[k]=h);if(F[b.waitId])delete F[b.waitId],b.isDone=!0,f.waitCount-=1,f.waitCount===0&&(I=[]);if(c)return a=(k?g(k).url:"")||c.fileName||c.sourceURL,c=R("defineerror",'Error evaluating module "'+k+'" at location "'+a+'":\n'+c+"\nfileName:"+
  a+"\nlineNumber: "+(c.lineNumber||c.line),c),c.moduleName=k,d.onError(c);if(k&&(c=t[k])){for(h=0;h<c.length;h++)c[h].onDep(k,a);delete t[k]}}function z(b,a,c,d){var b=g(b,d),k=b.name,e=b.fullName,j={},l={waitId:k||ja+Q++,depCount:0,depMax:0,prefix:b.prefix,name:k,fullName:e,deps:{},depArray:a,callback:c,onDep:function(b,a){b in l.deps||(l.deps[b]=a,l.depCount+=1,l.depCount===l.depMax&&w(l))}},i,r;if(e){if(e in m||s[e]===!0||e==="jquery"&&p.jQuery&&p.jQuery!==c().fn.jquery)return;y[e]=!0;s[e]=!0;e===
  "jquery"&&c&&T(c())}for(c=0;c<a.length;c++)if(i=a[c])i=g(i,k?b:d),r=i.fullName,a[c]=r,r==="require"?l.deps[r]=q(b):r==="exports"?(l.deps[r]=m[e]={},l.usingExports=!0):r==="module"?(l.cjsModule=i=l.deps[r]={id:k,uri:k?f.nameToUrl(k,null,d):void 0,exports:m[e]},i.setExports=x(i)):r in m&&!(r in F)?l.deps[r]=m[r]:j[r]||(l.depMax+=1,v(i),(t[r]||(t[r]=[])).push(l),j[r]=!0);l.depCount===l.depMax?w(l):(F[l.waitId]=l,I.push(l),f.waitCount+=1)}function u(b){z.apply(null,b);s[b[0]]=!0}function C(b,a){if(!b.isDone){var c=
  b.fullName,d=b.depArray,f,e;if(c){if(a[c])return m[c];a[c]=!0}for(e=0;e<d.length;e++)if((f=d[e])&&!b.deps[f]&&F[f])b.onDep(f,C(F[f],a));return c?m[c]:void 0}}function A(){var b=p.waitSeconds*1E3,a=b&&f.startTime+b<(new Date).getTime(),b="",c=!1,g=!1,k;if(!(f.pausedCount>0)){if(p.priorityWait)if(e())G();else return;for(k in s)if(!(k in J)&&(c=!0,!s[k]))if(a)b+=k+" ";else{g=!0;break}if(c||f.waitCount){if(a&&b)return k=R("timeout","Load timeout for modules: "+b),k.requireType="timeout",k.requireModules=
  b,d.onError(k);if(g||f.scriptCount){if((B||ca)&&!X)X=setTimeout(function(){X=0;A()},50)}else{if(f.waitCount){for(H=0;b=I[H];H++)C(b,{});Y<5&&(Y+=1,A())}Y=0;d.checkReadyState()}}}}function D(b,a){var c=a.name,e=a.fullName,g;if(!(e in m||e in s))K[b]||(K[b]=m[b]),s[e]||(s[e]=!1),g=function(g){if(d.onPluginLoad)d.onPluginLoad(f,b,c,g);w({prefix:a.prefix,name:a.name,fullName:a.fullName,callback:function(){return g}});s[e]=!0},g.fromText=function(b,a){var c=N;f.loaded[b]=!1;f.scriptCount+=1;c&&(N=!1);
  d.exec(a);c&&(N=!0);f.completeLoad(b)},K[b].load(c,q(a.parentMap,!0),g,p)}function L(b){b.prefix&&b.name&&b.name.indexOf("__$p")===0&&m[b.prefix]&&(b=g(b.originalName,b.parentMap));var a=b.prefix,c=b.fullName,e=f.urlFetched;!y[c]&&!s[c]&&(y[c]=!0,a?m[a]?D(a,b):(O[a]||(O[a]=[],(t[a]||(t[a]=[])).push({onDep:function(b){if(b===a){for(var c,d=O[a],b=0;b<d.length;b++)c=d[b],D(a,g(c.originalName,c.parentMap));delete O[a]}}})),O[a].push(b)):e[b.url]||(d.load(f,c,b.url),e[b.url]=!0))}var f,G,p={waitSeconds:7,
  baseUrl:i.baseUrl||"./",paths:{},pkgs:{},catchError:{}},P=[],y={require:!0,exports:!0,module:!0},E={},m={},s={},F={},I=[],Q=0,t={},K={},O={},Z=0,S={};T=function(b){if(!f.jQuery&&(b=b||(typeof jQuery!=="undefined"?jQuery:null))&&!(p.jQuery&&b.fn.jquery!==p.jQuery)&&("holdReady"in b||"readyWait"in b))if(f.jQuery=b,u(["jquery",[],function(){return jQuery}]),f.scriptCount)W(b,!0),f.jQueryIncremented=!0};G=function(){var b,a,c;Z+=1;if(f.scriptCount<=0)f.scriptCount=0;for(;P.length;)if(b=P.shift(),b[0]===
  null)return d.onError(R("mismatch","Mismatched anonymous define() module: "+b[b.length-1]));else u(b);if(!p.priorityWait||e())for(;f.paused.length;){c=f.paused;f.pausedCount+=c.length;f.paused=[];for(a=0;b=c[a];a++)L(b);f.startTime=(new Date).getTime();f.pausedCount-=c.length}Z===1&&A();Z-=1};f={contextName:a,config:p,defQueue:P,waiting:F,waitCount:0,specified:y,loaded:s,urlMap:E,scriptCount:0,urlFetched:{},defined:m,paused:[],pausedCount:0,plugins:K,managerCallbacks:t,makeModuleMap:g,normalize:c,
  configure:function(b){var a,c,e;b.baseUrl&&b.baseUrl.charAt(b.baseUrl.length-1)!=="/"&&(b.baseUrl+="/");a=p.paths;e=p.pkgs;V(p,b,!0);if(b.paths){for(c in b.paths)c in J||(a[c]=b.paths[c]);p.paths=a}if((a=b.packagePaths)||b.packages){if(a)for(c in a)c in J||aa(e,a[c],c);b.packages&&aa(e,b.packages);p.pkgs=e}if(b.priority)c=f.requireWait,f.requireWait=!1,f.takeGlobalQueue(),G(),f.require(b.priority),G(),f.requireWait=c,p.priorityWait=b.priority;if(b.deps||b.callback)f.require(b.deps||[],b.callback);
  b.ready&&d.ready(b.ready)},requireDefined:function(b,a){return g(b,a).fullName in m},requireSpecified:function(b,a){return g(b,a).fullName in y},require:function(b,c,e){if(typeof b==="string"){if(d.get)return d.get(f,b,c);c=g(b,c);b=c.fullName;return!(b in m)?d.onError(R("notloaded","Module name '"+c.fullName+"' has not been loaded yet for context: "+a)):m[b]}z(null,b,c,e);if(!f.requireWait)for(;!f.scriptCount&&f.paused.length;)f.takeGlobalQueue(),G();return f.require},takeGlobalQueue:function(){U.length&&
  (ka.apply(f.defQueue,[f.defQueue.length-1,0].concat(U)),U=[])},completeLoad:function(b){var a;for(f.takeGlobalQueue();P.length;)if(a=P.shift(),a[0]===null){a[0]=b;break}else if(a[0]===b)break;else u(a),a=null;a?u(a):u([b,[],b==="jquery"&&typeof jQuery!=="undefined"?function(){return jQuery}:null]);s[b]=!0;T();d.isAsync&&(f.scriptCount-=1);G();d.isAsync||(f.scriptCount-=1)},toUrl:function(b,a){var c=b.lastIndexOf("."),d=null;c!==-1&&(d=b.substring(c,b.length),b=b.substring(0,c));return f.nameToUrl(b,
  d,a)},nameToUrl:function(b,a,e){var g,j,i,m,l=f.config,b=c(b,e&&e.fullName);if(d.jsExtRegExp.test(b))a=b+(a?a:"");else{g=l.paths;j=l.pkgs;e=b.split("/");for(m=e.length;m>0;m--)if(i=e.slice(0,m).join("/"),g[i]){e.splice(0,m,g[i]);break}else if(i=j[i]){b=b===i.name?i.location+"/"+i.main:i.location;e.splice(0,m,b);break}a=e.join("/")+(a||".js");a=(a.charAt(0)==="/"||a.match(/^\w+:/)?"":l.baseUrl)+a}return l.urlArgs?a+((a.indexOf("?")===-1?"?":"&")+l.urlArgs):a}};f.jQueryCheck=T;f.resume=G;return f}function la(){var a,
  c,d;if(C&&C.readyState==="interactive")return C;a=document.getElementsByTagName("script");for(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState==="interactive")return C=d;return null}var ma=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,na=/require\(\s*["']([^'"\s]+)["']\s*\)/g,fa=/^\.\//,ba=/\.js$/,$=Object.prototype.toString,q=Array.prototype,ia=q.slice,ka=q.splice,B=!!(typeof window!=="undefined"&&navigator&&document),ca=!B&&typeof importScripts!=="undefined",oa=B&&navigator.platform==="PLAYSTATION 3"?/^complete$/:
  /^(complete|loaded)$/,da=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",ja="_r@@",J={},z={},U=[],C=null,Y=0,N=!1,d,q={},I,i,u,L,v,A,D,H,Q,ea,w,T,X;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(M(requirejs))return;else q=requirejs,requirejs=void 0;typeof require!=="undefined"&&!M(require)&&(q=require,require=void 0);d=requirejs=function(a,c,d){var e="_",i;!E(a)&&typeof a!=="string"&&(i=a,E(c)?(a=c,c=d):a=[]);if(i&&i.context)e=i.context;d=z[e]||(z[e]=ga(e));i&&
  d.configure(i);return d.require(a,c)};d.config=function(a){return d(a)};typeof require==="undefined"&&(require=d);d.toUrl=function(a){return z._.toUrl(a)};d.version="0.26.0";d.isArray=E;d.isFunction=M;d.mixin=V;d.jsExtRegExp=/^\/|:|\?|\.js$/;i=d.s={contexts:z,skipAsync:{},isPageLoaded:!B,readyCalls:[]};if(d.isAsync=d.isBrowser=B)if(u=i.head=document.getElementsByTagName("head")[0],L=document.getElementsByTagName("base")[0])u=i.head=L.parentNode;d.onError=function(a){throw a;};d.load=function(a,c,
  g){var e=a.loaded;e[c]||(e[c]=!1);a.scriptCount+=1;d.attach(g,a,c);if(a.jQuery&&!a.jQueryIncremented)W(a.jQuery,!0),a.jQueryIncremented=!0};define=d.def=function(a,c,g){var e,i;typeof a!=="string"&&(g=c,c=a,a=null);d.isArray(c)||(g=c,c=[]);!a&&!c.length&&d.isFunction(g)&&g.length&&(g.toString().replace(ma,"").replace(na,function(a,d){c.push(d)}),c=(g.length===1?["require"]:["require","exports","module"]).concat(c));if(N&&(e=I||la()))a||(a=e.getAttribute("data-requiremodule")),i=z[e.getAttribute("data-requirecontext")];
  (i?i.defQueue:U).push([a,c,g])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,e){return c.apply(e,d)};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,g;if(a.type==="load"||oa.test(c.readyState))C=null,a=c.getAttribute("data-requirecontext"),g=c.getAttribute("data-requiremodule"),z[a].completeLoad(g),c.detachEvent&&!da?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach=
  function(a,c,g,e,q){var j;if(B)return e=e||d.onScriptLoad,j=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),j.type=q||"text/javascript",j.charset="utf-8",j.async=!i.skipAsync[a],c&&j.setAttribute("data-requirecontext",c.contextName),j.setAttribute("data-requiremodule",g),j.attachEvent&&!da?(N=!0,j.attachEvent("onreadystatechange",e)):j.addEventListener("load",e,!1),j.src=a,I=j,L?u.insertBefore(j,L):u.appendChild(j),
  I=null,j;else if(ca)e=c.loaded,e[g]=!1,importScripts(a),c.completeLoad(g);return null};if(B){v=document.getElementsByTagName("script");for(H=v.length-1;H>-1&&(A=v[H]);H--){if(!u)u=A.parentNode;if(D=A.getAttribute("data-main")){if(!q.baseUrl)v=D.split("/"),A=v.pop(),v=v.length?v.join("/")+"/":"./",q.baseUrl=v,D=A.replace(ba,"");q.deps=q.deps?q.deps.concat(D):[D];break}}}i.baseUrl=q.baseUrl;d.pageLoaded=function(){if(!i.isPageLoaded){i.isPageLoaded=!0;Q&&clearInterval(Q);if(ea)document.readyState="complete";
  d.callReady()}};d.checkReadyState=function(){var a=i.contexts,c;for(c in a)if(!(c in J)&&a[c].waitCount)return;i.isDone=!0;d.callReady()};d.callReady=function(){var a=i.readyCalls,c,d,e;if(i.isPageLoaded&&i.isDone){if(a.length){i.readyCalls=[];for(c=0;d=a[c];c++)d()}a=i.contexts;for(e in a)if(!(e in J)&&(c=a[e],c.jQueryIncremented))W(c.jQuery,!1),c.jQueryIncremented=!1}};d.ready=function(a){i.isPageLoaded&&i.isDone?a():i.readyCalls.push(a);return d};if(B){if(document.addEventListener){if(document.addEventListener("DOMContentLoaded",
  d.pageLoaded,!1),window.addEventListener("load",d.pageLoaded,!1),!document.readyState)ea=!0,document.readyState="loading"}else window.attachEvent&&(window.attachEvent("onload",d.pageLoaded),self===self.top&&(Q=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),d.pageLoaded())}catch(a){}},30)));document.readyState==="complete"&&d.pageLoaded()}d(q);if(d.isAsync&&typeof setTimeout!=="undefined")w=i.contexts[q.context||"_"],w.requireWait=!0,setTimeout(function(){w.requireWait=
  !1;w.takeGlobalQueue();w.jQueryCheck();w.scriptCount||w.resume();d.checkReadyState()},0)}})();
 
file:a/js/lang.js -> file:b/js/lang.js
/* /*
* GitPHP Javascript language selector * GitPHP Javascript language selector
* *
* Changes the language as soon as it's selected, * Changes the language as soon as it's selected,
* rather than requiring a submit * rather than requiring a submit
* *
* @author Christopher Han <xiphux@gmail.com> * @author Christopher Han <xiphux@gmail.com>
* @copyright Copyright (c) 2010 Christopher Han * @copyright Copyright (c) 2011 Christopher Han
* @package GitPHP * @package GitPHP
  * @subpackage Javascript
*/ */
   
function initLangSelector() { define(["jquery"],
$("#selLang").change(function() { function($) {
$("#frmLangSelect").submit(); return function(langSelContainer) {
}); langSelContainer.find('select').change(
$("#btnLangSet").remove(); function() {
}; langSelContainer.find('form').submit();
  }
  );
  langSelContainer.find('input[type="submit"]').remove();
  }
  }
  );
   
$(document).ready(function() {  
initLangSelector();  
});  
   
  /*
  * GitPHP Javascript commit tooltip
  *
  * Displays commit messages in a tooltip
  *
  * @author Christopher Han <xiphux@gmail.com>
  * @copyright Copyright (c) 2011 Christopher Han
  * @package GitPHP
  * @subpackage Javascript
  */
 
  define(["jquery", "ext/jquery.qtip.min"],
  function($) {
 
  function getCommitHash(element) {
  var hash = element.attr('href').match(/h=([0-9a-fA-F]{40}|HEAD)/);
  return hash ? hash[1] : null;
  }
 
  function buildTipConfig(url, project, hash) {
  return {
  content: {
  text: '<img src="' + url + 'images/tooltip-loader.gif" alt="' + GITPHP_RES_LOADING + '" />',
  ajax: {
  url: 'index.php',
  data: {
  p: project,
  a: 'commit',
  o: 'jstip',
  h: hash
  },
  type: 'GET'
  }
  },
  style: {
  classes: 'ui-tooltip-light ui-tooltip-shadow'
  },
  position: {
  adjust: {
  screen: true
  }
  }
  }
  }
 
  return function(elements, project, href) {
  elements.each(function(){
  var jThis = $(this);
  var hash = getCommitHash(jThis);
  if (!hash) {
  return;
  }
  var config = buildTipConfig(href, project, hash);
  jThis.qtip(config);
  });
  }
  }
  );
 
  /*
  * GitPHP Javascript snapshot tooltip
  *
  * Displays choices of snapshot format in a tooltip
  *
  * @author Christopher Han <xiphux@gmail.com>
  * @copyright Copyright (c) 2011 Christopher Han
  * @package GitPHP
  * @subpackage Javascript
  */
 
  define(["jquery", "ext/jquery.qtip.min"],
  function($) {
 
  function buildTipContent(href) {
  var content = '<div>' + GITPHP_RES_SNAPSHOT + ': ';
  var first = true;
  for (var type in GITPHP_SNAPSHOT_FORMATS) {
  if (!first) {
  content += ' | ';
  }
  content += '<a href="' + href + '&fmt=' + type + '">' + GITPHP_SNAPSHOT_FORMATS[type] + '</a>';
  first = false;
  }
  content += '</div>';
  return content;
  }
 
  function buildTipConfig(content) {
  return {
  content: {
  text: content
  },
  show: {
  event: 'click'
  },
  hide: {
  fixed: true,
  delay: 150
  },
  style: {
  classes: 'ui-tooltip-light ui-tooltip-shadow'
  },
  position: {
  adjust: {
  screen: true
  }
  }
  }
  }
 
  return function(elements) {
  elements.each(function(){
  var jThis = $(this);
  var href = jThis.attr('href');
  var content = buildTipContent(href);
  var config = buildTipConfig(content);
  jThis.qtip(config);
  jThis.click(function() { return false; });
  });
  }
  }
  );
 
file:b/js/tooltip.tag.js (new)
  /*
  * GitPHP Javascript tag tooltip
  *
  * Displays tag messages in a tooltip
  *
  * @author Christopher Han <xiphux@gmail.com>
  * @copyright Copyright (c) 2011 Christopher Han
  * @package GitPHP
  * @subpackage Javascript
  */
 
  define(["jquery", "ext/jquery.qtip.min"],
  function($) {
 
  function getTagName(element) {
  var tag = element.attr('href').match(/h=([^&]+)/);
  return tag ? tag[1] : null;
  }
 
  function buildTipConfig(url, project, tag) {
  return {
  content: {
  text: '<img src="' + url + 'images/tooltip-loader.gif" alt="' + GITPHP_RES_LOADING + '" />',
  ajax: {
  url: 'index.php',
  data: {
  p: project,
  a: 'tag',
  o: 'jstip',
  h: tag
  },
  type: 'GET'
  }
  },
  style: {
  classes: 'ui-tooltip-light ui-tooltip-shadow'
  },
  position: {
  adjust: {
  screen: true
  }
  }
  }
  }
 
  return function(elements, project, href) {
  elements.each(function(){
  var jThis = $(this);
  var tag = getTagName(jThis);
  if (!tag) {
  return;
  }
  var config = buildTipConfig(href, project, tag);
  jThis.qtip(config);
  });
  }
  }
  );
 
file:a/js/tooltips.js (deleted)
/*  
* GitPHP Javascript tooltips  
*  
* Javascript tooltips to show more info about a commit  
*  
* @author Christopher Han <xiphux@gmail.com>  
* @copyright Copyright (c) 2010 Christopher Han  
* @package GitPHP  
*/  
 
function initSnapshotTips() {  
 
$('a.snapshotTip').each(function()  
{  
var href = $(this).attr('href');  
 
var content = '<div>' + GITPHP_RES_SNAPSHOT + ': ';  
var first = true;  
for (var type in GITPHP_SNAPSHOT_FORMATS) {  
if (!first) {  
content += ' | ';  
}  
content += '<a href="' + href + '&fmt=' + type + '">' + GITPHP_SNAPSHOT_FORMATS[type] + '</a>';  
first = false;  
}  
content += '</div>';  
 
$(this).qtip(  
{  
content: {  
text: content  
},  
show: {  
event: 'click'  
},  
hide: {  
fixed: true,  
delay: 150  
},  
style: {  
classes: 'ui-tooltip-light ui-tooltip-shadow'  
},  
position: {  
adjust: {  
screen: true  
}  
}  
});  
 
$(this).click(function() { return false; });  
});  
 
};  
 
function initCommitTips() {  
 
var project = window.location.href.match(/p=([^&]+)/);  
if (!project) {  
return;  
}  
project = unescape(project[1]);  
 
var url = window.location.href.match(/^([^\?]+\/)/);  
if (!url) {  
return;  
}  
url = url[1];  
 
$('a.commitTip').each(function()  
{  
var commitHash = $(this).attr('href').match(/h=([0-9a-fA-F]{40}|HEAD)/);  
if (!commitHash) {  
return;  
}  
 
commitHash = commitHash[1];  
 
$(this).qtip(  
{  
content: {  
text: '<img src="' + url + 'images/tooltip-loader.gif" alt="' + GITPHP_RES_LOADING + '" />',  
ajax: {  
url: 'index.php',  
data: {  
p: project,  
a: 'commit',  
o: 'jstip',  
h: commitHash  
},  
type: 'GET'  
}  
},  
style: {  
classes: 'ui-tooltip-light ui-tooltip-shadow'  
},  
position: {  
adjust: {  
screen: true  
}  
}  
});  
});  
 
};  
 
function initTagTips() {  
 
var project = window.location.href.match(/p=([^&]+)/);  
if (!project) {  
return;  
}  
project = unescape(project[1]);  
 
var url = window.location.href.match(/^([^\?]+\/)/);  
if (!url) {  
return;  
}  
url = url[1];  
 
$('a.tagTip').each(function()  
{  
var tagName = $(this).attr('href').match(/h=([^&]+)/);  
if (!tagName) {  
return;  
}  
 
tagName = tagName[1];  
 
$(this).qtip(  
{  
content: {  
text: '<img src="' + url + 'images/tooltip-loader.gif" alt="' + GITPHP_RES_LOADING + '" />',  
ajax: {  
url: 'index.php',  
data: {  
p: project,  
a: 'tag',  
o: 'jstip',  
h: tagName  
},  
type: 'GET'  
}  
},  
style: {  
classes: 'ui-tooltip-light ui-tooltip-shadow'  
},  
position: {  
adjust: {  
screen: true  
}  
}  
});  
});  
 
};  
 
$(document).ready(function() {  
initCommitTips();  
initTagTips();  
initSnapshotTips();  
});  
 
{* {*
* header.tpl * header.tpl
* gitphp: A PHP git repository browser * gitphp: A PHP git repository browser
* Component: Page header template * Component: Page header template
* *
* Copyright (C) 2006 Christopher Han <xiphux@gmail.com> * Copyright (C) 2006 Christopher Han <xiphux@gmail.com>
*} *}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<!-- gitphp web interface {$version}, (C) 2006-2011 Christopher Han <xiphux@gmail.com> --> <!-- gitphp web interface {$version}, (C) 2006-2011 Christopher Han <xiphux@gmail.com> -->
<head> <head>
<title>{$pagetitle}{if $project} :: {$project->GetProject()}{if $actionlocal}/{$actionlocal}{/if}{/if}</title> <title>{$pagetitle}{if $project} :: {$project->GetProject()}{if $actionlocal}/{$actionlocal}{/if}{/if}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
{if $project} {if $project}
<link rel="alternate" title="{$project->GetProject()} log (Atom)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" type="application/atom+xml" /> <link rel="alternate" title="{$project->GetProject()} log (Atom)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" type="application/atom+xml" />
<link rel="alternate" title="{$project->GetProject()} log (RSS)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" type="application/rss+xml" /> <link rel="alternate" title="{$project->GetProject()} log (RSS)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" type="application/rss+xml" />
{/if} {/if}
{if file_exists('css/gitphp.min.css')} {if file_exists('css/gitphp.min.css')}
<link rel="stylesheet" href="css/gitphp.min.css" type="text/css" /> <link rel="stylesheet" href="css/gitphp.min.css" type="text/css" />
{else} {else}
<link rel="stylesheet" href="css/gitphp.css" type="text/css" /> <link rel="stylesheet" href="css/gitphp.css" type="text/css" />
{/if} {/if}
{if file_exists("css/$stylesheet.min.css")} {if file_exists("css/$stylesheet.min.css")}
<link rel="stylesheet" href="css/{$stylesheet}.min.css" type="text/css" /> <link rel="stylesheet" href="css/{$stylesheet}.min.css" type="text/css" />
{else} {else}
<link rel="stylesheet" href="css/{$stylesheet}.css" type="text/css" /> <link rel="stylesheet" href="css/{$stylesheet}.css" type="text/css" />
{/if} {/if}
{if $extracss} {if $extracss}
<style type="text/css"> <style type="text/css">
{$extracss} {$extracss}
</style> </style>
{/if} {/if}
{if $javascript} {if $javascript}
<script type="text/javascript"> <script type="text/javascript">
var GITPHP_RES_LOADING="{t escape='js'}Loading…{/t}"; var GITPHP_RES_LOADING="{t escape='js'}Loading…{/t}";
var GITPHP_RES_LOADING_BLAME_DATA="{t escape='js'}Loading blame data…{/t}"; var GITPHP_RES_LOADING_BLAME_DATA="{t escape='js'}Loading blame data…{/t}";
var GITPHP_RES_SNAPSHOT="{t escape='js'}snapshot{/t}"; var GITPHP_RES_SNAPSHOT="{t escape='js'}snapshot{/t}";
var GITPHP_RES_NO_MATCHES_FOUND='{t escape=no}No matches found for "%1"{/t}'; var GITPHP_RES_NO_MATCHES_FOUND='{t escape=no}No matches found for "%1"{/t}';
var GITPHP_SNAPSHOT_FORMATS = {ldelim} var GITPHP_SNAPSHOT_FORMATS = {ldelim}
{foreach from=$snapshotformats key=format item=extension name=formats} {foreach from=$snapshotformats key=format item=extension name=formats}
"{$format}": "{$extension}"{if !$smarty.foreach.formats.last},{/if} "{$format}": "{$extension}"{if !$smarty.foreach.formats.last},{/if}
{/foreach} {/foreach}
{rdelim} {rdelim}
</script> </script>
<link rel="stylesheet" href="css/ext/jquery.qtip.css" type="text/css" /> <link rel="stylesheet" href="css/ext/jquery.qtip.css" type="text/css" />
{if $googlejs} <script src="js/ext/require.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> <script>
{else} require({ldelim}
<script type="text/javascript" src="js/ext/jquery-1.4.2.min.js"></script> baseUrl: 'js',
{/if} paths: {ldelim}
<script type="text/javascript" src="js/ext/jquery.qtip.min.js"></script> {if $googlejs}
{if file_exists('js/tooltips.min.js')} jquery: 'https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min'
<script type="text/javascript" src="js/tooltips.min.js"></script> {else}
{else} jquery: 'ext/jquery-1.4.2.min'
<script type="text/javascript" src="js/tooltips.js"></script> {/if}
{/if} {rdelim},
{if file_exists('js/lang.min.js')} priority: ['jquery']
<script type="text/javascript" src="js/lang.min.js"></script> {rdelim}, ['common']);
{else} </script>
<script type="text/javascript" src="js/lang.js"></script>  
{/if}  
{foreach from=$extrascripts item=script} {foreach from=$extrascripts item=script}
{if file_exists("js/$script.min.js")} {if file_exists("js/$script.min.js")}
<script type="text/javascript" src="js/{$script}.min.js"></script> <script type="text/javascript" src="js/{$script}.min.js"></script>
{else} {else}
<script type="text/javascript" src="js/{$script}.js"></script> <script type="text/javascript" src="js/{$script}.js"></script>
{/if} {/if}
{/foreach} {/foreach}
{/if} {/if}
{$smarty.capture.header} {$smarty.capture.header}
</head> </head>
<body> <body>
<div class="page_header"> <div class="page_header">
<a href="http://git-scm.com" title="git homepage"> <a href="http://git-scm.com" title="git homepage">
<img src="images/git-logo.png" width="72" height="27" alt="git" class="logo" /> <img src="images/git-logo.png" width="72" height="27" alt="git" class="logo" />
</a> </a>
{if $supportedlocales} {if $supportedlocales}
<div class="lang_select"> <div class="lang_select">
<form action="{$SCRIPT_NAME}" method="get" id="frmLangSelect"> <form action="{$SCRIPT_NAME}" method="get" id="frmLangSelect">
<div> <div>
{foreach from=$requestvars key=var item=val} {foreach from=$requestvars key=var item=val}
{if $var != "l"} {if $var != "l"}
<input type="hidden" name="{$var}" value="{$val}" /> <input type="hidden" name="{$var}" value="{$val}" />
{/if} {/if}
{/foreach} {/foreach}
<label for="selLang">{t}language:{/t}</label> <label for="selLang">{t}language:{/t}</label>
<select name="l" id="selLang"> <select name="l" id="selLang">
{foreach from=$supportedlocales key=locale item=language} {foreach from=$supportedlocales key=locale item=language}
<option {if $locale == $currentlocale}selected="selected"{/if} value="{$locale}">{if $language}{$language} ({$locale}){else}{$locale}{/if}</option> <option {if $locale == $currentlocale}selected="selected"{/if} value="{$locale}">{if $language}{$language} ({$locale}){else}{$locale}{/if}</option>
{/foreach} {/foreach}
</select> </select>
<input type="submit" value="{t}set{/t}" id="btnLangSet" /> <input type="submit" value="{t}set{/t}" id="btnLangSet" />
</div> </div>
</form> </form>
</div> </div>
{/if} {/if}
<a href="index.php">{if $homelink}{$homelink}{else}{t}projects{/t}{/if}</a> / <a href="index.php">{if $homelink}{$homelink}{else}{t}projects{/t}{/if}</a> /
{if $project} {if $project}
<a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=summary">{$project->GetProject()}</a> <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=summary">{$project->GetProject()}</a>
{if $actionlocal} {if $actionlocal}
/ {$actionlocal} / {$actionlocal}
{/if} {/if}
{if $enablesearch} {if $enablesearch}
<form method="get" action="index.php" enctype="application/x-www-form-urlencoded"> <form method="get" action="index.php" enctype="application/x-www-form-urlencoded">
<div class="search"> <div class="search">
<input type="hidden" name="p" value="{$project->GetProject()}" /> <input type="hidden" name="p" value="{$project->GetProject()}" />
<input type="hidden" name="a" value="search" /> <input type="hidden" name="a" value="search" />
<input type ="hidden" name="h" value="{if $commit}{$commit->GetHash()}{else}HEAD{/if}" /> <input type ="hidden" name="h" value="{if $commit}{$commit->GetHash()}{else}HEAD{/if}" />
<select name="st"> <select name="st">
<option {if $searchtype == 'commit'}selected="selected"{/if} value="commit">{t}commit{/t}</option> <option {if $searchtype == 'commit'}selected="selected"{/if} value="commit">{t}commit{/t}</option>
<option {if $searchtype == 'author'}selected="selected"{/if} value="author">{t}author{/t}</option> <option {if $searchtype == 'author'}selected="selected"{/if} value="author">{t}author{/t}</option>
<option {if $searchtype == 'committer'}selected="selected"{/if} value="committer">{t}committer{/t}</option> <option {if $searchtype == 'committer'}selected="selected"{/if} value="committer">{t}committer{/t}</option>
{if $filesearch} {if $filesearch}
<option {if $searchtype == 'file'}selected="selected"{/if} value="file">{t}file{/t}</option> <option {if $searchtype == 'file'}selected="selected"{/if} value="file">{t}file{/t}</option>
{/if} {/if}
</select> {t}search{/t}: <input type="text" name="s" {if $search}value="{$search}"{/if} /> </select> {t}search{/t}: <input type="text" name="s" {if $search}value="{$search}"{/if} />
</div> </div>
</form> </form>
{/if} {/if}
{/if} {/if}
</div> </div>
   
comments