1 function loadPanel(target, url) {
2 $('.change-notification', $(target).parent()).fadeOut();
3 $(document).trigger('panel:unload', target);
7 success: function(data, textStatus) {
9 $(document).trigger('panel:load', target);
11 error: function(request, textStatus, errorThrown) {
12 console.log('ajax', url, target, 'error:', textStatus, errorThrown);
17 // Funkcja do tworzenia nowych paneli
18 function panel(load, unload) {
20 var eventId = Math.ceil(Math.random() * 1000000000);
22 unloadHandler = function(event, panel) {
23 if (self && self == panel) {
24 $(document).unbind('panel:unload.' + eventId);
31 $(document).one('panel:load', function(event, panel) {
33 $(document).bind('panel:unload.' + eventId, unloadHandler);
39 // ========================
40 // = Resizable panels =
41 // ========================
42 // function resizePanels() {
43 // // called on resize
44 // $('.panel').height($(window).height() - $('.panel').position().top);
45 // $('.panel-content').height($(window).height() - $('.panel-contents').position().top);
46 // $('#right-panel-wrap').width($(window).width() - $('#left-panel-wrap').outerWidth());
49 // $(window).resize(function() {
53 $('#panels').makeHorizPanel({});
54 $('#panels').css('top', ($('#header').outerHeight() ) + 'px');
56 // $('#left-panel-wrap').bind('resizable:stop', resizePanels)
57 // .resizable({minWidth: 8});
60 $('.panel-toolbar select').change(function() {
61 loadPanel($('.panel-content', $(this).parent().parent()), $(this).val())
63 // $('#id_folders').change(function() {
64 // $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() {
65 // $('#images-wrap').data('lazyload:lastCheckedScrollTop', -10000);
71 // var editor = CodeMirror.fromTextArea("id_text", {
72 // parserfile: 'parsexml.js',
73 // path: "/static/js/codemirror/",
74 // stylesheet: "/static/css/xmlcolors.css",
75 // parserConfig: {useHTMLKludges: false},
76 // initCallback: function() {
77 // $('#images').autoscroll('iframe');
78 // $('.toggleAutoscroll').toggle(function() {
79 // $(this).html('Synchronizuj przewijanie');
80 // $('#images').disableAutoscroll();
82 // $(this).html('Nie synchronizuj przewijania');
83 // $('#images').enableAutoscroll();
87 // $('#toolbar-tabs li').click(function() {
88 // var id = $(this).attr('p:button-list');
89 // $('#toolbar-tabs li').removeClass('active');
90 // $(this).addClass('active');
91 // if (!$('#' + id).is(':visible')) {
92 // $('#toolbar-buttons ol').not('#' + id).hide();
93 // $('#' + id).show();
98 // $('#toolbar-buttons li').each(function() {
99 // var tag = $(this).attr('p:tag');
100 // var handler = function() {
101 // var text = editor.selection();
102 // editor.replaceSelection('<' + tag + '>' + text + '</' + tag + '>');
103 // if (text.length == 0) {
104 // var pos = editor.cursorPosition();
105 // editor.selectLines(pos.line, pos.character + tag.length + 2);
108 // if ($(this).attr('p:key')) {
109 // keys[$(this).attr('p:key')] = handler;
111 // $(this).click(handler)
114 // editor.grabKeys(function(event) {
115 // if (keys[event.keyCode]) {
116 // keys[event.keyCode]();
118 // }, function(event) {
119 // return event.altKey && keys[event.keyCode];
128 // $('#toolbar-buttons li').wTooltip({
131 // border: "1px solid #7F7D67",
133 // background: "#FBFBC6",
138 // $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5});