Wydzielenie JavaScriptu z szablonu explorer/file_xml.html do pliku js/panels.js.
[redakcja.git] / project / static / js / panels.js
1 $(function() {
2     // ========================
3     // = Resizable panels =
4     // ========================
5     function resizePanels() {
6         $('.panel').height($(window).height() - $('.panel').position().top);
7         $('#right-panel-wrap').width($(window).width() - $('#left-panel-wrap').outerWidth());
8     }
9     
10     $(window).resize(function() {
11         resizePanels();
12     })
13     
14     $('#left-panel-wrap').bind('resizable:resize', resizePanels)
15         .resizable('#slider', {minWidth: 8});
16     
17     resizePanels();
18     
19     $('.panel-toolbar select').change(function() {
20         console.log('loading panel', $(this).val(), 'into', $('.panel-contents', $(this).parent()));
21     });
22     // $('#id_folders').change(function() {
23     //     $('#images').load('{% url folder_image_ajax %}' + $('#id_folders').val() + '/', function() {
24     //         $('#images-wrap').data('lazyload:lastCheckedScrollTop', -10000);
25     //     });
26     // });
27     // 
28     //
29     
30     // var editor = CodeMirror.fromTextArea("id_text", {
31     //     parserfile: 'parsexml.js',
32     //     path: "/static/js/codemirror/",
33     //     stylesheet: "/static/css/xmlcolors.css",
34     //     parserConfig: {useHTMLKludges: false},
35     //     initCallback: function() {
36     //         $('#images').autoscroll('iframe');
37     //         $('.toggleAutoscroll').toggle(function() {
38     //             $(this).html('Synchronizuj przewijanie');
39     //             $('#images').disableAutoscroll();
40     //         }, function() {
41     //             $(this).html('Nie synchronizuj przewijania');
42     //             $('#images').enableAutoscroll();
43     //         })
44     //         
45     //         // Toolbar
46     //         $('#toolbar-tabs li').click(function() {
47     //             var id = $(this).attr('p:button-list');
48     //             $('#toolbar-tabs li').removeClass('active');
49     //             $(this).addClass('active');
50     //             if (!$('#' + id).is(':visible')) {
51     //                 $('#toolbar-buttons ol').not('#' + id).hide();
52     //                 $('#' + id).show();
53     //             }
54     //         })
55     // 
56     //         var keys = {};
57     //         $('#toolbar-buttons li').each(function() {
58     //             var tag = $(this).attr('p:tag');
59     //             var handler = function() {
60     //                 var text = editor.selection();
61     //                 editor.replaceSelection('<' + tag + '>' + text + '</' + tag + '>');
62     //                 if (text.length == 0) {
63     //                     var pos = editor.cursorPosition();
64     //                     editor.selectLines(pos.line, pos.character + tag.length + 2);
65     //                 }
66     //             }
67     //             if ($(this).attr('p:key')) {
68     //                 keys[$(this).attr('p:key')] = handler;
69     //             }
70     //             $(this).click(handler)
71     //         });
72     //         
73     //         editor.grabKeys(function(event) { 
74     //             if (keys[event.keyCode]) {
75     //                 keys[event.keyCode]();
76     //             }
77     //         }, function(event) {
78     //             return event.altKey && keys[event.keyCode];
79     //         });
80     //     }
81     // });
82     
83
84     
85
86     
87     // $('#toolbar-buttons li').wTooltip({
88     //     delay: 1000, 
89     //     style: {
90     //         border: "1px solid #7F7D67",
91     //         opacity: 0.9, 
92     //         background: "#FBFBC6", 
93     //         padding: "1px",
94     //         fontSize: "12px",
95     //     }});
96     
97     // $('#images-wrap').lazyload('.image-box', {threshold: 640 * 10, scrollTreshold: 640 * 5});
98 });