Plugin Directory

Changeset 643762


Ignore:
Timestamp:
12/23/2012 07:11:10 PM (13 years ago)
Author:
FranceImage
Message:

test presense of attribute 'id' in javascript before using it

Location:
fi-geolocation/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fi-geolocation/trunk/fi-geolocation.php

    r643627 r643762  
    463463           
    464464            $this->has_showme_where = true;
     465        }
     466       
     467        return $ret;
     468    }
     469   
     470   
     471    function showme_config() {
     472        if($this->has_showme_where) {
    465473            wp_enqueue_script('fi-geolocation-showme-where');
    466474            wp_enqueue_style( 'fi-geolocation-style');
    467         }
    468        
    469         return $ret;
    470     }
    471    
    472    
    473     function showme_config() {
    474         if($this->has_showme_where) {
    475            
     475       
    476476            echo '
    477477            <div id="fi-showme-where-popup" style="width:'.$this->options->default_map_width.';height:'.$this->options->default_map_height.';position:absolute;visibility:hidden;top:0;left:0;z-index:9999" coords="'.$this->options->default_map_lat.','.$this->options->default_map_lng.','.$this->options->default_map_zoom.'"></div>
  • fi-geolocation/trunk/js/showme-where.js

    r639444 r643762  
    126126       
    127127        // target id
    128         var post_id = $j(this).attr('id').substr('fi-showme-where-'.length);
    129         if($j('#fi-showme-where-target-' + post_id).length != 0) {
    130             popup_left = $j('#fi-showme-where-target-' + post_id).offset().left;
    131             popup_top = $j('#fi-showme-where-target-' + post_id).offset().top;
     128        if($j(this).attr('id') !== undefined) {
     129            var post_id = $j(this).attr('id').substr('fi-showme-where-'.length);
     130            if($j('#fi-showme-where-target-' + post_id).length != 0) {
     131                popup_left = $j('#fi-showme-where-target-' + post_id).offset().left;
     132                popup_top = $j('#fi-showme-where-target-' + post_id).offset().top;
     133            }
    132134        }
    133135       
Note: See TracChangeset for help on using the changeset viewer.