Show More
@@ -1,199 +1,199 b'' | |||
|
1 | 1 | .ui-button { |
|
2 | 2 | display: none; |
|
3 | 3 | } |
|
4 | 4 | |
|
5 | 5 | .ui-dialog-content { |
|
6 | 6 | padding: 0; |
|
7 | 7 | min-height: 0; |
|
8 | 8 | } |
|
9 | 9 | |
|
10 | 10 | .mark_btn { |
|
11 | 11 | cursor: pointer; |
|
12 | 12 | } |
|
13 | 13 | |
|
14 | 14 | .img-full { |
|
15 | 15 | position: fixed; |
|
16 | 16 | background-color: #CCC; |
|
17 | 17 | border: 1px solid #000; |
|
18 | 18 | cursor: pointer; |
|
19 | 19 | } |
|
20 | 20 | |
|
21 | 21 | .strikethrough { |
|
22 | 22 | text-decoration: line-through; |
|
23 | 23 | } |
|
24 | 24 | |
|
25 | 25 | .post_preview { |
|
26 | 26 | z-index: 300; |
|
27 | 27 | position:absolute; |
|
28 | 28 | } |
|
29 | 29 | |
|
30 | 30 | .gallery_image { |
|
31 | 31 | display: inline-block; |
|
32 | 32 | } |
|
33 | 33 | |
|
34 | 34 | @media print { |
|
35 | 35 | .post-form-w { |
|
36 | 36 | display: none; |
|
37 | 37 | } |
|
38 | 38 | } |
|
39 | 39 | |
|
40 | 40 | input[name="image"] { |
|
41 | 41 | display: block; |
|
42 | 42 | width: 100px; |
|
43 | 43 | height: 100px; |
|
44 | 44 | cursor: pointer; |
|
45 | 45 | position: absolute; |
|
46 | 46 | opacity: 0; |
|
47 | 47 | z-index: 1; |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | .file_wrap { |
|
51 | 51 | width: 100px; |
|
52 | 52 | height: 100px; |
|
53 | 53 | border: solid 1px white; |
|
54 | 54 | display: inline-block; |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | form > .file_wrap { |
|
58 | 58 | float: left; |
|
59 | 59 | } |
|
60 | 60 | |
|
61 | 61 | .file-thumb { |
|
62 | 62 | width: 100px; |
|
63 | 63 | height: 100px; |
|
64 | 64 | background-size: cover; |
|
65 | 65 | background-position: center; |
|
66 | 66 | } |
|
67 | 67 | |
|
68 | 68 | .compact-form-text { |
|
69 | 69 | margin-left:110px; |
|
70 | 70 | } |
|
71 | 71 | |
|
72 | 72 | textarea, input { |
|
73 | 73 | -moz-box-sizing: border-box; |
|
74 | 74 | -webkit-box-sizing: border-box; |
|
75 | 75 | box-sizing: border-box; |
|
76 | 76 | } |
|
77 | 77 | |
|
78 | 78 | .compact-form-text > textarea { |
|
79 | 79 | height: 100px; |
|
80 | 80 | width: 100%; |
|
81 | 81 | } |
|
82 | 82 | |
|
83 | 83 | .post-button-form { |
|
84 | 84 | display: inline; |
|
85 | 85 | } |
|
86 | 86 | |
|
87 | 87 | .post-button-form > button, #autoupdate { |
|
88 | 88 | border: none; |
|
89 | 89 | margin: inherit; |
|
90 | 90 | padding: inherit; |
|
91 | 91 | background: none; |
|
92 | 92 | font-size: inherit; |
|
93 | 93 | cursor: pointer; |
|
94 | 94 | } |
|
95 | 95 | |
|
96 | 96 | .post-image-full { |
|
97 | 97 | width: 100%; |
|
98 | 98 | height: auto; |
|
99 | 99 | } |
|
100 | 100 | |
|
101 | 101 | #preview-text { |
|
102 | 102 | display: none; |
|
103 | 103 | } |
|
104 | 104 | |
|
105 | 105 | .random-images-table { |
|
106 | 106 | text-align: center; |
|
107 | 107 | } |
|
108 | 108 | |
|
109 | 109 | .random-images-table > div { |
|
110 | 110 | margin-left: auto; |
|
111 | 111 | margin-right: auto; |
|
112 | 112 | } |
|
113 | 113 | |
|
114 | 114 | .tag-image, .tag-text-data { |
|
115 | 115 | display: inline-block; |
|
116 | 116 | } |
|
117 | 117 | |
|
118 | 118 | .tag-text-data > h2 { |
|
119 | 119 | margin: 0; |
|
120 | 120 | } |
|
121 | 121 | |
|
122 | 122 | .tag-image { |
|
123 | 123 | margin-right: 5px; |
|
124 | 124 | } |
|
125 | 125 | |
|
126 | 126 | .reply-to-message { |
|
127 | 127 | display: none; |
|
128 | 128 | } |
|
129 | 129 | |
|
130 | 130 | .tripcode { |
|
131 | 131 | padding: 2px; |
|
132 | 132 | } |
|
133 | 133 | |
|
134 | 134 | #fav-panel { |
|
135 | 135 | display: none; |
|
136 | 136 | margin: 1ex; |
|
137 | 137 | } |
|
138 | 138 | |
|
139 | 139 | .hidden_post { |
|
140 | 140 | opacity: 0.2; |
|
141 | 141 | } |
|
142 | 142 | |
|
143 | 143 | .hidden_post:hover { |
|
144 | 144 | opacity: 1; |
|
145 | 145 | } |
|
146 | 146 | |
|
147 | .monochrome > .image > .thumb > img { | |
|
147 | .monochrome > .image > .thumb > img, .monochrome.img-full { | |
|
148 | 148 | filter: grayscale(100%); |
|
149 | 149 | -webkit-filter: grayscale(100%); |
|
150 | 150 | } |
|
151 | 151 | |
|
152 | 152 | #quote-button { |
|
153 | 153 | position: absolute; |
|
154 | 154 | display: none; |
|
155 | 155 | cursor: pointer; |
|
156 | 156 | z-index: 400; |
|
157 | 157 | } |
|
158 | 158 | |
|
159 | 159 | .required-field:before { |
|
160 | 160 | content: '* '; |
|
161 | 161 | } |
|
162 | 162 | |
|
163 | 163 | .hint { |
|
164 | 164 | border-bottom: dashed 1px; |
|
165 | 165 | cursor: help; |
|
166 | 166 | } |
|
167 | 167 | |
|
168 | 168 | .url-image:hover { |
|
169 | 169 | filter: invert(100%); |
|
170 | 170 | } |
|
171 | 171 | |
|
172 | 172 | .landing-tags, .landing-images { |
|
173 | 173 | max-width: 800px; |
|
174 | 174 | margin-left: auto; |
|
175 | 175 | margin-right: auto; |
|
176 | 176 | } |
|
177 | 177 | |
|
178 | 178 | .landing-images { |
|
179 | 179 | text-align: center; |
|
180 | 180 | } |
|
181 | 181 | |
|
182 | 182 | .landing-threads { |
|
183 | 183 | margin-left: auto; |
|
184 | 184 | margin-right: auto; |
|
185 | 185 | text-align: center; |
|
186 | 186 | display: flex; |
|
187 | 187 | flex-wrap: wrap; |
|
188 | 188 | justify-content: space-around; |
|
189 | 189 | } |
|
190 | 190 | |
|
191 | 191 | .landing-threads > .thread-short { |
|
192 | 192 | display: inline-block; |
|
193 | 193 | width: 240px; |
|
194 | 194 | } |
|
195 | 195 | |
|
196 | 196 | audio { |
|
197 | 197 | width: 200px; |
|
198 | 198 | } |
|
199 | 199 |
@@ -1,205 +1,208 b'' | |||
|
1 | 1 | /* |
|
2 | 2 | @licstart The following is the entire license notice for the |
|
3 | 3 | JavaScript code in this page. |
|
4 | 4 | |
|
5 | 5 | |
|
6 | 6 | Copyright (C) 2013 neko259 |
|
7 | 7 | |
|
8 | 8 | The JavaScript code in this page is free software: you can |
|
9 | 9 | redistribute it and/or modify it under the terms of the GNU |
|
10 | 10 | General Public License (GNU GPL) as published by the Free Software |
|
11 | 11 | Foundation, either version 3 of the License, or (at your option) |
|
12 | 12 | any later version. The code is distributed WITHOUT ANY WARRANTY; |
|
13 | 13 | without even the implied warranty of MERCHANTABILITY or FITNESS |
|
14 | 14 | FOR A PARTICULAR PURPOSE. See the GNU GPL for more details. |
|
15 | 15 | |
|
16 | 16 | As additional permission under GNU GPL version 3 section 7, you |
|
17 | 17 | may distribute non-source (e.g., minimized or compacted) forms of |
|
18 | 18 | that code without the copy of the GNU GPL normally required by |
|
19 | 19 | section 4, provided you include this license notice and a URL |
|
20 | 20 | through which recipients can access the Corresponding Source. |
|
21 | 21 | |
|
22 | 22 | @licend The above is the entire license notice |
|
23 | 23 | for the JavaScript code in this page. |
|
24 | 24 | */ |
|
25 | 25 | |
|
26 | 26 | var IMAGE_POPUP_MARGIN = 10; |
|
27 | 27 | |
|
28 | 28 | |
|
29 | 29 | var IMAGE_VIEWERS = [ |
|
30 | 30 | ['simple', new SimpleImageViewer()], |
|
31 | 31 | ['popup', new PopupImageViewer()] |
|
32 | 32 | ]; |
|
33 | 33 | |
|
34 | 34 | var FULL_IMG_CLASS = 'post-image-full'; |
|
35 | 35 | |
|
36 | 36 | var ATTR_SCALE = 'scale'; |
|
37 | 37 | |
|
38 | 38 | |
|
39 | 39 | // Init image viewer |
|
40 | 40 | var viewerName = $('body').attr('data-image-viewer'); |
|
41 | 41 | var viewer = ImageViewer(); |
|
42 | 42 | for (var i = 0; i < IMAGE_VIEWERS.length; i++) { |
|
43 | 43 | var item = IMAGE_VIEWERS[i]; |
|
44 | 44 | if (item[0] === viewerName) { |
|
45 | 45 | viewer = item[1]; |
|
46 | 46 | break; |
|
47 | 47 | } |
|
48 | 48 | } |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | function getFullImageWidth(previewImage) { |
|
52 | 52 | var full_img_w = previewImage.attr('data-width'); |
|
53 | 53 | if (full_img_w == null) { |
|
54 | 54 | full_img_w = previewImage[0].naturalWidth; |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | 57 | return full_img_w; |
|
58 | 58 | } |
|
59 | 59 | |
|
60 | 60 | function getFullImageHeight(previewImage) { |
|
61 | 61 | var full_img_h = previewImage.attr('data-height'); |
|
62 | 62 | if (full_img_h == null) { |
|
63 | 63 | full_img_h = previewImage[0].naturalHeight; |
|
64 | 64 | } |
|
65 | 65 | |
|
66 | 66 | return full_img_h; |
|
67 | 67 | } |
|
68 | 68 | |
|
69 | 69 | |
|
70 | 70 | function ImageViewer() {} |
|
71 | 71 | ImageViewer.prototype.view = function (post) {}; |
|
72 | 72 | |
|
73 | 73 | function SimpleImageViewer() {} |
|
74 | 74 | SimpleImageViewer.prototype.view = function (post) { |
|
75 | 75 | var images = post.find('img'); |
|
76 | 76 | images.toggle(); |
|
77 | 77 | |
|
78 | 78 | // When we first enlarge an image, a full image needs to be created |
|
79 | 79 | if (images.length == 1) { |
|
80 | 80 | var thumb = images.first(); |
|
81 | 81 | |
|
82 | 82 | var width = getFullImageWidth(thumb); |
|
83 | 83 | var height = getFullImageHeight(thumb); |
|
84 | 84 | |
|
85 | 85 | if (width == null || height == null) { |
|
86 | 86 | width = '100%'; |
|
87 | 87 | height = '100%'; |
|
88 | 88 | } |
|
89 | 89 | |
|
90 | 90 | var parent = images.first().parent(); |
|
91 | 91 | var link = parent.attr('href'); |
|
92 | 92 | |
|
93 | 93 | var fullImg = $('<img />') |
|
94 | 94 | .addClass(FULL_IMG_CLASS) |
|
95 | 95 | .attr('src', link) |
|
96 | 96 | .attr('width', width) |
|
97 | 97 | .attr('height', height); |
|
98 | 98 | |
|
99 | 99 | parent.append(fullImg); |
|
100 | 100 | } |
|
101 | 101 | }; |
|
102 | 102 | |
|
103 | 103 | function PopupImageViewer() {} |
|
104 | 104 | PopupImageViewer.prototype.view = function (post) { |
|
105 | 105 | var el = post; |
|
106 | 106 | var thumb_id = 'full' + el.find('img').attr('alt'); |
|
107 | 107 | |
|
108 | 108 | var existingPopups = $('#' + thumb_id); |
|
109 | 109 | if (!existingPopups.length) { |
|
110 | 110 | var imgElement = el.find('img'); |
|
111 | 111 | |
|
112 | 112 | var full_img_w = getFullImageWidth(imgElement); |
|
113 | 113 | var full_img_h = getFullImageHeight(imgElement); |
|
114 | 114 | |
|
115 | 115 | var win = $(window); |
|
116 | 116 | |
|
117 | 117 | var win_w = win.width(); |
|
118 | 118 | var win_h = win.height(); |
|
119 | 119 | |
|
120 | 120 | // New image size |
|
121 | 121 | var w_scale = 1; |
|
122 | 122 | var h_scale = 1; |
|
123 | 123 | |
|
124 | 124 | var freeWidth = win_w - 2 * IMAGE_POPUP_MARGIN; |
|
125 | 125 | var freeHeight = win_h - 2 * IMAGE_POPUP_MARGIN; |
|
126 | 126 | |
|
127 | 127 | if (full_img_w > freeWidth) { |
|
128 | 128 | w_scale = full_img_w / freeWidth; |
|
129 | 129 | } |
|
130 | 130 | if (full_img_h > freeHeight) { |
|
131 | 131 | h_scale = full_img_h / freeHeight; |
|
132 | 132 | } |
|
133 | 133 | |
|
134 | 134 | var scale = Math.max(w_scale, h_scale) |
|
135 | 135 | var img_w = full_img_w / scale; |
|
136 | 136 | var img_h = full_img_h / scale; |
|
137 | 137 | |
|
138 | 138 | var postNode = $(el); |
|
139 | 139 | |
|
140 | 140 | var img_pv = new Image(); |
|
141 | 141 | var newImage = $(img_pv); |
|
142 | 142 | newImage.addClass('img-full') |
|
143 | 143 | .attr('id', thumb_id) |
|
144 | 144 | .attr('src', postNode.attr('href')) |
|
145 | 145 | .attr(ATTR_SCALE, scale) |
|
146 | 146 | .css({ |
|
147 | 147 | 'width': img_w, |
|
148 | 148 | 'height': img_h, |
|
149 | 149 | 'left': (win_w - img_w) / 2, |
|
150 | 150 | 'top': ((win_h - img_h) / 2), |
|
151 | 151 | 'position': 'fixed' // Chrome fix because it adds a 'relative' value to the image somehow |
|
152 | 152 | }) |
|
153 | 153 | //scaling preview |
|
154 | 154 | .mousewheel(function(event, delta) { |
|
155 | 155 | var cx = event.originalEvent.clientX; |
|
156 | 156 | var cy = event.originalEvent.clientY; |
|
157 | 157 | |
|
158 | 158 | var scale = newImage.attr(ATTR_SCALE) / (delta > 0 ? 1.25 : 0.8); |
|
159 | 159 | |
|
160 | 160 | var oldWidth = newImage.width(); |
|
161 | 161 | var oldHeight = newImage.height(); |
|
162 | 162 | |
|
163 | 163 | var newIW = full_img_w / scale; |
|
164 | 164 | var newIH = full_img_h / scale; |
|
165 | 165 | |
|
166 | 166 | newImage.width(newIW); |
|
167 | 167 | newImage.height(newIH); |
|
168 | 168 | newImage.attr(ATTR_SCALE, scale); |
|
169 | 169 | |
|
170 | 170 | // Set position |
|
171 | 171 | var oldPosition = newImage.position(); |
|
172 | 172 | newImage.css({ |
|
173 | 173 | left: parseInt(cx - (newIW/oldWidth) * (cx - parseInt(oldPosition.left, 10)), 10), |
|
174 | 174 | top: parseInt(cy - (newIH/oldHeight) * (cy - parseInt(oldPosition.top, 10)), 10) |
|
175 | 175 | }); |
|
176 | 176 | |
|
177 | 177 | return false; |
|
178 | 178 | }) |
|
179 | 179 | .draggable({ |
|
180 | 180 | addClasses: false, |
|
181 | 181 | stack: '.img-full' |
|
182 | 182 | }) |
|
183 | 183 | .appendTo($('body')); |
|
184 | 184 | newImage.click(function() { |
|
185 | 185 | $(this).remove(); |
|
186 | 186 | }); |
|
187 | if (post.parent().parent().hasClass('monochrome')) { | |
|
188 | newImage.addClass('monochrome'); | |
|
189 | } | |
|
187 | 190 | } else { |
|
188 | 191 | existingPopups.remove(); |
|
189 | 192 | } |
|
190 | 193 | }; |
|
191 | 194 | |
|
192 | 195 | function addImgPreview() { |
|
193 | 196 | //keybind |
|
194 | 197 | $(document).on('keyup.removepic', function(e) { |
|
195 | 198 | if(e.which === 27) { |
|
196 | 199 | $('.img-full').remove(); |
|
197 | 200 | } |
|
198 | 201 | }); |
|
199 | 202 | |
|
200 | 203 | $('body').on('click', '.thumb', function() { |
|
201 | 204 | viewer.view($(this)); |
|
202 | 205 | |
|
203 | 206 | return false; |
|
204 | 207 | }); |
|
205 | 208 | } |
General Comments 0
You need to be logged in to leave comments.
Login now