2011-02-14 17:19:44 -08:00
|
|
|
|
(function ($) {
|
|
|
|
|
$(function () {
|
|
|
|
|
$("<div id='debug-control'><ul><li id='debug-shapes'>Shapes</li><li id='debug-zones'>Zones</li></ul><div id='debug-control-toggle'>»</div></div>")
|
2011-02-08 17:52:53 -08:00
|
|
|
|
.appendTo("body");
|
2011-02-14 17:19:44 -08:00
|
|
|
|
$("#debug-shapes").click(function () {
|
2011-02-08 17:52:53 -08:00
|
|
|
|
var _this = $(this);
|
|
|
|
|
$("html").toggleClass(_this.attr("id"));
|
|
|
|
|
$(this).toggleClass("debug-active");
|
|
|
|
|
});
|
2011-02-14 17:19:44 -08:00
|
|
|
|
$("#debug-zones").click(function () {
|
2011-02-11 15:33:33 -08:00
|
|
|
|
var _this = $(this);
|
|
|
|
|
$("html").toggleClass(_this.attr("id"));
|
|
|
|
|
$(this).toggleClass("debug-active");
|
2011-02-14 17:19:44 -08:00
|
|
|
|
|
|
|
|
|
if ($(this).hasClass("debug-active")) {
|
|
|
|
|
|
|
|
|
|
// renders the zone name in each zone
|
|
|
|
|
$(".zone").each(function () {
|
|
|
|
|
var classes = $(this).attr("class").split(' ');
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < classes.length; i++) {
|
|
|
|
|
if (classes[i].indexOf("zone-") === 0) {
|
2011-02-24 16:59:01 -08:00
|
|
|
|
$(this).append('<div class="zone-name">' + classes[i].substr(classes[i].indexOf("-") + 1) + '</div>');
|
2011-02-14 17:19:44 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
$(".zone-name").remove();
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-11 15:33:33 -08:00
|
|
|
|
});
|
|
|
|
|
$("#debug-control-toggle").click(function () {
|
2011-02-08 17:52:53 -08:00
|
|
|
|
var _this = $(this), open = "debug-open";
|
2011-02-14 17:19:44 -08:00
|
|
|
|
if (_this.is("." + open)) {
|
|
|
|
|
_this.prev().hide("fast", function () { _this.removeClass(open).html("»"); });
|
2011-02-08 17:52:53 -08:00
|
|
|
|
} else {
|
2011-02-14 17:19:44 -08:00
|
|
|
|
_this.prev().show("fast", function () { _this.addClass(open).html("«"); });
|
2011-02-08 17:52:53 -08:00
|
|
|
|
}
|
|
|
|
|
});
|
2011-02-24 16:59:01 -08:00
|
|
|
|
|
|
|
|
|
$("div.shape-tracing.wrapper").click(function (e) {
|
|
|
|
|
var _this = $(this);
|
|
|
|
|
var classes = $(this).attr("class").split(' ');
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
for (i = 0; i < classes.length; i++) {
|
|
|
|
|
if (classes[i].indexOf("shapeId-") === 0) {
|
|
|
|
|
var shapeId = classes[i].substr(classes[i].indexOf("-") + 1);
|
|
|
|
|
$("div.shape-tracing.wrapper").toggleClass('selected', false);
|
|
|
|
|
_this.toggleClass('selected', true);
|
|
|
|
|
$("div.shape-tracing.meta").toggle(false);
|
|
|
|
|
$("div.shape-tracing.meta.shapeId-" + shapeId).toggle(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
/* tabs */
|
|
|
|
|
function bindTab(selector) {
|
|
|
|
|
$('li' + selector).click(function () {
|
|
|
|
|
var _this = $(this);
|
2011-02-25 23:52:45 -08:00
|
|
|
|
|
2011-02-24 16:59:01 -08:00
|
|
|
|
// toggle the selected class on the tab li
|
|
|
|
|
_this.parent().children('li').toggleClass('selected', false);
|
|
|
|
|
_this.toggleClass('selected', true);
|
|
|
|
|
|
|
|
|
|
// hide all tabs and display the selected one
|
|
|
|
|
var wrapper = _this.parent().parent().first();
|
|
|
|
|
wrapper.children('.content').children().toggle(false);
|
|
|
|
|
wrapper.children('.content').children('div' + selector).toggle(true);
|
2011-03-08 13:18:58 -08:00
|
|
|
|
|
|
|
|
|
if (wrapper.children('.content').children('div' + selector).children('.CodeMirror').length == 0) {
|
|
|
|
|
var textArea = wrapper.children('.content').children('div' + selector).children('textarea').get(0);
|
|
|
|
|
CodeMirror.fromTextArea(textArea, { mode: "razor", tabMode: "indent", height: "100%" });
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-24 16:59:01 -08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-25 23:52:45 -08:00
|
|
|
|
var glyph = $("<span class=\"expando-glyph-container closed\"><span class=\"expando-glyph\"></span>​</span>");
|
|
|
|
|
$('div.model div.type').prev().prepend(glyph);
|
|
|
|
|
|
|
|
|
|
$('div.model ul ul').toggle(false);
|
|
|
|
|
|
|
|
|
|
$('span.expando-glyph-container').click(function () {
|
|
|
|
|
var __this = $(this);
|
|
|
|
|
|
|
|
|
|
if (__this.hasClass("closed") || __this.hasClass("closing")) {
|
|
|
|
|
__this.parent().parent().parent().children('ul').slideDown(300, function () { __this.removeClass("opening").removeClass("closed").addClass("open"); });
|
|
|
|
|
__this.addClass("opening");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
__this.parent().parent().parent().children('ul').slideUp(300, function () { __this.removeClass("closing").removeClass("open").addClass("closed"); });
|
|
|
|
|
__this.addClass("closing");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
2011-02-24 16:59:01 -08:00
|
|
|
|
bindTab('.shape');
|
|
|
|
|
bindTab('.model');
|
|
|
|
|
bindTab('.placement');
|
|
|
|
|
bindTab('.templates');
|
|
|
|
|
bindTab('.source');
|
|
|
|
|
bindTab('.html');
|
2011-02-25 23:52:45 -08:00
|
|
|
|
|
|
|
|
|
|
2011-02-08 17:52:53 -08:00
|
|
|
|
});
|
|
|
|
|
})(jQuery);
|