Diff
Not logged in

Differences From Artifact [8f8e5f6a3d]:

To Artifact [89d091119d]:


1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
      is returned, else falsy is returned. */
  const findParentWithClass = function(e, className){
    while(e && !e.classList.contains(className)){
      e = e.parentNode;
    }
    return e;
  };
  
  /** To be passed each MessageWidget's top-level DOM element
      after initial processing of the message, to set up
      hashtag and numtag references. */
  const setupHashtags = function f(elem){
    if(!f.$click){
      f.$click = function(ev){
        /* Click handler for hashtags */
        const tag = ev.target.dataset.hashtag;
        if(tag){
          Chat.setHashtagFilter(
            tag===Chat.filter.hashtag.activeTag
              ? false : tag
          );







|




|
|







1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
      is returned, else falsy is returned. */
  const findParentWithClass = function(e, className){
    while(e && !e.classList.contains(className)){
      e = e.parentNode;
    }
    return e;
  };

  /** To be passed each MessageWidget's top-level DOM element
      after initial processing of the message, to set up
      hashtag and numtag references. */
  const setupHashtags = function f(elem){
    if(!f.$clickTag){
      f.$clickTag = function(ev){
        /* Click handler for hashtags */
        const tag = ev.target.dataset.hashtag;
        if(tag){
          Chat.setHashtagFilter(
            tag===Chat.filter.hashtag.activeTag
              ? false : tag
          );
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
              const state = {msgId: p.dataset.msgid};
              Chat.numtagHistoryStack.push(p.dataset.msgid);
              const rc = window.history.pushState(state, "");
              //console.debug("Pushing history for msgid", state);
              //console.debug("Chat.numtagHistoryStack =",Chat.numtagHistoryStack);
            }
          }else{
            F.toast.warning("Message #"+tag+" not found in loaded messages.");
          }
        }
      };
    }
    elem.querySelectorAll('[data-hashtag]').forEach(function(e){
      e.dataset.hashtag = e.dataset.hashtag.toLowerCase();
      e.addEventListener('click', f.$click, false);
    })
    elem.querySelectorAll('[data-numtag]').forEach(
      (e)=>e.addEventListener('click', f.$clickNum, false)
    )
  }/*setupHashtags()*/;

  /** Returns the first .message-widget element in DOM element







|






|







1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
              const state = {msgId: p.dataset.msgid};
              Chat.numtagHistoryStack.push(p.dataset.msgid);
              const rc = window.history.pushState(state, "");
              //console.debug("Pushing history for msgid", state);
              //console.debug("Chat.numtagHistoryStack =",Chat.numtagHistoryStack);
            }
          }else{
            Chat.submitSearch('#'+tag);
          }
        }
      };
    }
    elem.querySelectorAll('[data-hashtag]').forEach(function(e){
      e.dataset.hashtag = e.dataset.hashtag.toLowerCase();
      e.addEventListener('click', f.$clickTag, false);
    })
    elem.querySelectorAll('[data-numtag]').forEach(
      (e)=>e.addEventListener('click', f.$clickNum, false)
    )
  }/*setupHashtags()*/;

  /** Returns the first .message-widget element in DOM element
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
        const theMsg = findMessageWidgetParent(ev.target);
        if(theMsg) f.popup.show(theMsg);
      }/*_handleLegendClicked()*/
    }/*MessageWidget.prototype*/;
    /** Assumes that e is a MessageWidget element, ensures that
        Chat.e.viewMessages is visible, scrolls the message,
        and animates it a bit to make it more visible. */
    cf.scrollToMessageElem = function(e){
      if(e.firstElementChild){
        Chat.setCurrentView(Chat.e.viewMessages);
        e.scrollIntoView(false);
        Chat.animate(e, 'anim-fade-out-in');
      }
    };
    return ctor;







|







1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
        const theMsg = findMessageWidgetParent(ev.target);
        if(theMsg) f.popup.show(theMsg);
      }/*_handleLegendClicked()*/
    }/*MessageWidget.prototype*/;
    /** Assumes that e is a MessageWidget element, ensures that
        Chat.e.viewMessages is visible, scrolls the message,
        and animates it a bit to make it more visible. */
    ctor.scrollToMessageElem = function(e){
      if(e.firstElementChild){
        Chat.setCurrentView(Chat.e.viewMessages);
        e.scrollIntoView(false);
        Chat.animate(e, 'anim-fade-out-in');
      }
    };
    return ctor;
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577

2578
2579
2580
2581
2582
2583
2584
2585
      D.append(e, "Enter search terms in the message field. "+
               "Use #NNNNN to search for the message with ID NNNNN.");
    }
    return e;
  };
  Chat.clearSearch(true);
  /**
     Submits a history search using the main input field's current
     text. It is assumed that Chat.e.viewSearch===Chat.e.currentView.
  */
  Chat.submitSearch = function(){

    const term = this.inputValue(true);
    const eMsgTgt = this.clearSearch(true);
    if( !term ) return;
    D.append( eMsgTgt, "Searching for ",term," ...");
    const fd = new FormData();
    fd.set('q', term);
    F.fetch(
      "chat-query", {







|
|

|
>
|







2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
      D.append(e, "Enter search terms in the message field. "+
               "Use #NNNNN to search for the message with ID NNNNN.");
    }
    return e;
  };
  Chat.clearSearch(true);
  /**
     Submits a history search using either its argument or the the
     main input field's current text.
  */
  Chat.submitSearch = function(term){
    Chat.setCurrentView(Chat.e.viewSearch);
    if(!arguments.length) term = this.inputValue(true);
    const eMsgTgt = this.clearSearch(true);
    if( !term ) return;
    D.append( eMsgTgt, "Searching for ",term," ...");
    const fd = new FormData();
    fd.set('q', term);
    F.fetch(
      "chat-query", {