Show More
@@ -1,33 +1,32 b'' | |||||
1 | .ui-button { |
|
1 | .ui-button { | |
2 | display: none; |
|
2 | display: none; | |
3 | } |
|
3 | } | |
4 |
|
4 | |||
5 | .ui-dialog-content { |
|
5 | .ui-dialog-content { | |
6 | padding: 0; |
|
6 | padding: 0; | |
7 | min-height: 0; |
|
7 | min-height: 0; | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | .mark_btn { |
|
10 | .mark_btn { | |
11 | cursor: pointer; |
|
11 | cursor: pointer; | |
12 | } |
|
12 | } | |
13 |
|
13 | |||
14 | .img-full { |
|
14 | .img-full { | |
15 | position: fixed; |
|
15 | position: fixed; | |
16 | z-index: 9999; |
|
|||
17 | background-color: #CCC; |
|
16 | background-color: #CCC; | |
18 | border: 1px solid #000; |
|
17 | border: 1px solid #000; | |
19 | cursor: pointer; |
|
18 | cursor: pointer; | |
20 | } |
|
19 | } | |
21 |
|
20 | |||
22 | .strikethrough { |
|
21 | .strikethrough { | |
23 | text-decoration: line-through; |
|
22 | text-decoration: line-through; | |
24 | } |
|
23 | } | |
25 |
|
24 | |||
26 | .post_preview { |
|
25 | .post_preview { | |
27 | z-index: 300; |
|
26 | z-index: 300; | |
28 | position:absolute; |
|
27 | position:absolute; | |
29 | } |
|
28 | } | |
30 |
|
29 | |||
31 | .gallery_image { |
|
30 | .gallery_image { | |
32 | display: inline-block; |
|
31 | display: inline-block; | |
33 | } No newline at end of file |
|
32 | } |
@@ -1,96 +1,99 b'' | |||||
1 | /* |
|
1 | /* | |
2 | @licstart The following is the entire license notice for the |
|
2 | @licstart The following is the entire license notice for the | |
3 | JavaScript code in this page. |
|
3 | JavaScript code in this page. | |
4 |
|
4 | |||
5 |
|
5 | |||
6 | Copyright (C) 2013 neko259 |
|
6 | Copyright (C) 2013 neko259 | |
7 |
|
7 | |||
8 | The JavaScript code in this page is free software: you can |
|
8 | The JavaScript code in this page is free software: you can | |
9 | redistribute it and/or modify it under the terms of the GNU |
|
9 | redistribute it and/or modify it under the terms of the GNU | |
10 | General Public License (GNU GPL) as published by the Free Software |
|
10 | General Public License (GNU GPL) as published by the Free Software | |
11 | Foundation, either version 3 of the License, or (at your option) |
|
11 | Foundation, either version 3 of the License, or (at your option) | |
12 | any later version. The code is distributed WITHOUT ANY WARRANTY; |
|
12 | any later version. The code is distributed WITHOUT ANY WARRANTY; | |
13 | without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 | without even the implied warranty of MERCHANTABILITY or FITNESS | |
14 | FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. |
|
14 | FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. | |
15 |
|
15 | |||
16 | As additional permission under GNU GPL version 3 section 7, you |
|
16 | As additional permission under GNU GPL version 3 section 7, you | |
17 | may distribute non-source (e.g., minimized or compacted) forms of |
|
17 | may distribute non-source (e.g., minimized or compacted) forms of | |
18 | that code without the copy of the GNU GPL normally required by |
|
18 | that code without the copy of the GNU GPL normally required by | |
19 | section 4, provided you include this license notice and a URL |
|
19 | section 4, provided you include this license notice and a URL | |
20 | through which recipients can access the Corresponding Source. |
|
20 | through which recipients can access the Corresponding Source. | |
21 |
|
21 | |||
22 | @licend The above is the entire license notice |
|
22 | @licend The above is the entire license notice | |
23 | for the JavaScript code in this page. |
|
23 | for the JavaScript code in this page. | |
24 | */ |
|
24 | */ | |
25 |
|
25 | |||
26 | function addImgPreview() { |
|
26 | function addImgPreview() { | |
27 | var margin = 20; //..change |
|
27 | var margin = 20; //..change | |
28 |
|
28 | |||
29 | //keybind |
|
29 | //keybind | |
30 | $(document).on('keyup.removepic', function(e) { |
|
30 | $(document).on('keyup.removepic', function(e) { | |
31 | if(e.which === 27) { |
|
31 | if(e.which === 27) { | |
32 | $('.img-full').remove(); |
|
32 | $('.img-full').remove(); | |
33 | } |
|
33 | } | |
34 | }); |
|
34 | }); | |
35 |
|
35 | |||
36 | $('body').on('click', '.thumb', function() { |
|
36 | $('body').on('click', '.thumb', function() { | |
37 | var el = $(this); |
|
37 | var el = $(this); | |
38 | var thumb_id = 'full' + el.find('img').attr('alt'); |
|
38 | var thumb_id = 'full' + el.find('img').attr('alt'); | |
39 |
|
39 | |||
40 | if(!$('#'+thumb_id).length) { |
|
40 | if(!$('#'+thumb_id).length) { | |
41 | var img_w = el.find('img').attr('data-width'); |
|
41 | var img_w = el.find('img').attr('data-width'); | |
42 | var img_h = el.find('img').attr('data-height'); |
|
42 | var img_h = el.find('img').attr('data-height'); | |
43 |
|
43 | |||
44 | var win_w = $(window).width(); |
|
44 | var win_w = $(window).width(); | |
45 | var win_h = $(window).height(); |
|
45 | var win_h = $(window).height(); | |
46 | //new image size |
|
46 | //new image size | |
47 | if (img_w > win_w) { |
|
47 | if (img_w > win_w) { | |
48 | img_h = img_h * (win_w/img_w) - margin; |
|
48 | img_h = img_h * (win_w/img_w) - margin; | |
49 | img_w = win_w - margin; |
|
49 | img_w = win_w - margin; | |
50 | } |
|
50 | } | |
51 | if (img_h > win_h) { |
|
51 | if (img_h > win_h) { | |
52 | img_w = img_w * (win_h/img_h) - margin; |
|
52 | img_w = img_w * (win_h/img_h) - margin; | |
53 | img_h = win_h - margin; |
|
53 | img_h = win_h - margin; | |
54 | } |
|
54 | } | |
55 |
|
55 | |||
56 | var img_pv = new Image(); |
|
56 | var img_pv = new Image(); | |
57 | $(img_pv) |
|
57 | $(img_pv) | |
58 | .addClass('img-full') |
|
58 | .addClass('img-full') | |
59 | .attr('id', thumb_id) |
|
59 | .attr('id', thumb_id) | |
60 | .attr('src', $(el).attr('href')) |
|
60 | .attr('src', $(el).attr('href')) | |
61 | .appendTo($(el)) |
|
61 | .appendTo($(el)) | |
62 | .css({ |
|
62 | .css({ | |
63 | 'width': img_w, |
|
63 | 'width': img_w, | |
64 | 'height': img_h, |
|
64 | 'height': img_h, | |
65 | 'left': (win_w - img_w) / 2, |
|
65 | 'left': (win_w - img_w) / 2, | |
66 | 'top': ((win_h - img_h) / 2) |
|
66 | 'top': ((win_h - img_h) / 2) | |
67 | }) |
|
67 | }) | |
68 | //scaling preview |
|
68 | //scaling preview | |
69 | .mousewheel(function(event, delta) { |
|
69 | .mousewheel(function(event, delta) { | |
70 | var cx = event.originalEvent.clientX, |
|
70 | var cx = event.originalEvent.clientX, | |
71 | cy = event.originalEvent.clientY, |
|
71 | cy = event.originalEvent.clientY, | |
72 | i_w = parseFloat($(img_pv).width()), |
|
72 | i_w = parseFloat($(img_pv).width()), | |
73 | i_h = parseFloat($(img_pv).height()), |
|
73 | i_h = parseFloat($(img_pv).height()), | |
74 | newIW = i_w * (delta > 0 ? 1.25 : 0.8), |
|
74 | newIW = i_w * (delta > 0 ? 1.25 : 0.8), | |
75 | newIH = i_h * (delta > 0 ? 1.25 : 0.8); |
|
75 | newIH = i_h * (delta > 0 ? 1.25 : 0.8); | |
76 |
|
76 | |||
77 | $(img_pv).width(newIW); |
|
77 | $(img_pv).width(newIW); | |
78 | $(img_pv).height(newIH); |
|
78 | $(img_pv).height(newIH); | |
79 | //set position |
|
79 | //set position | |
80 | $(img_pv) |
|
80 | $(img_pv) | |
81 | .css({ |
|
81 | .css({ | |
82 | left: parseInt(cx - (newIW/i_w) * (cx - parseInt($(img_pv).position().left, 10)), 10), |
|
82 | left: parseInt(cx - (newIW/i_w) * (cx - parseInt($(img_pv).position().left, 10)), 10), | |
83 | top: parseInt(cy - (newIH/i_h) * (cy - parseInt($(img_pv).position().top, 10)), 10) |
|
83 | top: parseInt(cy - (newIH/i_h) * (cy - parseInt($(img_pv).position().top, 10)), 10) | |
84 | }); |
|
84 | }); | |
85 |
|
85 | |||
86 | return false; |
|
86 | return false; | |
87 | } |
|
87 | } | |
88 |
).draggable( |
|
88 | ).draggable({ | |
|
89 | addClasses: false, | |||
|
90 | stack: '.img-full' | |||
|
91 | }) | |||
89 | } |
|
92 | } | |
90 | else { |
|
93 | else { | |
91 | $('#'+thumb_id).remove(); |
|
94 | $('#'+thumb_id).remove(); | |
92 | } |
|
95 | } | |
93 | //prevent default |
|
96 | //prevent default | |
94 | return false; |
|
97 | return false; | |
95 | }); |
|
98 | }); | |
96 | } No newline at end of file |
|
99 | } |
General Comments 0
You need to be logged in to leave comments.
Login now