├── screenshots ├── 1.png ├── 2.png ├── 3.png └── 4.png ├── assets ├── images │ ├── pe.gif │ ├── logo.gif │ ├── logo-blue.gif │ └── ajax-loader.gif ├── js │ ├── master-wa.js │ ├── pet.js │ └── plugins │ │ ├── excanvas.js │ │ └── jquery.js ├── scss │ └── master-wa.scss └── css │ └── master-wa.css ├── view.php ├── draft.php ├── upload.php ├── README.md └── index.php /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/screenshots/2.png -------------------------------------------------------------------------------- /screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/screenshots/3.png -------------------------------------------------------------------------------- /screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/screenshots/4.png -------------------------------------------------------------------------------- /assets/images/pe.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/assets/images/pe.gif -------------------------------------------------------------------------------- /assets/images/logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/assets/images/logo.gif -------------------------------------------------------------------------------- /assets/images/logo-blue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/assets/images/logo-blue.gif -------------------------------------------------------------------------------- /assets/images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wajrcs-dk/html5-picture-editor/HEAD/assets/images/ajax-loader.gif -------------------------------------------------------------------------------- /view.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /draft.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /upload.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/js/master-wa.js: -------------------------------------------------------------------------------- 1 | (function() 2 | { 3 | if (document.location.hostname === 'localhost') { 4 | var links = document.getElementById('header').getElementsByTagName('a'); 5 | for (var i = 0, len = links.length; i < len; i++) { 6 | // very retarted fix but fuck it 7 | links[i].href = links[i].href.replace('fabricjs.com', 'localhost:4000'); 8 | } 9 | } 10 | else { 11 | var s = document.createElement('script'), t = document.getElementsByTagName('script')[0]; 12 | s.async = true; 13 | s.src = 'http://api.flattr.com/js/0.6/load.js?mode=auto'; 14 | t.parentNode.insertBefore(s, t); 15 | 16 | !function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs"); 17 | } 18 | })(); 19 | 20 | function clickTabs(panels , buttons , button) 21 | { 22 | for(var i=0; i 3 | */ 4 | 5 | // Importing compass the real part 6 | @import "compass"; 7 | 8 | @import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,700); 9 | body { font-family: "Open Sans", sans-serif !important; margin: 0; font-size: 14px !important; line-height: 1.5 !important; color: #333; background:#fff; } 10 | a:hover, a:focus { text-decoration: none; } 11 | h3, h4 { margin-top: 1.5em !important; } 12 | label { display: inline-block; margin-right:8px; width:150px; } 13 | textarea { font-family: monospace; } 14 | input[type=color] { width: 40px; padding: 0; margin: 0; height: 20px; position: relative; top: 2px;} 15 | input[type=radio] { margin-top: -3px; } 16 | 17 | body { 18 | #header-wrapper { position:fixed; top:0; left:0; right:0; } 19 | #wrapper { height:100%; width:100%; } 20 | #content { width:auto !important; margin:0; height:auto !important; position:absolute; top:71px; left:0; bottom:0; right:0; 21 | strong { font-size:14px; } 22 | .mainWindow { font-size:12px; } 23 | } 24 | } 25 | 26 | body { position:absolute; top:10px; left:38px; bottom:10px; right:10px; overflow:hidden; 27 | .mainWindow { min-width:1200px; width:100%; height:100%; position:relative; overflow:auto; } 28 | .canvasWindow { position:absolute; top:80px; left:0; bottom:45px; width:49%; margin-right:1%; overflow:hidden; 29 | #complexity strong { background:#5BB75B; @include border-radius(50%); padding:0px 5px; color:#fff; font-weight:normal; } 30 | .buttons-positions { margin-top:10px; float:left; clear:both; } 31 | #loader { display:none; margin-left:10px; } 32 | #loader.show { display:inline-block; } 33 | } 34 | .controlsWindow { position:absolute; top:80px; left:50%; bottom:45px; width:49%; overflow-x:hidden; overflow-y:auto; 35 | .controlsWindowChild { position:absolute; left:0; right:18px; top:0; height:auto; 36 | .nav { margin-bottom:0; } 37 | .tab-content { padding:12px 12px 12px 12px; border-bottom:1px solid #ddd; border-left:1px solid #ddd; border-right:1px solid #ddd; @include border-radius(0 0 4px 4px); } 38 | textarea { resize:none; } 39 | input, textarea { font-family:'Open Sans', sans-serif; } 40 | i { font-size:12px; } 41 | .image_url_p .last { margin-bottom:0; } 42 | .image_url_p i { margin-bottom:10px; margin-top:3px; display:block; } 43 | #text-wrapper { display:none; 44 | textarea { text-align:left; } 45 | } 46 | button.selected { font-weight:bold; vertical-align:top; } 47 | } 48 | } 49 | 50 | .canvas-container { margin-top:0px !important; border:1px solid #ddd; } 51 | .about { position:absolute; width:100%; bottom:12px; text-align:center; } 52 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | HTML5 Picture Editor 2 | ================== 3 | HTML5 Picture editor is an open source online image generator, which allows you to add images, text and let you to style them as you want. It is developed using HTML5 and JavaScript libraries Fabric.js & commonly used jQuery. It's UI is designed with Twitter bootstrap. 4 | 5 | 6 | ## Features 7 | • Add multiple images
8 | • Scale, rotate, resize & relocate image
9 | • Add multiple text
10 | • Change font, size, bg color, text color, line height, bold, italic, underline, line-though & over-line text.
11 | • Add shadow to objects
12 | • Save as draft, PNG and JPEG.
13 | • Change canvas size and its background.
14 | 15 | 16 | ## Screenshots 17 | ![output1](https://raw.github.com/waqar-alamgir/html5-picture-editor/master/screenshots/1.png) 18 | ![output2](https://raw.github.com/waqar-alamgir/html5-picture-editor/master/screenshots/2.png) 19 | ![output3](https://raw.github.com/waqar-alamgir/html5-picture-editor/master/screenshots/3.png) 20 | ![output4](https://raw.github.com/waqar-alamgir/html5-picture-editor/master/screenshots/4.png) 21 | 22 | 23 | ## Demo 24 | Follow this URL to see working demo: 25 | [Link](https://wajrcs.tk/app/html5-picture-editor/) 26 | 27 | 28 | ## Developer Resources 29 | Check out the URLs bellow to find out how its done:
30 | [fabric.js](http://fabricjs.com/)
31 | [jQuery](http://jquery.com/)
32 | [Twitter bootstrap](http://getbootstrap.com/2.3.2/)
33 | 34 | 35 | ## Kick Starter (for developers) 36 | Just fork the repository, clone it or just download its source. Deploy it on any directory on a machine where Apache/PHP running. 37 | 38 | 39 | ## Configuration 40 | Using Pet.js: 41 | Define your own custom messages 42 |
43 | var MESSAGES = [
44 | 	'Fabric library is missing.',
45 | 	'Are you sure?',
46 | 	'This browser doesn\'t provide this feature',
47 | 	'Saved',
48 | 	'Post data is missing',
49 | 	'Saving draft',
50 | 	'Exporting as JPEG',
51 | 	'Exporting as PNG',
52 | 	'Loading from draft',
53 | 	'Maximum width of the image can be set to ',
54 | 	'Maximum height of the image can be set to ',
55 | 	'Value is invalid'
56 | ];
57 | 
58 | 59 | For a different server side define your own http URLs: 60 |
61 | var PAGES = [
62 | 	'draft.php',
63 | 	'view.php'
64 | ];
65 | 
66 | 67 | For exporting images; look at upload.php also in html form. 68 | 69 | 70 | ## Interested in contributing? 71 | If you wanna add more features and user options then just fork this repo from the link bellow: 72 | https://github.com/waqar-alamgir/html5-picture-editor/fork 73 | 74 | 75 | ## Credits 76 | html5-picture-editor by [Waqar Alamgir](https://wajrcs.tk/)
77 | [Web](https://wajrcs.tk/)
78 | [Twitter](http://www.twitter.com/wajrcs) 79 | -------------------------------------------------------------------------------- /assets/css/master-wa.css: -------------------------------------------------------------------------------- 1 | @import url(http://fonts.googleapis.com/css?family=Open+Sans:300,400,700); 2 | /** 3 | * @author Waqar Alamgir 4 | */ 5 | /* line 9, ../scss/master-wa.scss */ 6 | body { 7 | font-family: "Open Sans", sans-serif !important; 8 | margin: 0; 9 | font-size: 14px !important; 10 | line-height: 1.5 !important; 11 | color: #333; 12 | background: #fff; 13 | } 14 | 15 | /* line 10, ../scss/master-wa.scss */ 16 | a:hover, a:focus { 17 | text-decoration: none; 18 | } 19 | 20 | /* line 11, ../scss/master-wa.scss */ 21 | h3, h4 { 22 | margin-top: 1.5em !important; 23 | } 24 | 25 | /* line 12, ../scss/master-wa.scss */ 26 | label { 27 | display: inline-block; 28 | margin-right: 8px; 29 | width: 150px; 30 | } 31 | 32 | /* line 13, ../scss/master-wa.scss */ 33 | textarea { 34 | font-family: monospace; 35 | } 36 | 37 | /* line 14, ../scss/master-wa.scss */ 38 | input[type=color] { 39 | width: 40px; 40 | padding: 0; 41 | margin: 0; 42 | height: 20px; 43 | position: relative; 44 | top: 2px; 45 | } 46 | 47 | /* line 15, ../scss/master-wa.scss */ 48 | input[type=radio] { 49 | margin-top: -3px; 50 | } 51 | 52 | /* line 18, ../scss/master-wa.scss */ 53 | body #header-wrapper { 54 | position: fixed; 55 | top: 0; 56 | left: 0; 57 | right: 0; 58 | } 59 | /* line 19, ../scss/master-wa.scss */ 60 | body #wrapper { 61 | height: 100%; 62 | width: 100%; 63 | } 64 | /* line 20, ../scss/master-wa.scss */ 65 | body #content { 66 | width: auto !important; 67 | margin: 0; 68 | height: auto !important; 69 | position: absolute; 70 | top: 71px; 71 | left: 0; 72 | bottom: 0; 73 | right: 0; 74 | } 75 | /* line 21, ../scss/master-wa.scss */ 76 | body #content strong { 77 | font-size: 14px; 78 | } 79 | /* line 22, ../scss/master-wa.scss */ 80 | body #content .mainWindow { 81 | font-size: 12px; 82 | } 83 | 84 | /* line 26, ../scss/master-wa.scss */ 85 | body { 86 | position: absolute; 87 | top: 10px; 88 | left: 38px; 89 | bottom: 10px; 90 | right: 10px; 91 | overflow: hidden; 92 | } 93 | /* line 27, ../scss/master-wa.scss */ 94 | body .mainWindow { 95 | min-width: 1200px; 96 | width: 100%; 97 | height: 100%; 98 | position: relative; 99 | overflow: auto; 100 | } 101 | /* line 28, ../scss/master-wa.scss */ 102 | body .canvasWindow { 103 | position: absolute; 104 | top: 80px; 105 | left: 0; 106 | bottom: 45px; 107 | width: 49%; 108 | margin-right: 1%; 109 | overflow: hidden; 110 | } 111 | /* line 29, ../scss/master-wa.scss */ 112 | body .canvasWindow #complexity strong { 113 | background: #5BB75B; 114 | -webkit-border-radius: 50%; 115 | -moz-border-radius: 50%; 116 | -ms-border-radius: 50%; 117 | -o-border-radius: 50%; 118 | border-radius: 50%; 119 | padding: 0px 5px; 120 | color: #fff; 121 | font-weight: normal; 122 | } 123 | /* line 30, ../scss/master-wa.scss */ 124 | body .canvasWindow .buttons-positions { 125 | margin-top: 10px; 126 | float: left; 127 | clear: both; 128 | } 129 | /* line 31, ../scss/master-wa.scss */ 130 | body .canvasWindow #loader { 131 | display: none; 132 | margin-left: 10px; 133 | } 134 | /* line 32, ../scss/master-wa.scss */ 135 | body .canvasWindow #loader.show { 136 | display: inline-block; 137 | } 138 | /* line 34, ../scss/master-wa.scss */ 139 | body .controlsWindow { 140 | position: absolute; 141 | top: 80px; 142 | left: 50%; 143 | bottom: 45px; 144 | width: 49%; 145 | overflow-x: hidden; 146 | overflow-y: auto; 147 | } 148 | /* line 35, ../scss/master-wa.scss */ 149 | body .controlsWindow .controlsWindowChild { 150 | position: absolute; 151 | left: 0; 152 | right: 18px; 153 | top: 0; 154 | height: auto; 155 | } 156 | /* line 36, ../scss/master-wa.scss */ 157 | body .controlsWindow .controlsWindowChild .nav { 158 | margin-bottom: 0; 159 | } 160 | /* line 37, ../scss/master-wa.scss */ 161 | body .controlsWindow .controlsWindowChild .tab-content { 162 | padding: 12px 12px 12px 12px; 163 | border-bottom: 1px solid #ddd; 164 | border-left: 1px solid #ddd; 165 | border-right: 1px solid #ddd; 166 | -webkit-border-radius: 0 0 4px 4px; 167 | -moz-border-radius: 0 0 4px 4px; 168 | -ms-border-radius: 0 0 4px 4px; 169 | -o-border-radius: 0 0 4px 4px; 170 | border-radius: 0 0 4px 4px; 171 | } 172 | /* line 38, ../scss/master-wa.scss */ 173 | body .controlsWindow .controlsWindowChild textarea { 174 | resize: none; 175 | } 176 | /* line 39, ../scss/master-wa.scss */ 177 | body .controlsWindow .controlsWindowChild input, body .controlsWindow .controlsWindowChild textarea { 178 | font-family: 'Open Sans', sans-serif; 179 | } 180 | /* line 40, ../scss/master-wa.scss */ 181 | body .controlsWindow .controlsWindowChild i { 182 | font-size: 12px; 183 | } 184 | /* line 41, ../scss/master-wa.scss */ 185 | body .controlsWindow .controlsWindowChild .image_url_p .last { 186 | margin-bottom: 0; 187 | } 188 | /* line 42, ../scss/master-wa.scss */ 189 | body .controlsWindow .controlsWindowChild .image_url_p i { 190 | margin-bottom: 10px; 191 | margin-top: 3px; 192 | display: block; 193 | } 194 | /* line 43, ../scss/master-wa.scss */ 195 | body .controlsWindow .controlsWindowChild #text-wrapper { 196 | display: none; 197 | } 198 | /* line 44, ../scss/master-wa.scss */ 199 | body .controlsWindow .controlsWindowChild #text-wrapper textarea { 200 | text-align: left; 201 | } 202 | /* line 46, ../scss/master-wa.scss */ 203 | body .controlsWindow .controlsWindowChild button.selected { 204 | font-weight: bold; 205 | vertical-align: top; 206 | } 207 | /* line 50, ../scss/master-wa.scss */ 208 | body .canvas-container { 209 | margin-top: 0px !important; 210 | border: 1px solid #ddd; 211 | } 212 | /* line 51, ../scss/master-wa.scss */ 213 | body .about { 214 | position: absolute; 215 | width: 100%; 216 | bottom: 12px; 217 | text-align: center; 218 | } 219 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Picture Editor - HTML5 7 | 8 | 9 | 12 | 19 | 22 | 26 | 27 | 28 | 29 | 33 | 34 |
35 |

Picture Editor

36 | 37 |
38 | 39 |
40 |
loading Loading
41 |
42 |
43 | 44 |
45 |
46 | 52 |
53 |
54 |

55 | Upload image 56 |

57 |

58 | 59 | 60 |

61 |

62 | Add text 63 |

64 |

65 | 66 |
67 | 79 |
80 | 81 |
82 | 83 |

84 |

85 | Add image 86 |

87 |

88 | 89 |
90 | Paste an http url here. 91 | 92 |

93 |
94 | 95 |
96 |

97 | Actions 98 |

99 |

100 | 101 |

102 |
103 |

104 | Z-axis 105 |

106 |

107 | 108 | 109 | 110 | 111 |

112 |
113 |

114 | Effects 115 |

116 |

117 | 118 |

119 |
120 | 121 |
122 |

123 | Edit Text 124 |

125 |

126 | 127 | 128 |

129 |

130 | 131 | 143 |

144 |

145 | 146 | 153 |

154 |

155 | 156 | 157 |

158 |

159 | 160 | 161 |

162 |

163 | 164 | 165 |

166 |

167 | 168 | 179 |

180 |

181 | 182 | 193 |

194 |

195 | 196 | 207 |

208 |

209 | 210 | 211 | 212 | 213 | 214 |

215 |
216 |
217 | 218 |
219 |

220 | Save 221 |

222 |

223 | 224 |
225 | JPEG format does not support transparency, so set background to #fff before exporting it. 226 |

227 |
228 |

229 | Actions 230 |

231 |

232 | 233 |

234 |
235 | 236 |
237 |

238 | Image size 239 |

240 |

241 | 242 |
243 | 244 |
245 | Maximum image size can be set to 600x400. 246 |

247 |
248 |

249 | Select Background 250 |

251 |

252 | 253 |

254 |
255 | 256 |
257 |
258 |
259 | 260 |
261 | 262 | 263 |
264 | 265 |
266 | Built using fabric.js, jquery and bootstrap by @wajrcs  .  Fork  .  267 |
268 |
269 | 270 | 271 | 272 | 273 | 274 | -------------------------------------------------------------------------------- /assets/js/pet.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Class for all kind for event binding for Pet's commands and controls 4 | * 5 | * @Author Waqar Alamgir 6 | * @Created 23 Sep 2013 7 | * @Modified 25 Sep 2013 8 | * 9 | */ 10 | 11 | var MESSAGES = [ 12 | 'Fabric library is missing.', 13 | 'Are you sure?', 14 | 'This browser doesn\'t provide this feature', 15 | 'Saved', 16 | 'Post data is missing', 17 | 'Saving draft', 18 | 'Exporting as JPEG', 19 | 'Exporting as PNG', 20 | 'Loading from draft', 21 | 'Maximum width of the image can be set to ', 22 | 'Maximum height of the image can be set to ', 23 | 'Value is invalid' 24 | ]; 25 | 26 | var PAGES = [ 27 | 'draft.php', 28 | 'view.php' 29 | ]; 30 | 31 | PetUtil = function() 32 | { 33 | var that = this; 34 | var _timer = 0; 35 | 36 | that.getRandomNum = function(min, max) 37 | { 38 | return Math.random() * (max - min) + min; 39 | }; 40 | 41 | that.getImage = function(image) 42 | { 43 | return SITE_URL_APPLICATION + PAGES[1] + '?v=' + encodeURIComponent(image); 44 | }; 45 | 46 | that.hideLoader = function() 47 | { 48 | $('#loader img').show(); 49 | $('#loader').removeClass('show').find('span').text('Loading'); 50 | }; 51 | 52 | that.showLoader = function(text) 53 | { 54 | $('#loader img').show(); 55 | $('#loader').addClass('show').find('span').text(text); 56 | }; 57 | 58 | that.fadeOutLoader = function(text) 59 | { 60 | if(_timer) 61 | { 62 | clearTimeout(_timer); 63 | } 64 | 65 | $('#loader').addClass('show').find('span').text(text); 66 | $('#loader img').hide(); 67 | 68 | _timer = setTimeout(function() 69 | { 70 | that.hideLoader(); 71 | } , 4000); 72 | }; 73 | }; 74 | 75 | petUtil = new PetUtil(); 76 | 77 | Pet = function() 78 | { 79 | var that = this; 80 | 81 | var _objectCompose = $('#object-compose'); 82 | var _clear = $('#clear'); 83 | var _rasterize = $('#rasterize'); 84 | var _rasterizeJpeg = $('#rasterize-jpeg'); 85 | var _rasterizeSvg = $('#rasterize-svg'); 86 | var _rasterizeJson = $('#rasterize-json'); 87 | var _rasterizeDraft = $('#rasterize-draft'); 88 | var _removeSelected = $('#remove-selected'); 89 | var _sendBackwards = $('#send-backwards'); 90 | var _sendToBack = $('#send-to-back'); 91 | var _bringForward = $('#bring-forward'); 92 | var _bringToFront = $('#bring-to-front'); 93 | var _shadowify = $('#shadowify'); 94 | var _canvasBackgroundPicker = $('#canvas-background-picker'); 95 | var _fontFamily = $('#font-family'); 96 | var _imageUrl = $('#image_url'); 97 | var _text = $('#text'); 98 | var _canvasWindow = $('.canvasWindow'); 99 | var _canvasDom = $('#canvas'); 100 | var _originX = $('.origin-x'); 101 | var _originY = $('.origin-y'); 102 | var _complexity = $('#complexity strong'); 103 | var _loadDraft = $('#load-draft'); 104 | var _uploadImagePreview = $('#upload_image_preview'); 105 | var _uploadImage = $("#upload_image"); 106 | var _addImageBtn = 'add_image_btn'; 107 | var _uploadImageBtn = 'upload_image_btn'; 108 | var _addTextBtn = 'add_text_btn'; 109 | var _downloadFileForm = $('#downloadFileForm'); 110 | var _fileData = $('#file_data'); 111 | var _fileType = $('#file_type'); 112 | var _textColor = $('#text-color'); 113 | var _imageSizeW = $('#image_size_w'); 114 | var _imageSizeH = $('#image_size_h'); 115 | var _textWrapper = $('#text-wrapper'); 116 | var _canvasEle = 'canvas'; 117 | var _textEditor = $('#text-wrapper #text-edit'); 118 | var _cmdBoldBtn = $('#text-cmd-bold'); 119 | var _cmdItalicBtn = $('#text-cmd-italic'); 120 | var _cmdUnderlineBtn = $('#text-cmd-underline'); 121 | var _cmdLinethroughBtn = $('#text-cmd-linethrough'); 122 | var _cmdOverlineBtn = $('#text-cmd-overline'); 123 | var _fontFamilyEdit = $('#font-family-edit'); 124 | var _textAlignEdit = $('#text-align-edit'); 125 | var _texBgColor = $('#text-bg-color'); 126 | var _textLinesBgColor = $('#text-lines-bg-color'); 127 | var _textStrokeColor = $('#text-stroke-color'); 128 | var _textStrokeWidth = $('#text-stroke-width'); 129 | var _textFontSize = $('#text-font-size'); 130 | var _textLineHeight = $('#text-line-height'); 131 | 132 | var _event = 'click'; 133 | var _blur = 'blur'; 134 | var _change = 'change'; 135 | var _focus = 'focus'; 136 | var _keyup = 'keyup'; 137 | _canvasDom.attr('width', parseInt(_canvasWindow.css('width'))-2); 138 | _canvasDom.attr('height', parseInt($(window).height())-188); 139 | var _canvas = new fabric.Canvas(_canvasEle); 140 | var _getRandomInt = fabric.util.getRandomInt; 141 | 142 | var _canvasWidth = 500; 143 | var _canvasHeight = 300; 144 | var _canvasMaxWidth = 600; 145 | var _canvasMaxHeight = 400; 146 | 147 | 148 | that.bootstrap = function(config) 149 | { 150 | if(!fabric) 151 | { 152 | alert(MESSAGES[0]); 153 | return; 154 | } 155 | 156 | if(config && config.canvasWidth) 157 | { 158 | _canvasWidth = config.canvasWidth; 159 | } 160 | 161 | if(config && config.canvasHeight) 162 | { 163 | _canvasHeight = config.canvasHeight; 164 | } 165 | 166 | _leEventBinding(); 167 | 168 | if(window.jsonData) 169 | { 170 | petUtil.showLoader(MESSAGES[8]); 171 | } 172 | 173 | setTimeout(function() 174 | { 175 | _canvas.calcOffset(); 176 | 177 | if(window.jsonData) 178 | { 179 | _canvas.clear(); 180 | _canvas.loadFromDatalessJSON(window.jsonData); 181 | setTimeout(function() { 182 | _canvasBackgroundPicker.trigger('blur'); 183 | petUtil.hideLoader(); 184 | } , 1000); 185 | } 186 | }, 100); 187 | 188 | _imageUrl.focus(); 189 | }; 190 | 191 | function _reAdjustCanvas() 192 | { 193 | _canvas.calcOffset(); 194 | } 195 | 196 | function _leEventBindingMain() 197 | { 198 | _clear.bind(_event , function(event) 199 | { 200 | if( confirm(MESSAGES[1]) ) 201 | { 202 | _canvas.clear(); 203 | } 204 | }); 205 | 206 | _loadDraft.bind(_event , function(event) 207 | { 208 | var url = SITE_URL_APPLICATION + '?load'; 209 | window.location.href = url; 210 | }); 211 | } 212 | 213 | function _leEventBindingCompose() 214 | { 215 | _uploadImage.change(function() { 216 | input = this; 217 | if (input.files && input.files[0]) { 218 | var reader = new FileReader(); 219 | reader.onload = function(e) { 220 | _uploadImagePreview.attr('src', e.target.result); 221 | var img = new Image(); 222 | img.src = e.target.result; 223 | img.onload = function () { 224 | // var imgElement = document.getElementById('upload_image_preview'); 225 | var imgInstance = new fabric.Image(img, { 226 | left: 100, 227 | top: 100, 228 | angle: 0, 229 | opacity: 1 230 | }); 231 | _canvas.add(imgInstance); 232 | } 233 | 234 | } 235 | reader.readAsDataURL(input.files[0]); // convert to base64 string 236 | } 237 | }); 238 | 239 | _objectCompose.bind(_event , function(event) 240 | { 241 | var element = event.target; 242 | if (element.nodeName.toLowerCase() === 'strong') 243 | { 244 | element = element.parentNode; 245 | } 246 | 247 | var className = 248 | element.className, 249 | offset = 50, 250 | left = fabric.util.getRandomInt(0 + offset, _canvasWidth - offset), 251 | top = fabric.util.getRandomInt(0 + offset, _canvasHeight - offset), 252 | scale = 1; 253 | angle = 0; 254 | opacity = 1; 255 | 256 | if( $(element).hasClass(_addImageBtn) ) 257 | { 258 | var imageUrl = _imageUrl.val(); 259 | 260 | if(imageUrl != '') 261 | { 262 | imageUrl = petUtil.getImage(imageUrl); 263 | fabric.Image.fromURL(imageUrl , function(image) 264 | { 265 | image.set({ left:left , top:top , angle:angle , cornersize:10 }); 266 | image.scale(scale).setCoords(); 267 | _canvas.add(image); 268 | }); 269 | } 270 | 271 | _imageUrl.val('').focus(); 272 | } 273 | 274 | if( $(element).hasClass(_addTextBtn) ) 275 | { 276 | var text = _text.val(); 277 | var font = _fontFamily.val(); 278 | var color = _textColor.val(); 279 | 280 | if(text!='' && font !='' && color!='') 281 | { 282 | var textObject = new fabric.Text( 283 | text, 284 | { 285 | left: 0, 286 | top: 0, 287 | fontSize:20, 288 | lineHeight:1, 289 | fontFamily: font, 290 | angle: angle, 291 | fill: color, 292 | scaleX: 1, 293 | scaleY: 1, 294 | fontWeight: '', 295 | originX: 'left', 296 | hasRotatingPoint:true 297 | }); 298 | _canvas.add(textObject); 299 | _text.val('').focus(); 300 | } 301 | else if(color == '') 302 | { 303 | _textColor.focus(); 304 | } 305 | else if(font == '') 306 | { 307 | _fontFamily.focus(); 308 | } 309 | else if(text == '') 310 | { 311 | _text.focus(); 312 | } 313 | } 314 | 315 | _reAdjustCanvas(); 316 | }); 317 | } 318 | 319 | function _leEventBindingExport() 320 | { 321 | _rasterize.bind(_event , function(event) 322 | { 323 | petUtil.showLoader(MESSAGES[7]); 324 | if (!fabric.Canvas.supports('toDataURL')) 325 | { 326 | petUtil.fadeOutLoader(MESSAGES[2]); 327 | } 328 | else 329 | { 330 | _fileData.val(_canvas.toDataURL('png')); 331 | _fileType.val('png'); 332 | _downloadFileForm.submit(); 333 | petUtil.fadeOutLoader(MESSAGES[3]); 334 | } 335 | }); 336 | 337 | _rasterizeJpeg.bind(_event , function(event) 338 | { 339 | petUtil.showLoader(MESSAGES[6]); 340 | if (!fabric.Canvas.supports('toDataURL')) 341 | { 342 | petUtil.fadeOutLoader(MESSAGES[2]); 343 | } 344 | else 345 | { 346 | _fileData.val($('#' + _canvasEle).get(0).toDataURL('image/jpeg' , 100)); 347 | _fileType.val('jpeg'); 348 | _downloadFileForm.submit(); 349 | petUtil.fadeOutLoader(MESSAGES[3]); 350 | } 351 | }); 352 | 353 | _rasterizeDraft.bind(_event , function(event) 354 | { 355 | petUtil.showLoader(MESSAGES[5]); 356 | $.post(SITE_URL_APPLICATION + PAGES[0] , { file_data:JSON.stringify( _canvas.toDatalessJSON() ) } , function(r) 357 | { 358 | if(r == '1') 359 | { 360 | petUtil.fadeOutLoader(MESSAGES[3]); 361 | } 362 | else 363 | { 364 | petUtil.fadeOutLoader(MESSAGES[4]); 365 | } 366 | }); 367 | }); 368 | } 369 | 370 | function _leEventBindingControls() 371 | { 372 | _removeSelected.bind(_event , function(event) 373 | { 374 | var activeObject = _canvas.getActiveObject(); 375 | var activeGroup = _canvas.getActiveGroup(); 376 | if (activeGroup) 377 | { 378 | var objectsInGroup = activeGroup.getObjects(); 379 | _canvas.discardActiveGroup(); 380 | objectsInGroup.forEach(function(object) 381 | { 382 | _canvas.remove(object); 383 | }); 384 | } 385 | else if (activeObject) 386 | { 387 | _canvas.remove(activeObject); 388 | } 389 | }); 390 | 391 | _sendBackwards.bind(_event , function(event) 392 | { 393 | var activeObject = _canvas.getActiveObject(); 394 | if (activeObject) 395 | { 396 | _canvas.sendBackwards(activeObject); 397 | } 398 | }); 399 | 400 | _sendToBack.bind(_event , function(event) 401 | { 402 | var activeObject = _canvas.getActiveObject(); 403 | if (activeObject) 404 | { 405 | _canvas.sendToBack(activeObject); 406 | } 407 | }); 408 | 409 | _bringForward.bind(_event , function(event) 410 | { 411 | var activeObject = _canvas.getActiveObject(); 412 | if (activeObject) 413 | { 414 | _canvas.bringForward(activeObject); 415 | } 416 | }); 417 | 418 | _bringToFront.bind(_event , function(event) 419 | { 420 | var activeObject = _canvas.getActiveObject(); 421 | if (activeObject) 422 | { 423 | _canvas.bringToFront(activeObject); 424 | } 425 | }); 426 | 427 | _shadowify.bind(_event , function(event) 428 | { 429 | var obj = _canvas.getActiveObject(); 430 | if (!obj) return; 431 | if (obj.shadow) 432 | { 433 | obj.shadow = null; 434 | } 435 | else 436 | { 437 | obj.setShadow({ 438 | color: 'rgba(0,0,0,0.15)', 439 | blur: 10, 440 | offsetX: 6, 441 | offsetY: 6 442 | }); 443 | } 444 | _canvas.renderAll(); 445 | }); 446 | } 447 | 448 | function _leEventBindingSettings() 449 | { 450 | _canvasBackgroundPicker.bind(_blur , function() 451 | { 452 | _canvas.backgroundColor = _canvasBackgroundPicker.val(); 453 | _canvas.renderAll(); 454 | }); 455 | 456 | _imageSizeW.bind(_blur , function() 457 | { 458 | var w = _imageSizeW.val(); 459 | if(!isNaN(w) && w<=_canvasMaxWidth) 460 | { 461 | _canvas.setWidth(w); 462 | _canvas.renderAll(); 463 | } 464 | else if(!isNaN(w) && w>_canvasMaxWidth) 465 | { 466 | petUtil.fadeOutLoader(MESSAGES[9] + _canvasMaxWidth); 467 | } 468 | else 469 | { 470 | petUtil.fadeOutLoader(MESSAGES[11]); 471 | } 472 | }); 473 | 474 | _imageSizeH.bind(_blur , function() 475 | { 476 | var h = _imageSizeH.val(); 477 | if(!isNaN(h) && h<=_canvasMaxHeight) 478 | { 479 | _canvas.setHeight(h); 480 | _canvas.renderAll(); 481 | } 482 | else if(!isNaN(h) && h>_canvasMaxHeight) 483 | { 484 | petUtil.fadeOutLoader(MESSAGES[10] + _canvasMaxHeight); 485 | } 486 | else 487 | { 488 | petUtil.fadeOutLoader(MESSAGES[11]); 489 | } 490 | }); 491 | } 492 | 493 | function _leEventBindingSectionText() 494 | { 495 | _canvas.on('object:selected' , _onObjectSelected); 496 | _canvas.on('group:selected' , _onObjectSelected); 497 | _canvas.on('selection:cleared', function(e) 498 | { 499 | _textWrapper.hide(); 500 | }); 501 | 502 | _cmdBoldBtn.bind(_event , function() 503 | { 504 | var activeObject = _canvas.getActiveObject(); 505 | if (activeObject && /text/.test(activeObject.type)) 506 | { 507 | activeObject.fontWeight = (activeObject.fontWeight == 'bold' ? '' : 'bold'); 508 | activeObject.fontWeight ? _cmdBoldBtn.addClass('selected') : _cmdBoldBtn.removeClass('selected'); 509 | _canvas.renderAll(); 510 | } 511 | }); 512 | 513 | _cmdItalicBtn.bind(_event , function() 514 | { 515 | var activeObject = _canvas.getActiveObject(); 516 | if (activeObject && /text/.test(activeObject.type)) 517 | { 518 | activeObject.fontStyle = (activeObject.fontStyle == 'italic' ? '' : 'italic'); 519 | activeObject.fontStyle ? _cmdItalicBtn.addClass('selected') : _cmdItalicBtn.removeClass('selected'); 520 | _canvas.renderAll(); 521 | } 522 | }); 523 | 524 | _textEditor.bind(_focus , function() 525 | { 526 | var activeObject = _canvas.getActiveObject(); 527 | if (activeObject && /text/.test(activeObject.type)) 528 | { 529 | _textEditor.val(activeObject.text); 530 | } 531 | }); 532 | 533 | _textEditor.bind(_keyup , function() 534 | { 535 | var activeObject = _canvas.getActiveObject(); 536 | if (activeObject) 537 | { 538 | if (!_textEditor.val()) 539 | { 540 | _canvas.discardActiveObject(); 541 | } 542 | else 543 | { 544 | activeObject.setText(_textEditor.val()); 545 | } 546 | _canvas.renderAll(); 547 | } 548 | }); 549 | 550 | _textAlignEdit.change(function() 551 | { 552 | var activeObject = _canvas.getActiveObject(); 553 | if (activeObject && /text/.test(activeObject.type)) 554 | { 555 | var value = _textAlignEdit.val().toLowerCase(); 556 | activeObject.textAlign = value; 557 | _canvas._adjustPosition && _canvas._adjustPosition(activeObject, value === 'justify' ? 'left' : value); 558 | _canvas.renderAll(); 559 | } 560 | }); 561 | 562 | _fontFamilyEdit.change(function() 563 | { 564 | var activeObject = _canvas.getActiveObject(); 565 | if (activeObject && /text/.test(activeObject.type)) 566 | { 567 | activeObject.fontFamily = _fontFamilyEdit.val().toLowerCase(); 568 | _canvas.renderAll(); 569 | } 570 | }); 571 | 572 | _texBgColor.change(function() 573 | { 574 | var activeObject = _canvas.getActiveObject(); 575 | if (activeObject && /text/.test(activeObject.type)) 576 | { 577 | activeObject.backgroundColor = _texBgColor.val().toLowerCase(); 578 | _canvas.renderAll(); 579 | } 580 | }); 581 | 582 | _textLinesBgColor.change(function() 583 | { 584 | var activeObject = _canvas.getActiveObject(); 585 | if (activeObject && /text/.test(activeObject.type)) 586 | { 587 | activeObject.textBackgroundColor = _textLinesBgColor.val(); 588 | _canvas.renderAll(); 589 | } 590 | }); 591 | 592 | _textFontSize.change(function() 593 | { 594 | var activeObject = _canvas.getActiveObject(); 595 | if (activeObject && /text/.test(activeObject.type)) 596 | { 597 | activeObject.setFontSize(parseInt(_textFontSize.val(), 10)); 598 | _canvas.renderAll(); 599 | } 600 | }); 601 | 602 | _textStrokeColor.change(function() 603 | { 604 | var activeObject = _canvas.getActiveObject(); 605 | if (activeObject && /text/.test(activeObject.type)) 606 | { 607 | activeObject.stroke = _textStrokeColor.val(); 608 | _canvas.renderAll(); 609 | } 610 | }); 611 | 612 | _textStrokeWidth.change(function() 613 | { 614 | var activeObject = _canvas.getActiveObject(); 615 | if (activeObject && /text/.test(activeObject.type)) 616 | { 617 | activeObject.strokeWidth = parseInt(_textStrokeWidth.val(), 10); 618 | _canvas.renderAll(); 619 | } 620 | }); 621 | 622 | _textLineHeight.change(function() 623 | { 624 | var activeObject = _canvas.getActiveObject(); 625 | if (activeObject && /text/.test(activeObject.type)) 626 | { 627 | activeObject.setLineHeight(parseInt(_textLineHeight.val(), 10)); 628 | _canvas.renderAll(); 629 | } 630 | }); 631 | 632 | _cmdUnderlineBtn.bind(_event , function() 633 | { 634 | var activeObject = _canvas.getActiveObject(); 635 | if (activeObject && /text/.test(activeObject.type)) 636 | { 637 | activeObject.textDecoration = (activeObject.textDecoration == 'underline' ? '' : 'underline'); 638 | if (activeObject.textDecoration === 'underline') 639 | { 640 | _cmdUnderlineBtn.addClass('selected'); 641 | _cmdLinethroughBtn.removeClass('selected'); 642 | _cmdOverlineBtn.removeClass('selected'); 643 | } 644 | else 645 | { 646 | _cmdUnderlineBtn.removeClass('selected'); 647 | } 648 | _canvas.renderAll(); 649 | } 650 | }); 651 | 652 | _cmdLinethroughBtn.bind(_event , function() 653 | { 654 | var activeObject = _canvas.getActiveObject(); 655 | if (activeObject && /text/.test(activeObject.type)) 656 | { 657 | activeObject.textDecoration = (activeObject.textDecoration == 'line-through' ? '' : 'line-through'); 658 | if (activeObject.textDecoration === 'line-through') 659 | { 660 | _cmdLinethroughBtn.addClass('selected'); 661 | _cmdUnderlineBtn.removeClass('selected'); 662 | _cmdOverlineBtn.removeClass('selected'); 663 | } 664 | else 665 | { 666 | _cmdLinethroughBtn.removeClass('selected'); 667 | } 668 | _canvas.renderAll(); 669 | } 670 | }); 671 | 672 | _cmdOverlineBtn.bind(_event , function() 673 | { 674 | var activeObject = _canvas.getActiveObject(); 675 | if (activeObject && /text/.test(activeObject.type)) 676 | { 677 | activeObject.textDecoration = (activeObject.textDecoration == 'overline' ? '' : 'overline'); 678 | if (activeObject.textDecoration === 'overline') 679 | { 680 | _cmdOverlineBtn.addClass('selected'); 681 | _cmdUnderlineBtn.removeClass('selected'); 682 | _cmdLinethroughBtn.removeClass('selected'); 683 | } 684 | else 685 | { 686 | _cmdOverlineBtn.removeClass('selected'); 687 | } 688 | _canvas.renderAll(); 689 | } 690 | }); 691 | } 692 | 693 | function _onObjectSelected(e) 694 | { 695 | var selectedObject = e.target; 696 | if (/text/.test(selectedObject.type)) 697 | { 698 | _textWrapper.show(); 699 | _textEditor.val(selectedObject.getText()); 700 | 701 | var buttons = [_textEditor , _cmdBoldBtn , _cmdItalicBtn , _cmdUnderlineBtn , _cmdLinethroughBtn , _cmdOverlineBtn]; 702 | for(var i=0; i elements as element.getContext(). 55 | * @this {HTMLElement} 56 | * @return {CanvasRenderingContext2D_} 57 | */ 58 | function getContext() { 59 | return this.context_ || 60 | (this.context_ = new CanvasRenderingContext2D_(this)); 61 | } 62 | 63 | var slice = Array.prototype.slice; 64 | 65 | /** 66 | * Binds a function to an object. The returned function will always use the 67 | * passed in {@code obj} as {@code this}. 68 | * 69 | * Example: 70 | * 71 | * g = bind(f, obj, a, b) 72 | * g(c, d) // will do f.call(obj, a, b, c, d) 73 | * 74 | * @param {Function} f The function to bind the object to 75 | * @param {Object} obj The object that should act as this when the function 76 | * is called 77 | * @param {*} var_args Rest arguments that will be used as the initial 78 | * arguments when the function is called 79 | * @return {Function} A new function that has bound this 80 | */ 81 | function bind(f, obj, var_args) { 82 | var a = slice.call(arguments, 2); 83 | return function() { 84 | return f.apply(obj, a.concat(slice.call(arguments))); 85 | }; 86 | } 87 | 88 | function encodeHtmlAttribute(s) { 89 | return String(s).replace(/&/g, '&').replace(/"/g, '"'); 90 | } 91 | 92 | function addNamespace(doc, prefix, urn) { 93 | if (!doc.namespaces[prefix]) { 94 | doc.namespaces.add(prefix, urn, '#default#VML'); 95 | } 96 | } 97 | 98 | function addNamespacesAndStylesheet(doc) { 99 | addNamespace(doc, 'g_vml_', 'urn:schemas-microsoft-com:vml'); 100 | addNamespace(doc, 'g_o_', 'urn:schemas-microsoft-com:office:office'); 101 | 102 | // Setup default CSS. Only add one style sheet per document 103 | if (!doc.styleSheets['ex_canvas_']) { 104 | var ss = doc.createStyleSheet(); 105 | ss.owningElement.id = 'ex_canvas_'; 106 | ss.cssText = 'canvas{display:inline-block;overflow:hidden;' + 107 | // default size is 300x150 in Gecko and Opera 108 | 'text-align:left;width:300px;height:150px}'; 109 | } 110 | } 111 | 112 | // Add namespaces and stylesheet at startup. 113 | addNamespacesAndStylesheet(document); 114 | 115 | var G_vmlCanvasManager_ = { 116 | init: function(opt_doc) { 117 | var doc = opt_doc || document; 118 | // Create a dummy element so that IE will allow canvas elements to be 119 | // recognized. 120 | doc.createElement('canvas'); 121 | doc.attachEvent('onreadystatechange', bind(this.init_, this, doc)); 122 | }, 123 | 124 | init_: function(doc) { 125 | // find all canvas elements 126 | var els = doc.getElementsByTagName('canvas'); 127 | for (var i = 0; i < els.length; i++) { 128 | this.initElement(els[i]); 129 | } 130 | }, 131 | 132 | /** 133 | * Public initializes a canvas element so that it can be used as canvas 134 | * element from now on. This is called automatically before the page is 135 | * loaded but if you are creating elements using createElement you need to 136 | * make sure this is called on the element. 137 | * @param {HTMLElement} el The canvas element to initialize. 138 | * @return {HTMLElement} the element that was created. 139 | */ 140 | initElement: function(el) { 141 | if (!el.getContext) { 142 | el.getContext = getContext; 143 | 144 | // Add namespaces and stylesheet to document of the element. 145 | addNamespacesAndStylesheet(el.ownerDocument); 146 | 147 | // Remove fallback content. There is no way to hide text nodes so we 148 | // just remove all childNodes. We could hide all elements and remove 149 | // text nodes but who really cares about the fallback content. 150 | el.innerHTML = ''; 151 | 152 | // do not use inline function because that will leak memory 153 | el.attachEvent('onpropertychange', onPropertyChange); 154 | el.attachEvent('onresize', onResize); 155 | 156 | var attrs = el.attributes; 157 | if (attrs.width && attrs.width.specified) { 158 | // TODO: use runtimeStyle and coordsize 159 | // el.getContext().setWidth_(attrs.width.nodeValue); 160 | el.style.width = attrs.width.nodeValue + 'px'; 161 | } else { 162 | el.width = el.clientWidth; 163 | } 164 | if (attrs.height && attrs.height.specified) { 165 | // TODO: use runtimeStyle and coordsize 166 | // el.getContext().setHeight_(attrs.height.nodeValue); 167 | el.style.height = attrs.height.nodeValue + 'px'; 168 | } else { 169 | el.height = el.clientHeight; 170 | } 171 | //el.getContext().setCoordsize_() 172 | } 173 | return el; 174 | } 175 | }; 176 | 177 | function onPropertyChange(e) { 178 | var el = e.srcElement; 179 | 180 | switch (e.propertyName) { 181 | case 'width': 182 | el.getContext().clearRect(); 183 | el.style.width = el.attributes.width.nodeValue + 'px'; 184 | // In IE8 this does not trigger onresize. 185 | el.firstChild.style.width = el.clientWidth + 'px'; 186 | break; 187 | case 'height': 188 | el.getContext().clearRect(); 189 | el.style.height = el.attributes.height.nodeValue + 'px'; 190 | el.firstChild.style.height = el.clientHeight + 'px'; 191 | break; 192 | } 193 | } 194 | 195 | function onResize(e) { 196 | var el = e.srcElement; 197 | if (el.firstChild) { 198 | el.firstChild.style.width = el.clientWidth + 'px'; 199 | el.firstChild.style.height = el.clientHeight + 'px'; 200 | } 201 | } 202 | 203 | G_vmlCanvasManager_.init(); 204 | 205 | // precompute "00" to "FF" 206 | var decToHex = []; 207 | for (var i = 0; i < 16; i++) { 208 | for (var j = 0; j < 16; j++) { 209 | decToHex[i * 16 + j] = i.toString(16) + j.toString(16); 210 | } 211 | } 212 | 213 | function createMatrixIdentity() { 214 | return [ 215 | [1, 0, 0], 216 | [0, 1, 0], 217 | [0, 0, 1] 218 | ]; 219 | } 220 | 221 | function matrixMultiply(m1, m2) { 222 | var result = createMatrixIdentity(); 223 | 224 | for (var x = 0; x < 3; x++) { 225 | for (var y = 0; y < 3; y++) { 226 | var sum = 0; 227 | 228 | for (var z = 0; z < 3; z++) { 229 | sum += m1[x][z] * m2[z][y]; 230 | } 231 | 232 | result[x][y] = sum; 233 | } 234 | } 235 | return result; 236 | } 237 | 238 | function copyState(o1, o2) { 239 | o2.fillStyle = o1.fillStyle; 240 | o2.lineCap = o1.lineCap; 241 | o2.lineJoin = o1.lineJoin; 242 | o2.lineWidth = o1.lineWidth; 243 | o2.miterLimit = o1.miterLimit; 244 | o2.shadowBlur = o1.shadowBlur; 245 | o2.shadowColor = o1.shadowColor; 246 | o2.shadowOffsetX = o1.shadowOffsetX; 247 | o2.shadowOffsetY = o1.shadowOffsetY; 248 | o2.strokeStyle = o1.strokeStyle; 249 | o2.globalAlpha = o1.globalAlpha; 250 | o2.font = o1.font; 251 | o2.textAlign = o1.textAlign; 252 | o2.textBaseline = o1.textBaseline; 253 | o2.arcScaleX_ = o1.arcScaleX_; 254 | o2.arcScaleY_ = o1.arcScaleY_; 255 | o2.lineScale_ = o1.lineScale_; 256 | o2.rotation_ = o1.rotation_; // used for images 257 | } 258 | 259 | var colorData = { 260 | aliceblue: '#F0F8FF', 261 | antiquewhite: '#FAEBD7', 262 | aquamarine: '#7FFFD4', 263 | azure: '#F0FFFF', 264 | beige: '#F5F5DC', 265 | bisque: '#FFE4C4', 266 | black: '#000000', 267 | blanchedalmond: '#FFEBCD', 268 | blueviolet: '#8A2BE2', 269 | brown: '#A52A2A', 270 | burlywood: '#DEB887', 271 | cadetblue: '#5F9EA0', 272 | chartreuse: '#7FFF00', 273 | chocolate: '#D2691E', 274 | coral: '#FF7F50', 275 | cornflowerblue: '#6495ED', 276 | cornsilk: '#FFF8DC', 277 | crimson: '#DC143C', 278 | cyan: '#00FFFF', 279 | darkblue: '#00008B', 280 | darkcyan: '#008B8B', 281 | darkgoldenrod: '#B8860B', 282 | darkgray: '#A9A9A9', 283 | darkgreen: '#006400', 284 | darkgrey: '#A9A9A9', 285 | darkkhaki: '#BDB76B', 286 | darkmagenta: '#8B008B', 287 | darkolivegreen: '#556B2F', 288 | darkorange: '#FF8C00', 289 | darkorchid: '#9932CC', 290 | darkred: '#8B0000', 291 | darksalmon: '#E9967A', 292 | darkseagreen: '#8FBC8F', 293 | darkslateblue: '#483D8B', 294 | darkslategray: '#2F4F4F', 295 | darkslategrey: '#2F4F4F', 296 | darkturquoise: '#00CED1', 297 | darkviolet: '#9400D3', 298 | deeppink: '#FF1493', 299 | deepskyblue: '#00BFFF', 300 | dimgray: '#696969', 301 | dimgrey: '#696969', 302 | dodgerblue: '#1E90FF', 303 | firebrick: '#B22222', 304 | floralwhite: '#FFFAF0', 305 | forestgreen: '#228B22', 306 | gainsboro: '#DCDCDC', 307 | ghostwhite: '#F8F8FF', 308 | gold: '#FFD700', 309 | goldenrod: '#DAA520', 310 | grey: '#808080', 311 | greenyellow: '#ADFF2F', 312 | honeydew: '#F0FFF0', 313 | hotpink: '#FF69B4', 314 | indianred: '#CD5C5C', 315 | indigo: '#4B0082', 316 | ivory: '#FFFFF0', 317 | khaki: '#F0E68C', 318 | lavender: '#E6E6FA', 319 | lavenderblush: '#FFF0F5', 320 | lawngreen: '#7CFC00', 321 | lemonchiffon: '#FFFACD', 322 | lightblue: '#ADD8E6', 323 | lightcoral: '#F08080', 324 | lightcyan: '#E0FFFF', 325 | lightgoldenrodyellow: '#FAFAD2', 326 | lightgreen: '#90EE90', 327 | lightgrey: '#D3D3D3', 328 | lightpink: '#FFB6C1', 329 | lightsalmon: '#FFA07A', 330 | lightseagreen: '#20B2AA', 331 | lightskyblue: '#87CEFA', 332 | lightslategray: '#778899', 333 | lightslategrey: '#778899', 334 | lightsteelblue: '#B0C4DE', 335 | lightyellow: '#FFFFE0', 336 | limegreen: '#32CD32', 337 | linen: '#FAF0E6', 338 | magenta: '#FF00FF', 339 | mediumaquamarine: '#66CDAA', 340 | mediumblue: '#0000CD', 341 | mediumorchid: '#BA55D3', 342 | mediumpurple: '#9370DB', 343 | mediumseagreen: '#3CB371', 344 | mediumslateblue: '#7B68EE', 345 | mediumspringgreen: '#00FA9A', 346 | mediumturquoise: '#48D1CC', 347 | mediumvioletred: '#C71585', 348 | midnightblue: '#191970', 349 | mintcream: '#F5FFFA', 350 | mistyrose: '#FFE4E1', 351 | moccasin: '#FFE4B5', 352 | navajowhite: '#FFDEAD', 353 | oldlace: '#FDF5E6', 354 | olivedrab: '#6B8E23', 355 | orange: '#FFA500', 356 | orangered: '#FF4500', 357 | orchid: '#DA70D6', 358 | palegoldenrod: '#EEE8AA', 359 | palegreen: '#98FB98', 360 | paleturquoise: '#AFEEEE', 361 | palevioletred: '#DB7093', 362 | papayawhip: '#FFEFD5', 363 | peachpuff: '#FFDAB9', 364 | peru: '#CD853F', 365 | pink: '#FFC0CB', 366 | plum: '#DDA0DD', 367 | powderblue: '#B0E0E6', 368 | rosybrown: '#BC8F8F', 369 | royalblue: '#4169E1', 370 | saddlebrown: '#8B4513', 371 | salmon: '#FA8072', 372 | sandybrown: '#F4A460', 373 | seagreen: '#2E8B57', 374 | seashell: '#FFF5EE', 375 | sienna: '#A0522D', 376 | skyblue: '#87CEEB', 377 | slateblue: '#6A5ACD', 378 | slategray: '#708090', 379 | slategrey: '#708090', 380 | snow: '#FFFAFA', 381 | springgreen: '#00FF7F', 382 | steelblue: '#4682B4', 383 | tan: '#D2B48C', 384 | thistle: '#D8BFD8', 385 | tomato: '#FF6347', 386 | turquoise: '#40E0D0', 387 | violet: '#EE82EE', 388 | wheat: '#F5DEB3', 389 | whitesmoke: '#F5F5F5', 390 | yellowgreen: '#9ACD32' 391 | }; 392 | 393 | 394 | function getRgbHslContent(styleString) { 395 | var start = styleString.indexOf('(', 3); 396 | var end = styleString.indexOf(')', start + 1); 397 | var parts = styleString.substring(start + 1, end).split(','); 398 | // add alpha if needed 399 | if (parts.length != 4 || styleString.charAt(3) != 'a') { 400 | parts[3] = 1; 401 | } 402 | return parts; 403 | } 404 | 405 | function percent(s) { 406 | return parseFloat(s) / 100; 407 | } 408 | 409 | function clamp(v, min, max) { 410 | return Math.min(max, Math.max(min, v)); 411 | } 412 | 413 | function hslToRgb(parts){ 414 | var r, g, b, h, s, l; 415 | h = parseFloat(parts[0]) / 360 % 360; 416 | if (h < 0) 417 | h++; 418 | s = clamp(percent(parts[1]), 0, 1); 419 | l = clamp(percent(parts[2]), 0, 1); 420 | if (s == 0) { 421 | r = g = b = l; // achromatic 422 | } else { 423 | var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 424 | var p = 2 * l - q; 425 | r = hueToRgb(p, q, h + 1 / 3); 426 | g = hueToRgb(p, q, h); 427 | b = hueToRgb(p, q, h - 1 / 3); 428 | } 429 | 430 | return '#' + decToHex[~~(r * 255)] + 431 | decToHex[~~(g * 255)] + 432 | decToHex[~~(b * 255)]; 433 | } 434 | 435 | function hueToRgb(m1, m2, h) { 436 | if (h < 0) 437 | h++; 438 | if (h > 1) 439 | h--; 440 | 441 | if (6 * h < 1) 442 | return m1 + (m2 - m1) * 6 * h; 443 | else if (2 * h < 1) 444 | return m2; 445 | else if (3 * h < 2) 446 | return m1 + (m2 - m1) * (2 / 3 - h) * 6; 447 | else 448 | return m1; 449 | } 450 | 451 | var processStyleCache = {}; 452 | 453 | function processStyle(styleString) { 454 | if (styleString in processStyleCache) { 455 | return processStyleCache[styleString]; 456 | } 457 | 458 | var str, alpha = 1; 459 | 460 | styleString = String(styleString); 461 | if (styleString.charAt(0) == '#') { 462 | str = styleString; 463 | } else if (/^rgb/.test(styleString)) { 464 | var parts = getRgbHslContent(styleString); 465 | var str = '#', n; 466 | for (var i = 0; i < 3; i++) { 467 | if (parts[i].indexOf('%') != -1) { 468 | n = ~~(percent(parts[i]) * 255); 469 | } else { 470 | n = +parts[i]; 471 | } 472 | str += decToHex[clamp(n, 0, 255)]; 473 | } 474 | alpha = +parts[3]; 475 | } else if (/^hsl/.test(styleString)) { 476 | var parts = getRgbHslContent(styleString); 477 | str = hslToRgb(parts); 478 | alpha = parts[3]; 479 | } else { 480 | str = colorData[styleString] || styleString; 481 | } 482 | return processStyleCache[styleString] = {color: str, alpha: alpha}; 483 | } 484 | 485 | var DEFAULT_STYLE = { 486 | style: 'normal', 487 | variant: 'normal', 488 | weight: 'normal', 489 | size: 10, 490 | family: 'sans-serif' 491 | }; 492 | 493 | // Internal text style cache 494 | var fontStyleCache = {}; 495 | 496 | function processFontStyle(styleString) { 497 | if (fontStyleCache[styleString]) { 498 | return fontStyleCache[styleString]; 499 | } 500 | 501 | var el = document.createElement('div'); 502 | var style = el.style; 503 | try { 504 | style.font = styleString; 505 | } catch (ex) { 506 | // Ignore failures to set to invalid font. 507 | } 508 | 509 | return fontStyleCache[styleString] = { 510 | style: style.fontStyle || DEFAULT_STYLE.style, 511 | variant: style.fontVariant || DEFAULT_STYLE.variant, 512 | weight: style.fontWeight || DEFAULT_STYLE.weight, 513 | size: style.fontSize || DEFAULT_STYLE.size, 514 | family: style.fontFamily || DEFAULT_STYLE.family 515 | }; 516 | } 517 | 518 | function getComputedStyle(style, element) { 519 | var computedStyle = {}; 520 | 521 | for (var p in style) { 522 | computedStyle[p] = style[p]; 523 | } 524 | 525 | // Compute the size 526 | var canvasFontSize = parseFloat(element.currentStyle.fontSize), 527 | fontSize = parseFloat(style.size); 528 | 529 | if (typeof style.size == 'number') { 530 | computedStyle.size = style.size; 531 | } else if (style.size.indexOf('px') != -1) { 532 | computedStyle.size = fontSize; 533 | } else if (style.size.indexOf('em') != -1) { 534 | computedStyle.size = canvasFontSize * fontSize; 535 | } else if(style.size.indexOf('%') != -1) { 536 | computedStyle.size = (canvasFontSize / 100) * fontSize; 537 | } else if (style.size.indexOf('pt') != -1) { 538 | computedStyle.size = fontSize / .75; 539 | } else { 540 | computedStyle.size = canvasFontSize; 541 | } 542 | 543 | // Different scaling between normal text and VML text. This was found using 544 | // trial and error to get the same size as non VML text. 545 | computedStyle.size *= 0.981; 546 | 547 | return computedStyle; 548 | } 549 | 550 | function buildStyle(style) { 551 | return style.style + ' ' + style.variant + ' ' + style.weight + ' ' + 552 | style.size + 'px ' + style.family; 553 | } 554 | 555 | var lineCapMap = { 556 | 'butt': 'flat', 557 | 'round': 'round' 558 | }; 559 | 560 | function processLineCap(lineCap) { 561 | return lineCapMap[lineCap] || 'square'; 562 | } 563 | 564 | /** 565 | * This class implements CanvasRenderingContext2D interface as described by 566 | * the WHATWG. 567 | * @param {HTMLElement} canvasElement The element that the 2D context should 568 | * be associated with 569 | */ 570 | function CanvasRenderingContext2D_(canvasElement) { 571 | this.m_ = createMatrixIdentity(); 572 | 573 | this.mStack_ = []; 574 | this.aStack_ = []; 575 | this.currentPath_ = []; 576 | 577 | // Canvas context properties 578 | this.strokeStyle = '#000'; 579 | this.fillStyle = '#000'; 580 | 581 | this.lineWidth = 1; 582 | this.lineJoin = 'miter'; 583 | this.lineCap = 'butt'; 584 | this.miterLimit = Z * 1; 585 | this.globalAlpha = 1; 586 | this.font = '10px sans-serif'; 587 | this.textAlign = 'left'; 588 | this.textBaseline = 'alphabetic'; 589 | this.canvas = canvasElement; 590 | 591 | var cssText = 'width:' + canvasElement.clientWidth + 'px;height:' + 592 | canvasElement.clientHeight + 'px;overflow:hidden;position:absolute'; 593 | var el = canvasElement.ownerDocument.createElement('div'); 594 | el.style.cssText = cssText; 595 | canvasElement.appendChild(el); 596 | 597 | var overlayEl = el.cloneNode(false); 598 | // Use a non transparent background. 599 | overlayEl.style.backgroundColor = 'red'; 600 | overlayEl.style.filter = 'alpha(opacity=0)'; 601 | canvasElement.appendChild(overlayEl); 602 | 603 | this.element_ = el; 604 | this.arcScaleX_ = 1; 605 | this.arcScaleY_ = 1; 606 | this.lineScale_ = 1; 607 | this.rotation_ = 0; 608 | } 609 | 610 | var contextPrototype = CanvasRenderingContext2D_.prototype; 611 | contextPrototype.clearRect = function() { 612 | if (this.textMeasureEl_) { 613 | this.textMeasureEl_.removeNode(true); 614 | this.textMeasureEl_ = null; 615 | } 616 | this.element_.innerHTML = ''; 617 | }; 618 | 619 | contextPrototype.beginPath = function() { 620 | // TODO: Branch current matrix so that save/restore has no effect 621 | // as per safari docs. 622 | this.currentPath_ = []; 623 | }; 624 | 625 | contextPrototype.moveTo = function(aX, aY) { 626 | var p = getCoords(this, aX, aY); 627 | this.currentPath_.push({type: 'moveTo', x: p.x, y: p.y}); 628 | this.currentX_ = p.x; 629 | this.currentY_ = p.y; 630 | }; 631 | 632 | contextPrototype.lineTo = function(aX, aY) { 633 | var p = getCoords(this, aX, aY); 634 | this.currentPath_.push({type: 'lineTo', x: p.x, y: p.y}); 635 | 636 | this.currentX_ = p.x; 637 | this.currentY_ = p.y; 638 | }; 639 | 640 | contextPrototype.bezierCurveTo = function(aCP1x, aCP1y, 641 | aCP2x, aCP2y, 642 | aX, aY) { 643 | var p = getCoords(this, aX, aY); 644 | var cp1 = getCoords(this, aCP1x, aCP1y); 645 | var cp2 = getCoords(this, aCP2x, aCP2y); 646 | bezierCurveTo(this, cp1, cp2, p); 647 | }; 648 | 649 | // Helper function that takes the already fixed cordinates. 650 | function bezierCurveTo(self, cp1, cp2, p) { 651 | self.currentPath_.push({ 652 | type: 'bezierCurveTo', 653 | cp1x: cp1.x, 654 | cp1y: cp1.y, 655 | cp2x: cp2.x, 656 | cp2y: cp2.y, 657 | x: p.x, 658 | y: p.y 659 | }); 660 | self.currentX_ = p.x; 661 | self.currentY_ = p.y; 662 | } 663 | 664 | contextPrototype.quadraticCurveTo = function(aCPx, aCPy, aX, aY) { 665 | // the following is lifted almost directly from 666 | // http://developer.mozilla.org/en/docs/Canvas_tutorial:Drawing_shapes 667 | 668 | var cp = getCoords(this, aCPx, aCPy); 669 | var p = getCoords(this, aX, aY); 670 | 671 | var cp1 = { 672 | x: this.currentX_ + 2.0 / 3.0 * (cp.x - this.currentX_), 673 | y: this.currentY_ + 2.0 / 3.0 * (cp.y - this.currentY_) 674 | }; 675 | var cp2 = { 676 | x: cp1.x + (p.x - this.currentX_) / 3.0, 677 | y: cp1.y + (p.y - this.currentY_) / 3.0 678 | }; 679 | 680 | bezierCurveTo(this, cp1, cp2, p); 681 | }; 682 | 683 | contextPrototype.arc = function(aX, aY, aRadius, 684 | aStartAngle, aEndAngle, aClockwise) { 685 | aRadius *= Z; 686 | var arcType = aClockwise ? 'at' : 'wa'; 687 | 688 | var xStart = aX + mc(aStartAngle) * aRadius - Z2; 689 | var yStart = aY + ms(aStartAngle) * aRadius - Z2; 690 | 691 | var xEnd = aX + mc(aEndAngle) * aRadius - Z2; 692 | var yEnd = aY + ms(aEndAngle) * aRadius - Z2; 693 | 694 | // IE won't render arches drawn counter clockwise if xStart == xEnd. 695 | if (xStart == xEnd && !aClockwise) { 696 | xStart += 0.125; // Offset xStart by 1/80 of a pixel. Use something 697 | // that can be represented in binary 698 | } 699 | 700 | var p = getCoords(this, aX, aY); 701 | var pStart = getCoords(this, xStart, yStart); 702 | var pEnd = getCoords(this, xEnd, yEnd); 703 | 704 | this.currentPath_.push({type: arcType, 705 | x: p.x, 706 | y: p.y, 707 | radius: aRadius, 708 | xStart: pStart.x, 709 | yStart: pStart.y, 710 | xEnd: pEnd.x, 711 | yEnd: pEnd.y}); 712 | 713 | }; 714 | 715 | contextPrototype.rect = function(aX, aY, aWidth, aHeight) { 716 | this.moveTo(aX, aY); 717 | this.lineTo(aX + aWidth, aY); 718 | this.lineTo(aX + aWidth, aY + aHeight); 719 | this.lineTo(aX, aY + aHeight); 720 | this.closePath(); 721 | }; 722 | 723 | contextPrototype.strokeRect = function(aX, aY, aWidth, aHeight) { 724 | var oldPath = this.currentPath_; 725 | this.beginPath(); 726 | 727 | this.moveTo(aX, aY); 728 | this.lineTo(aX + aWidth, aY); 729 | this.lineTo(aX + aWidth, aY + aHeight); 730 | this.lineTo(aX, aY + aHeight); 731 | this.closePath(); 732 | this.stroke(); 733 | 734 | this.currentPath_ = oldPath; 735 | }; 736 | 737 | contextPrototype.fillRect = function(aX, aY, aWidth, aHeight) { 738 | var oldPath = this.currentPath_; 739 | this.beginPath(); 740 | 741 | this.moveTo(aX, aY); 742 | this.lineTo(aX + aWidth, aY); 743 | this.lineTo(aX + aWidth, aY + aHeight); 744 | this.lineTo(aX, aY + aHeight); 745 | this.closePath(); 746 | this.fill(); 747 | 748 | this.currentPath_ = oldPath; 749 | }; 750 | 751 | contextPrototype.createLinearGradient = function(aX0, aY0, aX1, aY1) { 752 | var gradient = new CanvasGradient_('gradient'); 753 | gradient.x0_ = aX0; 754 | gradient.y0_ = aY0; 755 | gradient.x1_ = aX1; 756 | gradient.y1_ = aY1; 757 | return gradient; 758 | }; 759 | 760 | contextPrototype.createRadialGradient = function(aX0, aY0, aR0, 761 | aX1, aY1, aR1) { 762 | var gradient = new CanvasGradient_('gradientradial'); 763 | gradient.x0_ = aX0; 764 | gradient.y0_ = aY0; 765 | gradient.r0_ = aR0; 766 | gradient.x1_ = aX1; 767 | gradient.y1_ = aY1; 768 | gradient.r1_ = aR1; 769 | return gradient; 770 | }; 771 | 772 | contextPrototype.drawImage = function(image) { 773 | var dx, dy, dw, dh, sx, sy, sw, sh; 774 | 775 | // to fix new Image() we check the existance of runtimeStyle 776 | var rts = image.runtimeStyle.width; 777 | 778 | // to find the original width we overide the width and height 779 | if(rts) { 780 | var oldRuntimeWidth = image.runtimeStyle.width; 781 | var oldRuntimeHeight = image.runtimeStyle.height; 782 | 783 | image.runtimeStyle.width = 'auto'; 784 | image.runtimeStyle.height = 'auto'; 785 | } 786 | 787 | // get the original size 788 | var w = image.width; 789 | var h = image.height; 790 | 791 | // and remove overides 792 | if(rts) { 793 | image.runtimeStyle.width = oldRuntimeWidth; 794 | image.runtimeStyle.height = oldRuntimeHeight; 795 | } 796 | 797 | if (arguments.length == 3) { 798 | dx = arguments[1]; 799 | dy = arguments[2]; 800 | sx = sy = 0; 801 | sw = dw = w; 802 | sh = dh = h; 803 | } else if (arguments.length == 5) { 804 | dx = arguments[1]; 805 | dy = arguments[2]; 806 | dw = arguments[3]; 807 | dh = arguments[4]; 808 | sx = sy = 0; 809 | sw = w; 810 | sh = h; 811 | } else if (arguments.length == 9) { 812 | sx = arguments[1]; 813 | sy = arguments[2]; 814 | sw = arguments[3]; 815 | sh = arguments[4]; 816 | dx = arguments[5]; 817 | dy = arguments[6]; 818 | dw = arguments[7]; 819 | dh = arguments[8]; 820 | } else { 821 | throw Error('Invalid number of arguments'); 822 | } 823 | 824 | var d = getCoords(this, dx, dy); 825 | 826 | var w2 = sw / 2; 827 | var h2 = sh / 2; 828 | 829 | var vmlStr = []; 830 | 831 | var W = 10; 832 | var H = 10; 833 | 834 | var scaleX = scaleY = 1; 835 | 836 | // FIX: divs give better quality then vml image and also fixes transparent PNG's 837 | vmlStr.push('
'); 890 | 891 | // Draw a special cropping div if needed 892 | if (sx || sy) { 893 | // Apply scales to width and height 894 | vmlStr.push('
'); 898 | } 899 | 900 | 901 | // Apply scales to width and height 902 | vmlStr.push('
'); 912 | 913 | // Close the crop div if necessary 914 | if (sx || sy) vmlStr.push('
'); 915 | 916 | vmlStr.push('
'); 917 | 918 | this.element_.insertAdjacentHTML('beforeEnd', vmlStr.join('')); 919 | }; 920 | 921 | contextPrototype.stroke = function(aFill) { 922 | var lineStr = []; 923 | var lineOpen = false; 924 | 925 | var W = 10; 926 | var H = 10; 927 | 928 | lineStr.push(''); 996 | 997 | if (!aFill) { 998 | appendStroke(this, lineStr); 999 | } else { 1000 | appendFill(this, lineStr, min, max); 1001 | } 1002 | 1003 | lineStr.push(''); 1004 | 1005 | this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); 1006 | }; 1007 | 1008 | function appendStroke(ctx, lineStr) { 1009 | var a = processStyle(ctx.strokeStyle); 1010 | var color = a.color; 1011 | var opacity = a.alpha * ctx.globalAlpha; 1012 | var lineWidth = ctx.lineScale_ * ctx.lineWidth; 1013 | 1014 | // VML cannot correctly render a line if the width is less than 1px. 1015 | // In that case, we dilute the color to make the line look thinner. 1016 | if (lineWidth < 1) { 1017 | opacity *= lineWidth; 1018 | } 1019 | 1020 | lineStr.push( 1021 | '' 1028 | ); 1029 | } 1030 | 1031 | function appendFill(ctx, lineStr, min, max) { 1032 | var fillStyle = ctx.fillStyle; 1033 | var arcScaleX = ctx.arcScaleX_; 1034 | var arcScaleY = ctx.arcScaleY_; 1035 | var width = max.x - min.x; 1036 | var height = max.y - min.y; 1037 | if (fillStyle instanceof CanvasGradient_) { 1038 | // TODO: Gradients transformed with the transformation matrix. 1039 | var angle = 0; 1040 | var focus = {x: 0, y: 0}; 1041 | 1042 | // additional offset 1043 | var shift = 0; 1044 | // scale factor for offset 1045 | var expansion = 1; 1046 | 1047 | if (fillStyle.type_ == 'gradient') { 1048 | var x0 = fillStyle.x0_ / arcScaleX; 1049 | var y0 = fillStyle.y0_ / arcScaleY; 1050 | var x1 = fillStyle.x1_ / arcScaleX; 1051 | var y1 = fillStyle.y1_ / arcScaleY; 1052 | var p0 = getCoords(ctx, x0, y0); 1053 | var p1 = getCoords(ctx, x1, y1); 1054 | var dx = p1.x - p0.x; 1055 | var dy = p1.y - p0.y; 1056 | angle = Math.atan2(dx, dy) * 180 / Math.PI; 1057 | 1058 | // The angle should be a non-negative number. 1059 | if (angle < 0) { 1060 | angle += 360; 1061 | } 1062 | 1063 | // Very small angles produce an unexpected result because they are 1064 | // converted to a scientific notation string. 1065 | if (angle < 1e-6) { 1066 | angle = 0; 1067 | } 1068 | } else { 1069 | var p0 = getCoords(ctx, fillStyle.x0_, fillStyle.y0_); 1070 | focus = { 1071 | x: (p0.x - min.x) / width, 1072 | y: (p0.y - min.y) / height 1073 | }; 1074 | 1075 | width /= arcScaleX * Z; 1076 | height /= arcScaleY * Z; 1077 | var dimension = m.max(width, height); 1078 | shift = 2 * fillStyle.r0_ / dimension; 1079 | expansion = 2 * fillStyle.r1_ / dimension - shift; 1080 | } 1081 | 1082 | // We need to sort the color stops in ascending order by offset, 1083 | // otherwise IE won't interpret it correctly. 1084 | var stops = fillStyle.colors_; 1085 | stops.sort(function(cs1, cs2) { 1086 | return cs1.offset - cs2.offset; 1087 | }); 1088 | 1089 | var length = stops.length; 1090 | var color1 = stops[0].color; 1091 | var color2 = stops[length - 1].color; 1092 | var opacity1 = stops[0].alpha * ctx.globalAlpha; 1093 | var opacity2 = stops[length - 1].alpha * ctx.globalAlpha; 1094 | 1095 | var colors = []; 1096 | for (var i = 0; i < length; i++) { 1097 | var stop = stops[i]; 1098 | colors.push(stop.offset * expansion + shift + ' ' + stop.color); 1099 | } 1100 | 1101 | // When colors attribute is used, the meanings of opacity and o:opacity2 1102 | // are reversed. 1103 | lineStr.push(''); 1112 | } else if (fillStyle instanceof CanvasPattern_) { 1113 | if (width && height) { 1114 | var deltaLeft = -min.x; 1115 | var deltaTop = -min.y; 1116 | lineStr.push(''); 1124 | } 1125 | } else { 1126 | var a = processStyle(ctx.fillStyle); 1127 | var color = a.color; 1128 | var opacity = a.alpha * ctx.globalAlpha; 1129 | lineStr.push(''); 1131 | } 1132 | } 1133 | 1134 | contextPrototype.fill = function() { 1135 | this.stroke(true); 1136 | }; 1137 | 1138 | contextPrototype.closePath = function() { 1139 | this.currentPath_.push({type: 'close'}); 1140 | }; 1141 | 1142 | function getCoords(ctx, aX, aY) { 1143 | var m = ctx.m_; 1144 | return { 1145 | x: Z * (aX * m[0][0] + aY * m[1][0] + m[2][0]) - Z2, 1146 | y: Z * (aX * m[0][1] + aY * m[1][1] + m[2][1]) - Z2 1147 | }; 1148 | }; 1149 | 1150 | contextPrototype.save = function() { 1151 | var o = {}; 1152 | copyState(this, o); 1153 | this.aStack_.push(o); 1154 | this.mStack_.push(this.m_); 1155 | this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); 1156 | }; 1157 | 1158 | contextPrototype.restore = function() { 1159 | if (this.aStack_.length) { 1160 | copyState(this.aStack_.pop(), this); 1161 | this.m_ = this.mStack_.pop(); 1162 | } 1163 | }; 1164 | 1165 | function matrixIsFinite(m) { 1166 | return isFinite(m[0][0]) && isFinite(m[0][1]) && 1167 | isFinite(m[1][0]) && isFinite(m[1][1]) && 1168 | isFinite(m[2][0]) && isFinite(m[2][1]); 1169 | } 1170 | 1171 | function setM(ctx, m, updateLineScale) { 1172 | if (!matrixIsFinite(m)) { 1173 | return; 1174 | } 1175 | ctx.m_ = m; 1176 | 1177 | if (updateLineScale) { 1178 | // Get the line scale. 1179 | // Determinant of this.m_ means how much the area is enlarged by the 1180 | // transformation. So its square root can be used as a scale factor 1181 | // for width. 1182 | var det = m[0][0] * m[1][1] - m[0][1] * m[1][0]; 1183 | ctx.lineScale_ = sqrt(abs(det)); 1184 | } 1185 | } 1186 | 1187 | contextPrototype.translate = function(aX, aY) { 1188 | var m1 = [ 1189 | [1, 0, 0], 1190 | [0, 1, 0], 1191 | [aX, aY, 1] 1192 | ]; 1193 | 1194 | setM(this, matrixMultiply(m1, this.m_), false); 1195 | }; 1196 | 1197 | contextPrototype.rotate = function(aRot) { 1198 | var c = mc(aRot); 1199 | var s = ms(aRot); 1200 | 1201 | this.rotation_ += aRot; 1202 | 1203 | var m1 = [ 1204 | [c, s, 0], 1205 | [-s, c, 0], 1206 | [0, 0, 1] 1207 | ]; 1208 | 1209 | setM(this, matrixMultiply(m1, this.m_), false); 1210 | }; 1211 | 1212 | contextPrototype.scale = function(aX, aY) { 1213 | this.arcScaleX_ *= aX; 1214 | this.arcScaleY_ *= aY; 1215 | var m1 = [ 1216 | [aX, 0, 0], 1217 | [0, aY, 0], 1218 | [0, 0, 1] 1219 | ]; 1220 | 1221 | setM(this, matrixMultiply(m1, this.m_), true); 1222 | }; 1223 | 1224 | contextPrototype.transform = function(m11, m12, m21, m22, dx, dy) { 1225 | var m1 = [ 1226 | [m11, m12, 0], 1227 | [m21, m22, 0], 1228 | [dx, dy, 1] 1229 | ]; 1230 | 1231 | setM(this, matrixMultiply(m1, this.m_), true); 1232 | }; 1233 | 1234 | contextPrototype.setTransform = function(m11, m12, m21, m22, dx, dy) { 1235 | var m = [ 1236 | [m11, m12, 0], 1237 | [m21, m22, 0], 1238 | [dx, dy, 1] 1239 | ]; 1240 | 1241 | setM(this, m, true); 1242 | }; 1243 | 1244 | /** 1245 | * The text drawing function. 1246 | * The maxWidth argument isn't taken in account, since no browser supports 1247 | * it yet. 1248 | */ 1249 | contextPrototype.drawText_ = function(text, x, y, maxWidth, stroke) { 1250 | var m = this.m_, 1251 | delta = 1000, 1252 | left = 0, 1253 | right = delta, 1254 | offset = {x: 0, y: 0}, 1255 | lineStr = []; 1256 | 1257 | var fontStyle = getComputedStyle(processFontStyle(this.font), 1258 | this.element_); 1259 | 1260 | var fontStyleString = buildStyle(fontStyle); 1261 | 1262 | var elementStyle = this.element_.currentStyle; 1263 | var textAlign = this.textAlign.toLowerCase(); 1264 | switch (textAlign) { 1265 | case 'left': 1266 | case 'center': 1267 | case 'right': 1268 | break; 1269 | case 'end': 1270 | textAlign = elementStyle.direction == 'ltr' ? 'right' : 'left'; 1271 | break; 1272 | case 'start': 1273 | textAlign = elementStyle.direction == 'rtl' ? 'right' : 'left'; 1274 | break; 1275 | default: 1276 | textAlign = 'left'; 1277 | } 1278 | 1279 | // 1.75 is an arbitrary number, as there is no info about the text baseline 1280 | switch (this.textBaseline) { 1281 | case 'hanging': 1282 | case 'top': 1283 | offset.y = fontStyle.size / 1.75; 1284 | break; 1285 | case 'middle': 1286 | break; 1287 | default: 1288 | case null: 1289 | case 'alphabetic': 1290 | case 'ideographic': 1291 | case 'bottom': 1292 | offset.y = -fontStyle.size / 2.25; 1293 | break; 1294 | } 1295 | 1296 | switch(textAlign) { 1297 | case 'right': 1298 | left = delta; 1299 | right = 0.05; 1300 | break; 1301 | case 'center': 1302 | left = right = delta / 2; 1303 | break; 1304 | } 1305 | 1306 | var d = getCoords(this, x + offset.x, y + offset.y); 1307 | 1308 | lineStr.push(''); 1312 | 1313 | if (stroke) { 1314 | appendStroke(this, lineStr); 1315 | } else { 1316 | // TODO: Fix the min and max params. 1317 | appendFill(this, lineStr, {x: -left, y: 0}, 1318 | {x: right, y: fontStyle.size}); 1319 | } 1320 | 1321 | var skewM = m[0][0].toFixed(3) + ',' + m[1][0].toFixed(3) + ',' + 1322 | m[0][1].toFixed(3) + ',' + m[1][1].toFixed(3) + ',0,0'; 1323 | 1324 | var skewOffset = mr(d.x / Z) + ',' + mr(d.y / Z); 1325 | 1326 | lineStr.push('', 1328 | '', 1329 | ''); 1334 | 1335 | this.element_.insertAdjacentHTML('beforeEnd', lineStr.join('')); 1336 | }; 1337 | 1338 | contextPrototype.fillText = function(text, x, y, maxWidth) { 1339 | this.drawText_(text, x, y, maxWidth, false); 1340 | }; 1341 | 1342 | contextPrototype.strokeText = function(text, x, y, maxWidth) { 1343 | this.drawText_(text, x, y, maxWidth, true); 1344 | }; 1345 | 1346 | contextPrototype.measureText = function(text) { 1347 | if (!this.textMeasureEl_) { 1348 | var s = ''; 1351 | this.element_.insertAdjacentHTML('beforeEnd', s); 1352 | this.textMeasureEl_ = this.element_.lastChild; 1353 | } 1354 | var doc = this.element_.ownerDocument; 1355 | this.textMeasureEl_.innerHTML = ''; 1356 | // FIX: Apply current font style to textMeasureEl to get correct size 1357 | var fontStyle = getComputedStyle(processFontStyle(this.font), this.element_), 1358 | fontStyleString = buildStyle(fontStyle); 1359 | this.textMeasureEl_.style.font = fontStyleString; 1360 | 1361 | // Don't use innerHTML or innerText because they allow markup/whitespace. 1362 | this.textMeasureEl_.appendChild(doc.createTextNode(text)); 1363 | return {width: this.textMeasureEl_.offsetWidth}; 1364 | }; 1365 | 1366 | /******** STUBS ********/ 1367 | contextPrototype.clip = function() { 1368 | // TODO: Implement 1369 | }; 1370 | 1371 | contextPrototype.arcTo = function() { 1372 | // TODO: Implement 1373 | }; 1374 | 1375 | contextPrototype.createPattern = function(image, repetition) { 1376 | return new CanvasPattern_(image, repetition); 1377 | }; 1378 | 1379 | // Gradient / Pattern Stubs 1380 | function CanvasGradient_(aType) { 1381 | this.type_ = aType; 1382 | this.x0_ = 0; 1383 | this.y0_ = 0; 1384 | this.r0_ = 0; 1385 | this.x1_ = 0; 1386 | this.y1_ = 0; 1387 | this.r1_ = 0; 1388 | this.colors_ = []; 1389 | } 1390 | 1391 | CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { 1392 | aColor = processStyle(aColor); 1393 | this.colors_.push({offset: aOffset, 1394 | color: aColor.color, 1395 | alpha: aColor.alpha}); 1396 | }; 1397 | 1398 | function CanvasPattern_(image, repetition) { 1399 | assertImageIsValid(image); 1400 | switch (repetition) { 1401 | case 'repeat': 1402 | case null: 1403 | case '': 1404 | this.repetition_ = 'repeat'; 1405 | break 1406 | case 'repeat-x': 1407 | case 'repeat-y': 1408 | case 'no-repeat': 1409 | this.repetition_ = repetition; 1410 | break; 1411 | default: 1412 | throwException('SYNTAX_ERR'); 1413 | } 1414 | 1415 | this.src_ = image.src; 1416 | this.width_ = image.width; 1417 | this.height_ = image.height; 1418 | } 1419 | 1420 | function throwException(s) { 1421 | throw new DOMException_(s); 1422 | } 1423 | 1424 | function assertImageIsValid(img) { 1425 | if (!img || img.nodeType != 1 || img.tagName != 'IMG') { 1426 | throwException('TYPE_MISMATCH_ERR'); 1427 | } 1428 | if (img.readyState != 'complete') { 1429 | throwException('INVALID_STATE_ERR'); 1430 | } 1431 | } 1432 | 1433 | function DOMException_(s) { 1434 | this.code = this[s]; 1435 | this.message = s +': DOM Exception ' + this.code; 1436 | } 1437 | var p = DOMException_.prototype = new Error; 1438 | p.INDEX_SIZE_ERR = 1; 1439 | p.DOMSTRING_SIZE_ERR = 2; 1440 | p.HIERARCHY_REQUEST_ERR = 3; 1441 | p.WRONG_DOCUMENT_ERR = 4; 1442 | p.INVALID_CHARACTER_ERR = 5; 1443 | p.NO_DATA_ALLOWED_ERR = 6; 1444 | p.NO_MODIFICATION_ALLOWED_ERR = 7; 1445 | p.NOT_FOUND_ERR = 8; 1446 | p.NOT_SUPPORTED_ERR = 9; 1447 | p.INUSE_ATTRIBUTE_ERR = 10; 1448 | p.INVALID_STATE_ERR = 11; 1449 | p.SYNTAX_ERR = 12; 1450 | p.INVALID_MODIFICATION_ERR = 13; 1451 | p.NAMESPACE_ERR = 14; 1452 | p.INVALID_ACCESS_ERR = 15; 1453 | p.VALIDATION_ERR = 16; 1454 | p.TYPE_MISMATCH_ERR = 17; 1455 | 1456 | // set up externs 1457 | G_vmlCanvasManager = G_vmlCanvasManager_; 1458 | CanvasRenderingContext2D = CanvasRenderingContext2D_; 1459 | CanvasGradient = CanvasGradient_; 1460 | CanvasPattern = CanvasPattern_; 1461 | DOMException = DOMException_; 1462 | })(); 1463 | 1464 | } // if -------------------------------------------------------------------------------- /assets/js/plugins/jquery.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.7.2 jquery.com | jquery.org/license */ 2 | (function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( 3 | a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f 4 | .clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); 5 | --------------------------------------------------------------------------------