mirror of https://github.com/CGAL/cgal
Add a menu for version selection to the doc.
This commit is contained in:
parent
10783492f9
commit
0161fe7c49
|
|
@ -15,6 +15,7 @@ EXAMPLE_PATH = ${CGAL_Convex_hull_2_EXAMPLE_DIR} \
|
||||||
FILTER_PATTERNS = *.txt=${CMAKE_BINARY_DIR}/pkglist_filter
|
FILTER_PATTERNS = *.txt=${CMAKE_BINARY_DIR}/pkglist_filter
|
||||||
|
|
||||||
HTML_EXTRA_FILES += ${CGAL_DOC_RESOURCE_DIR}/hacks.js \
|
HTML_EXTRA_FILES += ${CGAL_DOC_RESOURCE_DIR}/hacks.js \
|
||||||
|
${CGAL_DOC_RESOURCE_DIR}/menu_version.js \
|
||||||
${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css \
|
${CGAL_DOC_RESOURCE_DIR}/cgal_stylesheet.css \
|
||||||
${CMAKE_BINARY_DIR}/how_to_cite_cgal.bib \
|
${CMAKE_BINARY_DIR}/how_to_cite_cgal.bib \
|
||||||
${CMAKE_BINARY_DIR}/how_to_cite.html
|
${CMAKE_BINARY_DIR}/how_to_cite.html
|
||||||
|
|
|
||||||
|
|
@ -90,3 +90,19 @@ $(document).ready(function() {
|
||||||
* Version 1.2.2
|
* Version 1.2.2
|
||||||
*/
|
*/
|
||||||
(function(c){c.fn.footnotes=function(d){var e=c.extend({},c.fn.footnotes.defaults,d);return this.each(function(f){b("INFO: Building footnotes for "+(f+1)+"...",e.debugMode);c(e.footnotes,this).addClass(e.autoFootnoteClass);var h=(""===e.contentBlock)?c(this):c(e.contentBlock,this),g=e.orderedList?"<ol/>":"<ul/>";c("."+e.autoFootnoteClass).each(function(l){var t=-1,n=f+"-"+l,q=c(this),j,r,s,u,p,m,o,k;if(e.singleFootnoteDestination){j=c("#"+e.destination);if(0===j.length){b("INFO: No #autoFootnotes found; adding our own",e.debugMode);j=c(g).attr("id",e.destination).addClass("footnotesList").appendTo(h)}}else{j=c("#"+e.destination+f);if(0===j.length){b("INFO: No #autoFootnotes"+f+" found; adding our own for "+(f+1),e.debugMode);j=c(g).attr("id",e.destination+f).addClass("footnotesList").appendTo(h)}}q.removeClass(e.autoFootnoteClass);r=e.fnExtractFootnote(this);t=-1;n=f+"-"+l;j.find("li > .footnoteContent").each(function(i){var v=c(this);if(v.html()===r){t=i;s=c(v.parents("li").get(0));return false}});if(-1===t){u=c("<a/>").attr("href","#cite-text-"+n).attr("name","cite-ref-"+n).attr("id","cite-ref-"+n).attr("dir","ltr").attr("title",r).text("["+(j.find("li").length+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}p=c("<li/>").attr("id","cite-text-"+n);m=c("<span/>").addClass("footnoteBackReferenceGroup").appendTo(p);c("<span/>").addClass("footnoteContent").html(r).appendTo(p);u=c("<a/>").text("^").attr("href","#cite-ref-"+n).addClass("footnoteBackref").prependTo(m);j.append(p)}else{n=f+"-"+t;m=c(c("li > .footnoteBackReferenceGroup",j).get(t));o=m.find(".footnoteBackref");k=o.length;if(0===o.length){b("ERROR: $backRefs.length == 0, which should have prevented this code path",e.debugMode)}else{if(1===o.length){c("<sup/>").text("^ ").addClass("footnoteBackref").prependTo(m);o.html("<sup>a</sup>");++k}u=c("<a/>").attr("href","#"+s.attr("id")).attr("name","cite-ref-"+n+"-"+o.length).attr("id","cite-ref-"+n+"-"+o.length).attr("title",r).text("["+(t+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}u=c("<a/>").attr("href","#cite-ref-"+n+"-"+o.length).addClass("footnoteBackref");if(k>=26){b("WARN: multiple letter functionality is probably broken when more than 26 footnotes exist",e.debugMode)}u.prepend(String.fromCharCode((k)+96));c("<sup/>").appendTo(m).append(u)}}});b("INFO: Done building footnotes for "+(f+1),e.debugMode)})};c.fn.footnotes.version=function(){return"1.2.2"};c.fn.footnotes.defaults={footnotes:"blockquote[title],span.footnote,blockquote[cite]",prependTags:"blockquote",singleFootnoteDestination:false,destination:"autoFootnotes",contentBlock:".content",autoFootnoteClass:"autoFootnote",fnExtractFootnote:a,orderedList:true,debugMode:true};function b(e,d){if(d){if(window.console&&window.console.log){window.console.log(e)}}}function a(i){var j=c(i),e,f,h,g,d;if(j.is("span.footnote")){e=c(i).html();f=/^(?:(?: )|\s)*\(([\S\s]+)\)(?:(?: )|\s)*$/;h=e.match(f);if(h&&2===h.length){e=h[1]}j.empty()}else{if(j.is("blockquote[title]")){g=j.attr("cite");e=j.attr("title");if(""!==g){d=c("<a/>").attr("href",g);if(0===c(e).length){e=d.text(e)}else{e=d.text(g).wrap("<span/>").parent().append(": "+e);j.attr("title","")}}}else{if(j.is("blockquote[cite]")){g=j.attr("cite");e=c("<a/>").attr("href",g).text(g)}}}return e}})(jQuery);
|
(function(c){c.fn.footnotes=function(d){var e=c.extend({},c.fn.footnotes.defaults,d);return this.each(function(f){b("INFO: Building footnotes for "+(f+1)+"...",e.debugMode);c(e.footnotes,this).addClass(e.autoFootnoteClass);var h=(""===e.contentBlock)?c(this):c(e.contentBlock,this),g=e.orderedList?"<ol/>":"<ul/>";c("."+e.autoFootnoteClass).each(function(l){var t=-1,n=f+"-"+l,q=c(this),j,r,s,u,p,m,o,k;if(e.singleFootnoteDestination){j=c("#"+e.destination);if(0===j.length){b("INFO: No #autoFootnotes found; adding our own",e.debugMode);j=c(g).attr("id",e.destination).addClass("footnotesList").appendTo(h)}}else{j=c("#"+e.destination+f);if(0===j.length){b("INFO: No #autoFootnotes"+f+" found; adding our own for "+(f+1),e.debugMode);j=c(g).attr("id",e.destination+f).addClass("footnotesList").appendTo(h)}}q.removeClass(e.autoFootnoteClass);r=e.fnExtractFootnote(this);t=-1;n=f+"-"+l;j.find("li > .footnoteContent").each(function(i){var v=c(this);if(v.html()===r){t=i;s=c(v.parents("li").get(0));return false}});if(-1===t){u=c("<a/>").attr("href","#cite-text-"+n).attr("name","cite-ref-"+n).attr("id","cite-ref-"+n).attr("dir","ltr").attr("title",r).text("["+(j.find("li").length+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}p=c("<li/>").attr("id","cite-text-"+n);m=c("<span/>").addClass("footnoteBackReferenceGroup").appendTo(p);c("<span/>").addClass("footnoteContent").html(r).appendTo(p);u=c("<a/>").text("^").attr("href","#cite-ref-"+n).addClass("footnoteBackref").prependTo(m);j.append(p)}else{n=f+"-"+t;m=c(c("li > .footnoteBackReferenceGroup",j).get(t));o=m.find(".footnoteBackref");k=o.length;if(0===o.length){b("ERROR: $backRefs.length == 0, which should have prevented this code path",e.debugMode)}else{if(1===o.length){c("<sup/>").text("^ ").addClass("footnoteBackref").prependTo(m);o.html("<sup>a</sup>");++k}u=c("<a/>").attr("href","#"+s.attr("id")).attr("name","cite-ref-"+n+"-"+o.length).attr("id","cite-ref-"+n+"-"+o.length).attr("title",r).text("["+(t+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}u=c("<a/>").attr("href","#cite-ref-"+n+"-"+o.length).addClass("footnoteBackref");if(k>=26){b("WARN: multiple letter functionality is probably broken when more than 26 footnotes exist",e.debugMode)}u.prepend(String.fromCharCode((k)+96));c("<sup/>").appendTo(m).append(u)}}});b("INFO: Done building footnotes for "+(f+1),e.debugMode)})};c.fn.footnotes.version=function(){return"1.2.2"};c.fn.footnotes.defaults={footnotes:"blockquote[title],span.footnote,blockquote[cite]",prependTags:"blockquote",singleFootnoteDestination:false,destination:"autoFootnotes",contentBlock:".content",autoFootnoteClass:"autoFootnote",fnExtractFootnote:a,orderedList:true,debugMode:true};function b(e,d){if(d){if(window.console&&window.console.log){window.console.log(e)}}}function a(i){var j=c(i),e,f,h,g,d;if(j.is("span.footnote")){e=c(i).html();f=/^(?:(?: )|\s)*\(([\S\s]+)\)(?:(?: )|\s)*$/;h=e.match(f);if(h&&2===h.length){e=h[1]}j.empty()}else{if(j.is("blockquote[title]")){g=j.attr("cite");e=j.attr("title");if(""!==g){d=c("<a/>").attr("href",g);if(0===c(e).length){e=d.text(e)}else{e=d.text(g).wrap("<span/>").parent().append(": "+e);j.attr("title","")}}}else{if(j.is("blockquote[cite]")){g=j.attr("cite");e=c("<a/>").attr("href",g).text(g)}}}return e}})(jQuery);
|
||||||
|
(function(){
|
||||||
|
if(window.location.href.includes("doc.cgal.org")){
|
||||||
|
var url='https://doc.cgal.org/latest/Manual/menu_version.js';
|
||||||
|
var script = document.createElement("script"); // Make a script DOM node
|
||||||
|
script.src = url; // Set it's src to the provided URL
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var url='../Manual/menu_version.js';
|
||||||
|
var script = document.createElement("script"); // Make a script DOM node
|
||||||
|
script.src = url; // Set it's src to the provided URL
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var url_re = /doc\.cgal\.org\/(master|latest|(\d\.\d+))\//;
|
||||||
|
var url_local = /.*\/doc_output\//;
|
||||||
|
var all_versions = [
|
||||||
|
'master',
|
||||||
|
'latest',
|
||||||
|
'4.12',
|
||||||
|
'4.11',
|
||||||
|
'4.10',
|
||||||
|
'4.9',
|
||||||
|
'4.8',
|
||||||
|
'4.7',
|
||||||
|
'4.6',
|
||||||
|
'4.5',
|
||||||
|
'4.4',
|
||||||
|
'4.3'
|
||||||
|
];
|
||||||
|
|
||||||
|
function build_select(current_version, current_release) {
|
||||||
|
var buf = ['<select>'];
|
||||||
|
|
||||||
|
$.each(all_versions, function(id) {
|
||||||
|
var version = all_versions[id];
|
||||||
|
buf.push('<option value="' + version + '"');
|
||||||
|
if (version == current_version) {
|
||||||
|
console.log(version);
|
||||||
|
buf.push(' selected="selected">');
|
||||||
|
if (version[0] == '4') {
|
||||||
|
buf.push(current_release);
|
||||||
|
} else {
|
||||||
|
buf.push(title + ' (' + current_release + ')');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buf.push('>' + version);
|
||||||
|
}
|
||||||
|
buf.push('</option>');
|
||||||
|
});
|
||||||
|
|
||||||
|
buf.push('</select>');
|
||||||
|
return buf.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function patch_url(url, new_version) {
|
||||||
|
if(url.includes("doc.cgal.org")){
|
||||||
|
return url.replace(url_re, 'https://doc.cgal.org/' + new_version + '/');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return url.replace(url_local, 'https://doc.cgal.org/' + new_version + '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_switch() {
|
||||||
|
var selected = $(this).children('option:selected').attr('value');
|
||||||
|
var url = window.location.href,
|
||||||
|
new_url = patch_url(url, selected);
|
||||||
|
if (new_url != url) {
|
||||||
|
window.location.href = new_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
var motherNode=document.getElementById("back-nav");
|
||||||
|
var node = document.createElement("LI");
|
||||||
|
var spanNode = document.createElement("SPAN");
|
||||||
|
var titleNode =document.createTextNode("CGAL Version: ");
|
||||||
|
var textNode = document.createTextNode("4.11");
|
||||||
|
spanNode.setAttribute("class", "version_menu");
|
||||||
|
spanNode.appendChild(textNode);
|
||||||
|
node.appendChild(titleNode);
|
||||||
|
node.appendChild(spanNode);
|
||||||
|
motherNode.insertBefore(node, motherNode.firstChild);
|
||||||
|
var match = url_re.exec(window.location.href);
|
||||||
|
if (match) {
|
||||||
|
var version = match[1];
|
||||||
|
var release = '4.11';
|
||||||
|
var select = build_select(version, release);
|
||||||
|
spanNode.innerHTML=select;
|
||||||
|
$('.version_menu').bind('change', on_switch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
match = url_local.exec(window.location.href);
|
||||||
|
if (match) {
|
||||||
|
var version = '4.11';
|
||||||
|
var release = '4.11';
|
||||||
|
var select = build_select(version, release);
|
||||||
|
spanNode.innerHTML=select;
|
||||||
|
$('.version_menu select').bind('change', on_switch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
@ -90,3 +90,19 @@ $(document).ready(function() {
|
||||||
* Version 1.2.2
|
* Version 1.2.2
|
||||||
*/
|
*/
|
||||||
(function(c){c.fn.footnotes=function(d){var e=c.extend({},c.fn.footnotes.defaults,d);return this.each(function(f){b("INFO: Building footnotes for "+(f+1)+"...",e.debugMode);c(e.footnotes,this).addClass(e.autoFootnoteClass);var h=(""===e.contentBlock)?c(this):c(e.contentBlock,this),g=e.orderedList?"<ol/>":"<ul/>";c("."+e.autoFootnoteClass).each(function(l){var t=-1,n=f+"-"+l,q=c(this),j,r,s,u,p,m,o,k;if(e.singleFootnoteDestination){j=c("#"+e.destination);if(0===j.length){b("INFO: No #autoFootnotes found; adding our own",e.debugMode);j=c(g).attr("id",e.destination).addClass("footnotesList").appendTo(h)}}else{j=c("#"+e.destination+f);if(0===j.length){b("INFO: No #autoFootnotes"+f+" found; adding our own for "+(f+1),e.debugMode);j=c(g).attr("id",e.destination+f).addClass("footnotesList").appendTo(h)}}q.removeClass(e.autoFootnoteClass);r=e.fnExtractFootnote(this);t=-1;n=f+"-"+l;j.find("li > .footnoteContent").each(function(i){var v=c(this);if(v.html()===r){t=i;s=c(v.parents("li").get(0));return false}});if(-1===t){u=c("<a/>").attr("href","#cite-text-"+n).attr("name","cite-ref-"+n).attr("id","cite-ref-"+n).attr("dir","ltr").attr("title",r).text("["+(j.find("li").length+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}p=c("<li/>").attr("id","cite-text-"+n);m=c("<span/>").addClass("footnoteBackReferenceGroup").appendTo(p);c("<span/>").addClass("footnoteContent").html(r).appendTo(p);u=c("<a/>").text("^").attr("href","#cite-ref-"+n).addClass("footnoteBackref").prependTo(m);j.append(p)}else{n=f+"-"+t;m=c(c("li > .footnoteBackReferenceGroup",j).get(t));o=m.find(".footnoteBackref");k=o.length;if(0===o.length){b("ERROR: $backRefs.length == 0, which should have prevented this code path",e.debugMode)}else{if(1===o.length){c("<sup/>").text("^ ").addClass("footnoteBackref").prependTo(m);o.html("<sup>a</sup>");++k}u=c("<a/>").attr("href","#"+s.attr("id")).attr("name","cite-ref-"+n+"-"+o.length).attr("id","cite-ref-"+n+"-"+o.length).attr("title",r).text("["+(t+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}u=c("<a/>").attr("href","#cite-ref-"+n+"-"+o.length).addClass("footnoteBackref");if(k>=26){b("WARN: multiple letter functionality is probably broken when more than 26 footnotes exist",e.debugMode)}u.prepend(String.fromCharCode((k)+96));c("<sup/>").appendTo(m).append(u)}}});b("INFO: Done building footnotes for "+(f+1),e.debugMode)})};c.fn.footnotes.version=function(){return"1.2.2"};c.fn.footnotes.defaults={footnotes:"blockquote[title],span.footnote,blockquote[cite]",prependTags:"blockquote",singleFootnoteDestination:false,destination:"autoFootnotes",contentBlock:".content",autoFootnoteClass:"autoFootnote",fnExtractFootnote:a,orderedList:true,debugMode:true};function b(e,d){if(d){if(window.console&&window.console.log){window.console.log(e)}}}function a(i){var j=c(i),e,f,h,g,d;if(j.is("span.footnote")){e=c(i).html();f=/^(?:(?: )|\s)*\(([\S\s]+)\)(?:(?: )|\s)*$/;h=e.match(f);if(h&&2===h.length){e=h[1]}j.empty()}else{if(j.is("blockquote[title]")){g=j.attr("cite");e=j.attr("title");if(""!==g){d=c("<a/>").attr("href",g);if(0===c(e).length){e=d.text(e)}else{e=d.text(g).wrap("<span/>").parent().append(": "+e);j.attr("title","")}}}else{if(j.is("blockquote[cite]")){g=j.attr("cite");e=c("<a/>").attr("href",g).text(g)}}}return e}})(jQuery);
|
(function(c){c.fn.footnotes=function(d){var e=c.extend({},c.fn.footnotes.defaults,d);return this.each(function(f){b("INFO: Building footnotes for "+(f+1)+"...",e.debugMode);c(e.footnotes,this).addClass(e.autoFootnoteClass);var h=(""===e.contentBlock)?c(this):c(e.contentBlock,this),g=e.orderedList?"<ol/>":"<ul/>";c("."+e.autoFootnoteClass).each(function(l){var t=-1,n=f+"-"+l,q=c(this),j,r,s,u,p,m,o,k;if(e.singleFootnoteDestination){j=c("#"+e.destination);if(0===j.length){b("INFO: No #autoFootnotes found; adding our own",e.debugMode);j=c(g).attr("id",e.destination).addClass("footnotesList").appendTo(h)}}else{j=c("#"+e.destination+f);if(0===j.length){b("INFO: No #autoFootnotes"+f+" found; adding our own for "+(f+1),e.debugMode);j=c(g).attr("id",e.destination+f).addClass("footnotesList").appendTo(h)}}q.removeClass(e.autoFootnoteClass);r=e.fnExtractFootnote(this);t=-1;n=f+"-"+l;j.find("li > .footnoteContent").each(function(i){var v=c(this);if(v.html()===r){t=i;s=c(v.parents("li").get(0));return false}});if(-1===t){u=c("<a/>").attr("href","#cite-text-"+n).attr("name","cite-ref-"+n).attr("id","cite-ref-"+n).attr("dir","ltr").attr("title",r).text("["+(j.find("li").length+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}p=c("<li/>").attr("id","cite-text-"+n);m=c("<span/>").addClass("footnoteBackReferenceGroup").appendTo(p);c("<span/>").addClass("footnoteContent").html(r).appendTo(p);u=c("<a/>").text("^").attr("href","#cite-ref-"+n).addClass("footnoteBackref").prependTo(m);j.append(p)}else{n=f+"-"+t;m=c(c("li > .footnoteBackReferenceGroup",j).get(t));o=m.find(".footnoteBackref");k=o.length;if(0===o.length){b("ERROR: $backRefs.length == 0, which should have prevented this code path",e.debugMode)}else{if(1===o.length){c("<sup/>").text("^ ").addClass("footnoteBackref").prependTo(m);o.html("<sup>a</sup>");++k}u=c("<a/>").attr("href","#"+s.attr("id")).attr("name","cite-ref-"+n+"-"+o.length).attr("id","cite-ref-"+n+"-"+o.length).attr("title",r).text("["+(t+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}u=c("<a/>").attr("href","#cite-ref-"+n+"-"+o.length).addClass("footnoteBackref");if(k>=26){b("WARN: multiple letter functionality is probably broken when more than 26 footnotes exist",e.debugMode)}u.prepend(String.fromCharCode((k)+96));c("<sup/>").appendTo(m).append(u)}}});b("INFO: Done building footnotes for "+(f+1),e.debugMode)})};c.fn.footnotes.version=function(){return"1.2.2"};c.fn.footnotes.defaults={footnotes:"blockquote[title],span.footnote,blockquote[cite]",prependTags:"blockquote",singleFootnoteDestination:false,destination:"autoFootnotes",contentBlock:".content",autoFootnoteClass:"autoFootnote",fnExtractFootnote:a,orderedList:true,debugMode:true};function b(e,d){if(d){if(window.console&&window.console.log){window.console.log(e)}}}function a(i){var j=c(i),e,f,h,g,d;if(j.is("span.footnote")){e=c(i).html();f=/^(?:(?: )|\s)*\(([\S\s]+)\)(?:(?: )|\s)*$/;h=e.match(f);if(h&&2===h.length){e=h[1]}j.empty()}else{if(j.is("blockquote[title]")){g=j.attr("cite");e=j.attr("title");if(""!==g){d=c("<a/>").attr("href",g);if(0===c(e).length){e=d.text(e)}else{e=d.text(g).wrap("<span/>").parent().append(": "+e);j.attr("title","")}}}else{if(j.is("blockquote[cite]")){g=j.attr("cite");e=c("<a/>").attr("href",g).text(g)}}}return e}})(jQuery);
|
||||||
|
(function(){
|
||||||
|
if(window.location.href.includes("doc.cgal.org")){
|
||||||
|
var url='https://doc.cgal.org/latest/Manual/menu_version.js';
|
||||||
|
var script = document.createElement("script"); // Make a script DOM node
|
||||||
|
script.src = url; // Set it's src to the provided URL
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var url='../Manual/menu_version.js';
|
||||||
|
var script = document.createElement("script"); // Make a script DOM node
|
||||||
|
script.src = url; // Set it's src to the provided URL
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var url_re = /doc\.cgal\.org\/(master|latest|(\d\.\d+))\//;
|
||||||
|
var url_local = /.*\/doc_output\//;
|
||||||
|
var all_versions = [
|
||||||
|
'master',
|
||||||
|
'latest',
|
||||||
|
'4.12',
|
||||||
|
'4.11',
|
||||||
|
'4.10',
|
||||||
|
'4.9',
|
||||||
|
'4.8',
|
||||||
|
'4.7',
|
||||||
|
'4.6',
|
||||||
|
'4.5',
|
||||||
|
'4.4',
|
||||||
|
'4.3'
|
||||||
|
];
|
||||||
|
|
||||||
|
function build_select(current_version, current_release) {
|
||||||
|
var buf = ['<select>'];
|
||||||
|
|
||||||
|
$.each(all_versions, function(id) {
|
||||||
|
var version = all_versions[id];
|
||||||
|
buf.push('<option value="' + version + '"');
|
||||||
|
if (version == current_version) {
|
||||||
|
console.log(version);
|
||||||
|
buf.push(' selected="selected">');
|
||||||
|
if (version[0] == '4') {
|
||||||
|
buf.push(current_release);
|
||||||
|
} else {
|
||||||
|
buf.push(title + ' (' + current_release + ')');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buf.push('>' + version);
|
||||||
|
}
|
||||||
|
buf.push('</option>');
|
||||||
|
});
|
||||||
|
|
||||||
|
buf.push('</select>');
|
||||||
|
return buf.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function patch_url(url, new_version) {
|
||||||
|
if(url.includes("doc.cgal.org")){
|
||||||
|
return url.replace(url_re, 'https://doc.cgal.org/' + new_version + '/');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return url.replace(url_local, 'https://doc.cgal.org/' + new_version + '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_switch() {
|
||||||
|
var selected = $(this).children('option:selected').attr('value');
|
||||||
|
var url = window.location.href,
|
||||||
|
new_url = patch_url(url, selected);
|
||||||
|
if (new_url != url) {
|
||||||
|
window.location.href = new_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
var motherNode=document.getElementById("back-nav");
|
||||||
|
var node = document.createElement("LI");
|
||||||
|
var spanNode = document.createElement("SPAN");
|
||||||
|
var titleNode =document.createTextNode("CGAL Version: ");
|
||||||
|
var textNode = document.createTextNode("4.11");
|
||||||
|
spanNode.setAttribute("class", "version_menu");
|
||||||
|
spanNode.appendChild(textNode);
|
||||||
|
node.appendChild(titleNode);
|
||||||
|
node.appendChild(spanNode);
|
||||||
|
motherNode.insertBefore(node, motherNode.firstChild);
|
||||||
|
var match = url_re.exec(window.location.href);
|
||||||
|
if (match) {
|
||||||
|
var version = match[1];
|
||||||
|
var release = '4.11';
|
||||||
|
var select = build_select(version, release);
|
||||||
|
spanNode.innerHTML=select;
|
||||||
|
$('.version_menu').bind('change', on_switch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
match = url_local.exec(window.location.href);
|
||||||
|
if (match) {
|
||||||
|
var version = '4.11';
|
||||||
|
var release = '4.11';
|
||||||
|
var select = build_select(version, release);
|
||||||
|
spanNode.innerHTML=select;
|
||||||
|
$('.version_menu select').bind('change', on_switch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
|
@ -90,3 +90,19 @@ $(document).ready(function() {
|
||||||
* Version 1.2.2
|
* Version 1.2.2
|
||||||
*/
|
*/
|
||||||
(function(c){c.fn.footnotes=function(d){var e=c.extend({},c.fn.footnotes.defaults,d);return this.each(function(f){b("INFO: Building footnotes for "+(f+1)+"...",e.debugMode);c(e.footnotes,this).addClass(e.autoFootnoteClass);var h=(""===e.contentBlock)?c(this):c(e.contentBlock,this),g=e.orderedList?"<ol/>":"<ul/>";c("."+e.autoFootnoteClass).each(function(l){var t=-1,n=f+"-"+l,q=c(this),j,r,s,u,p,m,o,k;if(e.singleFootnoteDestination){j=c("#"+e.destination);if(0===j.length){b("INFO: No #autoFootnotes found; adding our own",e.debugMode);j=c(g).attr("id",e.destination).addClass("footnotesList").appendTo(h)}}else{j=c("#"+e.destination+f);if(0===j.length){b("INFO: No #autoFootnotes"+f+" found; adding our own for "+(f+1),e.debugMode);j=c(g).attr("id",e.destination+f).addClass("footnotesList").appendTo(h)}}q.removeClass(e.autoFootnoteClass);r=e.fnExtractFootnote(this);t=-1;n=f+"-"+l;j.find("li > .footnoteContent").each(function(i){var v=c(this);if(v.html()===r){t=i;s=c(v.parents("li").get(0));return false}});if(-1===t){u=c("<a/>").attr("href","#cite-text-"+n).attr("name","cite-ref-"+n).attr("id","cite-ref-"+n).attr("dir","ltr").attr("title",r).text("["+(j.find("li").length+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}p=c("<li/>").attr("id","cite-text-"+n);m=c("<span/>").addClass("footnoteBackReferenceGroup").appendTo(p);c("<span/>").addClass("footnoteContent").html(r).appendTo(p);u=c("<a/>").text("^").attr("href","#cite-ref-"+n).addClass("footnoteBackref").prependTo(m);j.append(p)}else{n=f+"-"+t;m=c(c("li > .footnoteBackReferenceGroup",j).get(t));o=m.find(".footnoteBackref");k=o.length;if(0===o.length){b("ERROR: $backRefs.length == 0, which should have prevented this code path",e.debugMode)}else{if(1===o.length){c("<sup/>").text("^ ").addClass("footnoteBackref").prependTo(m);o.html("<sup>a</sup>");++k}u=c("<a/>").attr("href","#"+s.attr("id")).attr("name","cite-ref-"+n+"-"+o.length).attr("id","cite-ref-"+n+"-"+o.length).attr("title",r).text("["+(t+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}u=c("<a/>").attr("href","#cite-ref-"+n+"-"+o.length).addClass("footnoteBackref");if(k>=26){b("WARN: multiple letter functionality is probably broken when more than 26 footnotes exist",e.debugMode)}u.prepend(String.fromCharCode((k)+96));c("<sup/>").appendTo(m).append(u)}}});b("INFO: Done building footnotes for "+(f+1),e.debugMode)})};c.fn.footnotes.version=function(){return"1.2.2"};c.fn.footnotes.defaults={footnotes:"blockquote[title],span.footnote,blockquote[cite]",prependTags:"blockquote",singleFootnoteDestination:false,destination:"autoFootnotes",contentBlock:".content",autoFootnoteClass:"autoFootnote",fnExtractFootnote:a,orderedList:true,debugMode:true};function b(e,d){if(d){if(window.console&&window.console.log){window.console.log(e)}}}function a(i){var j=c(i),e,f,h,g,d;if(j.is("span.footnote")){e=c(i).html();f=/^(?:(?: )|\s)*\(([\S\s]+)\)(?:(?: )|\s)*$/;h=e.match(f);if(h&&2===h.length){e=h[1]}j.empty()}else{if(j.is("blockquote[title]")){g=j.attr("cite");e=j.attr("title");if(""!==g){d=c("<a/>").attr("href",g);if(0===c(e).length){e=d.text(e)}else{e=d.text(g).wrap("<span/>").parent().append(": "+e);j.attr("title","")}}}else{if(j.is("blockquote[cite]")){g=j.attr("cite");e=c("<a/>").attr("href",g).text(g)}}}return e}})(jQuery);
|
(function(c){c.fn.footnotes=function(d){var e=c.extend({},c.fn.footnotes.defaults,d);return this.each(function(f){b("INFO: Building footnotes for "+(f+1)+"...",e.debugMode);c(e.footnotes,this).addClass(e.autoFootnoteClass);var h=(""===e.contentBlock)?c(this):c(e.contentBlock,this),g=e.orderedList?"<ol/>":"<ul/>";c("."+e.autoFootnoteClass).each(function(l){var t=-1,n=f+"-"+l,q=c(this),j,r,s,u,p,m,o,k;if(e.singleFootnoteDestination){j=c("#"+e.destination);if(0===j.length){b("INFO: No #autoFootnotes found; adding our own",e.debugMode);j=c(g).attr("id",e.destination).addClass("footnotesList").appendTo(h)}}else{j=c("#"+e.destination+f);if(0===j.length){b("INFO: No #autoFootnotes"+f+" found; adding our own for "+(f+1),e.debugMode);j=c(g).attr("id",e.destination+f).addClass("footnotesList").appendTo(h)}}q.removeClass(e.autoFootnoteClass);r=e.fnExtractFootnote(this);t=-1;n=f+"-"+l;j.find("li > .footnoteContent").each(function(i){var v=c(this);if(v.html()===r){t=i;s=c(v.parents("li").get(0));return false}});if(-1===t){u=c("<a/>").attr("href","#cite-text-"+n).attr("name","cite-ref-"+n).attr("id","cite-ref-"+n).attr("dir","ltr").attr("title",r).text("["+(j.find("li").length+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}p=c("<li/>").attr("id","cite-text-"+n);m=c("<span/>").addClass("footnoteBackReferenceGroup").appendTo(p);c("<span/>").addClass("footnoteContent").html(r).appendTo(p);u=c("<a/>").text("^").attr("href","#cite-ref-"+n).addClass("footnoteBackref").prependTo(m);j.append(p)}else{n=f+"-"+t;m=c(c("li > .footnoteBackReferenceGroup",j).get(t));o=m.find(".footnoteBackref");k=o.length;if(0===o.length){b("ERROR: $backRefs.length == 0, which should have prevented this code path",e.debugMode)}else{if(1===o.length){c("<sup/>").text("^ ").addClass("footnoteBackref").prependTo(m);o.html("<sup>a</sup>");++k}u=c("<a/>").attr("href","#"+s.attr("id")).attr("name","cite-ref-"+n+"-"+o.length).attr("id","cite-ref-"+n+"-"+o.length).attr("title",r).text("["+(t+1)+"]").addClass("footnoteLink");if(q.is(e.prependTags)){c("<sup/>").prependTo(this).append(u)}else{c("<sup/>").appendTo(this).append(u)}u=c("<a/>").attr("href","#cite-ref-"+n+"-"+o.length).addClass("footnoteBackref");if(k>=26){b("WARN: multiple letter functionality is probably broken when more than 26 footnotes exist",e.debugMode)}u.prepend(String.fromCharCode((k)+96));c("<sup/>").appendTo(m).append(u)}}});b("INFO: Done building footnotes for "+(f+1),e.debugMode)})};c.fn.footnotes.version=function(){return"1.2.2"};c.fn.footnotes.defaults={footnotes:"blockquote[title],span.footnote,blockquote[cite]",prependTags:"blockquote",singleFootnoteDestination:false,destination:"autoFootnotes",contentBlock:".content",autoFootnoteClass:"autoFootnote",fnExtractFootnote:a,orderedList:true,debugMode:true};function b(e,d){if(d){if(window.console&&window.console.log){window.console.log(e)}}}function a(i){var j=c(i),e,f,h,g,d;if(j.is("span.footnote")){e=c(i).html();f=/^(?:(?: )|\s)*\(([\S\s]+)\)(?:(?: )|\s)*$/;h=e.match(f);if(h&&2===h.length){e=h[1]}j.empty()}else{if(j.is("blockquote[title]")){g=j.attr("cite");e=j.attr("title");if(""!==g){d=c("<a/>").attr("href",g);if(0===c(e).length){e=d.text(e)}else{e=d.text(g).wrap("<span/>").parent().append(": "+e);j.attr("title","")}}}else{if(j.is("blockquote[cite]")){g=j.attr("cite");e=c("<a/>").attr("href",g).text(g)}}}return e}})(jQuery);
|
||||||
|
(function(){
|
||||||
|
if(window.location.href.includes("doc.cgal.org")){
|
||||||
|
var url='https://doc.cgal.org/latest/Manual/menu_version.js';
|
||||||
|
var script = document.createElement("script"); // Make a script DOM node
|
||||||
|
script.src = url; // Set it's src to the provided URL
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var url='../Manual/menu_version.js';
|
||||||
|
var script = document.createElement("script"); // Make a script DOM node
|
||||||
|
script.src = url; // Set it's src to the provided URL
|
||||||
|
document.head.appendChild(script);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,93 @@
|
||||||
|
(function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var url_re = /doc\.cgal\.org\/(master|latest|(\d\.\d+))\//;
|
||||||
|
var url_local = /.*\/doc_output\//;
|
||||||
|
var all_versions = [
|
||||||
|
'master',
|
||||||
|
'latest',
|
||||||
|
'4.12',
|
||||||
|
'4.11',
|
||||||
|
'4.10',
|
||||||
|
'4.9',
|
||||||
|
'4.8',
|
||||||
|
'4.7',
|
||||||
|
'4.6',
|
||||||
|
'4.5',
|
||||||
|
'4.4',
|
||||||
|
'4.3'
|
||||||
|
];
|
||||||
|
|
||||||
|
function build_select(current_version, current_release) {
|
||||||
|
var buf = ['<select>'];
|
||||||
|
|
||||||
|
$.each(all_versions, function(id) {
|
||||||
|
var version = all_versions[id];
|
||||||
|
buf.push('<option value="' + version + '"');
|
||||||
|
if (version == current_version) {
|
||||||
|
console.log(version);
|
||||||
|
buf.push(' selected="selected">');
|
||||||
|
if (version[0] == '4') {
|
||||||
|
buf.push(current_release);
|
||||||
|
} else {
|
||||||
|
buf.push(title + ' (' + current_release + ')');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buf.push('>' + version);
|
||||||
|
}
|
||||||
|
buf.push('</option>');
|
||||||
|
});
|
||||||
|
|
||||||
|
buf.push('</select>');
|
||||||
|
return buf.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
function patch_url(url, new_version) {
|
||||||
|
if(url.includes("doc.cgal.org")){
|
||||||
|
return url.replace(url_re, 'https://doc.cgal.org/' + new_version + '/');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return url.replace(url_local, 'https://doc.cgal.org/' + new_version + '/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function on_switch() {
|
||||||
|
var selected = $(this).children('option:selected').attr('value');
|
||||||
|
var url = window.location.href,
|
||||||
|
new_url = patch_url(url, selected);
|
||||||
|
if (new_url != url) {
|
||||||
|
window.location.href = new_url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
var motherNode=document.getElementById("back-nav");
|
||||||
|
var node = document.createElement("LI");
|
||||||
|
var spanNode = document.createElement("SPAN");
|
||||||
|
var titleNode =document.createTextNode("CGAL Version: ");
|
||||||
|
var textNode = document.createTextNode("4.11");
|
||||||
|
spanNode.setAttribute("class", "version_menu");
|
||||||
|
spanNode.appendChild(textNode);
|
||||||
|
node.appendChild(titleNode);
|
||||||
|
node.appendChild(spanNode);
|
||||||
|
motherNode.insertBefore(node, motherNode.firstChild);
|
||||||
|
var match = url_re.exec(window.location.href);
|
||||||
|
if (match) {
|
||||||
|
var version = match[1];
|
||||||
|
var release = '4.11';
|
||||||
|
var select = build_select(version, release);
|
||||||
|
spanNode.innerHTML=select;
|
||||||
|
$('.version_menu').bind('change', on_switch);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
match = url_local.exec(window.location.href);
|
||||||
|
if (match) {
|
||||||
|
var version = '4.11';
|
||||||
|
var release = '4.11';
|
||||||
|
var select = build_select(version, release);
|
||||||
|
spanNode.innerHTML=select;
|
||||||
|
$('.version_menu select').bind('change', on_switch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})();
|
||||||
Loading…
Reference in New Issue