Ticket #685: share-this.php.diff
| File share-this.php.diff, 2.7 kB (added by CaptainN, 10 months ago) |
|---|
-
share-this.php
old new 194 194 } 195 195 } 196 196 197 if (!function_exists('ak_prototype')) {198 function ak_prototype() {199 if (!function_exists('wp_enqueue_script')) {200 global $ak_prototype;201 if (!isset($ak_prototype) || !$ak_prototype) {202 print('203 <script type="text/javascript" src="'.get_bloginfo('wpurl').'/wp-includes/js/prototype.js"></script>204 ');205 }206 $ak_prototype = true;207 }208 }209 }210 211 197 if (!empty($_REQUEST['akst_action'])) { 212 198 switch ($_REQUEST['akst_action']) { 213 199 case 'js': … … 214 200 header("Content-type: text/javascript"); 215 201 ?> 216 202 function akst_share(id, url, title, html_id) { 217 var form = $('akst_form');218 var post_id = $('akst_post_id');203 var form = document.getElementById('akst_form'); 204 var post_id = document.getElementById('akst_post_id'); 219 205 220 206 if (form.style.display == 'block' && post_id.value == id) { 221 207 form.style.display = 'none'; … … 222 208 return; 223 209 } 224 210 225 var link = $('akst_link_' + html_id); 226 var offset = Position.cumulativeOffset(link); 211 var link = document.getElementById('akst_link_' + id); 212 var offset = [0,0]; 213 214 var element = link; 215 while (element) { 216 offset[0] += element.offsetLeft; 217 offset[1] += element.offsetTop; 218 element = element.offsetParent; 219 } 227 220 228 221 <?php 229 222 foreach ($social_sites as $key => $data) { 230 print(' $("akst_'.$key.'").href = akst_share_url("'.$data['url'].'", url, title);'."\n");223 print(' document.getElementById("akst_'.$key.'").href = akst_share_url("'.$data['url'].'", url, title);'."\n"); 231 224 } 232 225 ?> 233 226 … … 402 395 } 403 396 add_action('init', 'akst_request_handler', 9999); 404 397 405 function akst_init() {406 if (function_exists('wp_enqueue_script')) {407 wp_enqueue_script('prototype');408 }409 }410 add_action('init', 'akst_init');411 412 398 function akst_head() { 413 399 $wp = get_bloginfo('wpurl'); 414 400 $url = $wp.AKST_FILEPATH; 415 ak_prototype();416 401 print(' 417 402 <script type="text/javascript" src="'.$url.'?akst_action=js"></script> 418 403 <link rel="stylesheet" type="text/css" href="'.$url.'?akst_action=css" /> … … 480 465 ?> 481 466 <!-- Share This BEGIN --> 482 467 <div id="akst_form"> 483 <a href="javascript:void( $('akst_form').style.display='none');" class="akst_close"><?php _e('Close', 'share-this'); ?></a>468 <a href="javascript:void(document.getElementById('akst_form').style.display='none');" class="akst_close"><?php _e('Close', 'share-this'); ?></a> 484 469 <ul class="tabs"> 485 470 <li id="akst_tab1" class="selected" onclick="akst_share_tab('1');"><?php _e('Social Web', 'share-this'); ?></li> 486 471 <li id="akst_tab2" onclick="akst_share_tab('2');"><?php _e('E-mail', 'share-this'); ?></li>
