Dotclear

Changeset 3819:148005ada8b3 for admin


Ignore:
Timestamp:
08/24/18 12:14:08 (7 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Outgoing links (in a new window): cope with asynchronous content which may content external links. Fixes #2281

Location:
admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/js/_index.js

    r3781 r3819  
    155155        var xml = $('rsp>update', data).attr('ret'); 
    156156        $('#content h2').after(xml); 
     157        // manage outgoing links 
     158        dotclear.outgoingLink('#ajax-update a'); 
    157159      } 
    158160    } 
     
    180182        } 
    181183        $('#dashboard-boxes div.db-items').prepend(xml); 
     184        // manage outgoing links 
     185        dotclear.outgoingLink('#ajax-news a'); 
    182186      } 
    183187    } 
  • admin/js/common.js

    r3815 r3819  
    433433      return true; 
    434434    }); 
     435  }, 
     436  outgoingLink: function(target) { 
     437    $(target).filter(function() { 
     438      return ((this.hostname && this.hostname != location.hostname && !$(this).hasClass('modal') && !$(this).hasClass('modal-image')) || $(this).hasClass('outgoing')); 
     439    }).each(function() { 
     440      $(this).prop('title', $(this).prop('title') + ' (' + dotclear.msg.new_window + ')'); 
     441      if (!$(this).hasClass('outgoing')) { 
     442        $(this).append('&nbsp;<img class="outgoing-js" src="images/outgoing-link.svg" alt=""/>'); 
     443      } 
     444    }).click(function(e) { 
     445      e.preventDefault(); 
     446      window.open($(this).attr('href')); 
     447    }); 
    435448  } 
    436449}; 
     
    448461  }); 
    449462  // manage outgoing links 
    450   $('a').filter(function() { 
    451     return ((this.hostname && this.hostname != location.hostname && !$(this).hasClass('modal') && !$(this).hasClass('modal-image')) || $(this).hasClass('outgoing')); 
    452   }).each(function() { 
    453     $(this).prop('title', $(this).prop('title') + ' (' + dotclear.msg.new_window + ')'); 
    454     if (!$(this).hasClass('outgoing')) { 
    455       $(this).append('&nbsp;<img class="outgoing-js" src="images/outgoing-link.svg" alt=""/>'); 
    456     } 
    457   }).click(function(e) { 
    458     e.preventDefault(); 
    459     window.open($(this).attr('href')); 
    460   }); 
     463  dotclear.outgoingLink('a'); 
    461464  // Popups: dealing with Escape key fired 
    462465  $('#dotclear-admin.popup').keyup(function(e) { 
  • admin/services.php

    r3781 r3819  
    8686                $feed = $feed_reader->parse($GLOBALS['__resources']['rss_news']); 
    8787                if ($feed) { 
    88                     $ret = '<div class="box medium dc-box"><h3>' . __('Dotclear news') . '</h3><dl id="news">'; 
     88                    $ret = '<div class="box medium dc-box" id="ajax-news"><h3>' . __('Dotclear news') . '</h3><dl id="news">'; 
    8989                    $i   = 1; 
    9090                    foreach ($feed->items as $item) { 
     
    132132                if (version_compare(phpversion(), $updater->getPHPVersion()) >= 0) { 
    133133                    $ret = 
    134                     '<div class="dc-update"><h3>' . sprintf(__('Dotclear %s is available!'), $new_v) . '</h3> ' . 
     134                    '<div class="dc-update" id="ajax-update"><h3>' . sprintf(__('Dotclear %s is available!'), $new_v) . '</h3> ' . 
    135135                    '<p><a class="button submit" href="' . $core->adminurl->get("admin.update") . '">' . sprintf(__('Upgrade now'), $new_v) . '</a> ' . 
    136136                    '<a class="button" href="' . $core->adminurl->get("admin.update", array('hide_msg' => 1)) . '">' . __('Remind me later') . '</a>' . 
Note: See TracChangeset for help on using the changeset viewer.

Sites map