", {
text: "Source code",
href: "#",
"class": "showCode"
}).appendTo($container)
.click(function(e){
try {
prettyPrint();
} catch (e) {
alert(e);
}
var $pre = $container.find("pre");
if($pre.is(":visible")){
$(this).text("Source code");
}else{
$(this).text("Hide source");
}
$pre.toggle("slow");
return false;
});
var sourceCode = "" + opts.code;
// Remove outer function(){ CODE }
// sourceCode = sourceCode.match(/[]\{(.*)\}/);
sourceCode = sourceCode.substring(
sourceCode.indexOf("{") + 1,
sourceCode.lastIndexOf("}"));
// sourceCode = $.trim(sourceCode);
// Reduce tabs from 8 to 2 characters
sourceCode = sourceCode.replace(/\t/g, " ");
// Format code samples
$("", {
text: sourceCode,
"class": "prettyprint"
}).hide().appendTo($container);
if(opts.newline){
$container.append($("
"));
}
if(opts.header){
$("", {text: opts.header}).appendTo($("p#sampleButtons"));
}
$container.appendTo($("p#sampleButtons"));
}
function initCodeSamples()
{
var $source = $("#sourceCode");
$("#codeExample").clickToggle(
function(){
$source.show("fast");
if( !this.old ){
this.old = $(this).html();
$.get(this.href, function(code){
// Remove blocks:
code = code.replace(//gi, "");
// Reduce tabs from 8 to 2 characters
code = code.replace(/\t/g, " ");
$source.text(code);
// Format code samples
try {
prettyPrint();
} catch (e) {
alert(e);
}
}, "html");
}
$(this).html("Hide source code");
},
function(){
$(this).html(this.old);
$source.hide("fast");
}
);
if(jQuery.ui){
var info = "Fancytree " + jQuery.ui.fancytree.version
+ ", jQuery UI " + jQuery.ui.version
+ ", jQuery " + jQuery.fn.jquery;
/*
info += "\n
";
info += "document.compatMode: " + document.compatMode + "\n";
for(e in jQuery.support){
info += "
\n" + e + ": " + jQuery.support[e];
}
*/
$("p.sample-links").after("
" + info + "
");
}
}
var _gaq = _gaq || [];
$(function(){
// Log to Google Analytics, when not running locally
if ( document.URL.toLowerCase().indexOf("wwwendt.de/") >= 0 ) {
_gaq.push(["_setAccount", "UA-316028-1"]);
_gaq.push(["_trackPageview"]);
(function() {
var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;
ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);
})();
}
// Show some elements only, if (not) inside the Example Browser
if (top.location == self.location){
$(".hideOutsideFS").hide();
}else{
$(".hideInsideFS").hide();
}
initCodeSamples();
$("select#skinswitcher").skinswitcher({
base: "../src/",
choices: [{name: "XP", value: "xp", href: "skin-xp/ui.fancytree.css"},
{name: "Vista (classic Dynatree)", value: "vista", href: "skin-vista/ui.fancytree.css"},
{name: "Win7", value: "win7", href: "skin-win7/ui.fancytree.css"},
{name: "Win8", value: "win8", href: "skin-win8/ui.fancytree.css"},
{name: "Lion", value: "lion", href: "skin-lion/ui.fancytree.css"}
]
// init: "lion"
});
});