/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Portions Copyright 2011, 2012, Jens Elkner.
*/
// YUI.GlobalConfig = { fetchCSS: false };
/* Create a new YUI instance and attach modules + deps always needed */
// lets fake cssbutton entry to avoid useless downloads - it is a css-only
// module, already integrated into our style.css
if (typeof OpenGrok != 'undefined') {
}
var OpenGrok = function() {
var O = this,
instanceOf = function(o, type) {
return (o && o.hasOwnProperty && (o instanceof type));
};
if (!(instanceOf(O, OpenGrok))) {
O = new OpenGrok();
} else {
// set up the core environment
O._init();
}
O.instanceOf = instanceOf;
return O;
};
(function() {
/** Initialize this OpenGrok instance */
_init: function() {
var O = this;
.getAttribute('content');
O.constructor = OpenGrok;
},
/** Array of functions to be called when the page is completely loaded
* (i.e. incl. images etc.). Default: [] */
/** Array of functions to be called when the DOM of the page got loaded.
* Default: [] */
/** The revision string of the shown document prefixed with 'r='.
* Default: null */
/** Link to the web applications home. Default: # */
linkHome: "#",
/** Link to the most recent version of the shown document. Default: null */
/** Link to the history of the shown document. Append <var>O.rev</var>
* parameter to fetch a certain revision. Default: null */
linkHistory: null, // see mast.jsp
/** Download link to the file of the shown document. Append <var>O.rev</var>
* parameter to fetch a certain revision. Default: null */
linkDownload: null, // see mast.jsp
/** Boolean value to indicate, whether annotations are available
* for the most recent version of the shown document. Default: false */
hasAnnotations: false, // see mast.jsp
/** Boolean value to incidcate, whether the shown document already
* contains all annotations. Default: false */
/** Boolean value to indicate, whether a list of files for the
* changeset corresponding to the shown document is available.
* Default: false */
hasFileList: false, // see history.jsp
/** Boolean value to indicate, whether the shown document is a directory
* listing. Default: false */
/** Boolean value to indicate, whether the shown document contains
* cross reference content. Default: false */
/** The list of all available project. Default: [] */
/** Base path for cross file links (i.e. without the project part).
* Default: null */
/** A list with symbols of the shown code. Default: []
* @see JFlexXref#writeSymbolTable() */
};
// bootstrap
}
}
// set up the environment
// Support the CommonJS method for exporting our single global
if (typeof exports == 'object') {
}
}());
/** Make an instance available to the document beeing loaded */
var O = new OpenGrok();
/**
* Invoke all functions of document.pageReady .
*/
Y.on('load', function() {
for(var i in O.pageReady) {
O.pageReady[i]();
}
});
/**
* Invoke all functions of document.domReady .
*/
Y.on('domready', function() {
for(var i in O.domReady) {
O.domReady[i]();
}
});
if (this.cssBase) {
return this.cssBase;
}
if (!tmp) {
return "";
}
this.cssBase = "";
this.cssScheme = "";
break;
}
}
return this.cssBase;
};
if (!this.cssScheme) {
this.getCssBase();
}
return this.cssScheme;
};
return uri;
}
var prefix = "";
var suffix = "";
prefix = 'url(';
suffix = ')';
}
prefix += "'";
}
{
return uri;
}
};
return;
}
O.doingLinenums = true;
// ID nodes need to be separate, since display:none usually removes
// the node from the DOM and thus lines are not addressable by
// lineno. Visibility:hidden doesn't work as well - just makes the
// box transparent but keeps its width ...
var txtId = '<div id="nids">';
var txtNum = '<div id="nums">';
for (var i=1; i <= num; i++) {
// works, but style a single num becomes tricky :(
// txtNum += i + ' \n';
}
txtId += '</div>';
txtNum += '</div>';
delete(O.doingLinenums);
if (txtNum) {
// need to redo since on the first try the ID is not available
}
};
return;
}
return;
}
O.fetchingA = true;
// Prefix.XREF_P, Prefix.JSON_A
}
if (msg) {
}
}
// simple data conversion and check
try {
} catch (e) {
return;
}
return;
}
{
cleanup("data format error");
return;
}
// prepare for later use
a = data.a;
O.a = {
'uri' : a.uri,
'lines' : a.lines,
'revs' : revs
};
}
}
}
// generate rev and author column
len += 2;
var rcol = '<div id="revision">';
var acol = '<div id="author">';
}
}
rcol += '</div>';
acol += '</div>';
// insert columns
}
var a = O.a;
triggerNodes : '#revision > div',
showDelay: 150,
autoHideDelay : 6000,
delegate : '#revision',
shim : false,
zIndex : 2000,
CONTENT_TEMPLATE : null,
if (rid) {
if (info) {
}
}
return "";
}
});
if (a.uri) {
e.halt();
if (!rid) {
return;
}
if (info) {
}
}, 'div');
}
if (a.ulink) {
e.halt();
if (!rid) {
return;
}
if (a.usfx) {
}
}, 'div');
}
cleanup();
};
});
backgroundPosition: '0 0',
verticalAlign: 'middle',
width: '18px',
height: '18px',
display: 'inline-block',
});
// fetch
});
};
/**
* Init after DOM has been loaded.
* @see menu.jspf
*/
});
});
/** Select all projects in the project selection list. */
});
/** Invert the list of selected projects in the project selection list. */
});
});
/** Redirect to the project page of the first selected project. */
var goFirstProject = function(e) {
if (!selected) {
// TODO: Use a customized dialog
alert('Please select a project!');
return;
}
e.halt();
};
// selects event.get('target') before this one gets called, so:
goFirstProject(e);
});
Y.on('key', function(e) {
{
goFirstProject(e);
} else {
}
}, '#project', 'enter');
};
/**
* Init after DOM has been loaded.
*
* @see history.jsp
*/
var divList = null;
var radioList = null;
if (O.hasFileList) {
O.filelistExpanded = false;
var expandLabel = ' + Modified files ';
var collapseLabel = ' - Modified files ';
} else {
}
* view. */
e.halt();
O.filelistExpanded = !O.filelistExpanded;
if (!divList) {
}
return true;
});
e.halt();
}, '> tr > td > p');
} else {
}
var togglediffs = function(e) {
if (e) {
e.stopPropagation();
}
/** Toggle revision radio buttons in the history view. */
var cr2 = false;
var cr1 = false;
if (!radioList) {
}
if (this.get('checked')) {
cr1 = true;
return true;
}
if (this.get('checked')) {
cr2 = true;
return true;
}
}
});
};
// start state should ALWAYS be: first row: r1 hidden, r2 checked ;
// second row: r1 clicked, (r2 hidden)(optionally)
// I cannot say what will happen if they are not like that, togglediffs
// will go mad !
if (!O.isDir) {
Y.on('key', function(e) {
e.halt();
return true;
} else {
return false;
}
}, 'body', 'c');
togglediffs();
}
};
/**
* Init after DOM has been loaded.
*
* @see mast.jsp
*/
}
e.halt();
return false;
});
} else {
e.halt();
return false;
});
}
if (!O.hasAnnotations) {
} else if (O.annotated) {
// old style via ?a=true : annotations already there and initially shown
e.halt();
/** Make annotations [in]visible. */
? 'inline-block' : 'none';
blameNodes.each(function() {
});
});
Y.use('tooltip', function(Y) {
triggerNodes : '.blame .r',
showDelay: 150,
autoHideDelay : 6000,
delegate : "#lines",
shim : false,
zIndex : 2000,
CONTENT_TEMPLATE : null
});
});
} else {
// better: fetch annotations on demand
e.halt();
O.fetchAnnotations();
} else {
}
});
}
O.createLinenums();
} else {
}
});
e.halt();
}, 'div');
} else {
}
} else {
Y.use('symbols-panel', function(Y) {
var panel = new Y.SymbolsPanel({
zIndex: 50,
visible: false,
shim: false,
render: true,
fillHeight: 'body'
});
});
} else {
} else {
}
}
});
}
} else {
var link = O.linkDownload;
}
e.halt();
return false;
});
}
if (O.linkHome != '/source/') {
if (button) {
// 'click' works for left mouse button, only. 'mouseover' has the
// advantage wrt. 'mousedown', that the link tooltip shows the
// adjusted URL as well.
(function() {
var checkLink = function (e) {
}
return true;
};
}());
}
}
};
/* Add all modules used anywhere in this script via Y.use(...) or
* requires: [ ... ]. Thus we force loading all of them and can determine,
* which modules are sufficient to satisfy this script.
*/
if (!node) {
return;
}
// what we currently use
Y.use(// opengrok.js
'node-style', 'node-screen', 'node-event-delegate', 'event-key',
'widget', 'widget-position', 'widget-stack',
'widget', 'widget-position', 'widget-stack',
'widget-autohide', 'widget-buttons', 'widget-stdmod',
'dd-plugin', 'escape',
// annotations
'io-base', 'json-parse',
// our own extensions as well
'tooltip', 'symbols-panel');
var copy = [];
}
// let's find out unused modules - attach all
Y.use('*');
var copy2 = [];
}
var unused = [];
idx--;
} else {
}
}
}
};
/**
* Init after complete page (i.e. incl. images etc.) has been loaded.
*
* @see mast.jsp
*/
O.adjustContent = 0;
/**
* Resize the element with the ID 'content' so that it fills the whole
* browser window (i.e. the space between the header and the bottom of the
* window) and thus get rid off the scrollbar in the page header.
*/
var resize = function() {
if (O.adjustContent !== 0) {
var h = Y.one('#whole_header');
bottom : 0
});
}
};
O.adjustContent = 1;
resize();
}
};
if (!node) {
return 0;
}
while (x) {
x = x.get('offsetParent');
}
return st;
};
/**
* Init after DOM has been loaded.
* @see diff.jsp
*/
return;
}
return;
}
e.halt();
if (!block) {
return;
}
// expand or (with alt key pressed) collapse all
? e.clientY
if (e.altKey && !showSource) {
}
} else if (showSource && e.altKey) {
// preserve the position of the row which follows "this", i.e.
// the bottom of the row to show should have the same y position
// as the bottom of the row to hide
} else if (showSource) {
// just replace, i.e. the top of the row to show should have the same
// y position as the top of the row to hide
} else if (!showSource) {
// hide the row with unchanged source lines and try to position the
// row to show where the click occured wrt. its y position
var st = O.getTotalOffset(this);
}
}, function(target, e) {
});
};
// vim: set filetype=javascript ts=4