Post Thumbnail Editor - Version 0.1.1

Version Description

  • Fixed IE8/firefox javascript errors
Download this release

Release Info

Developer sewpafly
Plugin Icon Post Thumbnail Editor
Version 0.1.1
Comparing to
See all releases

Version 0.1.1

README.txt ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Post Thumbnail Editor ===
2
+ Contributors: sewpafly
3
+ Donate link: http://github.com/sewpafly/post-thumbnail-editor
4
+ Tags: post-thumbnail, post thumbnail, featured image, featured, editor, image
5
+ Requires at least: 3.1
6
+ Tested up to: 3.1
7
+ Stable tag: trunk
8
+
9
+ Fed up with the lack of automated tools to properly crop and scale post thumbnails? Maybe this plugin can help.
10
+
11
+ == Description ==
12
+
13
+ To meet the needs of themes where the post-thumbnails have random and capricious sizes (which causes wordpress to crop images simply from the middle (either chopping off the top and bottom or chopping off the sides), this plugin attempts to give the users an interface to manually fix those thumbnail and random images.
14
+
15
+ **Use**:
16
+
17
+ 1. Open Media Library
18
+ 2. Pick the image to edit
19
+ 3. Click "Edit Image"
20
+ 4. Use the dropdown box underneath the "Thumbnail Settings" section to select the thumbnail that you want to edit.
21
+ 5. After you select the cropped/scaled area, click "Save"
22
+ 6. You might have to refresh the cache (ctrl+f5 on the page) to see changes, but they should be there.
23
+
24
+ == Installation ==
25
+
26
+ 1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
27
+ 2. Activate the plugin through the 'Plugins' menu in WordPress
28
+ 3. Rock On
29
+
30
+ = or =
31
+ 1. Install from within your wordpress admin area by searching for "post thumbnail editor"
32
+
33
+ == Frequently Asked Questions ==
34
+
35
+ = Did you even test this? =
36
+
37
+ No, thanks for asking. But [let me know if you're having problems](https://github.com/sewpafly/post-thumbnail-editor/issues) and I'll see what I can do.
38
+
39
+ == Screenshots ==
40
+
41
+ 1. Before/After
42
+ 2. In the Edit subpage for media locate the box title "Edit Post Thumbnails", and select the image size you wish to modify.
43
+ 3. Crop the image as you see fit and click "Save".
44
+
45
+ == Changelog ==
46
+
47
+ = 0.1.1 =
48
+ * Fixed IE8/firefox javascript errors
49
+
50
+ = 0.1 =
51
+ * Initial cut
52
+
53
+ == Upgrade Notice ==
54
+
55
+ = 0.1.1 =
56
+ This version fixes a IE8/firefox javascript error.
apps/fancybox/README.markdown ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ Fancy Box Jquery Plugin
2
+ =======================
3
+
4
+ I just wanted to have a git repository for the [fancybox jQuery plugin](http://fancybox.net/) so that I could use it for my submodules. Originally this was just to recreate exactly the structure of the zip file you could download from the official site. So the official zip structure can be found in the example branch while the master is a cut of the fancybox directory with an additional closure compiled/minified version of the fancybox plugin.
apps/fancybox/blank.gif ADDED
Binary file
apps/fancybox/fancy_close.png ADDED
Binary file
apps/fancybox/fancy_loading.png ADDED
Binary file
apps/fancybox/fancy_nav_left.png ADDED
Binary file
apps/fancybox/fancy_nav_right.png ADDED
Binary file
apps/fancybox/fancy_shadow_e.png ADDED
Binary file
apps/fancybox/fancy_shadow_n.png ADDED
Binary file
apps/fancybox/fancy_shadow_ne.png ADDED
Binary file
apps/fancybox/fancy_shadow_nw.png ADDED
Binary file
apps/fancybox/fancy_shadow_s.png ADDED
Binary file
apps/fancybox/fancy_shadow_se.png ADDED
Binary file
apps/fancybox/fancy_shadow_sw.png ADDED
Binary file
apps/fancybox/fancy_shadow_w.png ADDED
Binary file
apps/fancybox/fancy_title_left.png ADDED
Binary file
apps/fancybox/fancy_title_main.png ADDED
Binary file
apps/fancybox/fancy_title_over.png ADDED
Binary file
apps/fancybox/fancy_title_right.png ADDED
Binary file
apps/fancybox/fancybox-x.png ADDED
Binary file
apps/fancybox/fancybox-y.png ADDED
Binary file
apps/fancybox/fancybox.png ADDED
Binary file
apps/fancybox/jquery.easing-1.3.pack.js ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
3
+ *
4
+ * Uses the built in easing capabilities added In jQuery 1.1
5
+ * to offer multiple easing options
6
+ *
7
+ * TERMS OF USE - jQuery Easing
8
+ *
9
+ * Open source under the BSD License.
10
+ *
11
+ * Copyright © 2008 George McGinley Smith
12
+ * All rights reserved.
13
+ *
14
+ * Redistribution and use in source and binary forms, with or without modification,
15
+ * are permitted provided that the following conditions are met:
16
+ *
17
+ * Redistributions of source code must retain the above copyright notice, this list of
18
+ * conditions and the following disclaimer.
19
+ * Redistributions in binary form must reproduce the above copyright notice, this list
20
+ * of conditions and the following disclaimer in the documentation and/or other materials
21
+ * provided with the distribution.
22
+ *
23
+ * Neither the name of the author nor the names of contributors may be used to endorse
24
+ * or promote products derived from this software without specific prior written permission.
25
+ *
26
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
27
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
28
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
31
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
32
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
34
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
35
+ *
36
+ */
37
+
38
+ // t: current time, b: begInnIng value, c: change In value, d: duration
39
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))
40
+
41
+ /*
42
+ *
43
+ * TERMS OF USE - EASING EQUATIONS
44
+ *
45
+ * Open source under the BSD License.
46
+ *
47
+ * Copyright © 2001 Robert Penner
48
+ * All rights reserved.
49
+ *
50
+ * Redistribution and use in source and binary forms, with or without modification,
51
+ * are permitted provided that the following conditions are met:
52
+ *
53
+ * Redistributions of source code must retain the above copyright notice, this list of
54
+ * conditions and the following disclaimer.
55
+ * Redistributions in binary form must reproduce the above copyright notice, this list
56
+ * of conditions and the following disclaimer in the documentation and/or other materials
57
+ * provided with the distribution.
58
+ *
59
+ * Neither the name of the author nor the names of contributors may be used to endorse
60
+ * or promote products derived from this software without specific prior written permission.
61
+ *
62
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
63
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
64
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
65
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
66
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
67
+ * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
68
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
69
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
70
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
71
+ *
72
+ */
apps/fancybox/jquery.fancybox-1.3.4.css ADDED
@@ -0,0 +1,359 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010)
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ #fancybox-loading {
19
+ position: fixed;
20
+ top: 50%;
21
+ left: 50%;
22
+ width: 40px;
23
+ height: 40px;
24
+ margin-top: -20px;
25
+ margin-left: -20px;
26
+ cursor: pointer;
27
+ overflow: hidden;
28
+ z-index: 1104;
29
+ display: none;
30
+ }
31
+
32
+ #fancybox-loading div {
33
+ position: absolute;
34
+ top: 0;
35
+ left: 0;
36
+ width: 40px;
37
+ height: 480px;
38
+ background-image: url('fancybox.png');
39
+ }
40
+
41
+ #fancybox-overlay {
42
+ position: absolute;
43
+ top: 0;
44
+ left: 0;
45
+ width: 100%;
46
+ z-index: 1100;
47
+ display: none;
48
+ }
49
+
50
+ #fancybox-tmp {
51
+ padding: 0;
52
+ margin: 0;
53
+ border: 0;
54
+ overflow: auto;
55
+ display: none;
56
+ }
57
+
58
+ #fancybox-wrap {
59
+ position: absolute;
60
+ top: 0;
61
+ left: 0;
62
+ padding: 20px;
63
+ z-index: 1101;
64
+ outline: none;
65
+ display: none;
66
+ }
67
+
68
+ #fancybox-outer {
69
+ position: relative;
70
+ width: 100%;
71
+ height: 100%;
72
+ background: #fff;
73
+ }
74
+
75
+ #fancybox-content {
76
+ width: 0;
77
+ height: 0;
78
+ padding: 0;
79
+ outline: none;
80
+ position: relative;
81
+ overflow: hidden;
82
+ z-index: 1102;
83
+ border: 0px solid #fff;
84
+ }
85
+
86
+ #fancybox-hide-sel-frame {
87
+ position: absolute;
88
+ top: 0;
89
+ left: 0;
90
+ width: 100%;
91
+ height: 100%;
92
+ background: transparent;
93
+ z-index: 1101;
94
+ }
95
+
96
+ #fancybox-close {
97
+ position: absolute;
98
+ top: -15px;
99
+ right: -15px;
100
+ width: 30px;
101
+ height: 30px;
102
+ background: transparent url('fancybox.png') -40px 0px;
103
+ cursor: pointer;
104
+ z-index: 1103;
105
+ display: none;
106
+ }
107
+
108
+ #fancybox-error {
109
+ color: #444;
110
+ font: normal 12px/20px Arial;
111
+ padding: 14px;
112
+ margin: 0;
113
+ }
114
+
115
+ #fancybox-img {
116
+ width: 100%;
117
+ height: 100%;
118
+ padding: 0;
119
+ margin: 0;
120
+ border: none;
121
+ outline: none;
122
+ line-height: 0;
123
+ vertical-align: top;
124
+ }
125
+
126
+ #fancybox-frame {
127
+ width: 100%;
128
+ height: 100%;
129
+ border: none;
130
+ display: block;
131
+ }
132
+
133
+ #fancybox-left, #fancybox-right {
134
+ position: absolute;
135
+ bottom: 0px;
136
+ height: 100%;
137
+ width: 35%;
138
+ cursor: pointer;
139
+ outline: none;
140
+ background: transparent url('blank.gif');
141
+ z-index: 1102;
142
+ display: none;
143
+ }
144
+
145
+ #fancybox-left {
146
+ left: 0px;
147
+ }
148
+
149
+ #fancybox-right {
150
+ right: 0px;
151
+ }
152
+
153
+ #fancybox-left-ico, #fancybox-right-ico {
154
+ position: absolute;
155
+ top: 50%;
156
+ left: -9999px;
157
+ width: 30px;
158
+ height: 30px;
159
+ margin-top: -15px;
160
+ cursor: pointer;
161
+ z-index: 1102;
162
+ display: block;
163
+ }
164
+
165
+ #fancybox-left-ico {
166
+ background-image: url('fancybox.png');
167
+ background-position: -40px -30px;
168
+ }
169
+
170
+ #fancybox-right-ico {
171
+ background-image: url('fancybox.png');
172
+ background-position: -40px -60px;
173
+ }
174
+
175
+ #fancybox-left:hover, #fancybox-right:hover {
176
+ visibility: visible; /* IE6 */
177
+ }
178
+
179
+ #fancybox-left:hover span {
180
+ left: 20px;
181
+ }
182
+
183
+ #fancybox-right:hover span {
184
+ left: auto;
185
+ right: 20px;
186
+ }
187
+
188
+ .fancybox-bg {
189
+ position: absolute;
190
+ padding: 0;
191
+ margin: 0;
192
+ border: 0;
193
+ width: 20px;
194
+ height: 20px;
195
+ z-index: 1001;
196
+ }
197
+
198
+ #fancybox-bg-n {
199
+ top: -20px;
200
+ left: 0;
201
+ width: 100%;
202
+ background-image: url('fancybox-x.png');
203
+ }
204
+
205
+ #fancybox-bg-ne {
206
+ top: -20px;
207
+ right: -20px;
208
+ background-image: url('fancybox.png');
209
+ background-position: -40px -162px;
210
+ }
211
+
212
+ #fancybox-bg-e {
213
+ top: 0;
214
+ right: -20px;
215
+ height: 100%;
216
+ background-image: url('fancybox-y.png');
217
+ background-position: -20px 0px;
218
+ }
219
+
220
+ #fancybox-bg-se {
221
+ bottom: -20px;
222
+ right: -20px;
223
+ background-image: url('fancybox.png');
224
+ background-position: -40px -182px;
225
+ }
226
+
227
+ #fancybox-bg-s {
228
+ bottom: -20px;
229
+ left: 0;
230
+ width: 100%;
231
+ background-image: url('fancybox-x.png');
232
+ background-position: 0px -20px;
233
+ }
234
+
235
+ #fancybox-bg-sw {
236
+ bottom: -20px;
237
+ left: -20px;
238
+ background-image: url('fancybox.png');
239
+ background-position: -40px -142px;
240
+ }
241
+
242
+ #fancybox-bg-w {
243
+ top: 0;
244
+ left: -20px;
245
+ height: 100%;
246
+ background-image: url('fancybox-y.png');
247
+ }
248
+
249
+ #fancybox-bg-nw {
250
+ top: -20px;
251
+ left: -20px;
252
+ background-image: url('fancybox.png');
253
+ background-position: -40px -122px;
254
+ }
255
+
256
+ #fancybox-title {
257
+ font-family: Helvetica;
258
+ font-size: 12px;
259
+ z-index: 1102;
260
+ }
261
+
262
+ .fancybox-title-inside {
263
+ padding-bottom: 10px;
264
+ text-align: center;
265
+ color: #333;
266
+ background: #fff;
267
+ position: relative;
268
+ }
269
+
270
+ .fancybox-title-outside {
271
+ padding-top: 10px;
272
+ color: #fff;
273
+ }
274
+
275
+ .fancybox-title-over {
276
+ position: absolute;
277
+ bottom: 0;
278
+ left: 0;
279
+ color: #FFF;
280
+ text-align: left;
281
+ }
282
+
283
+ #fancybox-title-over {
284
+ padding: 10px;
285
+ background-image: url('fancy_title_over.png');
286
+ display: block;
287
+ }
288
+
289
+ .fancybox-title-float {
290
+ position: absolute;
291
+ left: 0;
292
+ bottom: -20px;
293
+ height: 32px;
294
+ }
295
+
296
+ #fancybox-title-float-wrap {
297
+ border: none;
298
+ border-collapse: collapse;
299
+ width: auto;
300
+ }
301
+
302
+ #fancybox-title-float-wrap td {
303
+ border: none;
304
+ white-space: nowrap;
305
+ }
306
+
307
+ #fancybox-title-float-left {
308
+ padding: 0 0 0 15px;
309
+ background: url('fancybox.png') -40px -90px no-repeat;
310
+ }
311
+
312
+ #fancybox-title-float-main {
313
+ color: #FFF;
314
+ line-height: 29px;
315
+ font-weight: bold;
316
+ padding: 0 0 3px 0;
317
+ background: url('fancybox-x.png') 0px -40px;
318
+ }
319
+
320
+ #fancybox-title-float-right {
321
+ padding: 0 0 0 15px;
322
+ background: url('fancybox.png') -55px -90px no-repeat;
323
+ }
324
+
325
+ /* IE6 */
326
+
327
+ .fancybox-ie6 #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); }
328
+
329
+ .fancybox-ie6 #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); }
330
+ .fancybox-ie6 #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); }
331
+
332
+ .fancybox-ie6 #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; }
333
+ .fancybox-ie6 #fancybox-title-float-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); }
334
+ .fancybox-ie6 #fancybox-title-float-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); }
335
+ .fancybox-ie6 #fancybox-title-float-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); }
336
+
337
+ .fancybox-ie6 #fancybox-bg-w, .fancybox-ie6 #fancybox-bg-e, .fancybox-ie6 #fancybox-left, .fancybox-ie6 #fancybox-right, #fancybox-hide-sel-frame {
338
+ height: expression(this.parentNode.clientHeight + "px");
339
+ }
340
+
341
+ #fancybox-loading.fancybox-ie6 {
342
+ position: absolute; margin-top: 0;
343
+ top: expression( (-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px');
344
+ }
345
+
346
+ #fancybox-loading.fancybox-ie6 div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); }
347
+
348
+ /* IE6, IE7, IE8 */
349
+
350
+ .fancybox-ie .fancybox-bg { background: transparent !important; }
351
+
352
+ .fancybox-ie #fancybox-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); }
353
+ .fancybox-ie #fancybox-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); }
354
+ .fancybox-ie #fancybox-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); }
355
+ .fancybox-ie #fancybox-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); }
356
+ .fancybox-ie #fancybox-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); }
357
+ .fancybox-ie #fancybox-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); }
358
+ .fancybox-ie #fancybox-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); }
359
+ .fancybox-ie #fancybox-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); }
apps/fancybox/jquery.fancybox-1.3.4.js ADDED
@@ -0,0 +1,1156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010)
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ ;(function($) {
19
+ var tmp, loading, overlay, wrap, outer, content, close, title, nav_left, nav_right,
20
+
21
+ selectedIndex = 0, selectedOpts = {}, selectedArray = [], currentIndex = 0, currentOpts = {}, currentArray = [],
22
+
23
+ ajaxLoader = null, imgPreloader = new Image(), imgRegExp = /\.(jpg|gif|png|bmp|jpeg)(.*)?$/i, swfRegExp = /[^\.]\.(swf)\s*$/i,
24
+
25
+ loadingTimer, loadingFrame = 1,
26
+
27
+ titleHeight = 0, titleStr = '', start_pos, final_pos, busy = false, fx = $.extend($('<div/>')[0], { prop: 0 }),
28
+
29
+ isIE6 = $.browser.msie && $.browser.version < 7 && !window.XMLHttpRequest,
30
+
31
+ /*
32
+ * Private methods
33
+ */
34
+
35
+ _abort = function() {
36
+ loading.hide();
37
+
38
+ imgPreloader.onerror = imgPreloader.onload = null;
39
+
40
+ if (ajaxLoader) {
41
+ ajaxLoader.abort();
42
+ }
43
+
44
+ tmp.empty();
45
+ },
46
+
47
+ _error = function() {
48
+ if (false === selectedOpts.onError(selectedArray, selectedIndex, selectedOpts)) {
49
+ loading.hide();
50
+ busy = false;
51
+ return;
52
+ }
53
+
54
+ selectedOpts.titleShow = false;
55
+
56
+ selectedOpts.width = 'auto';
57
+ selectedOpts.height = 'auto';
58
+
59
+ tmp.html( '<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>' );
60
+
61
+ _process_inline();
62
+ },
63
+
64
+ _start = function() {
65
+ var obj = selectedArray[ selectedIndex ],
66
+ href,
67
+ type,
68
+ title,
69
+ str,
70
+ emb,
71
+ ret;
72
+
73
+ _abort();
74
+
75
+ selectedOpts = $.extend({}, $.fn.fancybox.defaults, (typeof $(obj).data('fancybox') == 'undefined' ? selectedOpts : $(obj).data('fancybox')));
76
+
77
+ ret = selectedOpts.onStart(selectedArray, selectedIndex, selectedOpts);
78
+
79
+ if (ret === false) {
80
+ busy = false;
81
+ return;
82
+ } else if (typeof ret == 'object') {
83
+ selectedOpts = $.extend(selectedOpts, ret);
84
+ }
85
+
86
+ title = selectedOpts.title || (obj.nodeName ? $(obj).attr('title') : obj.title) || '';
87
+
88
+ if (obj.nodeName && !selectedOpts.orig) {
89
+ selectedOpts.orig = $(obj).children("img:first").length ? $(obj).children("img:first") : $(obj);
90
+ }
91
+
92
+ if (title === '' && selectedOpts.orig && selectedOpts.titleFromAlt) {
93
+ title = selectedOpts.orig.attr('alt');
94
+ }
95
+
96
+ href = selectedOpts.href || (obj.nodeName ? $(obj).attr('href') : obj.href) || null;
97
+
98
+ if ((/^(?:javascript)/i).test(href) || href == '#') {
99
+ href = null;
100
+ }
101
+
102
+ if (selectedOpts.type) {
103
+ type = selectedOpts.type;
104
+
105
+ if (!href) {
106
+ href = selectedOpts.content;
107
+ }
108
+
109
+ } else if (selectedOpts.content) {
110
+ type = 'html';
111
+
112
+ } else if (href) {
113
+ if (href.match(imgRegExp)) {
114
+ type = 'image';
115
+
116
+ } else if (href.match(swfRegExp)) {
117
+ type = 'swf';
118
+
119
+ } else if ($(obj).hasClass("iframe")) {
120
+ type = 'iframe';
121
+
122
+ } else if (href.indexOf("#") === 0) {
123
+ type = 'inline';
124
+
125
+ } else {
126
+ type = 'ajax';
127
+ }
128
+ }
129
+
130
+ if (!type) {
131
+ _error();
132
+ return;
133
+ }
134
+
135
+ if (type == 'inline') {
136
+ obj = href.substr(href.indexOf("#"));
137
+ type = $(obj).length > 0 ? 'inline' : 'ajax';
138
+ }
139
+
140
+ selectedOpts.type = type;
141
+ selectedOpts.href = href;
142
+ selectedOpts.title = title;
143
+
144
+ if (selectedOpts.autoDimensions) {
145
+ if (selectedOpts.type == 'html' || selectedOpts.type == 'inline' || selectedOpts.type == 'ajax') {
146
+ selectedOpts.width = 'auto';
147
+ selectedOpts.height = 'auto';
148
+ } else {
149
+ selectedOpts.autoDimensions = false;
150
+ }
151
+ }
152
+
153
+ if (selectedOpts.modal) {
154
+ selectedOpts.overlayShow = true;
155
+ selectedOpts.hideOnOverlayClick = false;
156
+ selectedOpts.hideOnContentClick = false;
157
+ selectedOpts.enableEscapeButton = false;
158
+ selectedOpts.showCloseButton = false;
159
+ }
160
+
161
+ selectedOpts.padding = parseInt(selectedOpts.padding, 10);
162
+ selectedOpts.margin = parseInt(selectedOpts.margin, 10);
163
+
164
+ tmp.css('padding', (selectedOpts.padding + selectedOpts.margin));
165
+
166
+ $('.fancybox-inline-tmp').unbind('fancybox-cancel').bind('fancybox-change', function() {
167
+ $(this).replaceWith(content.children());
168
+ });
169
+
170
+ switch (type) {
171
+ case 'html' :
172
+ tmp.html( selectedOpts.content );
173
+ _process_inline();
174
+ break;
175
+
176
+ case 'inline' :
177
+ if ( $(obj).parent().is('#fancybox-content') === true) {
178
+ busy = false;
179
+ return;
180
+ }
181
+
182
+ $('<div class="fancybox-inline-tmp" />')
183
+ .hide()
184
+ .insertBefore( $(obj) )
185
+ .bind('fancybox-cleanup', function() {
186
+ $(this).replaceWith(content.children());
187
+ }).bind('fancybox-cancel', function() {
188
+ $(this).replaceWith(tmp.children());
189
+ });
190
+
191
+ $(obj).appendTo(tmp);
192
+
193
+ _process_inline();
194
+ break;
195
+
196
+ case 'image':
197
+ busy = false;
198
+
199
+ $.fancybox.showActivity();
200
+
201
+ imgPreloader = new Image();
202
+
203
+ imgPreloader.onerror = function() {
204
+ _error();
205
+ };
206
+
207
+ imgPreloader.onload = function() {
208
+ busy = true;
209
+
210
+ imgPreloader.onerror = imgPreloader.onload = null;
211
+
212
+ _process_image();
213
+ };
214
+
215
+ imgPreloader.src = href;
216
+ break;
217
+
218
+ case 'swf':
219
+ selectedOpts.scrolling = 'no';
220
+
221
+ str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"><param name="movie" value="' + href + '"></param>';
222
+ emb = '';
223
+
224
+ $.each(selectedOpts.swf, function(name, val) {
225
+ str += '<param name="' + name + '" value="' + val + '"></param>';
226
+ emb += ' ' + name + '="' + val + '"';
227
+ });
228
+
229
+ str += '<embed src="' + href + '" type="application/x-shockwave-flash" width="' + selectedOpts.width + '" height="' + selectedOpts.height + '"' + emb + '></embed></object>';
230
+
231
+ tmp.html(str);
232
+
233
+ _process_inline();
234
+ break;
235
+
236
+ case 'ajax':
237
+ busy = false;
238
+
239
+ $.fancybox.showActivity();
240
+
241
+ selectedOpts.ajax.win = selectedOpts.ajax.success;
242
+
243
+ ajaxLoader = $.ajax($.extend({}, selectedOpts.ajax, {
244
+ url : href,
245
+ data : selectedOpts.ajax.data || {},
246
+ error : function(XMLHttpRequest, textStatus, errorThrown) {
247
+ if ( XMLHttpRequest.status > 0 ) {
248
+ _error();
249
+ }
250
+ },
251
+ success : function(data, textStatus, XMLHttpRequest) {
252
+ var o = typeof XMLHttpRequest == 'object' ? XMLHttpRequest : ajaxLoader;
253
+ if (o.status == 200) {
254
+ if ( typeof selectedOpts.ajax.win == 'function' ) {
255
+ ret = selectedOpts.ajax.win(href, data, textStatus, XMLHttpRequest);
256
+
257
+ if (ret === false) {
258
+ loading.hide();
259
+ return;
260
+ } else if (typeof ret == 'string' || typeof ret == 'object') {
261
+ data = ret;
262
+ }
263
+ }
264
+
265
+ tmp.html( data );
266
+ _process_inline();
267
+ }
268
+ }
269
+ }));
270
+
271
+ break;
272
+
273
+ case 'iframe':
274
+ _show();
275
+ break;
276
+ }
277
+ },
278
+
279
+ _process_inline = function() {
280
+ var
281
+ w = selectedOpts.width,
282
+ h = selectedOpts.height;
283
+
284
+ if (w.toString().indexOf('%') > -1) {
285
+ w = parseInt( ($(window).width() - (selectedOpts.margin * 2)) * parseFloat(w) / 100, 10) + 'px';
286
+
287
+ } else {
288
+ w = w == 'auto' ? 'auto' : w + 'px';
289
+ }
290
+
291
+ if (h.toString().indexOf('%') > -1) {
292
+ h = parseInt( ($(window).height() - (selectedOpts.margin * 2)) * parseFloat(h) / 100, 10) + 'px';
293
+
294
+ } else {
295
+ h = h == 'auto' ? 'auto' : h + 'px';
296
+ }
297
+
298
+ tmp.wrapInner('<div style="width:' + w + ';height:' + h + ';overflow: ' + (selectedOpts.scrolling == 'auto' ? 'auto' : (selectedOpts.scrolling == 'yes' ? 'scroll' : 'hidden')) + ';position:relative;"></div>');
299
+
300
+ selectedOpts.width = tmp.width();
301
+ selectedOpts.height = tmp.height();
302
+
303
+ _show();
304
+ },
305
+
306
+ _process_image = function() {
307
+ selectedOpts.width = imgPreloader.width;
308
+ selectedOpts.height = imgPreloader.height;
309
+
310
+ $("<img />").attr({
311
+ 'id' : 'fancybox-img',
312
+ 'src' : imgPreloader.src,
313
+ 'alt' : selectedOpts.title
314
+ }).appendTo( tmp );
315
+
316
+ _show();
317
+ },
318
+
319
+ _show = function() {
320
+ var pos, equal;
321
+
322
+ loading.hide();
323
+
324
+ if (wrap.is(":visible") && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
325
+ $.event.trigger('fancybox-cancel');
326
+
327
+ busy = false;
328
+ return;
329
+ }
330
+
331
+ busy = true;
332
+
333
+ $(content.add( overlay )).unbind();
334
+
335
+ $(window).unbind("resize.fb scroll.fb");
336
+ $(document).unbind('keydown.fb');
337
+
338
+ if (wrap.is(":visible") && currentOpts.titlePosition !== 'outside') {
339
+ wrap.css('height', wrap.height());
340
+ }
341
+
342
+ currentArray = selectedArray;
343
+ currentIndex = selectedIndex;
344
+ currentOpts = selectedOpts;
345
+
346
+ if (currentOpts.overlayShow) {
347
+ overlay.css({
348
+ 'background-color' : currentOpts.overlayColor,
349
+ 'opacity' : currentOpts.overlayOpacity,
350
+ 'cursor' : currentOpts.hideOnOverlayClick ? 'pointer' : 'auto',
351
+ 'height' : $(document).height()
352
+ });
353
+
354
+ if (!overlay.is(':visible')) {
355
+ if (isIE6) {
356
+ $('select:not(#fancybox-tmp select)').filter(function() {
357
+ return this.style.visibility !== 'hidden';
358
+ }).css({'visibility' : 'hidden'}).one('fancybox-cleanup', function() {
359
+ this.style.visibility = 'inherit';
360
+ });
361
+ }
362
+
363
+ overlay.show();
364
+ }
365
+ } else {
366
+ overlay.hide();
367
+ }
368
+
369
+ final_pos = _get_zoom_to();
370
+
371
+ _process_title();
372
+
373
+ if (wrap.is(":visible")) {
374
+ $( close.add( nav_left ).add( nav_right ) ).hide();
375
+
376
+ pos = wrap.position(),
377
+
378
+ start_pos = {
379
+ top : pos.top,
380
+ left : pos.left,
381
+ width : wrap.width(),
382
+ height : wrap.height()
383
+ };
384
+
385
+ equal = (start_pos.width == final_pos.width && start_pos.height == final_pos.height);
386
+
387
+ content.fadeTo(currentOpts.changeFade, 0.3, function() {
388
+ var finish_resizing = function() {
389
+ content.html( tmp.contents() ).fadeTo(currentOpts.changeFade, 1, _finish);
390
+ };
391
+
392
+ $.event.trigger('fancybox-change');
393
+
394
+ content
395
+ .empty()
396
+ .removeAttr('filter')
397
+ .css({
398
+ 'border-width' : currentOpts.padding,
399
+ 'width' : final_pos.width - currentOpts.padding * 2,
400
+ 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
401
+ });
402
+
403
+ if (equal) {
404
+ finish_resizing();
405
+
406
+ } else {
407
+ fx.prop = 0;
408
+
409
+ $(fx).animate({prop: 1}, {
410
+ duration : currentOpts.changeSpeed,
411
+ easing : currentOpts.easingChange,
412
+ step : _draw,
413
+ complete : finish_resizing
414
+ });
415
+ }
416
+ });
417
+
418
+ return;
419
+ }
420
+
421
+ wrap.removeAttr("style");
422
+
423
+ content.css('border-width', currentOpts.padding);
424
+
425
+ if (currentOpts.transitionIn == 'elastic') {
426
+ start_pos = _get_zoom_from();
427
+
428
+ content.html( tmp.contents() );
429
+
430
+ wrap.show();
431
+
432
+ if (currentOpts.opacity) {
433
+ final_pos.opacity = 0;
434
+ }
435
+
436
+ fx.prop = 0;
437
+
438
+ $(fx).animate({prop: 1}, {
439
+ duration : currentOpts.speedIn,
440
+ easing : currentOpts.easingIn,
441
+ step : _draw,
442
+ complete : _finish
443
+ });
444
+
445
+ return;
446
+ }
447
+
448
+ if (currentOpts.titlePosition == 'inside' && titleHeight > 0) {
449
+ title.show();
450
+ }
451
+
452
+ content
453
+ .css({
454
+ 'width' : final_pos.width - currentOpts.padding * 2,
455
+ 'height' : selectedOpts.autoDimensions ? 'auto' : final_pos.height - titleHeight - currentOpts.padding * 2
456
+ })
457
+ .html( tmp.contents() );
458
+
459
+ wrap
460
+ .css(final_pos)
461
+ .fadeIn( currentOpts.transitionIn == 'none' ? 0 : currentOpts.speedIn, _finish );
462
+ },
463
+
464
+ _format_title = function(title) {
465
+ if (title && title.length) {
466
+ if (currentOpts.titlePosition == 'float') {
467
+ return '<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">' + title + '</td><td id="fancybox-title-float-right"></td></tr></table>';
468
+ }
469
+
470
+ return '<div id="fancybox-title-' + currentOpts.titlePosition + '">' + title + '</div>';
471
+ }
472
+
473
+ return false;
474
+ },
475
+
476
+ _process_title = function() {
477
+ titleStr = currentOpts.title || '';
478
+ titleHeight = 0;
479
+
480
+ title
481
+ .empty()
482
+ .removeAttr('style')
483
+ .removeClass();
484
+
485
+ if (currentOpts.titleShow === false) {
486
+ title.hide();
487
+ return;
488
+ }
489
+
490
+ titleStr = $.isFunction(currentOpts.titleFormat) ? currentOpts.titleFormat(titleStr, currentArray, currentIndex, currentOpts) : _format_title(titleStr);
491
+
492
+ if (!titleStr || titleStr === '') {
493
+ title.hide();
494
+ return;
495
+ }
496
+
497
+ title
498
+ .addClass('fancybox-title-' + currentOpts.titlePosition)
499
+ .html( titleStr )
500
+ .appendTo( 'body' )
501
+ .show();
502
+
503
+ switch (currentOpts.titlePosition) {
504
+ case 'inside':
505
+ title
506
+ .css({
507
+ 'width' : final_pos.width - (currentOpts.padding * 2),
508
+ 'marginLeft' : currentOpts.padding,
509
+ 'marginRight' : currentOpts.padding
510
+ });
511
+
512
+ titleHeight = title.outerHeight(true);
513
+
514
+ title.appendTo( outer );
515
+
516
+ final_pos.height += titleHeight;
517
+ break;
518
+
519
+ case 'over':
520
+ title
521
+ .css({
522
+ 'marginLeft' : currentOpts.padding,
523
+ 'width' : final_pos.width - (currentOpts.padding * 2),
524
+ 'bottom' : currentOpts.padding
525
+ })
526
+ .appendTo( outer );
527
+ break;
528
+
529
+ case 'float':
530
+ title
531
+ .css('left', parseInt((title.width() - final_pos.width - 40)/ 2, 10) * -1)
532
+ .appendTo( wrap );
533
+ break;
534
+
535
+ default:
536
+ title
537
+ .css({
538
+ 'width' : final_pos.width - (currentOpts.padding * 2),
539
+ 'paddingLeft' : currentOpts.padding,
540
+ 'paddingRight' : currentOpts.padding
541
+ })
542
+ .appendTo( wrap );
543
+ break;
544
+ }
545
+
546
+ title.hide();
547
+ },
548
+
549
+ _set_navigation = function() {
550
+ if (currentOpts.enableEscapeButton || currentOpts.enableKeyboardNav) {
551
+ $(document).bind('keydown.fb', function(e) {
552
+ if (e.keyCode == 27 && currentOpts.enableEscapeButton) {
553
+ e.preventDefault();
554
+ $.fancybox.close();
555
+
556
+ } else if ((e.keyCode == 37 || e.keyCode == 39) && currentOpts.enableKeyboardNav && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') {
557
+ e.preventDefault();
558
+ $.fancybox[ e.keyCode == 37 ? 'prev' : 'next']();
559
+ }
560
+ });
561
+ }
562
+
563
+ if (!currentOpts.showNavArrows) {
564
+ nav_left.hide();
565
+ nav_right.hide();
566
+ return;
567
+ }
568
+
569
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex !== 0) {
570
+ nav_left.show();
571
+ }
572
+
573
+ if ((currentOpts.cyclic && currentArray.length > 1) || currentIndex != (currentArray.length -1)) {
574
+ nav_right.show();
575
+ }
576
+ },
577
+
578
+ _finish = function () {
579
+ if (!$.support.opacity) {
580
+ content.get(0).style.removeAttribute('filter');
581
+ wrap.get(0).style.removeAttribute('filter');
582
+ }
583
+
584
+ if (selectedOpts.autoDimensions) {
585
+ content.css('height', 'auto');
586
+ }
587
+
588
+ wrap.css('height', 'auto');
589
+
590
+ if (titleStr && titleStr.length) {
591
+ title.show();
592
+ }
593
+
594
+ if (currentOpts.showCloseButton) {
595
+ close.show();
596
+ }
597
+
598
+ _set_navigation();
599
+
600
+ if (currentOpts.hideOnContentClick) {
601
+ content.bind('click', $.fancybox.close);
602
+ }
603
+
604
+ if (currentOpts.hideOnOverlayClick) {
605
+ overlay.bind('click', $.fancybox.close);
606
+ }
607
+
608
+ $(window).bind("resize.fb", $.fancybox.resize);
609
+
610
+ if (currentOpts.centerOnScroll) {
611
+ $(window).bind("scroll.fb", $.fancybox.center);
612
+ }
613
+
614
+ if (currentOpts.type == 'iframe') {
615
+ $('<iframe id="fancybox-frame" name="fancybox-frame' + new Date().getTime() + '" frameborder="0" hspace="0" ' + ($.browser.msie ? 'allowtransparency="true""' : '') + ' scrolling="' + selectedOpts.scrolling + '" src="' + currentOpts.href + '"></iframe>').appendTo(content);
616
+ }
617
+
618
+ wrap.show();
619
+
620
+ busy = false;
621
+
622
+ $.fancybox.center();
623
+
624
+ currentOpts.onComplete(currentArray, currentIndex, currentOpts);
625
+
626
+ _preload_images();
627
+ },
628
+
629
+ _preload_images = function() {
630
+ var href,
631
+ objNext;
632
+
633
+ if ((currentArray.length -1) > currentIndex) {
634
+ href = currentArray[ currentIndex + 1 ].href;
635
+
636
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
637
+ objNext = new Image();
638
+ objNext.src = href;
639
+ }
640
+ }
641
+
642
+ if (currentIndex > 0) {
643
+ href = currentArray[ currentIndex - 1 ].href;
644
+
645
+ if (typeof href !== 'undefined' && href.match(imgRegExp)) {
646
+ objNext = new Image();
647
+ objNext.src = href;
648
+ }
649
+ }
650
+ },
651
+
652
+ _draw = function(pos) {
653
+ var dim = {
654
+ width : parseInt(start_pos.width + (final_pos.width - start_pos.width) * pos, 10),
655
+ height : parseInt(start_pos.height + (final_pos.height - start_pos.height) * pos, 10),
656
+
657
+ top : parseInt(start_pos.top + (final_pos.top - start_pos.top) * pos, 10),
658
+ left : parseInt(start_pos.left + (final_pos.left - start_pos.left) * pos, 10)
659
+ };
660
+
661
+ if (typeof final_pos.opacity !== 'undefined') {
662
+ dim.opacity = pos < 0.5 ? 0.5 : pos;
663
+ }
664
+
665
+ wrap.css(dim);
666
+
667
+ content.css({
668
+ 'width' : dim.width - currentOpts.padding * 2,
669
+ 'height' : dim.height - (titleHeight * pos) - currentOpts.padding * 2
670
+ });
671
+ },
672
+
673
+ _get_viewport = function() {
674
+ return [
675
+ $(window).width() - (currentOpts.margin * 2),
676
+ $(window).height() - (currentOpts.margin * 2),
677
+ $(document).scrollLeft() + currentOpts.margin,
678
+ $(document).scrollTop() + currentOpts.margin
679
+ ];
680
+ },
681
+
682
+ _get_zoom_to = function () {
683
+ var view = _get_viewport(),
684
+ to = {},
685
+ resize = currentOpts.autoScale,
686
+ double_padding = currentOpts.padding * 2,
687
+ ratio;
688
+
689
+ if (currentOpts.width.toString().indexOf('%') > -1) {
690
+ to.width = parseInt((view[0] * parseFloat(currentOpts.width)) / 100, 10);
691
+ } else {
692
+ to.width = currentOpts.width + double_padding;
693
+ }
694
+
695
+ if (currentOpts.height.toString().indexOf('%') > -1) {
696
+ to.height = parseInt((view[1] * parseFloat(currentOpts.height)) / 100, 10);
697
+ } else {
698
+ to.height = currentOpts.height + double_padding;
699
+ }
700
+
701
+ if (resize && (to.width > view[0] || to.height > view[1])) {
702
+ if (selectedOpts.type == 'image' || selectedOpts.type == 'swf') {
703
+ ratio = (currentOpts.width ) / (currentOpts.height );
704
+
705
+ if ((to.width ) > view[0]) {
706
+ to.width = view[0];
707
+ to.height = parseInt(((to.width - double_padding) / ratio) + double_padding, 10);
708
+ }
709
+
710
+ if ((to.height) > view[1]) {
711
+ to.height = view[1];
712
+ to.width = parseInt(((to.height - double_padding) * ratio) + double_padding, 10);
713
+ }
714
+
715
+ } else {
716
+ to.width = Math.min(to.width, view[0]);
717
+ to.height = Math.min(to.height, view[1]);
718
+ }
719
+ }
720
+
721
+ to.top = parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - to.height - 40) * 0.5)), 10);
722
+ to.left = parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - to.width - 40) * 0.5)), 10);
723
+
724
+ return to;
725
+ },
726
+
727
+ _get_obj_pos = function(obj) {
728
+ var pos = obj.offset();
729
+
730
+ pos.top += parseInt( obj.css('paddingTop'), 10 ) || 0;
731
+ pos.left += parseInt( obj.css('paddingLeft'), 10 ) || 0;
732
+
733
+ pos.top += parseInt( obj.css('border-top-width'), 10 ) || 0;
734
+ pos.left += parseInt( obj.css('border-left-width'), 10 ) || 0;
735
+
736
+ pos.width = obj.width();
737
+ pos.height = obj.height();
738
+
739
+ return pos;
740
+ },
741
+
742
+ _get_zoom_from = function() {
743
+ var orig = selectedOpts.orig ? $(selectedOpts.orig) : false,
744
+ from = {},
745
+ pos,
746
+ view;
747
+
748
+ if (orig && orig.length) {
749
+ pos = _get_obj_pos(orig);
750
+
751
+ from = {
752
+ width : pos.width + (currentOpts.padding * 2),
753
+ height : pos.height + (currentOpts.padding * 2),
754
+ top : pos.top - currentOpts.padding - 20,
755
+ left : pos.left - currentOpts.padding - 20
756
+ };
757
+
758
+ } else {
759
+ view = _get_viewport();
760
+
761
+ from = {
762
+ width : currentOpts.padding * 2,
763
+ height : currentOpts.padding * 2,
764
+ top : parseInt(view[3] + view[1] * 0.5, 10),
765
+ left : parseInt(view[2] + view[0] * 0.5, 10)
766
+ };
767
+ }
768
+
769
+ return from;
770
+ },
771
+
772
+ _animate_loading = function() {
773
+ if (!loading.is(':visible')){
774
+ clearInterval(loadingTimer);
775
+ return;
776
+ }
777
+
778
+ $('div', loading).css('top', (loadingFrame * -40) + 'px');
779
+
780
+ loadingFrame = (loadingFrame + 1) % 12;
781
+ };
782
+
783
+ /*
784
+ * Public methods
785
+ */
786
+
787
+ $.fn.fancybox = function(options) {
788
+ if (!$(this).length) {
789
+ return this;
790
+ }
791
+
792
+ $(this)
793
+ .data('fancybox', $.extend({}, options, ($.metadata ? $(this).metadata() : {})))
794
+ .unbind('click.fb')
795
+ .bind('click.fb', function(e) {
796
+ e.preventDefault();
797
+
798
+ if (busy) {
799
+ return;
800
+ }
801
+
802
+ busy = true;
803
+
804
+ $(this).blur();
805
+
806
+ selectedArray = [];
807
+ selectedIndex = 0;
808
+
809
+ var rel = $(this).attr('rel') || '';
810
+
811
+ if (!rel || rel == '' || rel === 'nofollow') {
812
+ selectedArray.push(this);
813
+
814
+ } else {
815
+ selectedArray = $("a[rel=" + rel + "], area[rel=" + rel + "]");
816
+ selectedIndex = selectedArray.index( this );
817
+ }
818
+
819
+ _start();
820
+
821
+ return;
822
+ });
823
+
824
+ return this;
825
+ };
826
+
827
+ $.fancybox = function(obj) {
828
+ var opts;
829
+
830
+ if (busy) {
831
+ return;
832
+ }
833
+
834
+ busy = true;
835
+ opts = typeof arguments[1] !== 'undefined' ? arguments[1] : {};
836
+
837
+ selectedArray = [];
838
+ selectedIndex = parseInt(opts.index, 10) || 0;
839
+
840
+ if ($.isArray(obj)) {
841
+ for (var i = 0, j = obj.length; i < j; i++) {
842
+ if (typeof obj[i] == 'object') {
843
+ $(obj[i]).data('fancybox', $.extend({}, opts, obj[i]));
844
+ } else {
845
+ obj[i] = $({}).data('fancybox', $.extend({content : obj[i]}, opts));
846
+ }
847
+ }
848
+
849
+ selectedArray = jQuery.merge(selectedArray, obj);
850
+
851
+ } else {
852
+ if (typeof obj == 'object') {
853
+ $(obj).data('fancybox', $.extend({}, opts, obj));
854
+ } else {
855
+ obj = $({}).data('fancybox', $.extend({content : obj}, opts));
856
+ }
857
+
858
+ selectedArray.push(obj);
859
+ }
860
+
861
+ if (selectedIndex > selectedArray.length || selectedIndex < 0) {
862
+ selectedIndex = 0;
863
+ }
864
+
865
+ _start();
866
+ };
867
+
868
+ $.fancybox.showActivity = function() {
869
+ clearInterval(loadingTimer);
870
+
871
+ loading.show();
872
+ loadingTimer = setInterval(_animate_loading, 66);
873
+ };
874
+
875
+ $.fancybox.hideActivity = function() {
876
+ loading.hide();
877
+ };
878
+
879
+ $.fancybox.next = function() {
880
+ return $.fancybox.pos( currentIndex + 1);
881
+ };
882
+
883
+ $.fancybox.prev = function() {
884
+ return $.fancybox.pos( currentIndex - 1);
885
+ };
886
+
887
+ $.fancybox.pos = function(pos) {
888
+ if (busy) {
889
+ return;
890
+ }
891
+
892
+ pos = parseInt(pos);
893
+
894
+ selectedArray = currentArray;
895
+
896
+ if (pos > -1 && pos < currentArray.length) {
897
+ selectedIndex = pos;
898
+ _start();
899
+
900
+ } else if (currentOpts.cyclic && currentArray.length > 1) {
901
+ selectedIndex = pos >= currentArray.length ? 0 : currentArray.length - 1;
902
+ _start();
903
+ }
904
+
905
+ return;
906
+ };
907
+
908
+ $.fancybox.cancel = function() {
909
+ if (busy) {
910
+ return;
911
+ }
912
+
913
+ busy = true;
914
+
915
+ $.event.trigger('fancybox-cancel');
916
+
917
+ _abort();
918
+
919
+ selectedOpts.onCancel(selectedArray, selectedIndex, selectedOpts);
920
+
921
+ busy = false;
922
+ };
923
+
924
+ // Note: within an iframe use - parent.$.fancybox.close();
925
+ $.fancybox.close = function() {
926
+ if (busy || wrap.is(':hidden')) {
927
+ return;
928
+ }
929
+
930
+ busy = true;
931
+
932
+ if (currentOpts && false === currentOpts.onCleanup(currentArray, currentIndex, currentOpts)) {
933
+ busy = false;
934
+ return;
935
+ }
936
+
937
+ _abort();
938
+
939
+ $(close.add( nav_left ).add( nav_right )).hide();
940
+
941
+ $(content.add( overlay )).unbind();
942
+
943
+ $(window).unbind("resize.fb scroll.fb");
944
+ $(document).unbind('keydown.fb');
945
+
946
+ content.find('iframe').attr('src', isIE6 && /^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank');
947
+
948
+ if (currentOpts.titlePosition !== 'inside') {
949
+ title.empty();
950
+ }
951
+
952
+ wrap.stop();
953
+
954
+ function _cleanup() {
955
+ overlay.fadeOut('fast');
956
+
957
+ title.empty().hide();
958
+ wrap.hide();
959
+
960
+ $.event.trigger('fancybox-cleanup');
961
+
962
+ content.empty();
963
+
964
+ currentOpts.onClosed(currentArray, currentIndex, currentOpts);
965
+
966
+ currentArray = selectedOpts = [];
967
+ currentIndex = selectedIndex = 0;
968
+ currentOpts = selectedOpts = {};
969
+
970
+ busy = false;
971
+ }
972
+
973
+ if (currentOpts.transitionOut == 'elastic') {
974
+ start_pos = _get_zoom_from();
975
+
976
+ var pos = wrap.position();
977
+
978
+ final_pos = {
979
+ top : pos.top ,
980
+ left : pos.left,
981
+ width : wrap.width(),
982
+ height : wrap.height()
983
+ };
984
+
985
+ if (currentOpts.opacity) {
986
+ final_pos.opacity = 1;
987
+ }
988
+
989
+ title.empty().hide();
990
+
991
+ fx.prop = 1;
992
+
993
+ $(fx).animate({ prop: 0 }, {
994
+ duration : currentOpts.speedOut,
995
+ easing : currentOpts.easingOut,
996
+ step : _draw,
997
+ complete : _cleanup
998
+ });
999
+
1000
+ } else {
1001
+ wrap.fadeOut( currentOpts.transitionOut == 'none' ? 0 : currentOpts.speedOut, _cleanup);
1002
+ }
1003
+ };
1004
+
1005
+ $.fancybox.resize = function() {
1006
+ if (overlay.is(':visible')) {
1007
+ overlay.css('height', $(document).height());
1008
+ }
1009
+
1010
+ $.fancybox.center(true);
1011
+ };
1012
+
1013
+ $.fancybox.center = function() {
1014
+ var view, align;
1015
+
1016
+ if (busy) {
1017
+ return;
1018
+ }
1019
+
1020
+ align = arguments[0] === true ? 1 : 0;
1021
+ view = _get_viewport();
1022
+
1023
+ if (!align && (wrap.width() > view[0] || wrap.height() > view[1])) {
1024
+ return;
1025
+ }
1026
+
1027
+ wrap
1028
+ .stop()
1029
+ .animate({
1030
+ 'top' : parseInt(Math.max(view[3] - 20, view[3] + ((view[1] - content.height() - 40) * 0.5) - currentOpts.padding)),
1031
+ 'left' : parseInt(Math.max(view[2] - 20, view[2] + ((view[0] - content.width() - 40) * 0.5) - currentOpts.padding))
1032
+ }, typeof arguments[0] == 'number' ? arguments[0] : 200);
1033
+ };
1034
+
1035
+ $.fancybox.init = function() {
1036
+ if ($("#fancybox-wrap").length) {
1037
+ return;
1038
+ }
1039
+
1040
+ $('body').append(
1041
+ tmp = $('<div id="fancybox-tmp"></div>'),
1042
+ loading = $('<div id="fancybox-loading"><div></div></div>'),
1043
+ overlay = $('<div id="fancybox-overlay"></div>'),
1044
+ wrap = $('<div id="fancybox-wrap"></div>')
1045
+ );
1046
+
1047
+ outer = $('<div id="fancybox-outer"></div>')
1048
+ .append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>')
1049
+ .appendTo( wrap );
1050
+
1051
+ outer.append(
1052
+ content = $('<div id="fancybox-content"></div>'),
1053
+ close = $('<a id="fancybox-close"></a>'),
1054
+ title = $('<div id="fancybox-title"></div>'),
1055
+
1056
+ nav_left = $('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),
1057
+ nav_right = $('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>')
1058
+ );
1059
+
1060
+ close.click($.fancybox.close);
1061
+ loading.click($.fancybox.cancel);
1062
+
1063
+ nav_left.click(function(e) {
1064
+ e.preventDefault();
1065
+ $.fancybox.prev();
1066
+ });
1067
+
1068
+ nav_right.click(function(e) {
1069
+ e.preventDefault();
1070
+ $.fancybox.next();
1071
+ });
1072
+
1073
+ if ($.fn.mousewheel) {
1074
+ wrap.bind('mousewheel.fb', function(e, delta) {
1075
+ if (busy) {
1076
+ e.preventDefault();
1077
+
1078
+ } else if ($(e.target).get(0).clientHeight == 0 || $(e.target).get(0).scrollHeight === $(e.target).get(0).clientHeight) {
1079
+ e.preventDefault();
1080
+ $.fancybox[ delta > 0 ? 'prev' : 'next']();
1081
+ }
1082
+ });
1083
+ }
1084
+
1085
+ if (!$.support.opacity) {
1086
+ wrap.addClass('fancybox-ie');
1087
+ }
1088
+
1089
+ if (isIE6) {
1090
+ loading.addClass('fancybox-ie6');
1091
+ wrap.addClass('fancybox-ie6');
1092
+
1093
+ $('<iframe id="fancybox-hide-sel-frame" src="' + (/^https/i.test(window.location.href || '') ? 'javascript:void(false)' : 'about:blank' ) + '" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(outer);
1094
+ }
1095
+ };
1096
+
1097
+ $.fn.fancybox.defaults = {
1098
+ padding : 10,
1099
+ margin : 40,
1100
+ opacity : false,
1101
+ modal : false,
1102
+ cyclic : false,
1103
+ scrolling : 'auto', // 'auto', 'yes' or 'no'
1104
+
1105
+ width : 560,
1106
+ height : 340,
1107
+
1108
+ autoScale : true,
1109
+ autoDimensions : true,
1110
+ centerOnScroll : false,
1111
+
1112
+ ajax : {},
1113
+ swf : { wmode: 'transparent' },
1114
+
1115
+ hideOnOverlayClick : true,
1116
+ hideOnContentClick : false,
1117
+
1118
+ overlayShow : true,
1119
+ overlayOpacity : 0.7,
1120
+ overlayColor : '#777',
1121
+
1122
+ titleShow : true,
1123
+ titlePosition : 'float', // 'float', 'outside', 'inside' or 'over'
1124
+ titleFormat : null,
1125
+ titleFromAlt : false,
1126
+
1127
+ transitionIn : 'fade', // 'elastic', 'fade' or 'none'
1128
+ transitionOut : 'fade', // 'elastic', 'fade' or 'none'
1129
+
1130
+ speedIn : 300,
1131
+ speedOut : 300,
1132
+
1133
+ changeSpeed : 300,
1134
+ changeFade : 'fast',
1135
+
1136
+ easingIn : 'swing',
1137
+ easingOut : 'swing',
1138
+
1139
+ showCloseButton : true,
1140
+ showNavArrows : true,
1141
+ enableEscapeButton : true,
1142
+ enableKeyboardNav : true,
1143
+
1144
+ onStart : function(){},
1145
+ onCancel : function(){},
1146
+ onComplete : function(){},
1147
+ onCleanup : function(){},
1148
+ onClosed : function(){},
1149
+ onError : function(){}
1150
+ };
1151
+
1152
+ $(document).ready(function() {
1153
+ $.fancybox.init();
1154
+ });
1155
+
1156
+ })(jQuery);
apps/fancybox/jquery.fancybox-1.3.4.min.js ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
2
+ F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
3
+ c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
4
+ false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
5
+ function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
6
+ '"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
7
+ "function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
8
+ ";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
9
+ opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){if(M)b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&
10
+ s.length?d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,
11
+ marginRight:d.padding});y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=
12
+ r.width==i.width&&r.height==i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn==
13
+ "elastic"){r=V();j.html(m.contents());f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();
14
+ b.fancybox.close()}else if((a.keyCode==37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&
15
+ j.css("height","auto");f.css("height","auto");s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+
16
+ e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!==
17
+ "undefined")c.opacity=a<0.5?0.5:a;f.css(c);j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+
18
+ k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type=="image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=
19
+ a.offset();c.top+=parseInt(a.css("paddingTop"),10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",
20
+ t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?
21
+ c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};
22
+ b.fancybox.next=function(){return b.fancybox.pos(p+1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,
23
+ p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};
24
+ if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-
25
+ 20,c[2]+(c[0]-j.width()-40)*0.5-d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
26
+ D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
27
+ b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
28
+ b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
29
+ easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
apps/fancybox/jquery.fancybox-1.3.4.pack.js ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * FancyBox - jQuery Plugin
3
+ * Simple and fancy lightbox alternative
4
+ *
5
+ * Examples and documentation at: http://fancybox.net
6
+ *
7
+ * Copyright (c) 2008 - 2010 Janis Skarnelis
8
+ * That said, it is hardly a one-person project. Many people have submitted bugs, code, and offered their advice freely. Their support is greatly appreciated.
9
+ *
10
+ * Version: 1.3.4 (11/11/2010)
11
+ * Requires: jQuery v1.3+
12
+ *
13
+ * Dual licensed under the MIT and GPL licenses:
14
+ * http://www.opensource.org/licenses/mit-license.php
15
+ * http://www.gnu.org/licenses/gpl.html
16
+ */
17
+
18
+ ;(function(b){var m,t,u,f,D,j,E,n,z,A,q=0,e={},o=[],p=0,d={},l=[],G=null,v=new Image,J=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,W=/[^\.]\.(swf)\s*$/i,K,L=1,y=0,s="",r,i,h=false,B=b.extend(b("<div/>")[0],{prop:0}),M=b.browser.msie&&b.browser.version<7&&!window.XMLHttpRequest,N=function(){t.hide();v.onerror=v.onload=null;G&&G.abort();m.empty()},O=function(){if(false===e.onError(o,q,e)){t.hide();h=false}else{e.titleShow=false;e.width="auto";e.height="auto";m.html('<p id="fancybox-error">The requested content cannot be loaded.<br />Please try again later.</p>');
19
+ F()}},I=function(){var a=o[q],c,g,k,C,P,w;N();e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));w=e.onStart(o,q,e);if(w===false)h=false;else{if(typeof w=="object")e=b.extend(e,w);k=e.title||(a.nodeName?b(a).attr("title"):a.title)||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(k===""&&e.orig&&e.titleFromAlt)k=e.orig.attr("alt");c=e.href||(a.nodeName?b(a).attr("href"):a.href)||null;if(/^(?:javascript)/i.test(c)||
20
+ c=="#")c=null;if(e.type){g=e.type;if(!c)c=e.content}else if(e.content)g="html";else if(c)g=c.match(J)?"image":c.match(W)?"swf":b(a).hasClass("iframe")?"iframe":c.indexOf("#")===0?"inline":"ajax";if(g){if(g=="inline"){a=c.substr(c.indexOf("#"));g=b(a).length>0?"inline":"ajax"}e.type=g;e.href=c;e.title=k;if(e.autoDimensions)if(e.type=="html"||e.type=="inline"||e.type=="ajax"){e.width="auto";e.height="auto"}else e.autoDimensions=false;if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=
21
+ false;e.enableEscapeButton=false;e.showCloseButton=false}e.padding=parseInt(e.padding,10);e.margin=parseInt(e.margin,10);m.css("padding",e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(j.children())});switch(g){case "html":m.html(e.content);F();break;case "inline":if(b(a).parent().is("#fancybox-content")===true){h=false;break}b('<div class="fancybox-inline-tmp" />').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(j.children())}).bind("fancybox-cancel",
22
+ function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity();v=new Image;v.onerror=function(){O()};v.onload=function(){h=true;v.onerror=v.onload=null;e.width=v.width;e.height=v.height;b("<img />").attr({id:"fancybox-img",src:v.src,alt:e.title}).appendTo(m);Q()};v.src=c;break;case "swf":e.scrolling="no";C='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+e.width+'" height="'+e.height+'"><param name="movie" value="'+c+
23
+ '"></param>';P="";b.each(e.swf,function(x,H){C+='<param name="'+x+'" value="'+H+'"></param>';P+=" "+x+'="'+H+'"'});C+='<embed src="'+c+'" type="application/x-shockwave-flash" width="'+e.width+'" height="'+e.height+'"'+P+"></embed></object>";m.html(C);F();break;case "ajax":h=false;b.fancybox.showActivity();e.ajax.win=e.ajax.success;G=b.ajax(b.extend({},e.ajax,{url:c,data:e.ajax.data||{},error:function(x){x.status>0&&O()},success:function(x,H,R){if((typeof R=="object"?R:G).status==200){if(typeof e.ajax.win==
24
+ "function"){w=e.ajax.win(c,x,H,R);if(w===false){t.hide();return}else if(typeof w=="string"||typeof w=="object")x=w}m.html(x);F()}}}));break;case "iframe":Q()}}else O()}},F=function(){var a=e.width,c=e.height;a=a.toString().indexOf("%")>-1?parseInt((b(window).width()-e.margin*2)*parseFloat(a)/100,10)+"px":a=="auto"?"auto":a+"px";c=c.toString().indexOf("%")>-1?parseInt((b(window).height()-e.margin*2)*parseFloat(c)/100,10)+"px":c=="auto"?"auto":c+"px";m.wrapInner('<div style="width:'+a+";height:"+c+
25
+ ";overflow: "+(e.scrolling=="auto"?"auto":e.scrolling=="yes"?"scroll":"hidden")+';position:relative;"></div>');e.width=m.width();e.height=m.height();Q()},Q=function(){var a,c;t.hide();if(f.is(":visible")&&false===d.onCleanup(l,p,d)){b.event.trigger("fancybox-cancel");h=false}else{h=true;b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");f.is(":visible")&&d.titlePosition!=="outside"&&f.css("height",f.height());l=o;p=q;d=e;if(d.overlayShow){u.css({"background-color":d.overlayColor,
26
+ opacity:d.overlayOpacity,cursor:d.hideOnOverlayClick?"pointer":"auto",height:b(document).height()});if(!u.is(":visible")){M&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"});u.show()}}else u.hide();i=X();s=d.title||"";y=0;n.empty().removeAttr("style").removeClass();if(d.titleShow!==false){if(b.isFunction(d.titleFormat))a=d.titleFormat(s,l,p,d);else a=s&&s.length?
27
+ d.titlePosition=="float"?'<table id="fancybox-title-float-wrap" cellpadding="0" cellspacing="0"><tr><td id="fancybox-title-float-left"></td><td id="fancybox-title-float-main">'+s+'</td><td id="fancybox-title-float-right"></td></tr></table>':'<div id="fancybox-title-'+d.titlePosition+'">'+s+"</div>":false;s=a;if(!(!s||s==="")){n.addClass("fancybox-title-"+d.titlePosition).html(s).appendTo("body").show();switch(d.titlePosition){case "inside":n.css({width:i.width-d.padding*2,marginLeft:d.padding,marginRight:d.padding});
28
+ y=n.outerHeight(true);n.appendTo(D);i.height+=y;break;case "over":n.css({marginLeft:d.padding,width:i.width-d.padding*2,bottom:d.padding}).appendTo(D);break;case "float":n.css("left",parseInt((n.width()-i.width-40)/2,10)*-1).appendTo(f);break;default:n.css({width:i.width-d.padding*2,paddingLeft:d.padding,paddingRight:d.padding}).appendTo(f)}}}n.hide();if(f.is(":visible")){b(E.add(z).add(A)).hide();a=f.position();r={top:a.top,left:a.left,width:f.width(),height:f.height()};c=r.width==i.width&&r.height==
29
+ i.height;j.fadeTo(d.changeFade,0.3,function(){var g=function(){j.html(m.contents()).fadeTo(d.changeFade,1,S)};b.event.trigger("fancybox-change");j.empty().removeAttr("filter").css({"border-width":d.padding,width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2});if(c)g();else{B.prop=0;b(B).animate({prop:1},{duration:d.changeSpeed,easing:d.easingChange,step:T,complete:g})}})}else{f.removeAttr("style");j.css("border-width",d.padding);if(d.transitionIn=="elastic"){r=V();j.html(m.contents());
30
+ f.show();if(d.opacity)i.opacity=0;B.prop=0;b(B).animate({prop:1},{duration:d.speedIn,easing:d.easingIn,step:T,complete:S})}else{d.titlePosition=="inside"&&y>0&&n.show();j.css({width:i.width-d.padding*2,height:e.autoDimensions?"auto":i.height-y-d.padding*2}).html(m.contents());f.css(i).fadeIn(d.transitionIn=="none"?0:d.speedIn,S)}}}},Y=function(){if(d.enableEscapeButton||d.enableKeyboardNav)b(document).bind("keydown.fb",function(a){if(a.keyCode==27&&d.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if((a.keyCode==
31
+ 37||a.keyCode==39)&&d.enableKeyboardNav&&a.target.tagName!=="INPUT"&&a.target.tagName!=="TEXTAREA"&&a.target.tagName!=="SELECT"){a.preventDefault();b.fancybox[a.keyCode==37?"prev":"next"]()}});if(d.showNavArrows){if(d.cyclic&&l.length>1||p!==0)z.show();if(d.cyclic&&l.length>1||p!=l.length-1)A.show()}else{z.hide();A.hide()}},S=function(){if(!b.support.opacity){j.get(0).style.removeAttribute("filter");f.get(0).style.removeAttribute("filter")}e.autoDimensions&&j.css("height","auto");f.css("height","auto");
32
+ s&&s.length&&n.show();d.showCloseButton&&E.show();Y();d.hideOnContentClick&&j.bind("click",b.fancybox.close);d.hideOnOverlayClick&&u.bind("click",b.fancybox.close);b(window).bind("resize.fb",b.fancybox.resize);d.centerOnScroll&&b(window).bind("scroll.fb",b.fancybox.center);if(d.type=="iframe")b('<iframe id="fancybox-frame" name="fancybox-frame'+(new Date).getTime()+'" frameborder="0" hspace="0" '+(b.browser.msie?'allowtransparency="true""':"")+' scrolling="'+e.scrolling+'" src="'+d.href+'"></iframe>').appendTo(j);
33
+ f.show();h=false;b.fancybox.center();d.onComplete(l,p,d);var a,c;if(l.length-1>p){a=l[p+1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}if(p>0){a=l[p-1].href;if(typeof a!=="undefined"&&a.match(J)){c=new Image;c.src=a}}},T=function(a){var c={width:parseInt(r.width+(i.width-r.width)*a,10),height:parseInt(r.height+(i.height-r.height)*a,10),top:parseInt(r.top+(i.top-r.top)*a,10),left:parseInt(r.left+(i.left-r.left)*a,10)};if(typeof i.opacity!=="undefined")c.opacity=a<0.5?0.5:a;f.css(c);
34
+ j.css({width:c.width-d.padding*2,height:c.height-y*a-d.padding*2})},U=function(){return[b(window).width()-d.margin*2,b(window).height()-d.margin*2,b(document).scrollLeft()+d.margin,b(document).scrollTop()+d.margin]},X=function(){var a=U(),c={},g=d.autoScale,k=d.padding*2;c.width=d.width.toString().indexOf("%")>-1?parseInt(a[0]*parseFloat(d.width)/100,10):d.width+k;c.height=d.height.toString().indexOf("%")>-1?parseInt(a[1]*parseFloat(d.height)/100,10):d.height+k;if(g&&(c.width>a[0]||c.height>a[1]))if(e.type==
35
+ "image"||e.type=="swf"){g=d.width/d.height;if(c.width>a[0]){c.width=a[0];c.height=parseInt((c.width-k)/g+k,10)}if(c.height>a[1]){c.height=a[1];c.width=parseInt((c.height-k)*g+k,10)}}else{c.width=Math.min(c.width,a[0]);c.height=Math.min(c.height,a[1])}c.top=parseInt(Math.max(a[3]-20,a[3]+(a[1]-c.height-40)*0.5),10);c.left=parseInt(Math.max(a[2]-20,a[2]+(a[0]-c.width-40)*0.5),10);return c},V=function(){var a=e.orig?b(e.orig):false,c={};if(a&&a.length){c=a.offset();c.top+=parseInt(a.css("paddingTop"),
36
+ 10)||0;c.left+=parseInt(a.css("paddingLeft"),10)||0;c.top+=parseInt(a.css("border-top-width"),10)||0;c.left+=parseInt(a.css("border-left-width"),10)||0;c.width=a.width();c.height=a.height();c={width:c.width+d.padding*2,height:c.height+d.padding*2,top:c.top-d.padding-20,left:c.left-d.padding-20}}else{a=U();c={width:d.padding*2,height:d.padding*2,top:parseInt(a[3]+a[1]*0.5,10),left:parseInt(a[2]+a[0]*0.5,10)}}return c},Z=function(){if(t.is(":visible")){b("div",t).css("top",L*-40+"px");L=(L+1)%12}else clearInterval(K)};
37
+ b.fn.fancybox=function(a){if(!b(this).length)return this;b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(c){c.preventDefault();if(!h){h=true;b(this).blur();o=[];q=0;c=b(this).attr("rel")||"";if(!c||c==""||c==="nofollow")o.push(this);else{o=b("a[rel="+c+"], area[rel="+c+"]");q=o.index(this)}I()}});return this};b.fancybox=function(a,c){var g;if(!h){h=true;g=typeof c!=="undefined"?c:{};o=[];q=parseInt(g.index,10)||0;if(b.isArray(a)){for(var k=
38
+ 0,C=a.length;k<C;k++)if(typeof a[k]=="object")b(a[k]).data("fancybox",b.extend({},g,a[k]));else a[k]=b({}).data("fancybox",b.extend({content:a[k]},g));o=jQuery.merge(o,a)}else{if(typeof a=="object")b(a).data("fancybox",b.extend({},g,a));else a=b({}).data("fancybox",b.extend({content:a},g));o.push(a)}if(q>o.length||q<0)q=0;I()}};b.fancybox.showActivity=function(){clearInterval(K);t.show();K=setInterval(Z,66)};b.fancybox.hideActivity=function(){t.hide()};b.fancybox.next=function(){return b.fancybox.pos(p+
39
+ 1)};b.fancybox.prev=function(){return b.fancybox.pos(p-1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a);o=l;if(a>-1&&a<l.length){q=a;I()}else if(d.cyclic&&l.length>1){q=a>=l.length?0:l.length-1;I()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");N();e.onCancel(o,q,e);h=false}};b.fancybox.close=function(){function a(){u.fadeOut("fast");n.empty().hide();f.hide();b.event.trigger("fancybox-cleanup");j.empty();d.onClosed(l,p,d);l=e=[];p=q=0;d=e={};h=false}if(!(h||f.is(":hidden"))){h=
40
+ true;if(d&&false===d.onCleanup(l,p,d))h=false;else{N();b(E.add(z).add(A)).hide();b(j.add(u)).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");j.find("iframe").attr("src",M&&/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank");d.titlePosition!=="inside"&&n.empty();f.stop();if(d.transitionOut=="elastic"){r=V();var c=f.position();i={top:c.top,left:c.left,width:f.width(),height:f.height()};if(d.opacity)i.opacity=1;n.empty().hide();B.prop=1;
41
+ b(B).animate({prop:0},{duration:d.speedOut,easing:d.easingOut,step:T,complete:a})}else f.fadeOut(d.transitionOut=="none"?0:d.speedOut,a)}}};b.fancybox.resize=function(){u.is(":visible")&&u.css("height",b(document).height());b.fancybox.center(true)};b.fancybox.center=function(a){var c,g;if(!h){g=a===true?1:0;c=U();!g&&(f.width()>c[0]||f.height()>c[1])||f.stop().animate({top:parseInt(Math.max(c[3]-20,c[3]+(c[1]-j.height()-40)*0.5-d.padding)),left:parseInt(Math.max(c[2]-20,c[2]+(c[0]-j.width()-40)*0.5-
42
+ d.padding))},typeof a=="number"?a:200)}};b.fancybox.init=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('<div id="fancybox-tmp"></div>'),t=b('<div id="fancybox-loading"><div></div></div>'),u=b('<div id="fancybox-overlay"></div>'),f=b('<div id="fancybox-wrap"></div>'));D=b('<div id="fancybox-outer"></div>').append('<div class="fancybox-bg" id="fancybox-bg-n"></div><div class="fancybox-bg" id="fancybox-bg-ne"></div><div class="fancybox-bg" id="fancybox-bg-e"></div><div class="fancybox-bg" id="fancybox-bg-se"></div><div class="fancybox-bg" id="fancybox-bg-s"></div><div class="fancybox-bg" id="fancybox-bg-sw"></div><div class="fancybox-bg" id="fancybox-bg-w"></div><div class="fancybox-bg" id="fancybox-bg-nw"></div>').appendTo(f);
43
+ D.append(j=b('<div id="fancybox-content"></div>'),E=b('<a id="fancybox-close"></a>'),n=b('<div id="fancybox-title"></div>'),z=b('<a href="javascript:;" id="fancybox-left"><span class="fancy-ico" id="fancybox-left-ico"></span></a>'),A=b('<a href="javascript:;" id="fancybox-right"><span class="fancy-ico" id="fancybox-right-ico"></span></a>'));E.click(b.fancybox.close);t.click(b.fancybox.cancel);z.click(function(a){a.preventDefault();b.fancybox.prev()});A.click(function(a){a.preventDefault();b.fancybox.next()});
44
+ b.fn.mousewheel&&f.bind("mousewheel.fb",function(a,c){if(h)a.preventDefault();else if(b(a.target).get(0).clientHeight==0||b(a.target).get(0).scrollHeight===b(a.target).get(0).clientHeight){a.preventDefault();b.fancybox[c>0?"prev":"next"]()}});b.support.opacity||f.addClass("fancybox-ie");if(M){t.addClass("fancybox-ie6");f.addClass("fancybox-ie6");b('<iframe id="fancybox-hide-sel-frame" src="'+(/^https/i.test(window.location.href||"")?"javascript:void(false)":"about:blank")+'" scrolling="no" border="0" frameborder="0" tabindex="-1"></iframe>').prependTo(D)}}};
45
+ b.fn.fancybox.defaults={padding:10,margin:40,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.7,overlayColor:"#777",titleShow:true,titlePosition:"float",titleFormat:null,titleFromAlt:false,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast",easingIn:"swing",
46
+ easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,enableKeyboardNav:true,onStart:function(){},onCancel:function(){},onComplete:function(){},onCleanup:function(){},onClosed:function(){},onError:function(){}};b(document).ready(function(){b.fancybox.init()})})(jQuery);
apps/fancybox/jquery.mousewheel-3.0.4.pack.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*! Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
2
+ * Licensed under the MIT License (LICENSE.txt).
3
+ *
4
+ * Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
5
+ * Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
6
+ * Thanks to: Seamus Leahy for adding deltaX and deltaY
7
+ *
8
+ * Version: 3.0.4
9
+ *
10
+ * Requires: 1.2.2+
11
+ */
12
+
13
+ (function(d){function g(a){var b=a||window.event,i=[].slice.call(arguments,1),c=0,h=0,e=0;a=d.event.fix(b);a.type="mousewheel";if(a.wheelDelta)c=a.wheelDelta/120;if(a.detail)c=-a.detail/3;e=c;if(b.axis!==undefined&&b.axis===b.HORIZONTAL_AXIS){e=0;h=-1*c}if(b.wheelDeltaY!==undefined)e=b.wheelDeltaY/120;if(b.wheelDeltaX!==undefined)h=-1*b.wheelDeltaX/120;i.unshift(a,c,h,e);return d.event.handle.apply(this,i)}var f=["DOMMouseScroll","mousewheel"];d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=
14
+ f.length;a;)this.addEventListener(f[--a],g,false);else this.onmousewheel=g},teardown:function(){if(this.removeEventListener)for(var a=f.length;a;)this.removeEventListener(f[--a],g,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
css/pte.css ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pte-display {
2
+ display: none;
3
+ width: 600px;
4
+ }
5
+
6
+ #pte-edit {
7
+ width: 400px;
8
+ float: left;
9
+ padding-right: 10px;
10
+ }
11
+
12
+ #pte-current img {
13
+ width: 190px;
14
+ }
15
+
16
+ #pte-controls { clear: both; padding-top: 10px}
17
+ #pte-controls #pte-save { margin-left: 20px; }
18
+
html/editor.phtml ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
5
+ <title>Editor</title>
6
+ <?php
7
+ wp_print_styles();
8
+ wp_print_scripts();
9
+ ?>
10
+ <script type="text/javascript" charset="utf-8">
11
+
12
+ jQuery(document).ready(function($){
13
+ var timeout = 5;
14
+
15
+ function countdown(){
16
+ if (timeout-- <= 0){
17
+ parent.jQuery.fancybox.close();
18
+ return;
19
+ }
20
+ else {
21
+ $("h1").html("Closing in " + timeout + " seconds.");
22
+ window.setTimeout(countdown, 1000);
23
+ }
24
+ }
25
+
26
+ window.setTimeout(countdown, 1000);
27
+ });
28
+ </script>
29
+ </head>
30
+ <body>
31
+ <h1>BOOM</h1>
32
+ </body>
33
+ </html>
js/pte_admin_media.js ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // log
2
+ function log(obj){
3
+ if (!window.console || !console.firebug)
4
+ {
5
+ var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
6
+ "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
7
+
8
+ window.console = {};
9
+ for (var i = 0; i < names.length; ++i)
10
+ window.console[names[i]] = function() {}
11
+ }
12
+ if (!console) console = window.console;
13
+
14
+ //console.log(obj);
15
+ //alert(obj);
16
+ }
17
+
18
+ jQuery(document).ready(function($){
19
+ var pte_timeout = 1000;
20
+ var pte_max_attempts = 50;
21
+ var ias_instance = null;
22
+
23
+ /*
24
+ * Entry to our code
25
+ * Override the imgEdit.open function
26
+ */
27
+ if (imageEdit.open){
28
+ imageEdit.oldopen = imageEdit.open;
29
+ imageEdit.open = function(id, nonce){
30
+ getImageEditor();
31
+ imageEdit.oldopen(id,nonce);
32
+ }
33
+ }
34
+
35
+ function imgDebug(img, s){
36
+ $('#pte-debug').html( "x1: " + s.x1 + "<br />"
37
+ + "y1: " + s.y1 + "<br />"
38
+ + "x2: " + s.x2 + "<br />"
39
+ + "y2: " + s.y2 + "<br />"
40
+ + "width: " + s.width + "<br />"
41
+ + "height: " + s.height + "<br />");
42
+ }
43
+
44
+ function closeImgAreaSelect(){
45
+ if (ias_instance){
46
+ ias_instance.setOptions({ show: false
47
+ , disable: true
48
+ , hide: true
49
+ , remove: true
50
+ });
51
+ ias_instance.update();
52
+ }
53
+ }
54
+
55
+ // http://en.wikipedia.org/wiki/Euclidean_algorithm#Implementations
56
+ function gcd(a, b){
57
+ if (a == 0) return b
58
+ while(b > 0){
59
+ if (a > b){
60
+ a = a - b
61
+ }
62
+ else {
63
+ b = b - a
64
+ }
65
+ }
66
+ if ( a < 0 || b < 0 ) return null
67
+ return a
68
+ }
69
+
70
+ function savePostThumbnail(){
71
+ if (!ias_instance) return;
72
+ var selection = ias_instance.getSelection();
73
+ log(selection);
74
+
75
+ var id = getID();
76
+ if (!id) return false;
77
+
78
+ var size = $("#pte-thumb").val()
79
+ log("Clicked: " + size);
80
+ if (!size || size == "" || size.length == 0) return false;
81
+
82
+ // Our script needs to know the REAL x1, y1 and x2, y2
83
+ // so it can crop and then scale...
84
+ var scale_factor = $('#imgedit-sizer-'+id).val();
85
+ var data = { 'action': 'pte_ajax'
86
+ , 'pte_action': 'resize-img'
87
+ , 'id': id
88
+ , 'size': size
89
+ , 'x': Math.floor(selection.x1/scale_factor)
90
+ , 'y': Math.floor(selection.y1/scale_factor)
91
+ , 'w': Math.floor(selection.width/scale_factor)
92
+ , 'h': Math.floor(selection.height/scale_factor)
93
+ , '_ajax_nonce': $('body').data('nonce')
94
+ }
95
+ log(data);
96
+ $.get( ajaxurl
97
+ , data
98
+ , function(data, txtstatus, xhr){
99
+ log(data);
100
+ if (data.error){
101
+ alert("Sorry, we encountered an issue: " + data.error);
102
+ }
103
+ if (data.url){
104
+ closeImgAreaSelect();
105
+ $('#pte-display').html('<strong>Updated image</strong>: <br/>'
106
+ + '<img src="'+data.url+'?'+randomness()+'"/><br>'
107
+ + 'Reload your cache (Shift+F5 on the page you want to see the changes)'
108
+ + ' and everything should work...');
109
+ }
110
+ else
111
+ $.fancybox.close();
112
+ }
113
+ , 'json'
114
+ );
115
+ }
116
+
117
+ function createPteDisplay(){
118
+ var pte_display = $('#pte-display')
119
+ .find('#pte-edit').empty().end()
120
+ .find('#pte-current').empty().end();
121
+ var pte_display_html = '<div id="pte-edit"></div>'
122
+ + '<div id="pte-info">Currently: (it\'s scaled to fit horizontally)...</div>'
123
+ + '<div id="pte-current"></div>'
124
+ + '<div id="pte-debug"></div>'
125
+ + '<div id="pte-controls">'
126
+ + '<input type="button" id="pte-stop" name="pte-stop" class="button" value="Cancel"/>'
127
+ + '<input type="button" id="pte-save" name="pte-save" class="button-primary" value="Save"/>'
128
+ + '</div>'
129
+ if (pte_display.length > 0){ // Exists
130
+ pte_display.html(pte_display_html);
131
+ }
132
+ else { // Doesn't exist
133
+ pte_display = $('<div id="pte-display">')
134
+ .html(pte_display_html)
135
+ .appendTo($('body'))
136
+ }
137
+ pte_display
138
+ .find("#pte-stop").click($.fancybox.close).end()
139
+ .find("#pte-save").click(savePostThumbnail)
140
+ }
141
+
142
+ function randomness(){
143
+ return Math.floor(Math.random()*1000001).toString(16);
144
+ }
145
+
146
+ function getID(){
147
+ try{
148
+ //var id = "pte-" + $(".image-editor").attr("id");
149
+ var id = /\d+$/.exec($(".image-editor").attr("id"))[0];
150
+ log(id);
151
+ return id;
152
+ }
153
+ catch(e){
154
+ log("oops");
155
+ }
156
+ return null;
157
+ }
158
+
159
+ // sent from click on pte-submit event
160
+ function createPostThumbnailEdit(event){
161
+ var size = $("#pte-thumb").val()
162
+ log("Clicked: " + size);
163
+ if (!size || size == "" || size.length == 0) return false;
164
+
165
+ var id = getID();
166
+ if (!id) return false;
167
+
168
+ // Find the aspect ratio
169
+ var sizes = $('body').data('sizes');
170
+ var cd = gcd( parseInt(sizes[size]['width'])
171
+ , parseInt(sizes[size]['height']));
172
+ var ar = null;
173
+ if (cd){
174
+ ar = parseInt(sizes[size]['width']) / cd
175
+ + ":"
176
+ + parseInt(sizes[size]['height']) / cd;
177
+ }
178
+
179
+
180
+ // Get the images (the fake one & the thumbnail)
181
+ //var main_img_url = $('#image-preview-'+id).attr('src');
182
+ createPteDisplay();
183
+ var img_preview = $('#image-preview-'+id)
184
+ ias_instance = img_preview
185
+ .clone(false)
186
+ .appendTo('#pte-edit')
187
+ .css({'height': img_preview.height()})
188
+ //.removeAttr('onload')
189
+ .imgAreaSelect( { handles: true
190
+ , zIndex: 1200
191
+ , instance: true
192
+ , aspectRatio: ar
193
+ , onSelectEnd: imgDebug
194
+ });
195
+
196
+ $.get( ajaxurl
197
+ , { 'action': 'pte_ajax'
198
+ , 'pte_action': 'get-image-data'
199
+ , 'id': id
200
+ , 'size': size
201
+ }
202
+ , function(data,txt,xhr){
203
+ log(data);
204
+ $('body').data('nonce', data.nonce);
205
+ var img = $('<img src="' + data.url + '?' + randomness() + '">').appendTo('#pte-current');
206
+ var img_width = sizes[size]['width'];
207
+ if (img_width < parseInt(img.width())){
208
+ log("Smallen [sic] the width");
209
+ img.css('width', img_width);
210
+ }
211
+ }
212
+ , 'json'
213
+ );
214
+
215
+ $('<a class="inline" href="#pte-display">Gnarly</a>')
216
+ .fancybox( {
217
+ // Fix for issue #1... IE8 & fancybox inline workaround...
218
+ 'href': '#pte-display'
219
+ , 'onStart': function(){
220
+ $('#pte-display').show();
221
+ $.fancybox.center();
222
+ }
223
+ , 'onClosed': function(){
224
+ closeImgAreaSelect();
225
+ $('#pte-display').hide()
226
+ }
227
+ }
228
+ )
229
+ .trigger('click')
230
+ //$('<a class="inline" href="#pte-display">Gnarly</a>').fancybox().trigger('click');
231
+
232
+ log("done with create Edit");
233
+ return false;
234
+ }
235
+
236
+ function getImageEditor(){
237
+ // HTML to inject into the editor
238
+ // This might need to be loaded by AJAX for localization purposes
239
+ var editbox = $("<div class='imgedit-group pte-thumbs'>"
240
+ + "<div class='imgedit-group-top'><strong>Edit Post Thumbnails</strong></div>"
241
+ + "<select id='pte-thumb' name='pte-thumb'>"
242
+ + "<option value=0 disabled selected>Choose a size to edit:</option>"
243
+ + "</select><br/>"
244
+ + "<input class='button-primary' type='submit' name='pte-edit-thumb' id='pte-submit' value='Edit'/>"
245
+ + "</div");
246
+
247
+ log("Attempts remaining: " + pte_max_attempts);
248
+ var editor = $(".imgedit-settings");
249
+ if (editor.size() < 1 && pte_max_attempts-- < 0){
250
+ log("Tried too many times, stopping");
251
+ return;
252
+ }
253
+ else if (editor.size() < 1){
254
+ log("No editor... Try again.");
255
+ window.setTimeout(getImageEditor, pte_timeout);
256
+ return;
257
+ }
258
+
259
+ log("Found: " + editor.size());
260
+
261
+ // Action: create image pop-up
262
+ // Used when the user selects a post thumbnail to edit
263
+ // OPTION 1: Create an ajax/php script to recreate the picture/setup that already exists
264
+ // on the current page
265
+ // OPTION 2: Borrow the parameters, add the thumbnail that you're attempting to process
266
+ // and send the data to your script.
267
+ //
268
+ // Let's try OPTION 2...
269
+ editbox.find("#pte-submit").click(createPostThumbnailEdit);
270
+
271
+ // Add the above HTML to the image-editor GUI
272
+ editor.append(editbox)
273
+ $('.imgedit-submit input.button').click(function(e){
274
+ log("Removing that bastard");
275
+ editbox.remove().find("#pte-thumb").empty();
276
+ });
277
+
278
+ // Get list of available sizes
279
+ log("ADMINAJAX: " + ajaxurl);
280
+ $.get(ajaxurl
281
+ , { 'action': 'pte_ajax'
282
+ , 'pte_action': 'get-alternate-sizes'}
283
+ , function(data, status, xhr){
284
+ log(data);
285
+ $('body').data('sizes',data.sizes);
286
+ try {
287
+ $.each(data.sizes, function(i,elem){
288
+ editbox.find("#pte-thumb")
289
+ .append("<option value='" + i
290
+ + "'>" + i
291
+ + ": " + elem.width + "x" + elem.height
292
+ + "</option>");
293
+ })
294
+ }
295
+ catch(e){
296
+ log("ERROR: " + e);
297
+ }
298
+ }
299
+ , 'json'
300
+ );
301
+ }
302
+
303
+ // Listens for "Edit" event
304
+ //$('input[id^="imgedit-open"]').bind('click', function(){
305
+ // log("pushed the button");
306
+ // getImageEditor();
307
+ //});
308
+ });
post-thumbnail-editor.php ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* Plugin name: Post Thumbnail Editor
3
+ Plugin URI: http://github.com/sewpafly/post-thumbnail-editor
4
+ Author: sewpafly
5
+ Author URI: http://sewpafly.github.com/
6
+ Version: 0.1.1
7
+ Description: Individually manage your post thumbnails
8
+ Max WP Version: 3.1
9
+
10
+ LICENSE
11
+
12
+ Copyright 2011 (email : sewpafly@gmail.com)
13
+
14
+ This program is free software; you can redistribute it and/or modify
15
+ it under the terms of the GNU General Public License as published by
16
+ the Free Software Foundation; either version 2 of the License, or
17
+ (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
+
28
+ */
29
+
30
+ /*
31
+ * Useful constants
32
+ */
33
+ define( PTE_PLUGINURL, plugins_url(basename( dirname(__FILE__))) . "/");
34
+ define( PTE_PLUGINPATH, dirname(__FILE__) . "/");
35
+
36
+ /*
37
+ * Put Hooks and immediate hook functions in this file
38
+ */
39
+
40
+ /* Hook into the Edit Image page */
41
+ function pte_admin_media_styles(){
42
+ wp_enqueue_style('fancybox',
43
+ PTE_PLUGINURL . 'apps/fancybox/jquery.fancybox-1.3.4.css');
44
+ wp_enqueue_style('pte',
45
+ PTE_PLUGINURL . 'css/pte.css');
46
+ }
47
+
48
+ function pte_admin_media_scripts(){
49
+ wp_enqueue_script('imgareaselect');
50
+ wp_enqueue_script('fancybox',
51
+ PTE_PLUGINURL . 'apps/fancybox/jquery.fancybox-1.3.4.min.js',
52
+ array('jquery')
53
+ );
54
+ wp_enqueue_script('pte',
55
+ PTE_PLUGINURL . 'js/pte_admin_media.js',
56
+ array('jquery')
57
+ );
58
+ }
59
+
60
+ function pte_ajax(){
61
+ // Move all adjuntant functions to a separate file and include that here
62
+ require_once(PTE_PLUGINPATH . 'pte_functions.php');
63
+ switch ($_GET['pte_action'])
64
+ {
65
+ case "get-alternate-sizes":
66
+ pte_get_alternate_sizes();
67
+ break;
68
+ case "get-image-data":
69
+ if ( is_numeric( $_GET['id'] ) ){
70
+ pte_get_image_data($_GET['id'], $_GET['size']);
71
+ }
72
+ break;
73
+ case "resize-img":
74
+ // Check that the parameters are digits
75
+ if ( is_numeric($_GET['id']) &&
76
+ is_numeric($_GET['x']) &&
77
+ is_numeric($_GET['y']) &&
78
+ is_numeric($_GET['w']) &&
79
+ is_numeric($_GET['h'])
80
+ ) {
81
+ check_ajax_referer("pte-{$_GET['id']}-{$_GET['size']}");
82
+ pte_resize_img($_GET['id'],
83
+ $_GET['size'],
84
+ $_GET['x'],
85
+ $_GET['y'],
86
+ $_GET['w'],
87
+ $_GET['h']
88
+ );
89
+ }
90
+ break;
91
+ }
92
+ die(-1);
93
+ }
94
+
95
+ /* This is the main admin media page */
96
+ add_action('admin_print_styles-media.php', 'pte_admin_media_styles');
97
+ add_action('admin_print_scripts-media.php', 'pte_admin_media_scripts');
98
+
99
+ /* This is for the popup media page */
100
+ add_action('admin_print_styles-media-upload-popup', 'pte_admin_media_styles');
101
+ add_action('admin_print_scripts-media-upload-popup', 'pte_admin_media_scripts');
102
+
103
+ /* For all purpose needs */
104
+ add_action('wp_ajax_pte_ajax', 'pte_ajax');
105
+
106
+ ?>
pte_functions.php ADDED
@@ -0,0 +1,217 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ function pte_get_alternate_sizes($return_php = false){
4
+ global $_wp_additional_image_sizes;
5
+ $sizes = array();
6
+ foreach (get_intermediate_image_sizes() as $s){
7
+ //$sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => FALSE );
8
+ //if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
9
+ // $sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] );
10
+ //else // For default sizes set in options
11
+ // $sizes[$s]['width'] = get_option( "{$s}_size_w" );
12
+
13
+ //if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
14
+ // $sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] );
15
+ //else // For default sizes set in options
16
+ // $sizes[$s]['height'] = get_option( "{$s}_size_h" );
17
+
18
+ //if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) // For theme-added sizes
19
+ // $sizes[$s]['crop'] = intval( $_wp_additional_image_sizes[$s]['crop'] );
20
+ //else // For default sizes set in options
21
+ // $sizes[$s]['crop'] = get_option( "{$s}_crop" );
22
+ ////$sizes[$s] = array(
23
+ //// 'width' => $width,
24
+ //// 'height' => $height,
25
+ //// 'crop' => $crop
26
+ ////);
27
+ if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) // For theme-added sizes
28
+ $width = intval( $_wp_additional_image_sizes[$s]['width'] );
29
+ else // For default sizes set in options
30
+ $width = get_option( "{$s}_size_w" );
31
+
32
+ if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) // For theme-added sizes
33
+ $height = intval( $_wp_additional_image_sizes[$s]['height'] );
34
+ else // For default sizes set in options
35
+ $height = get_option( "{$s}_size_h" );
36
+
37
+ if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) // For theme-added sizes
38
+ $crop = intval( $_wp_additional_image_sizes[$s]['crop'] );
39
+ else // For default sizes set in options
40
+ $crop = get_option( "{$s}_crop" );
41
+ $sizes[$s] = array(
42
+ 'width' => $width,
43
+ 'height' => $height,
44
+ 'crop' => $crop
45
+ );
46
+ }
47
+
48
+ if ($return_php) return $sizes;
49
+ else if ( function_exists('json_encode') ){
50
+ print(json_encode(array('sizes' => $sizes)));
51
+ }
52
+ else {
53
+ print("{\"error\":\"json_encode not available, upgrade your php\"}");
54
+ }
55
+ die();
56
+ }
57
+
58
+ //wp_enqueue_scripts('jquery');
59
+ //include(dirname(__FILE__) . "/html/editor.phtml");
60
+
61
+ // TODO: Check your inputs...
62
+ function pte_get_image_data($id, $size){
63
+
64
+ $fullsizepath = get_attached_file( $id );
65
+ $path_information = image_get_intermediate_size($id, $size);
66
+
67
+ $size_information = pte_get_alternate_sizes(true);
68
+ if (! array_key_exists( $size, $size_information ) ){
69
+ print_r($size_information);
70
+ pte_error("Invalid size: {$size}");
71
+ }
72
+
73
+ // Get/Create nonce
74
+ $nonce = wp_create_nonce("pte-{$id}-{$size}");
75
+
76
+ if ( $path_information &&
77
+ $path_information['width'] == $size_information[$size]['width'] &&
78
+ $path_information['height'] == $size_information[$size]['height'] &&
79
+ @file_exists(dirname($fullsizepath)."/".$path_information['file']))
80
+ {
81
+ $path_information['nonce'] = $nonce;
82
+ die(json_encode($path_information));
83
+ }
84
+
85
+ // We don't really care how it gets generated, just that it is...
86
+ // see ajax-thumbnail-rebuild plugin for inspiration
87
+ if ( FALSE !== $fullsizepath && @file_exists($fullsizepath) ) {
88
+ // Create the image and update the wordpress metadata
89
+ $resized = image_make_intermediate_size( $fullsizepath,
90
+ $size_information[$size]['width'],
91
+ $size_information[$size]['height'],
92
+ $size_information[$size]['crop']
93
+ );
94
+ if ($resized){
95
+ $metadata = wp_get_attachment_metadata($id);
96
+ $metadata['sizes'][$size] = $resized;
97
+ wp_update_attachment_metadata( $id, $metadata);
98
+ }
99
+ }
100
+
101
+ // Finish how we started
102
+ $path_information = image_get_intermediate_size($id, $size);
103
+ if ($path_information){
104
+ $path_information['nonce'] = $nonce;
105
+ die(json_encode($path_information));
106
+ }
107
+ else {
108
+ //print("{\"error\":\"Couldn't find metadata for image: $id\"}");
109
+ pte_error("Couldn't find metadata for image");
110
+ }
111
+ }
112
+
113
+ function pte_error($message){
114
+ die("{\"error\":\"{$message}\"}");
115
+ }
116
+
117
+ /*
118
+ * See wordpress: wp-includes/media.php for image_resize
119
+ */
120
+ function pte_resize_img($id, $thumb_size, $x, $y, $w, $h, $save = true){
121
+ // Check your inputs...
122
+ $id = (int) $id;
123
+ if ( !$post =& get_post( $id ) )
124
+ pte_error("Invalid id: {$id}");
125
+
126
+ $file = get_attached_file( $id );
127
+ $image = wp_load_image( $file );
128
+
129
+ $size_information = pte_get_alternate_sizes(true);
130
+ if (! array_key_exists( $thumb_size, $size_information ) ){
131
+ pte_error("Invalid size: {$thumb_size}");
132
+ }
133
+
134
+ if (! $path_information = image_get_intermediate_size($id, $thumb_size)){
135
+ pte_error("Invalid image: {$id} {$thumb_size}");
136
+ }
137
+ //die(json_encode($path_information));
138
+
139
+ if ( !is_resource( $image ) )
140
+ pte_error("Error loading image");
141
+
142
+ $size = @getimagesize( $file );
143
+ if ( !$size )
144
+ pte_error("Could not read image size");
145
+
146
+ list($orig_w, $orig_h, $orig_type) = $size;
147
+
148
+ // Error checking that the src is big enough to go into dst?
149
+ if (
150
+ $x < 0 ||
151
+ $y < 0 ||
152
+ $x + $w > $orig_w ||
153
+ $y + $h > $orig_h ||
154
+ $w <= 0 ||
155
+ $h <= 0 ){
156
+ pte_error("Invalid input parameters: {$x} {$y} {$w} {$h}");
157
+ }
158
+ $dst_x = 0;
159
+ $dst_y = 0;
160
+ $dst_w = $size_information[$thumb_size]['width'];
161
+ $dst_h = $size_information[$thumb_size]['height'];
162
+ $src_x = $x;
163
+ $src_y = $y;
164
+ $src_w = $w;
165
+ $src_h = $h;
166
+
167
+ // Now let's get down to business...
168
+ $newimage = wp_imagecreatetruecolor( $dst_w, $dst_h );
169
+
170
+ // Save the conversion data so if a batch script (a la ajax-thumbnail-rebuild)
171
+ // that we can find what the scale/crop area and rebuild using it.
172
+ if ($save){
173
+ $data = get_post_meta( $post->ID, 'pte-data', true );
174
+ $data[$thumb_size] = compact('dst_x', 'dst_y', 'dst_w', 'dst_h', 'src_x', 'src_y', 'src_w', 'src_h');
175
+ add_post_meta($post->ID, 'pte-data', $data, true) or update_post_meta($post->ID, 'pte-data', $data);
176
+ }
177
+
178
+ imagecopyresampled( $newimage, $image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
179
+
180
+ // convert from full colors to index colors, like original PNG.
181
+ if ( IMAGETYPE_PNG == $orig_type && function_exists('imageistruecolor') && !imageistruecolor( $image ) )
182
+ imagetruecolortopalette( $newimage, false, imagecolorstotal( $image ) );
183
+
184
+ // we don't need the original in memory anymore
185
+ imagedestroy( $image );
186
+
187
+ // Get the output filename
188
+ $destfilename = dirname($file)."/".$path_information['file'];
189
+
190
+ if ( IMAGETYPE_GIF == $orig_type ) {
191
+ if ( !imagegif( $newimage, $destfilename ) )
192
+ //return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
193
+ pte_error("Resize path invalid");
194
+ }
195
+ elseif ( IMAGETYPE_PNG == $orig_type ) {
196
+ if ( !imagepng( $newimage, $destfilename ) )
197
+ //return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
198
+ pte_error("Resize path invalid");
199
+ }
200
+ else {
201
+ // all other formats are converted to jpg
202
+ //if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) )
203
+ if ( !imagejpeg( $newimage, $destfilename, 90) )
204
+ //return new WP_Error('resize_path_invalid', __( 'Resize path invalid' ));
205
+ pte_error("Resize path invalid: " . $destfilename);
206
+ }
207
+
208
+ imagedestroy( $newimage );
209
+
210
+ // Set correct file permissions
211
+ $stat = stat( dirname( $destfilename ));
212
+ $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
213
+ @ chmod( $destfilename, $perms );
214
+
215
+ die(json_encode(array("url" => $path_information['url'])));
216
+ }
217
+
screenshot-1.jpg ADDED
Binary file
screenshot-2.jpg ADDED
Binary file
screenshot-3.jpg ADDED
Binary file