| 137 | | var last = null; |
|---|
| 138 | | function pick(img) { |
|---|
| 139 | | if (last) last.style.backgroundColor = '#f4f4f4'; |
|---|
| 140 | | if (img) { |
|---|
| 141 | | document.getElementById('photo_src').value = img.src; |
|---|
| 142 | | img.style.backgroundColor = '#44f'; |
|---|
| 143 | | } |
|---|
| 144 | | last = img; |
|---|
| 145 | | return false; |
|---|
| 146 | | } |
|---|
| 147 | | |
|---|
| 148 | | jQuery(document).ready(function() { |
|---|
| 149 | | var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| 150 | | var my_src = [<?php echo get_images_from_uri(clean_url($_GET['u'])); ?>]; |
|---|
| 151 | | |
|---|
| 152 | | for (i = 0; i < my_src.length; i++) { |
|---|
| 153 | | img = new Image(); |
|---|
| 154 | | img.src = my_src[i]; |
|---|
| 155 | | img_attr = 'id="img' + i + '" onclick="pick(this);"'; |
|---|
| 156 | | skip = false; |
|---|
| 157 | | if (img.width && img.height) { |
|---|
| 158 | | if (img.width * img.height < 2500) skip = true; |
|---|
| 159 | | aspect = img.width / img.height; |
|---|
| 160 | | if (aspect > 1) { |
|---|
| 161 | | // Image is wide |
|---|
| 162 | | scale = 75 / img.width; |
|---|
| 163 | | } else { |
|---|
| 164 | | // Image is tall or square |
|---|
| 165 | | scale = 75 / img.height; |
|---|
| 166 | | } |
|---|
| 167 | | if (scale < 1) { |
|---|
| 168 | | w = parseInt(img.width * scale); |
|---|
| 169 | | h = parseInt(img.height * scale); |
|---|
| 170 | | } else { |
|---|
| 171 | | w = img.width; |
|---|
| 172 | | h = img.height; |
|---|
| 173 | | } |
|---|
| 174 | | img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; |
|---|
| 175 | | } |
|---|
| 176 | | if (!skip) { |
|---|
| 177 | | strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>' |
|---|
| 178 | | } |
|---|
| 179 | | } |
|---|
| 180 | | jQuery('#img_container').html(strtoappend); |
|---|
| 181 | | |
|---|
| 182 | | tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox |
|---|
| 183 | | }); |
|---|
| 184 | | </script> |
|---|
| 185 | | |
|---|
| 186 | | <form action="press-this.php?action=post" method="post" id="photo_form"> |
|---|
| 187 | | <?php wp_nonce_field('press-this') ?> |
|---|
| 188 | | <input type="hidden" name="source" value="bookmarklet"/> |
|---|
| 189 | | <input type="hidden" name="post_type" value="photo"/> |
|---|
| 190 | | <div id="posting"> |
|---|
| 191 | | <h2><?php _e('Post Title') ?></h2> |
|---|
| 192 | | <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> |
|---|
| 193 | | |
|---|
| 194 | | <h2><?php _e('Caption') ?></h2> |
|---|
| 195 | | <div class="editor-container"> |
|---|
| 196 | | <textarea name="content" id="photo_post_two" style="height:130px;width:100%;" class="mceEditor"><?php echo stripslashes($_GET['s']);?> |
|---|
| 197 | | <br><a href="<?php echo clean_url($_GET['u']);?>"><?php echo $title;?></a></textarea> |
|---|
| 198 | | </div> |
|---|
| 199 | | |
|---|
| 200 | | <h2><?php _e('Photo URL') ?></h2> |
|---|
| 201 | | <input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/> |
|---|
| 202 | | |
|---|
| 203 | | <style type="text/css"> |
|---|
| 204 | | #img_container img { |
|---|
| 205 | | width: 75px; |
|---|
| 206 | | height: 75px; |
|---|
| 207 | | padding: 2px; |
|---|
| 208 | | background-color: #f4f4f4; |
|---|
| 209 | | margin-right: 7px; |
|---|
| 210 | | margin-bottom: 7px; |
|---|
| 211 | | cursor: pointer; |
|---|
| 212 | | } |
|---|
| 213 | | </style> |
|---|
| 214 | | <div id="img_container" style="border:solid 1px #ccc; background-color:#f4f4f4; padding:5px; width:370px; margin-top:10px; overflow:auto; height:100px;"> |
|---|
| 215 | | </div> |
|---|
| 216 | | |
|---|
| 217 | | <h2><?php _e('Link Photo to following URL') ?></h2><?php _e('(leave blank to leave the photo unlinked)') ?> |
|---|
| 218 | | <input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($_GET['u']);?>"/> |
|---|
| 219 | | |
|---|
| 220 | | <?php tag_input(); ?> |
|---|
| 221 | | |
|---|
| 222 | | <div> |
|---|
| 223 | | <input type="submit" value="<?php _e('Create Photo') ?>" style="margin-top:15px;" onclick="document.getElementById('photo_saving').style.display = '';"/> |
|---|
| 224 | | |
|---|
| 225 | | <a href="#" onclick="if (confirm('<?php _e('Are you sure?') ?>')) { self.close(); } else { return false; }" style="color:#007BFF;"><?php _e('Cancel') ?></a> |
|---|
| 226 | | <img src="/images/bookmarklet_loader.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/> |
|---|
| 227 | | </div> |
|---|
| 228 | | </div> |
|---|
| 229 | | <div id="categories"> |
|---|
| 230 | | <h2><?php _e('Categories') ?></h2> |
|---|
| 231 | | <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> |
|---|
| 232 | | <?php wp_category_checklist($post_ID) ?> |
|---|
| 233 | | </ul> |
|---|
| 234 | | </div> |
|---|
| 235 | | </form> |
|---|
| 236 | | <?php |
|---|
| 237 | | exit; |
|---|
| 238 | | } |
|---|
| | 146 | jQuery('#tags-input').hide(); |
|---|
| | 147 | tag_update_quickclicks(); |
|---|
| | 148 | // add the quickadd form |
|---|
| | 149 | jQuery('#jaxtag').prepend('<span id="ajaxtag"><input type="text" name="newtag" id="newtag" class="form-input-tip" size="16" autocomplete="off" value="'+postL10n.addTag+'" /><input type="button" class="button" id="tagadd" value="' + postL10n.add + '" tabindex="3" /><input type="hidden"/><input type="hidden"/><span class="howto">'+postL10n.separate+'</span></span>'); |
|---|
| | 150 | jQuery('#tagadd').click( tag_flush_to_text ); |
|---|
| | 151 | jQuery('#newtag').focus(function() { |
|---|
| | 152 | if ( this.value == postL10n.addTag ) |
|---|
| | 153 | jQuery(this).val( '' ).removeClass( 'form-input-tip' ); |
|---|
| | 154 | }); |
|---|
| | 155 | jQuery('#newtag').blur(function() { |
|---|
| | 156 | if ( this.value == '' ) |
|---|
| | 157 | jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' ); |
|---|
| | 158 | }); |
|---|
| | 159 | |
|---|
| | 160 | // auto-save tags on post save/publish |
|---|
| | 161 | jQuery('#publish').click( tag_save_on_publish ); |
|---|
| | 162 | jQuery('#save-post').click( tag_save_on_publish ); |
|---|
| | 163 | <?php |
|---|
| | 164 | } |
|---|
| | 165 | |
|---|
| | 166 | // Clean up the data being passed in |
|---|
| | 167 | $title = stripslashes($_GET['t']); |
|---|
| | 168 | |
|---|
| | 169 | if ( empty($_GET['tab']) ) { |
|---|
| 331 | | |
|---|
| 332 | | <!-- Regular --> |
|---|
| 333 | | <div id="section-1"> |
|---|
| | 262 | </div> |
|---|
| | 263 | |
|---|
| | 264 | </body> |
|---|
| | 265 | </html> |
|---|
| | 266 | <?php |
|---|
| | 267 | exit; |
|---|
| | 268 | } elseif ( 'photo' == $_GET['tab'] ) { |
|---|
| | 269 | ?> |
|---|
| | 270 | <script type="text/javascript"> |
|---|
| | 271 | <?php press_this_js_init(); ?> |
|---|
| | 272 | var last = null; |
|---|
| | 273 | function pick(img) { |
|---|
| | 274 | if (last) last.style.backgroundColor = '#f4f4f4'; |
|---|
| | 275 | if (img) { |
|---|
| | 276 | document.getElementById('photo_src').value = img.src; |
|---|
| | 277 | img.style.backgroundColor = '#44f'; |
|---|
| | 278 | } |
|---|
| | 279 | last = img; |
|---|
| | 280 | return false; |
|---|
| | 281 | } |
|---|
| | 282 | jQuery(document).ready(function() { |
|---|
| | 283 | var img, img_tag, aspect, w, h, skip, i, strtoappend = ""; |
|---|
| | 284 | var my_src = [<?php echo get_images_from_uri(clean_url($_GET['u'])); ?>]; |
|---|
| | 285 | |
|---|
| | 286 | for (i = 0; i < my_src.length; i++) { |
|---|
| | 287 | img = new Image(); |
|---|
| | 288 | img.src = my_src[i]; |
|---|
| | 289 | img_attr = 'id="img' + i + '" onclick="pick(this);"'; |
|---|
| | 290 | skip = false; |
|---|
| | 291 | if (img.width && img.height) { |
|---|
| | 292 | if (img.width * img.height < 2500) skip = true; |
|---|
| | 293 | aspect = img.width / img.height; |
|---|
| | 294 | if (aspect > 1) { |
|---|
| | 295 | // Image is wide |
|---|
| | 296 | scale = 75 / img.width; |
|---|
| | 297 | } else { |
|---|
| | 298 | // Image is tall or square |
|---|
| | 299 | scale = 75 / img.height; |
|---|
| | 300 | } |
|---|
| | 301 | if (scale < 1) { |
|---|
| | 302 | w = parseInt(img.width * scale); |
|---|
| | 303 | h = parseInt(img.height * scale); |
|---|
| | 304 | } else { |
|---|
| | 305 | w = img.width; |
|---|
| | 306 | h = img.height; |
|---|
| | 307 | } |
|---|
| | 308 | img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"'; |
|---|
| | 309 | } |
|---|
| | 310 | if (!skip) { |
|---|
| | 311 | strtoappend += '<a href="' + img.src + '" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>' |
|---|
| | 312 | } |
|---|
| | 313 | } |
|---|
| | 314 | jQuery('#img_container').html(strtoappend); |
|---|
| | 315 | |
|---|
| | 316 | tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox |
|---|
| | 317 | }); |
|---|
| | 318 | </script> |
|---|
| | 319 | |
|---|
| | 320 | <form action="press-this.php?action=post" method="post" id="photo_form"> |
|---|
| | 321 | <?php wp_nonce_field('press-this') ?> |
|---|
| | 322 | <input type="hidden" name="source" value="bookmarklet"/> |
|---|
| | 323 | <input type="hidden" name="post_type" value="photo"/> |
|---|
| | 324 | <div id="posting"> |
|---|
| | 325 | <h2><?php _e('Post Title') ?></h2> |
|---|
| | 326 | <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/> |
|---|
| | 327 | |
|---|
| | 328 | <h2><?php _e('Caption') ?></h2> |
|---|
| | 329 | <div class="editor-container"> |
|---|
| | 330 | <textarea name="content" id="photo_post_two" style="height:130px;width:100%;" class="mceEditor"><?php echo stripslashes($_GET['s']);?> |
|---|
| | 331 | <br><a href="<?php echo clean_url($_GET['u']);?>"><?php echo $title;?></a></textarea> |
|---|
| | 332 | </div> |
|---|
| | 333 | |
|---|
| | 334 | <h2><?php _e('Photo URL') ?></h2> |
|---|
| | 335 | <input name="photo_src" id="photo_src" class="text" onkeydown="pick(0);"/> |
|---|
| | 336 | |
|---|
| | 337 | <style type="text/css"> |
|---|
| | 338 | #img_container img { |
|---|
| | 339 | width: 75px; |
|---|
| | 340 | height: 75px; |
|---|
| | 341 | padding: 2px; |
|---|
| | 342 | background-color: #f4f4f4; |
|---|
| | 343 | margin-right: 7px; |
|---|
| | 344 | margin-bottom: 7px; |
|---|
| | 345 | cursor: pointer; |
|---|
| | 346 | } |
|---|
| | 347 | </style> |
|---|
| | 348 | <div id="img_container" style="border:solid 1px #ccc; background-color:#f4f4f4; padding:5px; width:370px; margin-top:10px; overflow:auto; height:100px;"> |
|---|
| | 349 | </div> |
|---|
| | 350 | |
|---|
| | 351 | <h2><?php _e('Link Photo to following URL') ?></h2><?php _e('(leave blank to leave the photo unlinked)') ?> |
|---|
| | 352 | <input name="photo_link" id="photo_link" class="text" value="<?php echo attribute_escape($_GET['u']);?>"/> |
|---|
| | 353 | |
|---|
| | 354 | <?php tag_div(); ?> |
|---|
| | 355 | |
|---|
| | 356 | <div> |
|---|
| | 357 | <input type="submit" value="<?php _e('Create Photo') ?>" style="margin-top:15px;" onclick="document.getElementById('photo_saving').style.display = '';"/> |
|---|
| | 358 | |
|---|
| | 359 | <a href="#" onclick="if (confirm('<?php _e('Are you sure?') ?>')) { self.close(); } else { return false; }" style="color:#007BFF;"><?php _e('Cancel') ?></a> |
|---|
| | 360 | <img src="/images/bookmarklet_loader.gif" alt="" id="photo_saving" style="width:16px; height:16px; vertical-align:-4px; display:none;"/> |
|---|
| | 361 | </div> |
|---|
| | 362 | </div> |
|---|
| | 363 | <?php category_div() ?> |
|---|
| | 364 | </form> |
|---|
| | 365 | <?php |
|---|
| | 366 | exit; |
|---|
| | 367 | } elseif ( 'text' == $_GET['tab'] ) { |
|---|
| | 368 | ?> |
|---|
| | 369 | <script type="text/javascript"> |
|---|
| | 370 | <?php press_this_js_init(); ?> |
|---|
| | 371 | </script> |
|---|
| | 372 | |
|---|