summaryrefslogtreecommitdiff
path: root/resizable.html
blob: 6f32028daa3404239a615ad54fb234cbf84487ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">
    <!-- jQuery UI -->
    <link href="css/jquery/jquery-ui.min.css" rel="stylesheet">

    <style>

        body {
            padding-top: 50px;
        }

        .div {
            border: 0.1em solid black;
        }


        /* lg */
        @media (min-width: 1200px) {
            html, body, #app, #app-row {
                height: 100%;
            }

            .div {
                overflow: auto;
                /*min-height: 100%;*/
                height: 100%;
            }
        }

        /* md */
        @media (min-width: 992px) and (max-width: 1199px) {
            html, body, #app, #app-row {
                height: 100%;
            }

            .div {
                overflow: auto;
                /*min-height: 100%;*/
                height: 50%;
            }
        }


        /* sm */
        @media (min-width: 768px) and (max-width: 991px) {
        }

        /* xs */
        @media (max-width: 767px) {

        }
/*
        .ui-resizable-handle {
            position: absolute;
            font-size: 0.1px;
            z-index: 99999;
            display: block;
        }
        .ui-resizable-e {
            background: #192f42;
            box-shadow: inset 0 0 0 rgba(180,180,180,0.3), 0 -1px 1px rgba(0,0,0,0.3);
            width:10px;
            z-index: 88 !important;
        }
        .ui-resizable-e:after {
            content: "-";
            display: block;
            position: absolute;
            top: calc(50% - 16px);
            left: 0;
            height: 30px;
            width: 10px;
            background-color: rgba(0,0,0,0.1);
        }
        .ui-resizable-s {
            background: #192f42;
            box-shadow: inset 0 1px 0 rgba(100,100,100,0.3), 0 0 0 rgba(40,40,40,0.3);
            height:10px;
        }
        .ui-resizable-s:after {
            content: "-";
            display: block;
            position: absolute;
            top: 1px;
            left: calc(50% - 20px);
            height: 8px;
            width: 38px;
            background-color: rgba(0,0,0,0.1);
        }

*/
    </style>


    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">CodeQ</a>
        </div>
        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#about">About</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</div>

<div class="container-fluid" id="app">
    <div class="row" id="app-row">
        <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="infoPane">
            <h2 class="text-center"><span>Instructions</span></h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        </div>
        <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="editorPane">
            <h2 class="text-center"><span>Editor</span></h2>
            <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        </div>
        <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="cmdPane">
            <h2 class="text-center"><span>Prompt</span></h2>
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
            <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur? Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        </div>
        <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 div ui-resizable" id="hintPane">
            <h2 class="text-center"><span>Hint</span></h2>
            <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
        </div>
    </div><!--/row-->
</div><!--container-->

<!-- jQuery stuff -->
<script src="js/jquery/jquery-1.11.3.js"></script>
<!--script src="js/jquery/jquery.terminal-0.8.8.js"></script-->
<script src="js/jquery/jquery.console.js"></script>
<!-- Bootstrap -->
<script src="js/bootstrap/bootstrap.min.js"></script>
<!-- jQuery UI -->
<script src="js/jquery/jquery-ui.min.js"></script>

<script type="text/javascript">

/*    var resizePanes = function () {
        if ($(window).width()>=992) {
            $('#infoPane').$('.ui-resizable-e').removeClass('hide');
            $('#infoPane').$('.ui-resizable-s').removeClass('hide');
            $('#editorPane').$('.ui-resizable-e').removeClass('hide');
            $('#editorPane').$('.ui-resizable-s').addClass('hide');
            $('#cmdPane').$('.ui-resizable-s').addClass('hide');
            $('#cmdPane').$('.ui-resizable-e').removeClass('hide');
            $('#hintPane').$('.ui-resizable-e').addClass('hide');
            $('#hintPane').$('.ui-resizable-s').addClass('hide');
        }
        if ($(window).width()>=1200) {
            $('#cmdPane').$('.ui-resizable-e').removeClass('hide');
            $('#hintPane').$('.ui-resizable-e').addClass('hide');
            $('.ui-resizable-s').addClass('hide');
        }
        else {
            $('.ui-resizable-handle').addClass('hide');
        }
    };
*/

    var resizePanes = function () {
        if ($(window).width()<=991) {
            $('.ui-resizable-handle').addClass('hide');
        }
        else {
            $('.ui-resizable-handle').removeClass('hide');
        }
    };

    $(window).bind("resize", function(event){
        console.log("resize ...");
        resizePanes();
   });

    $.widget("ui.resizable", $.ui.resizable, {
        resizeTo: function(newSize) {
            var start = new $.Event("mousedown", { pageX: 0, pageY: 0 });
            this._mouseStart(start);
            this.axis = 'se';
            var end = new $.Event("mouseup", {
                pageX: newSize.width - this.originalSize.width,
                //pageX: this.originalSize.width,
                pageY: newSize.height - this.originalSize.height
            });
            console.log(end);
            this._mouseDrag(end);
            this._mouseStop(end);
        }
    });
    $(function() {
        $( ".ui-resizable" ).resizable();
    });

    $('.div').resizable({
        handles: 's,e',
        minWidth: $(window).width()*0.1,
        //minHeight: 100,
        maxWidth: $(window).width()*0.9,
        //maxHeight: 500,
        resize:function(event,ui){
            var x=ui.element.outerWidth(),
                y=ui.element.outerHeight(),
                xpar=$(this).parent().width()-1,
                ypar=$(this).parent().height()-1,
                infoPane=$('#infoPane'), xi=infoPane.outerWidth(), yi=infoPane.outerHeight(),
                editorPane=$("#editorPane"), xe=editorPane.outerWidth(),
                cmdPane=$("#cmdPane"), xc= cmdPane.outerWidth(), yc= cmdPane.outerHeight(),
                hintPane=$("#hintPane"), xh=hintPane.outerWidth(),
                ele=ui.element,
                id=ele[0].id;

            console.log(ui, ele, id);
            console.log(x, y, xpar, ypar);


            if ($(window).width()>=1200) {
                if (id==='infoPane') {
                    editorPane.css('width',(xpar-x-xc-xh)+'px');
                    cmdPane.css('width',(xc)+'px');
                    hintPane.css('width',(xh)+'px');
                }
                if (id==='editorPane') {
                    infoPane.css('width',(xi)+'px');
                    cmdPane.css('width',(xpar-x-xi-xh)+'px');
                    hintPane.css('width',(xh)+'px');
                }
                if (id==='cmdPane') {
                    infoPane.css('width',(xi)+'px');
                    editorPane.css('width',(xe)+'px');
                    hintPane.css('width',(xpar-x-xi-xe)+'px');
                }
                if (id==='hintPane') {
                    infoPane.css('width',(xi)+'px');
                    editorPane.css('width',(xe)+'px');
                    cmdPane.css('width',(xpar-x-xi-xh)+'px');
                }

            }
            if (($(window).width()>=992) && ($(window).width()<1200)) {
                if (id==='infoPane') {
                    editorPane.css('width',(xpar-x)+'px');
                    editorPane.css('height',(y)+'px');
                    cmdPane.css('width',(x)+'px');
                    cmdPane.css('height',(ypar-y)+'px');
                    hintPane.css('width',(xpar-x)+'px');
                    hintPane.css('max-height',(ypar-y)+'px');
                }
                if (id==='editorPane') {
                    infoPane.css('width',(xpar-x)+'px');
                    infoPane.css('height',(y)+'px');
                    cmdPane.css('width',(xpar-x)+'px');
                    cmdPane.css('height',(ypar-y)+'px');
                    hintPane.css('width',(x)+'px');
                    hintPane.css('height',(ypar-y)+'px');
                }
                if (id==='cmdPane') {
                    infoPane.css('width',(x)+'px');
                    infoPane.css('height',(ypar-y)+'px');
                    editorPane.css('width',(xpar-x)+'px');
                    editorPane.css('height',(ypar-y)+'px');
                    hintPane.css('width',(xpar-x)+'px');
                    hintPane.css('height',(y)+'px');
                }
                if (id==='hintPane') {
                    infoPane.css('width',(xpar-x)+'px');
                    infoPane.css('height',(ypar-y)+'px');
                    editorPane.css('width',(x)+'px');
                    editorPane.css('height',(ypar-y)+'px');
                    cmdPane.css('width',(xpar-x)+'px');
                    cmdPane.css('height',(y)+'px');
                }
            }
            else { //($(window).width()<=991)
                //not resizable
            }
            //ele.next().css('height',y+'px');
            //ele.next().css('width',(factor/3)+'px');
            //ele.next().next().css('width',(factor/3)+'px');
            //ele.next().next().next().css('width',(factor/3)+'px');
            resizePanes();
        }
    }).on('resize', function (e) {
        e.stopPropagation();
    });

    resizePanes();
</script>
</body>
</html>