Plugin Directory


Ignore:
Timestamp:
10/10/2026 05:08:54 PM (3 weeks ago)
Author:
mxchat
Message:

Release 3.2.25 - per-site license on/off, Gemini safety-filter fix, chat styles scoped to the widget, link and PDF-detection fixes, import and Gemini 3 search improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mxchat-basic/trunk/js/chat-script.js

    r3724923 r3738408  
    26392639    // Process standalone URLs - but NOT if they're already in <a> tags or brackets
    26402640    // Updated pattern to be more careful about what it matches
    2641     const urlPattern = /(^|[^">=\[\]])(https?:\/\/[^\s<"\[\]]+)(?![^<]*<\/a>)(?!\])/gim;
     2641    //
     2642    // The prefix group (plan 78618d) is the start of a line, an ordinary
     2643    // character, OR a tag this formatter itself opened or closed (paragraph,
     2644    // list item, table cell, heading, emphasis, line break), so an address
     2645    // that opens a paragraph or sits inside **bold** is linked too. Never
     2646    // an anchor (its text would be linked twice; the lookahead guards that
     2647    // as well) and never a code span, which stays as typed. No lookbehind,
     2648    // for Safari.
     2649    const urlPattern = /(^|[^">=\[\]]|<\/?(?:p|li|td|th|h[1-6]|strong|em|b|i|del|br)(?:\s[^<>]*)?\/?>)(https?:\/\/[^\s<"\[\]]+)(?![^<]*<\/a>)(?!\])/gim;
    26422650    processedText = processedText.replace(urlPattern, (match, prefix, url) => {
    26432651        // Extra check: make sure this isn't already linked
    … …  
    26522660    });
    26532661   
    2654     // Process www. URLs - but NOT if they're already in <a> tags or brackets
    2655     const wwwPattern = /(^|[^">/\[\]])(www\.[\S]+)(?![^<]*<\/a>)(?!\])/gim;
     2662    // Process www. URLs - but NOT if they're already in <a> tags or brackets.
     2663    // The address stops at the same characters the https pattern stops at
     2664    // (plan 78618d): it used to run through the closing paragraph tag, so
     2665    // "Try www.example.com/page." linked to www.example.com/page.%3C/p%3E.
     2666    // Same prefix group as the https pattern, same reasons.
     2667    const wwwPattern = /(^|[^">/\[\]]|<\/?(?:p|li|td|th|h[1-6]|strong|em|b|i|del|br)(?:\s[^<>]*)?\/?>)(www\.[^\s<"\[\]]+)(?![^<]*<\/a>)(?!\])/gim;
    26562668    processedText = processedText.replace(wwwPattern, (match, prefix, url) => {
    26572669        // Extra check: make sure this isn't already linked
    … …  
    27192731    });
    27202732   
    2721     // Step 1c: Also protect bare URLs that might exist
     2733    // Step 1c: Also protect bare URLs that might exist. Trailing emphasis
     2734    // markers are not part of the address (plan 78618d): **https://x.com**
     2735    // used to protect "https://x.com**", so the bold never paired and the
     2736    // asterisks ended up inside the link. The markers stay outside the
     2737    // placeholder so the styling rules below can pair them.
    27222738    protectedText = protectedText.replace(/(https?:\/\/[^\s<>"]+)/gi, function(match) {
     2739        const markers = match.match(/[*_~]+$/);
     2740        const url = markers ? match.slice(0, match.length - markers[0].length) : match;
    27232741        const placeholder = `__PROTECTED_${protectedSegments.length}__`;
    2724         protectedSegments.push(match);
    2725         return placeholder;
     2742        protectedSegments.push(url);
     2743        return placeholder + (markers ? markers[0] : '');
    27262744    });
    27272745   
Note: See TracChangeset for help on using the changeset viewer.